:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #dfe5ec;
  --line-strong: #c7d0dc;
  --text: #17202a;
  --muted: #687789;
  --primary: #1769aa;
  --primary-dark: #0f4c81;
  --primary-soft: #e7f1fb;
  --ok: #1d7f5f;
  --warn: #b7791f;
  --danger: #b83232;
  --danger-soft: #fff0f0;
  --shadow: 0 12px 30px rgba(21, 39, 64, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 520px) 1fr;
  background: #eef3f7;
}

.icp-footer {
  position: absolute;
  left: 40px;
  bottom: 18px;
  font-size: 12px;
}

.icp-footer a,
.icp-link {
  color: var(--muted);
  text-decoration: none;
}

.icp-footer a:hover,
.icp-link:hover {
  color: var(--primary);
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--surface);
}

.login-card {
  width: min(100%, 360px);
}

.brand-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 30px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.brand-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.brand-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.login-visual {
  display: flex;
  align-items: center;
  padding: 64px;
  background:
    linear-gradient(135deg, rgba(23, 105, 170, .92), rgba(22, 77, 121, .9)),
    url("/assets/banner-1.svg");
  background-size: cover;
  color: #fff;
}

.login-visual h1 {
  margin: 0 0 18px;
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1.05;
  max-width: 680px;
}

.login-visual p {
  margin: 0;
  max-width: 620px;
  color: rgba(255, 255, 255, .82);
  font-size: 17px;
  line-height: 1.7;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: #344154;
  font-size: 13px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

.textarea {
  min-height: 86px;
  resize: vertical;
  line-height: 1.6;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, .12);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.sidebar {
  background: #152234;
  color: #d9e4ef;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.sidebar-head {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-head .brand-row {
  margin: 0;
}

.sidebar-head .brand-subtitle {
  color: #93a7bc;
}

.nav-list {
  padding: 14px 10px;
  display: grid;
  gap: 4px;
}

.icp-link {
  margin: auto 20px 18px;
  font-size: 12px;
}

.nav-item {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: transparent;
  color: #cbd8e5;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #21344e;
  color: #fff;
}

.nav-icon {
  width: 18px;
  text-align: center;
  color: #7fb3dc;
}

.main {
  min-width: 0;
}

.topbar {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-left,
.top-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.page-title {
  margin: 0;
  font-size: 18px;
  white-space: nowrap;
}

.project-select {
  min-width: 220px;
}

.content {
  padding: 22px 24px 34px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.toolbar-actions,
.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

.tab {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: #344154;
}

.tab:hover,
.tab.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.btn {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  color: #263241;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-dark);
}

.btn.danger {
  color: var(--danger);
  border-color: #efb6b6;
  background: var(--danger-soft);
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}

.btn.icon {
  width: 34px;
  min-width: 34px;
  padding: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.stat-label {
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.panel-head {
  min-height: 50px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  font-size: 15px;
}

.panel-body {
  padding: 16px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #4a596b;
  background: #f7f9fb;
  font-weight: 600;
  font-size: 13px;
}

td.wrap {
  white-space: normal;
  min-width: 220px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.tag.gray {
  color: #5f6b78;
  background: #eef2f5;
}

.tag.green {
  color: var(--ok);
  background: #e9f7f1;
}

.tag.orange {
  color: var(--warn);
  background: #fff5df;
}

.tag.red {
  color: var(--danger);
  background: var(--danger-soft);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 220px;
  white-space: normal;
}

.product-thumb,
.banner-thumb,
.avatar {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  object-fit: cover;
  background: #edf2f7;
  border: 1px solid var(--line);
}

.banner-thumb {
  width: 96px;
  height: 44px;
}

.avatar {
  border-radius: 50%;
}

.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 43, .42);
  z-index: 30;
  display: flex;
  justify-content: flex-end;
}

.drawer {
  width: min(760px, 100%);
  height: 100%;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.drawer-head {
  min-height: 62px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  margin: 0;
  font-size: 18px;
}

.drawer-body {
  flex: 1;
  overflow: auto;
  padding: 18px 20px;
}

.drawer-foot {
  min-height: 62px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #fff;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.check-item {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: #344154;
}

.check-item:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.check-item input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.empty {
  padding: 38px 16px;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  background: #17202a;
  color: #fff;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.toast.error {
  background: var(--danger);
}

.link-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mono {
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
}

.chart-list {
  display: grid;
  gap: 12px;
}

.car-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.car-info-item {
  min-height: 64px;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.car-info-item.span-2 {
  grid-column: span 2;
}

.car-list {
  display: grid;
  gap: 12px;
}

.car-edit-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.car-edit-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.personnel-edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px auto;
  gap: 14px;
  align-items: end;
}

.car-map {
  position: relative;
  height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .75) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, .75) 1px, transparent 1px),
    #dcebe7;
  background-size: 52px 52px;
}

.map-point {
  position: absolute;
  min-width: 68px;
  height: 34px;
  border-radius: 999px;
  color: #fff;
  text-align: center;
  line-height: 34px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 5px 14px rgba(16, 24, 32, .16);
}

.map-point.store {
  left: 9%;
  bottom: 16%;
  background: #17202a;
}

.map-point.staff {
  left: 45%;
  top: 43%;
  background: #b7791f;
}

.map-point.user {
  right: 12%;
  top: 18%;
  background: var(--danger);
}

.car-track-card {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  line-height: 1.5;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 46px;
  gap: 10px;
  align-items: center;
}

.bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #edf2f7;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--primary);
}

.mobile-menu {
  display: none;
}

@media (max-width: 980px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .icp-footer {
    left: 0;
    right: 0;
    text-align: center;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 240px;
    z-index: 25;
    transform: translateX(-100%);
    transition: transform .18s ease;
  }

  .icp-link {
    margin: auto 20px 18px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu {
    display: inline-flex;
  }

  .topbar {
    padding: 0 14px;
  }

  .content {
    padding: 16px 14px 24px;
  }

  .stats-grid,
  .grid-two {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions,
  .filters,
  .tabs {
    width: 100%;
  }

  .filters .input,
  .filters .select {
    flex: 1 1 160px;
  }

  .project-select {
    min-width: 0;
    max-width: 46vw;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 13px;
  }

  .login-shell {
    min-height: 100svh;
    background: var(--surface);
  }

  .login-panel {
    align-items: flex-start;
    padding: 32px 18px 58px;
  }

  .login-card {
    width: 100%;
  }

  .brand-row {
    margin-bottom: 22px;
  }

  .brand-title {
    font-size: 18px;
  }

  .topbar {
    height: auto;
    min-height: 58px;
    padding: 10px 12px;
    align-items: flex-start;
  }

  .top-left,
  .top-right {
    gap: 8px;
  }

  .top-left {
    flex: 1;
  }

  .top-right {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .page-title {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .project-select {
    max-width: 38vw;
    min-height: 34px;
  }

  .top-right .muted {
    display: none;
  }

  .content {
    padding: 12px 10px 22px;
  }

  .panel-head {
    min-height: auto;
    padding: 12px;
    gap: 10px;
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-head .btn {
    width: 100%;
  }

  .panel-body {
    padding: 12px;
  }

  .toolbar {
    gap: 10px;
  }

  .toolbar-actions,
  .filters,
  .tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

  .filters .input,
  .filters .select,
  .toolbar-actions .btn,
  .filters .btn,
  .tab,
  .car-service-select {
    width: 100%;
  }

  .stat-card {
    padding: 13px;
  }

  .stat-value {
    font-size: 22px;
  }

  .table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
  }

  .table-wrap::after {
    content: '左右滑动查看更多';
    display: block;
    padding: 8px 10px;
    color: var(--muted);
    font-size: 12px;
    background: #f7f9fb;
    border-top: 1px solid var(--line);
  }

  table {
    min-width: 760px;
  }

  th,
  td {
    padding: 10px;
  }

  .link-row {
    align-items: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .check-grid {
    grid-template-columns: 1fr;
  }

  .car-info-grid,
  .personnel-edit {
    grid-template-columns: 1fr;
  }

  .car-info-item.span-2 {
    grid-column: auto;
  }

  .card-actions {
    justify-content: stretch;
  }

  .card-actions .btn,
  .personnel-edit .btn {
    width: 100%;
  }

  .car-map {
    height: 300px;
  }

  .form-grid .span-2 {
    grid-column: auto;
  }

  .drawer {
    width: 100%;
  }

  .drawer-mask {
    align-items: stretch;
  }

  .drawer-head {
    min-height: 56px;
    padding: 0 14px;
  }

  .drawer-head h2 {
    font-size: 16px;
  }

  .drawer-body {
    padding: 14px;
  }

  .drawer-foot {
    min-height: auto;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }

  .drawer-foot .btn {
    flex: 1;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    text-align: center;
  }
}
