/* 羚牛车辆数据中心 — Design System
   Modern data cockpit · Hydrogen passenger vehicle fleet
*/

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ── Surfaces (羚牛 ink — warm-cool deep neutral, anchored on logo #2F2828) ── */
  --bg-0:        oklch(0.16 0.012 165);  /* canvas — slight green undertone */
  --bg-1:        oklch(0.20 0.014 165);  /* panel */
  --bg-2:        oklch(0.24 0.016 165);  /* elevated card */
  --bg-3:        oklch(0.28 0.018 165);  /* hover */
  --bg-popover:  oklch(0.22 0.014 165);

  /* ── Text ── */
  --fg-0:        oklch(0.97 0.005 165);
  --fg-1:        oklch(0.84 0.010 165);
  --fg-2:        oklch(0.66 0.015 165);
  --fg-3:        oklch(0.50 0.018 165);

  /* ── Borders ── */
  --border-1:    oklch(0.32 0.018 165 / 0.55);
  --border-2:    oklch(0.42 0.022 165 / 0.45);
  --border-3:    oklch(0.55 0.028 165 / 0.35);

  /* ── Accents (羚牛绿系 — derived from logo #007143) ── */
  --accent:      oklch(0.74 0.170 155);   /* bright forest-green for dark UI */
  --accent-soft: oklch(0.74 0.170 155 / 0.16);
  --accent-glow: oklch(0.74 0.170 155 / 0.32);

  --info:        oklch(0.72 0.110 200);   /* slate-teal */
  --info-soft:   oklch(0.72 0.110 200 / 0.16);

  /* ── Status ── */
  --ok:          oklch(0.78 0.160 150);
  --ok-soft:     oklch(0.78 0.160 150 / 0.18);
  --warn:        oklch(0.80 0.160  85);
  --warn-soft:   oklch(0.80 0.160  85 / 0.18);
  --danger:      oklch(0.68 0.220  25);
  --danger-soft: oklch(0.68 0.220  25 / 0.18);

  /* ── Type ── */
  --font-sans: "IBM Plex Sans", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  /* ── Radii ── */
  --r-1: 4px;
  --r-2: 6px;
  --r-3: 10px;
  --r-4: 14px;

  /* ── Shadows ── */
  --shadow-1: 0 1px 0 0 oklch(1 0 0 / 0.04) inset, 0 1px 2px 0 oklch(0 0 0 / 0.4);
  --shadow-2: 0 1px 0 0 oklch(1 0 0 / 0.05) inset, 0 8px 24px -8px oklch(0 0 0 / 0.6);

  /* ── Map (dark) ── */
  --map-bg:               oklch(0.14 0.014 165);
  --map-grid:             oklch(0.30 0.012 165 / 0.18);
  --map-park:             oklch(0.32 0.06 150 / 0.18);
  --map-park-stroke:      oklch(0.5 0.08 150 / 0.28);
  --map-river:            oklch(0.40 0.07 220 / 0.32);
  --map-road-minor:       oklch(0.28 0.014 165 / 0.6);
  --map-road-major-outer: oklch(0.30 0.014 165 / 0.8);
  --map-road-major-inner: oklch(0.45 0.014 165 / 0.5);
  --map-vignette:         oklch(0.10 0.012 165);
  --map-vignette-strength: 0.6;
}

/* ── Light Theme — 羚牛 logo palette ──────────────────────
   Off-white ground · ink #2F2828 · saturated forest green #007143
*/
:root[data-theme="light"] {
  --bg-0:        #FAFAF7;            /* warm paper */
  --bg-1:        #FFFFFF;
  --bg-2:        #F2F1ED;            /* warm tint */
  --bg-3:        #E8E7E2;
  --bg-popover:  #FFFFFF;

  --fg-0:        #2F2828;            /* logo ink */
  --fg-1:        #3D3636;
  --fg-2:        #6B6363;
  --fg-3:        #9A938F;

  --border-1:    #E8E5DF;
  --border-2:    #D6D2CB;
  --border-3:    #BFBAB1;

  /* logo green ramp */
  --accent:      #007143;            /* logo primary green */
  --accent-soft: #E0F0E5;            /* tint */
  --accent-glow: rgba(0,113,67,.18);

  --info:        #2F2828;            /* ink doubles as informational */
  --info-soft:   #ECE9E5;

  --ok:          #007143;
  --ok-soft:     #DDEEE2;
  --warn:        #B57A0E;            /* deeper amber against warm ground */
  --warn-soft:   #F5E5C3;
  --danger:      #B33028;            /* deeper brick */
  --danger-soft: #F2D5D0;

  --shadow-1: 0 1px 0 0 rgba(255,255,255,.6) inset, 0 1px 2px 0 rgba(47,40,40,.04);
  --shadow-2: 0 1px 0 0 rgba(255,255,255,.6) inset, 0 6px 18px -6px rgba(47,40,40,.10);

  /* ── Map (light · 羚牛) ── */
  --map-bg:               #F4F2EC;            /* warm paper map */
  --map-grid:             rgba(47,40,40,0.05);
  --map-park:             rgba(0,113,67,0.13);
  --map-park-stroke:      rgba(0,113,67,0.30);
  --map-river:            rgba(122,150,170,0.40);
  --map-road-minor:       rgba(155,148,138,0.55);
  --map-road-major-outer: #C9C3B8;
  --map-road-major-inner: #FFFFFF;
  --map-vignette:         #FAFAF7;
  --map-vignette-strength: 0;
}

/* light-theme tweaks for surface bits */
:root[data-theme="light"] .app { color: var(--fg-1); background: var(--bg-0); }
:root[data-theme="light"] .app::before {
  background: radial-gradient(ellipse at 50% 0%, rgba(0,113,67,.04), transparent 55%);
}
:root[data-theme="light"] .sidebar {
  background: #FFFFFF;
  border-right-color: var(--border-1);
}
:root[data-theme="light"] .sidebar .logo {
  background: #007143;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0,113,67,.24);
}
:root[data-theme="light"] .topbar {
  background: #FFFFFF;
  border-bottom-color: var(--border-1);
}
:root[data-theme="light"] .panel {
  background: #FFFFFF;
  border-color: var(--border-1);
  box-shadow: 0 1px 2px rgba(47,40,40,.03);
}
:root[data-theme="light"] .panel-head { background: #FAFAF7; }
:root[data-theme="light"] .chip {
  background: #F2F1ED;
  color: var(--fg-2);
  border-color: var(--border-1);
}
:root[data-theme="light"] .chip.ok     { color: #007143; background: #DDEEE2; border-color: #A8D4B5; }
:root[data-theme="light"] .chip.warn   { color: #8C5E0A; background: #F5E5C3; border-color: #E5C98A; }
:root[data-theme="light"] .chip.danger { color: #8E2620; background: #F2D5D0; border-color: #DCA8A2; }
:root[data-theme="light"] .chip.accent { color: #007143; background: #DDEEE2; border-color: #A8D4B5; }
:root[data-theme="light"] .chip.info   { color: #2F2828; background: #ECE9E5; border-color: #D6D2CB; }
:root[data-theme="light"] .btn { background: #FFFFFF; color: var(--fg-1); border-color: var(--border-1); }
:root[data-theme="light"] .btn:hover { background: #F2F1ED; border-color: var(--border-2); }
:root[data-theme="light"] .btn.primary { background: #007143; color: #fff; border-color: #007143; }
:root[data-theme="light"] .btn.primary:hover { background: #005A35; border-color: #005A35; }
:root[data-theme="light"] .btn.danger { background: var(--danger-soft); color: var(--danger); border-color: #DCA8A2; }
:root[data-theme="light"] .tbl thead th { background: #FAFAF7; color: var(--fg-3); border-bottom-color: var(--border-1); }
:root[data-theme="light"] .tbl tbody td { border-bottom-color: var(--border-1); color: var(--fg-1); }
:root[data-theme="light"] .tbl tbody tr:hover td { background: #FAFAF7; }
:root[data-theme="light"] .tbl tbody tr.sel td { background: #DDEEE2; }
:root[data-theme="light"] .tbl tbody tr.sel td:first-child { box-shadow: inset 2px 0 0 #007143; }
:root[data-theme="light"] .bar { background: #ECEAE3; }
:root[data-theme="light"] .scroll::-webkit-scrollbar-thumb { background: rgba(47,40,40,.16); }
:root[data-theme="light"] .scroll::-webkit-scrollbar-thumb:hover { background: rgba(47,40,40,.30); }
:root[data-theme="light"] .dot.ok { background: #007143; box-shadow: 0 0 4px rgba(0,113,67,.4); }
:root[data-theme="light"] .dot.warn { background: #B57A0E; box-shadow: 0 0 4px rgba(181,122,14,.35); }
:root[data-theme="light"] .dot.danger { background: #B33028; box-shadow: 0 0 4px rgba(179,48,40,.35); }
:root[data-theme="light"] .search { background: #F2F1ED; border-color: var(--border-1); }
:root[data-theme="light"] .search input { color: var(--fg-1); }
:root[data-theme="light"] .search kbd { background: #fff; border-color: var(--border-1); color: var(--fg-2); }
:root[data-theme="light"] .topbar .icon-btn:hover { background: #F2F1ED; }
:root[data-theme="light"] .nav-item { color: var(--fg-2); }
:root[data-theme="light"] .nav-item:hover { background: #F2F1ED; color: var(--fg-0); }
:root[data-theme="light"] .nav-item.active { color: #007143; background: #DDEEE2; }
:root[data-theme="light"] .nav-item.active::before { background: #007143; box-shadow: 0 0 6px rgba(0,113,67,.5); }
:root[data-theme="light"] .sidebar-divider { background: var(--border-1); }
:root[data-theme="light"] .topbar .crumbs .now { color: var(--fg-0); }

* { box-sizing: border-box; }

.app {
  width: 100%;
  height: 100%;
  background: var(--bg-0);
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.005em;
  overflow: hidden;
  display: flex;
  position: relative;
  font-feature-settings: "ss02", "cv11";
}

/* faint vignette for cockpit feel */
.app::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 100%, oklch(0.78 0.150 175 / 0.04), transparent 60%);
  z-index: 0;
}

.mono { font-family: var(--font-mono); font-feature-settings: "tnum", "zero"; }
.tnum { font-variant-numeric: tabular-nums; }

/* ── Sidebar ── */
.sidebar {
  width: 56px;
  flex: 0 0 56px;
  background: var(--bg-1);
  border-right: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  gap: 4px;
  z-index: 1;
}
.sidebar .logo {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--info));
  color: oklch(0.18 0.020 245);
  font-weight: 700; font-size: 14px;
  letter-spacing: -0.04em;
  margin-bottom: 12px;
  box-shadow: 0 0 24px var(--accent-glow);
}
.nav-item {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--fg-2);
  cursor: pointer;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item:hover { color: var(--fg-0); background: var(--bg-2); }
.nav-item.active { color: var(--accent); background: var(--accent-soft); }
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 2px; background: var(--accent); border-radius: 2px;
  box-shadow: 0 0 8px var(--accent);
}
.sidebar-divider { width: 24px; height: 1px; background: var(--border-1); margin: 8px 0; }

/* ── Topbar ── */
.topbar {
  height: 48px;
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-1);
  gap: 16px;
  z-index: 2;
}
.topbar .crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.topbar .crumbs .sep { color: var(--fg-3); }
.topbar .crumbs .now { color: var(--fg-0); font-weight: 500; }

.kpi-row { display: flex; align-items: center; gap: 18px; margin-left: 8px; }
.kpi-mini { display: flex; align-items: baseline; gap: 6px; }
.kpi-mini .lbl { font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.08em; }
.kpi-mini .val { font-family: var(--font-mono); font-size: 14px; font-weight: 500; color: var(--fg-0); }
.kpi-mini .delta { font-family: var(--font-mono); font-size: 11px; }
.kpi-mini .delta.up { color: var(--ok); }
.kpi-mini .delta.down { color: var(--danger); }

.search {
  flex: 1; max-width: 320px;
  height: 28px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: 6px;
  display: flex; align-items: center; padding: 0 10px; gap: 8px;
  color: var(--fg-2); font-size: 12px;
}
.search input {
  flex: 1; background: transparent; border: 0; outline: 0;
  color: var(--fg-1); font-size: 12px; font-family: inherit;
}
.search kbd {
  background: var(--bg-3); padding: 1px 5px; border-radius: 3px;
  font-family: var(--font-mono); font-size: 10px; color: var(--fg-2);
  border: 1px solid var(--border-2);
}

.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar .icon-btn {
  width: 28px; height: 28px; border-radius: 6px;
  display: grid; place-items: center;
  color: var(--fg-2); cursor: pointer; position: relative;
  transition: color .12s, background .12s;
}
.topbar .icon-btn:hover { color: var(--fg-0); background: var(--bg-2); }
.topbar .icon-btn .dot {
  position: absolute; top: 4px; right: 4px;
  width: 6px; height: 6px; border-radius: 3px;
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}
.avatar {
  width: 28px; height: 28px; border-radius: 14px;
  background: linear-gradient(135deg, oklch(0.55 0.10 285), oklch(0.65 0.12 320));
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: var(--fg-0);
}

/* ── Cards / panels ── */
.panel {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-3);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.panel-head {
  height: 36px;
  flex: 0 0 36px;
  border-bottom: 1px solid var(--border-1);
  padding: 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.panel-head .title {
  font-size: 12px; font-weight: 600; color: var(--fg-0);
  letter-spacing: 0.02em;
}
.panel-head .sub { font-size: 11px; color: var(--fg-3); }
.panel-head .actions { margin-left: auto; display: flex; gap: 4px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 18px; padding: 0 6px;
  font-size: 10px;
  border-radius: 4px;
  background: var(--bg-2);
  color: var(--fg-2);
  border: 1px solid var(--border-1);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.chip.ok { color: var(--ok); background: var(--ok-soft); border-color: oklch(0.78 0.150 155 / 0.3); }
.chip.warn { color: var(--warn); background: var(--warn-soft); border-color: oklch(0.80 0.160 85 / 0.3); }
.chip.danger { color: var(--danger); background: var(--danger-soft); border-color: oklch(0.68 0.220 25 / 0.4); }
.chip.accent { color: var(--accent); background: var(--accent-soft); border-color: oklch(0.78 0.150 175 / 0.3); }
.chip.info { color: var(--info); background: var(--info-soft); border-color: oklch(0.74 0.140 235 / 0.3); }

/* ── Buttons ── */
.btn {
  height: 28px; padding: 0 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  color: var(--fg-1);
  font-family: inherit; font-size: 12px; font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--bg-3); border-color: var(--border-2); }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: oklch(0.18 0.02 245);
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn.ghost:hover { background: var(--bg-2); color: var(--fg-0); }
.btn.danger { background: var(--danger-soft); border-color: oklch(0.68 0.220 25 / 0.4); color: var(--danger); }
.btn.sm { height: 24px; padding: 0 8px; font-size: 11px; }
.btn.icon { width: 28px; padding: 0; justify-content: center; }

/* ── Tables ── */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
.tbl thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-1);
  text-align: left;
  font-weight: 500;
  color: var(--fg-3);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-1);
}
.tbl tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-1);
  color: var(--fg-1);
  vertical-align: middle;
}
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--bg-2); }
.tbl tbody tr.sel td { background: var(--accent-soft); }
.tbl tbody tr.sel td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

/* status dots */
.dot { width: 6px; height: 6px; border-radius: 3px; display: inline-block; }
.dot.ok { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot.warn { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.dot.danger { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.dot.idle { background: var(--fg-3); }

/* ── Bars / meters ── */
.bar {
  height: 4px; border-radius: 2px;
  background: var(--bg-3); overflow: hidden;
  position: relative;
}
.bar > i {
  display: block; height: 100%;
  background: var(--accent);
  border-radius: 2px;
}
.bar.warn > i { background: var(--warn); }
.bar.danger > i { background: var(--danger); }
.bar.ok > i { background: var(--ok); }

/* ── Scrollbars ── */
.scroll { overflow: auto; }
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: oklch(0.4 0.02 245 / 0.4); border-radius: 4px; }
.scroll::-webkit-scrollbar-thumb:hover { background: oklch(0.5 0.02 245 / 0.5); }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* ── Icons (mini-stroke) ── */
.ic { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 13px; height: 13px; }
.ic.lg { width: 20px; height: 20px; }

/* keyframes */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.pulse { animation: pulse 1.6s ease-in-out infinite; }

@keyframes ping {
  0% { transform: scale(.4); opacity: .9; }
  80%,100% { transform: scale(2.4); opacity: 0; }
}
.ping {
  position: absolute; inset: 0; border-radius: 50%;
  animation: ping 2s ease-out infinite;
}

@keyframes dash { to { stroke-dashoffset: -100; } }

/* utilities */
.row { display: flex; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.f1 { flex: 1; }
.center { display: flex; align-items: center; justify-content: center; }
.mid { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--fg-3); }
.dim { color: var(--fg-2); }
.strong { color: var(--fg-0); }
.eyebrow { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--fg-3); font-weight: 500; }
