/* =====================================================================
   Kalyani Powertrain · Fleet Intelligence — design system
   Tokens → primitives → components. One type family, neutral surfaces,
   6 px corners, no gradients, shadows only for overlays.
   ===================================================================== */
:root {
  color-scheme: light;
  /* Reference: Figma "Dashboards Layout Ideas" node 202-277 — geometric sans, white cards on a very light surface,
     dark icon rail, green primary accents, purple/pink secondary series, 10 px card radius, 1 px borders, no shadows. */
  --font: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #f6f8f6; --surface: #ffffff; --surface-2: #f7f9f7; --surface-3: #eef2ee;
  --border: #e6eae6; --border-2: #d3d9d3;
  --text: #1c2422; --text-2: #4a5552; --muted: #6f7a76; --faint: #9aa49f;
  --accent: #4f8f3f; --accent-bg: #eef6ea; --accent-text: #3d7430; --focus: #4f8f3f;
  --rail: #1f2a28; --rail-text: #c7d0cc; --rail-active: #c9d96a; --brand: #c8102e;
  --ok: #3d7430; --ok-bg: #eef6ea; --warn: #b2660a; --warn-bg: #fbf1e3; --crit: #b42318; --crit-bg: #fcebe9; --info: #4a5552; --info-bg: #eef2ee; --code: #6a2fb5; --code-bg: #f1eaf9;
  /* series: charging power (reference green), Pack A (reference violet), Pack B (reference pink), speed (reference dark teal) */
  --power: #5f9f4a; --pack-a: #7a3fbf; --pack-b: #d0609a; --speed: #2f5f57; --combined: #8a948f; --temp: #c2410c; --aux: #4f7f5e; --s8: #8fbf6a; --neutral-series: #b8c2bc;
  --lime: #c9d96a; --green-2: #8fbf6a; --green-3: #6a9f5b; --green-4: #4f7f5e; --teal: #2f5f57;
  --grid: #eef2ee; --axis: #d3d9d3;
  --r: 8px; --r-lg: 10px; --sidebar-w: 224px; --sidebar-collapsed: 64px; --topbar-h: 64px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;
  --shadow-menu: 0 8px 24px rgba(16, 24, 40, 0.12);
  --page: var(--bg); --border-strong: var(--border-2); --action: var(--accent); --action-soft: var(--accent-bg); --sev-fault: var(--crit); --sev-warning: var(--warn); --sev-code: var(--code); --sev-watch: var(--warn); --sev-info: var(--info);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121917; --surface: #18201e; --surface-2: #1d2624; --surface-3: #25302d; --border: #2b3633; --border-2: #3b4845;
  --text: #e7ebe8; --text-2: #b7c1bc; --muted: #8e9994; --faint: #6c7772; --accent: #8fbf6a; --accent-bg: #203027; --accent-text: #a9d389;
  --rail: #0f1513; --rail-text: #aab5b0;
  --ok: #8fbf6a; --ok-bg: #203027; --warn: #f0b35a; --warn-bg: #3a2c14; --crit: #f26b63; --crit-bg: #3a1a18; --info: #9aa5a0; --info-bg: #25302d; --code: #b48be6; --code-bg: #2a2440;
  --power: #8fbf6a; --pack-a: #a97ee0; --pack-b: #e68bb8; --speed: #5fb3a4; --combined: #8e9994; --temp: #e07b5c; --aux: #7fb08f; --grid: #25302d; --axis: #3b4845;
}

/* ---------- primitives ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 13.5px; letter-spacing: -0.005em; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; } a:hover { text-decoration: underline; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num, .tbl td.num, .kv .v, .metric .v, .tile .value, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.section-title { font-size: 18px; font-weight: 700; color: var(--text); margin: var(--sp-2) 0 0; display: flex; gap: 10px; align-items: baseline; letter-spacing: -0.01em; }
.section-title .sub { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.note { color: var(--text-2); font-size: 12.5px; line-height: 1.5; margin: 0; }
.note.warn { border-left: 3px solid var(--warn); padding: 6px 10px; background: var(--warn-bg); border-radius: 0 var(--r) var(--r) 0; }
.note.info { border-left: 3px solid var(--accent); padding: 6px 10px; background: var(--accent-bg); border-radius: 0 var(--r) var(--r) 0; }
.plain { font-size: 13.5px; line-height: 1.55; margin: 0; }
.empty { color: var(--muted); padding: 28px; text-align: center; font-size: 13px; }
.loading-row { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; padding: 18px; }
.loading-row::before { content: ""; width: 14px; height: 14px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--text); border-color: var(--text); color: #fff; } .btn.primary:hover { background: #2b3633; }
.btn.soft { background: var(--surface-3); border-color: var(--surface-3); } .btn.soft:hover { background: var(--border); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; } .btn.ghost { background: transparent; border-color: transparent; } .btn.ghost:hover { background: var(--surface-3); }
.btn.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.period-btns { display: inline-flex; } .period-btns .btn { border-radius: 0; margin-left: -1px; } .period-btns .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; } .period-btns .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
select.sel, input.inp { height: 34px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 12.5px; font-weight: 600; }
select.sel { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; max-width: 320px; }

/* ---------- application shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.app.collapsed { grid-template-columns: var(--sidebar-collapsed) 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--rail); border-right: 0; display: flex; flex-direction: column; padding: 14px 10px; overflow: hidden; color: var(--rail-text); }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 8px; min-height: 52px; }
.brand .mark { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: -0.02em; flex: none; }
.brand .oem { font-weight: 700; font-size: 13.5px; white-space: nowrap; color: #fff; } .brand .product { color: var(--rail-text); font-size: 11px; white-space: nowrap; opacity: .8; } .brand img { height: 20px; width: auto; }
.nav-section { color: rgba(255,255,255,0.38); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; padding: 14px 12px 4px; font-weight: 600; white-space: nowrap; }
.nav a { display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 12px; border-radius: var(--r); color: var(--rail-text); font-weight: 500; font-size: 13.5px; white-space: nowrap; position: relative; }
.nav a:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,255,255,0.08); color: #fff; font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 9px; width: 3px; height: 20px; border-radius: 0 2px 2px 0; background: var(--rail-active); }
.nav a .n { margin-left: auto; font-size: 11.5px; color: rgba(255,255,255,0.5); font-variant-numeric: tabular-nums; }
.nav svg { width: 17px; height: 17px; flex: none; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255,255,255,0.08); color: rgba(255,255,255,0.5); font-size: 11.5px; display: grid; gap: 3px; white-space: nowrap; }
.collapse-btn { margin-top: 8px; width: 100%; justify-content: center; background: transparent; border-color: rgba(255,255,255,0.12); color: var(--rail-text); } .collapse-btn:hover { background: rgba(255,255,255,0.06); }
.app.collapsed .brand .oem, .app.collapsed .brand .product, .app.collapsed .nav-section, .app.collapsed .nav a .lbl, .app.collapsed .nav a .n, .app.collapsed .sidebar-foot { display: none; }
.app.collapsed .nav a { justify-content: center; padding: 0; } .app.collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
.main { min-width: 0; display: flex; flex-direction: column; }
.context-bar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 0; padding: 18px var(--sp-6) 0; min-height: var(--topbar-h); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.context-bar .lead { display: flex; align-items: center; gap: 10px; min-width: 0; }
.context-bar .spacer { flex: 1; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); white-space: nowrap; }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--accent-text); } .crumbs b { color: var(--text); font-weight: 600; }
.ctx { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; color: var(--text-2); cursor: default; position: relative; white-space: nowrap; }
.ctx::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex: none; }
.ctx.live::before { background: var(--ok); } .ctx.demo::before { background: var(--code); }
.ctx .pop { display: none; position: absolute; top: 28px; left: 0; width: 360px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-lg); box-shadow: var(--shadow-menu); padding: 10px 12px; z-index: 30; font-size: 12.5px; color: var(--text-2); line-height: 1.5; cursor: auto; white-space: normal; }
.ctx:hover .pop, .ctx:focus-within .pop { display: block; }
.vhead { display: flex; gap: 6px 16px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--text-2); padding: 6px 0 8px; width: 100%; }
.vhead b { color: var(--text); font-weight: 600; } .vhead .id { font-size: 16px; font-weight: 600; color: var(--text); }
.vhead .sep { width: 1px; height: 16px; background: var(--border); }
.content { padding: var(--sp-5) var(--sp-6) 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
.content > * { grid-column: 1 / 2 !important; min-width: 0; }

/* ---------- layout ---------- */
.grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.c12 { grid-column: 1 / -1; } .c9 { grid-column: span 9; } .c8 { grid-column: span 8; } .c7 { grid-column: span 7; } .c6 { grid-column: span 6; } .c5 { grid-column: span 5; } .c4 { grid-column: span 4; } .c3 { grid-column: span 3; }
@media (max-width: 1280px) { .c3, .c4, .c5, .c7 { grid-column: span 6; } .c8, .c9 { grid-column: span 12; } }
@media (max-width: 960px) { .c6, .c3, .c4, .c5, .c7 { grid-column: span 12; } .app, .app.collapsed { grid-template-columns: 1fr; } .sidebar { position: fixed; transform: translateX(-100%); z-index: 40; transition: transform .15s; width: var(--sidebar-w); } .sidebar.open { transform: none; } .menu-btn { display: inline-flex !important; } .content { padding: 14px; } .context-bar { padding: 0 14px; } }
.menu-btn { display: none; }

/* ---------- panel ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; min-height: 24px; }
.panel-head h3 { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-head .hint a, .panel-head a.more { color: var(--accent-text); font-weight: 600; font-size: 12px; }
.panel-head .hint { color: var(--muted); font-size: 12px; } .panel-head .tools { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.panel > .chart { flex: 1 1 auto; }
.chart { width: 100%; height: 280px; } .chart.tall { height: 360px; } .chart.short { height: 200px; } .chart.xs { height: 150px; }

/* ---------- metric tiles ---------- */
.ftiles, .tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 1500px) { .ftiles { grid-template-columns: repeat(8, minmax(0, 1fr)); } .tiles.eight { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
@media (max-width: 960px) { .ftiles, .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile, a.ftile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 14px; min-width: 0; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto auto; gap: 0 8px; align-content: start; color: var(--text); position: relative; }
.tile .label, a.ftile .t { grid-column: 1; color: var(--text); font-size: 13px; font-weight: 700; letter-spacing: 0; text-transform: none; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .value, a.ftile .n { grid-column: 1; font-size: 30px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .value small { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-left: 4px; letter-spacing: 0; }
.tile .sub, a.ftile .s, .tile .when { grid-column: 1 / -1; color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .sub.good { color: var(--ok); } .tile .sub.bad { color: var(--crit); } .tile .sub.warn { color: var(--warn); }
.tile::before, a.ftile .ic { grid-column: 2; grid-row: 1 / span 2; align-self: start; width: 8px; height: 8px; border-radius: 50%; background: var(--tile-accent, var(--ft, var(--border-2))); margin-top: 6px; content: ""; display: block; }
a.ftile .ic svg { display: none; }
a.ftile { text-decoration: none; cursor: pointer; transition: border-color .12s, background .12s; }
a.ftile:hover { border-color: var(--border-2); background: var(--surface-2); text-decoration: none; }
a.ftile::after { content: "›"; position: absolute; right: 12px; bottom: 8px; color: var(--faint); font-size: 14px; }
.tile.ab .value { display: flex; gap: 12px; align-items: baseline; } .tile.ab .value i { font-style: normal; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.metric { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; } .metric:last-child { border-right: 0; }
.metric .k { color: var(--muted); font-size: 12px; font-weight: 500; display: flex; justify-content: space-between; gap: 6px; } .metric .v { font-size: 20px; font-weight: 600; line-height: 1.25; margin-top: 2px; } .metric .v small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.metric .s { color: var(--text-2); font-size: 12px; margin-top: 1px; } .metric .scope { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); position: sticky; top: 0; white-space: nowrap; z-index: 1; }
.tbl td { padding: 8px 12px; height: 40px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; } .tbl tbody tr:hover { background: var(--surface-2); } .tbl tr.clickable { cursor: pointer; } .tbl tr.selected { background: var(--accent-bg); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; } .tbl td.wrap { white-space: normal; min-width: 240px; }
.tbl .sub { color: var(--muted); font-size: 11.5px; display: block; line-height: 1.3; }
.tbl.compact td { padding: 6px 12px; height: 36px; }

/* ---------- status language ---------- */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.st.on::before, .st.ok::before { background: var(--ok); } .st.off::before { background: transparent; border: 1.5px solid var(--faint); } .st.na::before { background: transparent; border: 1.5px dashed var(--faint); }
.st.warn::before { background: var(--warn); } .st.crit::before { background: var(--crit); } .st.info::before { background: var(--accent); } .st.code::before { background: var(--code); }
.sev { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; height: 22px; padding: 0 8px; border-radius: 4px; white-space: nowrap; }
.sev::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sev.fault { color: var(--crit); background: var(--crit-bg); } .sev.warning { color: var(--warn); background: var(--warn-bg); } .sev.code { color: var(--code); background: var(--code-bg); } .sev.watch { color: var(--warn); background: var(--warn-bg); } .sev.info { color: var(--info); background: var(--info-bg); } .sev.ok { color: var(--ok); background: var(--ok-bg); }
.type { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.type::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.type.driving::before { background: var(--speed); } .type.charging::before { background: var(--power); } .type.standby::before, .type.idle::before { background: var(--neutral-series); } .type.parked_off::before, .type.unknown::before { background: transparent; border: 1.5px solid var(--faint); }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; border-radius: 4px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--border-2); color: var(--text-2); background: var(--surface-2); white-space: nowrap; }
.tag.hist { color: var(--warn); border-color: #f0d3b4; background: var(--warn-bg); } .tag.demo { color: var(--code); border-color: #cfc6f3; background: var(--code-bg); } .tag.scope { font-weight: 500; color: var(--muted); border-style: dashed; }
.mapping { font-size: 11px; font-weight: 600; text-transform: uppercase; padding: 0 5px; border-radius: 3px; border: 1px solid var(--border-2); color: var(--muted); }
.mapping.verified { color: var(--ok); border-color: #b7e2cf; } .mapping.unverified { color: var(--warn); border-color: #f0d3b4; } .mapping.suspect { color: var(--crit); border-color: #f3c2bd; }

/* ---------- key/value ---------- */
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; font-size: 13px; }
.kv .k { color: var(--text-2); } .kv .v { text-align: right; font-weight: 500; } .kv .v.na { color: var(--faint); font-weight: 400; } .kv .sub { grid-column: 1 / -1; color: var(--muted); font-size: 11.5px; margin-top: -4px; }

/* ---------- toolbars, chips, tabs ---------- */
.filters, .toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; }
.chip i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; } .chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 14px; line-height: 1; }
.chip.f { background: var(--accent-bg); border-color: #c5d3f5; color: var(--accent-text); }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.tabbar { display: flex; border-bottom: 1px solid var(--border); margin: 0 0 2px; overflow-x: auto; }
.tabbar a { padding: 10px 14px; font-size: 13.5px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabbar a:hover { text-decoration: none; color: var(--text); } .tabbar a.active { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.tabs button { border: 0; background: transparent; padding: 8px 12px; font-size: 13px; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs button.active { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- operational timeline ---------- */
.oplane { position: relative; height: 92px; }
.oplane .row { position: absolute; left: 0; right: 0; height: 18px; } .oplane .lbl { position: absolute; left: 0; width: 86px; font-size: 11.5px; color: var(--muted); line-height: 18px; }
.oplane .track { position: absolute; left: 92px; right: 0; top: 0; bottom: 0; }
.oplane .blk { position: absolute; top: 2px; height: 14px; border-radius: 3px; cursor: pointer; font-size: 10.5px; color: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; }
.oplane .blk.driving { background: var(--speed); } .oplane .blk.charging { background: var(--power); } .oplane .blk.standby { background: var(--neutral-series); } .oplane .blk.segment { background: var(--surface-3); border: 1px solid var(--border-2); color: var(--muted); }
.oplane .blk.gap { background: repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in srgb, var(--warn) 35%, transparent) 4px 6px); border: 1px dashed color-mix(in srgb, var(--warn) 60%, transparent); color: var(--warn); }
.oplane .blk.selected { outline: 2px solid var(--text); outline-offset: 1px; }
.oplane .ev { position: absolute; top: 3px; width: 2px; height: 12px; border-radius: 1px; } .oplane .ev.fault { background: var(--crit); } .oplane .ev.warning { background: var(--warn); } .oplane .ev.code { background: var(--code); } .oplane .ev.watch { background: var(--warn); }
.oplane .axis { position: absolute; left: 92px; right: 0; bottom: 0; height: 16px; font-size: 11px; color: var(--muted); } .oplane .axis span { position: absolute; transform: translateX(-50%); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- inspection panel ---------- */
.inspect { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.inspect > div { background: var(--surface); padding: 8px 10px; min-width: 0; }
.inspect .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; } .inspect .v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; } .inspect .a { color: var(--faint); font-size: 11px; margin-top: 2px; }
.inspect .v.na { color: var(--muted); font-size: 12.5px; font-weight: 500; }

/* ---------- health, alert cards, details ---------- */
.health { display: grid; gap: 8px; }
.health .row { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: start; padding: 10px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); }
.health .row .led { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; } .health .row h4 { font-size: 13.5px; margin-bottom: 2px; } .health .row p { margin: 0; color: var(--text-2); font-size: 12.5px; }
.led.ok { background: var(--ok); } .led.watch, .led.attention { background: var(--warn); } .led.fault { background: var(--crit); }
.alert-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.alert-card > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 4px 1fr auto; gap: 14px; align-items: center; padding: 10px 14px 10px 0; }
.alert-card > summary::-webkit-details-marker { display: none; } .alert-card > summary .bar { align-self: stretch; }
.alert-card.fault > summary .bar { background: var(--crit); } .alert-card.warning > summary .bar { background: var(--warn); } .alert-card.code > summary .bar { background: var(--code); } .alert-card.watch > summary .bar { background: var(--warn); } .alert-card.info > summary .bar { background: var(--border-2); }
.alert-card .title { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .alert-card .when { color: var(--muted); font-size: 12px; margin-top: 2px; }
.alert-card .count { text-align: right; color: var(--muted); font-size: 12px; white-space: nowrap; } .alert-card .count b { display: block; font-size: 18px; color: var(--text); font-weight: 600; }
.alert-card .body { padding: 0 14px 14px 18px; display: grid; gap: 10px; }
.alert-card .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } @media (max-width: 1000px) { .alert-card .facts { grid-template-columns: 1fr; } }
.alert-card .facts div { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 8px 10px; font-size: 12.5px; color: var(--text-2); } .alert-card .facts b { display: block; color: var(--text); margin-bottom: 3px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
details.tech { border: 1px solid var(--border); border-radius: var(--r); padding: 8px 12px; color: var(--text-2); font-size: 12.5px; background: var(--surface); }
details.tech > summary { cursor: pointer; font-weight: 500; color: var(--text-2); list-style: none; display: flex; align-items: center; gap: 8px; } details.tech > summary::-webkit-details-marker { display: none; }
details.tech > summary::before { content: "▸"; font-size: 11px; color: var(--muted); } details.tech[open] > summary::before { content: "▾"; } details.tech > summary + * { margin-top: 10px; }
.detail-panel { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--r-lg); padding: 14px 16px; display: grid; gap: 12px; }
.detail-panel .head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .detail-panel .head h3 { font-size: 15px; }

/* ---------- explorer & misc ---------- */
.explorer { display: grid; grid-template-columns: 320px 1fr; gap: var(--sp-4); } @media (max-width: 1100px) { .explorer { grid-template-columns: 1fr; } }
.siglist { max-height: 70vh; overflow: auto; } .siglist .g { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 9px 6px 3px; font-weight: 600; }
.siglist label { display: grid; grid-template-columns: auto 1fr auto; gap: 7px; align-items: center; padding: 4px 6px; border-radius: 4px; cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.siglist label:hover { background: var(--surface-2); } .siglist label.on { background: var(--accent-bg); color: var(--text); } .siglist .meta { color: var(--faint); font-size: 11px; display: flex; gap: 6px; } .siglist input { accent-color: var(--accent); }
.gf-frame { width: 100%; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
pre.code { margin: 0; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); font-size: 12px; overflow: auto; }
.toast { position: fixed; bottom: 16px; right: 16px; background: var(--text); color: var(--surface); padding: 8px 12px; border-radius: var(--r); font-size: 13px; z-index: 50; box-shadow: var(--shadow-menu); }
.bar-missing { color: var(--muted); font-size: 12px; }
.mode-banner { display: none; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; border: 2px solid var(--surface); }

/* ---------- reference patterns: summary card with underlined KPIs; stage columns ---------- */
.sumcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 18px 14px; }
.sumcard .head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sumcard .head h3 { font-size: 14.5px; font-weight: 700; } .sumcard .head .sub { font-size: 11.5px; color: var(--muted); }
.sumrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0 22px; }
a.sumkpi { display: block; color: var(--text); text-decoration: none; padding: 4px 0 0; position: relative; border-radius: 6px; }
a.sumkpi:hover { text-decoration: none; } a.sumkpi:hover .n, a.sumkpi:focus-visible .n { color: var(--accent-text); }
a.sumkpi .n { font-size: 28px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; font-variant-numeric: tabular-nums; }
a.sumkpi .l { font-size: 11.5px; color: var(--text-2); font-weight: 600; margin-top: 4px; display: flex; justify-content: space-between; gap: 6px; }
a.sumkpi .bar { height: 3px; border-radius: 2px; background: var(--border); margin-top: 8px; } a.sumkpi.on .bar { background: var(--kpi, var(--accent)); }
a.sumkpi .s { font-size: 11px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.stage { padding: 14px 16px; border-right: 1px solid var(--border); min-width: 0; } .stage:last-child { border-right: 0; }
.stage .t { font-size: 13px; font-weight: 700; color: var(--text); } .stage .n { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; } .stage .n small { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 3px; }
.stage .m { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 11.5px; color: var(--muted); } .stage .m b { color: var(--text); font-weight: 600; } .stage .m .pct { color: var(--faint); }
.stage .scope { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; margin-top: 6px; }
.hero-kpi { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(240px, 1.6fr); gap: 16px; align-items: stretch; }
@media (max-width: 960px) { .hero-kpi { grid-template-columns: 1fr; } }
.hero-kpi .big { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; margin-top: 10px; }
.hero-kpi .delta { font-size: 11.5px; color: var(--muted); margin-top: 6px; } .hero-kpi .delta b { color: var(--accent-text); font-weight: 700; }
.link-more { color: var(--accent-text); font-weight: 600; font-size: 12px; } .link-more::after { content: " ›"; }
.pill-cal::before { content: ""; width: 12px; height: 12px; border: 1.5px solid currentColor; border-radius: 3px; display: inline-block; margin-right: 2px; opacity: .7; }
.metrics { background: transparent; border: 0; border-radius: 0; gap: 12px; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 14px; }
.metric .k { color: var(--text); font-weight: 700; font-size: 12.5px; } .metric .v { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.tbl th { text-transform: none; font-size: 11.5px; color: var(--muted); background: var(--surface); }
.tabbar a.active { color: var(--text); border-bottom-color: var(--accent); } .tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.stages.cols-4 { grid-template-columns: repeat(4, 1fr); } .stages.cols-4 .stage { border-bottom: 1px solid var(--border); } .stages.cols-4 .stage:nth-child(n+5) { border-bottom: 0; } .stages.cols-4 .stage:nth-child(4n) { border-right: 0; }
@media (max-width: 1100px) { .stages.cols-4 { grid-template-columns: repeat(2, 1fr); } .stages.cols-4 .stage:nth-child(n+5) { border-bottom: 1px solid var(--border); } .stages.cols-4 .stage:nth-child(n+7) { border-bottom: 0; } .stages.cols-4 .stage:nth-child(4n) { border-right: 1px solid var(--border); } .stages.cols-4 .stage:nth-child(2n) { border-right: 0; } }
@media (max-width: 960px) { .stages { grid-template-columns: repeat(2, 1fr); } .stage { border-bottom: 1px solid var(--border); } .stage:nth-child(2n) { border-right: 0; } }

/* ---------- fleet map ---------- */
.map-panel { gap: 10px; }
.map-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.map-toolbar .inp { height: 32px; } .map-toolbar .sel { height: 32px; max-width: 170px; }
.seg { display: inline-flex; gap: 0; } .seg .btn { border-radius: 0; margin-left: -1px; } .seg .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; } .seg .btn:last-child { border-radius: 0 var(--r) var(--r) 0; } .seg .btn.active { background: var(--text); border-color: var(--text); color: #fff; }
.map-wrap { position: relative; min-height: 460px; }
.fleet-map { width: 100%; height: 520px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); }
.map-preview-host { position: absolute; top: 12px; right: 12px; z-index: 5; width: min(320px, calc(100% - 24px)); }
.map-preview { background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-lg); padding: 12px 14px; box-shadow: var(--shadow-menu); display: grid; gap: 8px; font-size: 12.5px; }
.pv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; } .pv-id { font-weight: 800; font-size: 15px; color: var(--text); }
.pv-status { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pv-row { display: grid; grid-template-columns: 112px 1fr; gap: 8px; align-items: baseline; } .pv-row .k { color: var(--muted); font-size: 11.5px; } .pv-row .v { min-width: 0; overflow-wrap: anywhere; }
.pv-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.map-list .table-wrap { max-height: 520px; overflow: auto; }
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-2); align-items: center; } .map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; border: 1.5px solid #fff; box-shadow: 0 0 0 1px var(--border-2); } .lg-dot.hollow { background: var(--surface); border: 2px solid var(--text-2); box-shadow: none; }
.lg-tri { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid var(--crit); display: inline-block; }
.lg-dia { width: 8px; height: 8px; background: var(--warn); transform: rotate(45deg); display: inline-block; }
.lg-cluster { width: 18px; height: 18px; border-radius: 50%; background: var(--text); color: #fff; font-size: 10px; font-weight: 700; display: inline-grid; place-items: center; font-style: normal; }
@media (max-width: 960px) { .fleet-map { height: 420px; } .map-preview-host { position: static; width: auto; margin-top: 8px; } }

/* ---------- AI analytics ---------- */
.basis { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; border: 1px solid transparent; }
.basis.observed { color: var(--ok); background: var(--ok-bg); } .basis.calculated { color: var(--accent-text); background: var(--accent-bg); } .basis.predicted { color: var(--code); background: var(--code-bg); } .basis.simulated { color: var(--warn); background: var(--warn-bg); }
.insight { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 14px; display: grid; gap: 8px; background: var(--surface); }
.insight .head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .insight .head h4 { font-size: 13.5px; font-weight: 700; margin: 0; }
.insight .meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 6px 14px; font-size: 12px; } .insight .meta .k { color: var(--muted); font-size: 11px; display: block; }
.insight .links { display: flex; gap: 10px; flex-wrap: wrap; }
.prio { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11px; font-weight: 700; } .prio.P1 { color: var(--crit); background: var(--crit-bg); } .prio.P2 { color: var(--warn); background: var(--warn-bg); } .prio.P3 { color: var(--text-2); background: var(--surface-3); }
.score { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; } .score small { font-size: 12px; color: var(--muted); font-weight: 500; }
.demo-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); border: 1px solid #f0d3b4; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.demo-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } @media (max-width: 960px) { .cmp-grid { grid-template-columns: 1fr; } }
.steps { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.ai-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; } .ai-tabs a { padding: 10px 14px; font-size: 13px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; } .ai-tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; } .ai-tabs a:hover { text-decoration: none; color: var(--text); }
