/* DriveQ Portal · dark ink shell · extends app.css */
/* Layout: collapsible sidebar (with grouped submenus) + slim topbar + body.
   See THEME.md § 6 for surface rules; § 6.1 enforces dark form styling. */

body.portal-body { background: var(--ink); color: white; }

/* ─── THEME.md § 6.1 — Dark form rule (global override on ink surfaces) ─── */
body.portal-body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
body.portal-body select,
body.portal-body textarea,
body.portal-body .input {
  background: oklch(0.22 0.008 250);
  color: white;
  border: 1px solid oklch(0.28 0.008 250);
  color-scheme: dark;          /* native pickers + scrollbars use dark UA chrome */
}
body.portal-body input::placeholder,
body.portal-body textarea::placeholder { color: rgba(255,255,255,0.45); }
body.portal-body input:focus,
body.portal-body select:focus,
body.portal-body textarea:focus,
body.portal-body .input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  border-color: var(--gold);
}
body.portal-body input:disabled,
body.portal-body select:disabled,
body.portal-body textarea:disabled {
  background: oklch(0.18 0.008 250);
  color: rgba(255,255,255,0.40);
  cursor: not-allowed;
}
body.portal-body input[type="checkbox"],
body.portal-body input[type="radio"] {
  accent-color: var(--gold);
}
body.portal-body input[type="file"]::file-selector-button {
  background: oklch(0.28 0.008 250);
  color: white;
  border: 0;
  padding: 6px 12px; margin-right: 10px;
  border-radius: var(--r-2);
  cursor: pointer;
}
body.portal-body input[type="file"]::file-selector-button:hover {
  background: oklch(0.34 0.008 250);
}

.portal-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  transition: grid-template-columns 200ms ease;
}
.portal-page.rail-collapsed,
html.rail-collapsed .portal-page { grid-template-columns: 64px 1fr; }

/* ─── Sidebar rail ────────────────────────────────────────────────────── */
.portal-rail {
  position: sticky; top: 0; z-index: 40;
  align-self: start;
  height: 100vh;
  background: oklch(0.11 0.008 250);
  border-right: 1px solid oklch(0.22 0.008 250);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.portal-rail-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid oklch(0.22 0.008 250);
  min-height: 64px;
}
.portal-rail-brand .dq-wm  { font-size: 19px; }
.portal-rail-brand .pill   { font-size: 9.5px; letter-spacing: 0.1em; padding: 2px 7px; }
.rail-collapsed .portal-rail-brand,
html.rail-collapsed .portal-rail-brand { padding: 18px 0 !important; justify-content: center !important; }
.rail-collapsed .portal-rail-brand .dq-wm-text,
.rail-collapsed .portal-rail-brand .pill,
.rail-collapsed .portal-rail-brand .portal-env-badge { display: none !important; }

/* Sidebar toggle lives in the topbar (.portal-hamburger). */

/* Nav list */
.portal-rail-nav {
  flex: 1; overflow-y: auto;
  padding: 14px 10px;
  scrollbar-width: thin;
  scrollbar-color: oklch(0.28 0.008 250) transparent;
}
.portal-rail-section {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.12em;
  color: rgba(255,255,255,0.4); text-transform: uppercase;
  padding: 14px 12px 6px;
}
/* Collapsed: hide section headers entirely (truncated "OPERATI" looks like a bug).
   Keep a tiny dividing line above each group instead. */
.rail-collapsed .portal-rail-section { display: none !important; }
.rail-collapsed .portal-rail-section + .portal-rail-item { border-top: 1px solid oklch(0.22 0.008 250); margin-top: 8px; padding-top: 14px; }
.rail-collapsed .portal-rail-section:first-of-type + .portal-rail-item { border-top: 0; margin-top: 0; padding-top: 10px; }

.portal-rail-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-3);
  color: rgba(255,255,255,0.68); font-size: 13.5px; font-weight: 500;
  text-decoration: none; cursor: pointer; background: transparent; border: 0; width: 100%; text-align: left;
  transition: background 120ms, color 120ms;
}
.portal-rail-item:hover  { background: oklch(0.18 0.008 250); color: white; }
.portal-rail-item.active { background: color-mix(in oklch, var(--gold) 16%, oklch(0.20 0.008 250)); color: white; }
.portal-rail-item.active svg { color: var(--gold); }
.portal-rail-item.soon   { opacity: 0.45; cursor: not-allowed; }
.portal-rail-item .label { flex: 1; min-width: 0; }
.portal-rail-item .chev  { width: 12px; height: 12px; transition: transform 160ms; flex-shrink: 0; }
.portal-rail-item[aria-expanded="true"] .chev { transform: rotate(90deg); }

.rail-collapsed .portal-rail-item { justify-content: center !important; padding: 10px 0 !important; }
.rail-collapsed .portal-rail-item .label,
.rail-collapsed .portal-rail-item .chev,
.rail-collapsed .portal-rail-item .rail-soon-tag { display: none !important; }
.rail-collapsed .portal-rail-item.active { border-left: 0 !important; border-radius: var(--r-3) !important; padding-left: 0 !important; }

/* Sub-items (only render when section is open AND rail is expanded) */
.portal-rail-sub {
  display: flex; flex-direction: column; gap: 1px;
  padding: 2px 0 6px 30px;
}
.portal-rail-subitem {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 12px; border-radius: var(--r-2);
  color: rgba(255,255,255,0.56); font-size: 12.5px;
  text-decoration: none;
  transition: background 120ms, color 120ms;
}
.portal-rail-subitem:hover    { background: oklch(0.18 0.008 250); color: white; }
.portal-rail-subitem.on       { background: var(--gold-100); color: var(--gold-deep); font-weight: 500; }
.portal-rail-subitem.cta      { color: var(--gold); border-top: 1px dashed oklch(0.22 0.008 250); margin-top: 4px; padding-top: 8px; }
.portal-rail-subitem .badge   {
  font-family: var(--f-mono); font-size: 10.5px;
  padding: 1px 7px; border-radius: 999px;
  background: oklch(0.28 0.008 250); color: rgba(255,255,255,0.85);
}
.portal-rail-subitem.on .badge { background: oklch(0.85 0.08 84); color: var(--gold-deep); }

.rail-collapsed .portal-rail-sub { display: none !important; }

/* Fallback if Alpine fails or initial paint is slow: show the rail-sub
   block that follows an active rail-item (server-rendered active state).
   The `:not(.rail-collapsed *)` exclusion keeps the collapsed rail icon-only. */
:not(.rail-collapsed) > .portal-rail-item.active + .portal-rail-sub,
.portal-page:not(.rail-collapsed) .portal-rail-item.active + .portal-rail-sub { display: flex !important; }
.rail-collapsed .portal-rail-item.active + .portal-rail-sub { display: none !important; }

/* Rail footer (collapsed signed-in pill) */
.portal-rail-foot {
  border-top: 1px solid oklch(0.22 0.008 250);
  padding: 12px 14px;
}
.portal-rail-foot .mono { font-size: 10px; color: rgba(255,255,255,0.5); letter-spacing: 0.08em; }
.portal-rail-foot .who  { margin-top: 4px; color: white; font-size: 12.5px; font-weight: 500; }
.portal-rail-foot .sub  { margin-top: 2px; color: rgba(255,255,255,0.55); font-size: 11px; }
.rail-collapsed .portal-rail-foot { padding: 12px 0; text-align: center; }
.rail-collapsed .portal-rail-foot .mono,
.rail-collapsed .portal-rail-foot .who,
.rail-collapsed .portal-rail-foot .sub { display: none; }
.rail-collapsed .portal-rail-foot::before {
  content: attr(data-initial);
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 999px;
  background: var(--gold-deep); color: white;
  font-family: var(--f-display); font-size: 14px;
}

/* Right column wrapper */
.portal-main-col { min-width: 0; display: flex; flex-direction: column; }

/* ─── Top bar (slim) ──────────────────────────────────────────────────── */
.portal-topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 32px;
  background: var(--ink);
  border-bottom: 1px solid oklch(0.22 0.008 250);
  backdrop-filter: saturate(180%) blur(8px);
}
.portal-hamburger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid oklch(0.22 0.008 250);
  border-radius: 8px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.portal-hamburger:hover { background: oklch(0.18 0.008 250); color: white; border-color: oklch(0.30 0.008 250); }
.portal-hamburger:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.portal-topbar-tags {
  display: inline-flex; align-items: center; gap: 6px;
}

.portal-crumb {
  font-family: var(--f-display); font-size: 18px; letter-spacing: -0.01em;
  color: white;
}
.portal-crumb-eyebrow {
  font-family: var(--f-mono); font-size: 10.5px; color: var(--gold);
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 2px;
}

.portal-env-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: var(--r-2);
  background: oklch(0.30 0.10 25); color: white;
  border: 1px solid oklch(0.45 0.12 25);
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.08em;
}

.portal-topbar-spacer { flex: 1; }

.portal-topsearch {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: oklch(0.18 0.008 250);
  border: 1px solid oklch(0.22 0.008 250);
  border-radius: 8px;
  width: 320px; min-width: 0;
  color: rgba(255,255,255,0.5);
}
.portal-topsearch svg { flex-shrink: 0; }
.portal-topsearch input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0;
  color: white; font-family: var(--f-ui); font-size: 13px;
}
.portal-topsearch input::placeholder { color: rgba(255,255,255,0.45); }
.portal-topsearch kbd {
  font-family: var(--f-mono); font-size: 10px;
  padding: 2px 5px; border: 1px solid oklch(0.22 0.008 250); border-radius: 4px;
  color: rgba(255,255,255,0.5); background: transparent;
}

.portal-iconbtn {
  position: relative;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: oklch(0.18 0.008 250);
  border: 1px solid oklch(0.22 0.008 250);
  border-radius: 8px;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.portal-iconbtn:hover { background: oklch(0.22 0.008 250); color: white; }
.portal-iconbtn-dot {
  position: absolute; top: 8px; right: 8px;
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--gold);
}

/* ─── User menu ───────────────────────────────────────────────────────── */
.portal-userwrap { position: relative; }
.portal-usermenu {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 12px 4px 4px;
  background: oklch(0.18 0.008 250);
  border: 1px solid oklch(0.22 0.008 250);
  border-radius: 999px;
  color: white; font-family: var(--f-ui); font-size: 12.5px;
  cursor: pointer;
  transition: background 120ms;
}
.portal-usermenu:hover { background: oklch(0.22 0.008 250); }
.portal-avatar {
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--gold-deep); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--f-display); font-size: 14px;
}
.portal-username { font-weight: 500; }

.portal-menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 240px;
  background: oklch(0.16 0.008 250);
  border: 1px solid oklch(0.24 0.008 250);
  border-radius: var(--r-4);
  box-shadow: 0 14px 40px rgba(0,0,0,0.5);
  padding: 6px;
}
.portal-menu-header {
  padding: 12px 14px 14px;
  border-bottom: 1px solid oklch(0.22 0.008 250);
  margin-bottom: 6px;
}
.portal-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 9px 12px; border-radius: var(--r-3);
  color: rgba(255,255,255,0.85); font-size: 13px; font-family: var(--f-ui);
  text-decoration: none; background: transparent; border: 0; cursor: pointer;
  text-align: left;
}
.portal-menu-item:hover { background: oklch(0.22 0.008 250); color: white; }
.portal-menu-item.portal-menu-danger { color: var(--red); }
.portal-menu-item.portal-menu-danger:hover { background: oklch(0.30 0.08 25 / 0.4); color: white; }
.portal-menu-sep { height: 1px; background: oklch(0.22 0.008 250); margin: 6px 0; }
.rail-soon-tag {
  font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.08em;
  padding: 1px 5px; border-radius: 3px;
  background: oklch(0.30 0.08 84); color: white;
}

/* ─── Sub-nav (contextual chips strip) ────────────────────────────────── */
.portal-subnav {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 40px;
  background: oklch(0.15 0.008 250);
  border-bottom: 1px solid oklch(0.22 0.008 250);
  flex-wrap: wrap;
}
.portal-subnav-eyebrow {
  font-family: var(--f-mono); font-size: 11px; color: var(--gold);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.portal-subnav-chips {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.portal-subnav-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: oklch(0.20 0.008 250);
  border: 1px solid oklch(0.26 0.008 250);
  border-radius: 999px;
  font-size: 12.5px; color: rgba(255,255,255,0.75);
  text-decoration: none;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.portal-subnav-chip:hover { background: oklch(0.24 0.008 250); color: white; }
.portal-subnav-chip.on {
  background: var(--gold-100); color: var(--gold-deep);
  border-color: var(--gold);
}
.portal-subnav-badge {
  font-family: var(--f-mono); font-size: 10.5px;
  padding: 0 6px; border-radius: 999px;
  background: oklch(0.28 0.008 250); color: rgba(255,255,255,0.85);
}
.portal-subnav-chip.on .portal-subnav-badge {
  background: oklch(0.85 0.08 84); color: var(--gold-deep);
}

/* ─── Main column ─────────────────────────────────────────────────────── */
.portal-main { padding: 32px 40px; }

.portal-page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 28px; flex-wrap: wrap; gap: 16px;
}
.portal-page-head .eyebrow { color: var(--gold); }
.portal-page-head h1 { font-family: var(--f-display); font-size: 40px; letter-spacing: -0.015em; margin: 8px 0 0; color: white; }
.portal-page-head p  { color: rgba(255,255,255,0.65); font-size: 14px; max-width: 560px; }

/* KPI tiles */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi {
  background: oklch(0.18 0.008 250);
  border: 1px solid oklch(0.22 0.008 250);
  border-radius: var(--r-4); padding: 20px;
}
.kpi .label { font-family: var(--f-mono); font-size: 11px; color: rgba(255,255,255,0.5); letter-spacing: 0.08em; text-transform: uppercase; }
.kpi .value { font-family: var(--f-display); font-size: 36px; letter-spacing: -0.02em; margin-top: 8px; color: white; }
.kpi .delta { margin-top: 6px; font-family: var(--f-mono); font-size: 12px; color: var(--green); }
.kpi.warn .delta { color: var(--amber); }
.kpi.danger .delta { color: var(--red); }

/* Data table */
.portal-table {
  width: 100%; border-collapse: collapse;
  background: oklch(0.18 0.008 250);
  border: 1px solid oklch(0.22 0.008 250);
  border-radius: var(--r-4); overflow: hidden;
  font-size: 13.5px;
}
.portal-table thead th {
  text-align: left; padding: 12px 16px;
  background: oklch(0.16 0.008 250);
  color: rgba(255,255,255,0.55);
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  border-bottom: 1px solid oklch(0.22 0.008 250);
}
.portal-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid oklch(0.22 0.008 250);
  color: white;
}
.portal-table tbody tr:last-child td { border-bottom: 0; }
.portal-table tbody tr:hover { background: oklch(0.22 0.008 250); }
.portal-table .tabular { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

/* Card override for ink surface */
.portal-card {
  background: oklch(0.18 0.008 250);
  border: 1px solid oklch(0.22 0.008 250);
  border-radius: var(--r-4); padding: 24px; color: white;
}
.portal-card .eyebrow { color: var(--gold); }

@media (max-width: 1024px) {
  /* Auto-collapse the rail on tablet */
  .portal-page { grid-template-columns: 64px 1fr; }
  .portal-page .portal-rail { width: 64px; }
  .portal-page .portal-rail-brand { padding: 18px 0; justify-content: center; }
  .portal-page .portal-rail-brand .dq-wm-text,
  .portal-page .portal-rail-brand .pill,
  .portal-page .portal-rail-brand .portal-env-badge { display: none; }
  .portal-page .portal-rail-item { justify-content: center; padding: 10px 0; }
  .portal-page .portal-rail-item .label,
  .portal-page .portal-rail-item .chev,
  .portal-page .portal-rail-item .rail-soon-tag { display: none; }
  .portal-page .portal-rail-sub { display: none; }
  .portal-page .portal-rail-section { padding: 14px 4px 6px; text-align: center; font-size: 9px; }
  .portal-page .portal-rail-foot .mono,
  .portal-page .portal-rail-foot .who,
  .portal-page .portal-rail-foot .sub { display: none; }
  .portal-page .portal-rail-foot { padding: 12px 0; text-align: center; }

  .portal-topbar { padding: 12px 20px; }
  .portal-topsearch { width: 220px; }
  .portal-main { padding: 24px 20px; }
  .portal-page-head h1 { font-size: 28px !important; }
  .portal-main > div[style*="grid-template-columns: 2fr 1fr"],
  .portal-main > div[style*="grid-template-columns: 1fr 2fr"] {
    grid-template-columns: 1fr !important;
  }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .portal-table { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 640px) {
  .portal-topsearch    { display: none; }
  .portal-username     { display: none; }
  .portal-topbar-tags  { display: none; }
  .portal-crumb        { font-size: 16px; }
}

@media (max-width: 480px) {
  .portal-topbar { padding: 10px 14px; }
  .portal-main { padding: 20px 14px; }
  .portal-page-head h1 { font-size: 24px !important; }
  .portal-page-head p { font-size: 13px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi { padding: 16px; }
  .kpi .value { font-size: 28px; }
  .portal-card { padding: 18px; }
}

/* ============================================================
   DASHBOARD · analytics, charts, quick links, alerts
   ============================================================ */

.kpi .value { font-size: 30px; }

/* KPI grouping — two semantic sections with eyebrow + link */
.kpi-section { margin-bottom: 24px; }
.kpi-section-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.kpi-grid { gap: 16px; }
.kpi { padding: 18px 20px; transition: border-color 120ms, transform 120ms; }
.kpi-link {
  text-decoration: none; color: inherit; display: block;
}
.kpi-link:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}
.kpi.warn   { border-color: oklch(0.45 0.10 84 / 0.5); }
.kpi.danger { border-color: oklch(0.50 0.12 25 / 0.5); }

/* Chart head right cluster */
.chart-head-right {
  display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap;
}

/* Quick links strip */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.quick-link {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: oklch(0.18 0.008 250);
  border: 1px solid oklch(0.22 0.008 250);
  border-radius: var(--r-4);
  color: white; text-decoration: none;
  transition: background 120ms, border-color 120ms, transform 120ms;
}
.quick-link:hover {
  background: oklch(0.22 0.008 250);
  border-color: var(--gold);
  transform: translateY(-1px);
}
.quick-link svg { flex-shrink: 0; color: var(--gold); }
.quick-link .ql-label { font-size: 13.5px; font-weight: 500; color: white; }
.quick-link .ql-sub   { font-family: var(--f-mono); font-size: 10.5px; color: rgba(255,255,255,0.55); letter-spacing: 0.06em; margin-top: 2px; }

/* Grid helpers */
.dash-grid-2     { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dash-grid-2-1   { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.dash-grid-2-3   { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.dash-grid-3     { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
@media (max-width: 1180px) {
  .dash-grid-2, .dash-grid-2-1, .dash-grid-2-3, .dash-grid-3 { grid-template-columns: 1fr; }
}

/* Chart card */
.chart-card { display: flex; flex-direction: column; }
.chart-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.chart-title { font-family: var(--f-display); font-size: 22px; color: white; letter-spacing: -0.01em; margin-top: 4px; }
.chart-sub   { font-family: var(--f-ui); font-size: 12px; color: rgba(255,255,255,0.55); font-weight: 400; margin-left: 6px; }
.chart-legend {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.06em;
  color: rgba(255,255,255,0.6); text-transform: uppercase;
}
.chart-legend .dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.card-link {
  font-family: var(--f-mono); font-size: 11px; color: var(--gold);
  letter-spacing: 0.06em; text-decoration: none; padding-top: 6px;
}
.card-link:hover { text-decoration: underline; }

/* SVG area chart */
.chart-area { display: block; width: 100%; height: 140px; }
.chart-xaxis {
  display: grid; grid-template-columns: repeat(14, 1fr);
  font-family: var(--f-mono); font-size: 9.5px; color: rgba(255,255,255,0.4);
  margin-top: 6px; text-align: center; letter-spacing: 0.04em;
}

/* Bar chart (CSS, no SVG) */
.bar-chart {
  display: grid; grid-template-columns: repeat(14, 1fr);
  align-items: end; gap: 4px;
  height: 160px; padding: 6px 0 0;
  border-bottom: 1px dashed oklch(0.24 0.008 250);
}
.bar-col {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  height: 100%; gap: 6px;
}
.bar-fill {
  width: 100%; max-width: 22px;
  background: linear-gradient(180deg, #5fb1ff, #2f7fd9);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: filter 120ms;
}
.bar-col:hover .bar-fill { filter: brightness(1.25); }
.bar-label {
  font-family: var(--f-mono); font-size: 9.5px; color: rgba(255,255,255,0.45);
}

/* Pipeline horizontal bars */
.pipeline { display: flex; flex-direction: column; gap: 10px; }
.pipeline-row {
  display: grid; grid-template-columns: 150px 1fr 40px; align-items: center; gap: 12px;
}
.pipeline-label { font-size: 12.5px; color: rgba(255,255,255,0.8); }
.pipeline-track {
  height: 10px; background: oklch(0.14 0.008 250);
  border-radius: 999px; overflow: hidden;
}
.pipeline-fill { height: 100%; border-radius: 999px; transition: width 240ms; }
.pipeline-count { font-size: 12.5px; color: white; text-align: right; }

/* Donut + legend */
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut { flex-shrink: 0; }
.donut-legend {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 180px;
}
.donut-legend li {
  display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 10px;
  font-size: 12.5px;
}
.donut-legend .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.donut-legend .lg-label { color: rgba(255,255,255,0.8); text-transform: capitalize; }
.donut-legend .lg-val { font-family: var(--f-mono); color: white; font-size: 11.5px; }
.donut-legend .muted { color: rgba(255,255,255,0.45); }

/* Alerts list */
.alert-list { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 10px; }
.alert {
  display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 10px;
  padding: 12px 14px;
  background: oklch(0.22 0.008 250);
  border-radius: var(--r-3);
  border-left: 3px solid var(--gold);
}
.alert .mono { grid-column: 1; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.08em; }
.alert .alert-body { grid-column: 1; margin-top: 3px; font-size: 13px; color: rgba(255,255,255,0.92); }
.alert .alert-cta  {
  grid-column: 2; grid-row: 1 / span 2;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.04em;
  color: var(--gold); text-decoration: none; white-space: nowrap;
}
.alert .alert-cta:hover { text-decoration: underline; }
.alert.red    { border-left-color: var(--red); }
.alert.red    .mono { color: var(--red); }
.alert.amber  { border-left-color: var(--amber); }
.alert.amber  .mono { color: var(--amber); }
.alert.gold   { border-left-color: var(--gold); }
.alert.gold   .mono { color: var(--gold); }
.alert.green  { border-left-color: var(--green); }
.alert.green  .mono { color: var(--green); }

/* Payment health mini-block */
.pay-health {
  margin-top: 20px; padding-top: 18px;
  border-top: 1px dashed oklch(0.24 0.008 250);
}
.ph-head { display: flex; justify-content: space-between; align-items: baseline; }
.ph-success { font-family: var(--f-mono); font-size: 13px; color: var(--green); }
.ph-bar {
  display: flex; height: 8px; border-radius: 999px; overflow: hidden;
  background: oklch(0.14 0.008 250); margin-top: 10px;
}
.ph-bar span { display: block; height: 100%; }
.ph-legend {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-top: 8px;
  font-family: var(--f-mono); font-size: 10.5px; color: rgba(255,255,255,0.6); letter-spacing: 0.04em;
}
.ph-legend b { color: white; font-weight: 500; margin-right: 2px; }
.ph-volume { margin-top: 8px; font-size: 10.5px; color: rgba(255,255,255,0.5); letter-spacing: 0.08em; }

/* Leaderboards (top makes / top dealers) */
.leader-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 14px; }
.leader-empty { color: rgba(255,255,255,0.5); font-size: 12.5px; padding: 8px 0; }
.leader-row { display: flex; flex-direction: column; gap: 4px; }
.leader-top { display: flex; justify-content: space-between; align-items: center; }
.leader-name { font-size: 13.5px; color: white; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.leader-name:hover { color: var(--gold); }
.leader-val { font-size: 13px; color: white; }
.leader-bar { height: 6px; background: oklch(0.14 0.008 250); border-radius: 999px; overflow: hidden; }
.leader-bar > div { height: 100%; border-radius: 999px; transition: width 240ms; }
.leader-sub { font-size: 10.5px; color: rgba(255,255,255,0.5); letter-spacing: 0.06em; }
.tier-chip {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase;
  background: oklch(0.28 0.008 250); color: rgba(255,255,255,0.8);
}
.tier-chip.tier-elite    { background: var(--gold-100); color: var(--gold-deep); }
.tier-chip.tier-standard { background: oklch(0.30 0.05 220 / 0.45); color: #9ec9ff; }

/* Activity feed */
.activity-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 12px; }
.activity-row { display: grid; grid-template-columns: 12px 1fr; gap: 10px; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 999px; margin-top: 6px;
  box-shadow: 0 0 0 3px oklch(0.18 0.008 250);
}
.activity-line { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.activity-line .mono { font-family: var(--f-mono); font-size: 11.5px; color: white; letter-spacing: 0.03em; }
.activity-actor { font-size: 11.5px; color: rgba(255,255,255,0.55); }
.activity-meta {
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  margin-top: 2px; font-size: 11px; color: rgba(255,255,255,0.6);
}
.activity-meta .muted { color: rgba(255,255,255,0.4); font-family: var(--f-mono); }

@media (max-width: 760px) {
  .pipeline-row { grid-template-columns: 110px 1fr 40px; }
  .bar-chart, .chart-xaxis { grid-template-columns: repeat(14, 1fr); }
}

/* ============================================================
   VEHICLE DETAIL · hero, specs, gallery, cost-list
   ============================================================ */

.portal-table tbody tr.row-link:hover { background: oklch(0.24 0.008 250); }

.vd-hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px;
}
.vd-cover {
  background: oklch(0.14 0.008 250);
  border: 1px solid oklch(0.22 0.008 250);
  border-radius: var(--r-4);
  overflow: hidden; min-height: 320px;
  display: flex; align-items: center; justify-content: center;
}
.vd-cover img {
  width: 100%; height: 100%; min-height: 320px;
  object-fit: cover; display: block;
}
.vd-cover-placeholder {
  font-family: var(--f-mono); color: rgba(255,255,255,0.45);
  font-size: 12px; letter-spacing: 0.08em;
}
.vd-hero-side { display: flex; flex-direction: column; gap: 12px; }
.vd-countdown {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 18px;
  background: oklch(0.18 0.008 250);
  border: 1px solid oklch(0.22 0.008 250);
  border-left-width: 3px;
  border-radius: var(--r-4);
}
.vd-countdown .mono { font-size: 11px; letter-spacing: 0.1em; }
.vd-countdown-value {
  font-family: var(--f-display); font-size: 34px; letter-spacing: -0.01em;
  margin-top: 6px;
}
@media (max-width: 1024px) {
  .vd-hero { grid-template-columns: 1fr; }
  .vd-cover, .vd-cover img { min-height: 220px; }
}

.vd-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; }
.vd-col  { display: grid; gap: 20px; align-content: start; }
@media (max-width: 1024px) {
  .vd-grid { grid-template-columns: 1fr; }
}

/* Spec definition grid */
.spec-grid {
  margin-top: 14px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 20px;
}
.spec-grid .caption {
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.06em;
  color: rgba(255,255,255,0.5); text-transform: uppercase; margin-bottom: 3px;
}
.spec-grid > div > div + div { color: white; font-size: 13.5px; }
@media (max-width: 760px) {
  .spec-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Gallery */
.vd-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px;
}
.vd-gallery-item {
  display: block; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--r-3);
  border: 1px solid oklch(0.22 0.008 250);
}
.vd-gallery-item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 200ms;
}
.vd-gallery-item:hover img { transform: scale(1.05); }

/* Cost / definition list */
.cost-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.cost-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-size: 13.5px; color: rgba(255,255,255,0.85);
}
.cost-list li > span:first-child {
  color: rgba(255,255,255,0.6);
  font-family: var(--f-ui); font-size: 12.5px;
}
.cost-list li.cost-total {
  padding-top: 10px; margin-top: 4px;
  border-top: 1px dashed oklch(0.24 0.008 250);
  font-weight: 500;
}
.cost-list li.cost-total > span:first-child { color: white; }
