/* ============================================================
   Parvi Multi-Tenant Dashboard — styles.css
   Design system: DM Sans + Space Grotesk + Space Mono
   Two themes: dark (default) + light, via [data-theme]
   Per-product accent via [data-product="..."]
   ============================================================ */

/* ---------- THEME TOKENS ---------- */
:root {
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --mono: "Space Mono", ui-monospace, SFMono-Regular, monospace;
  --sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --display: "Space Grotesk", "DM Sans", system-ui, sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  --sidebar-w: 264px;
  --topbar-h: 64px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 180ms;

  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
}

/* DARK (default) */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E1520;
  --bg-elev: #121C2D;
  --surface: #14202F;
  --surface-2: #1A2738;
  --surface-hover: #1F2E42;
  --line: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.18);

  --text: #e8e8f0;
  --text-muted: #9a9ab0;
  --text-dim: #6a6a82;
  --text-on-accent: #0a1320;

  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.5);

  --grid-line: rgba(255, 255, 255, 0.05);
}

/* LIGHT */
[data-theme="light"] {
  color-scheme: light;
  --bg: #F6F8FB;
  --bg-elev: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F1F4F9;
  --surface-hover: #EAEEF5;
  --line: rgba(15, 23, 42, 0.08);
  --line-2: rgba(15, 23, 42, 0.14);
  --line-strong: rgba(15, 23, 42, 0.22);

  --text: #0E1520;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --text-on-accent: #ffffff;

  --shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.18);
  --shadow-sm: 0 2px 8px -2px rgba(15, 23, 42, 0.08);

  --grid-line: rgba(15, 23, 42, 0.06);
}

/* ---------- PRODUCT ACCENTS ---------- */
/* ParviGov = deep blue + gold (governance) */
[data-product="parvigov"] {
  --accent: #00D4C8;
  --accent-2: #00B8AD;
  --accent-soft: rgba(0, 212, 200, 0.12);
  --accent-line: rgba(0, 212, 200, 0.35);
  --accent-glow: rgba(0, 212, 200, 0.25);
  --grad-accent: linear-gradient(135deg, #00D4C8, #00B8AD);
}
/* ParviClaw = amber (execution) */
[data-product="parviclaw"] {
  --accent: #f59e0b;
  --accent-2: #d97706;
  --accent-soft: rgba(245, 158, 11, 0.12);
  --accent-line: rgba(245, 158, 11, 0.35);
  --accent-glow: rgba(245, 158, 11, 0.25);
  --grad-accent: linear-gradient(135deg, #f59e0b, #d97706);
}
/* ParviSight = violet (browser/perception) */
[data-product="parvisight"] {
  --accent: #8b5cf6;
  --accent-2: #7c3aed;
  --accent-soft: rgba(139, 92, 246, 0.12);
  --accent-line: rgba(139, 92, 246, 0.35);
  --accent-glow: rgba(139, 92, 246, 0.25);
  --grad-accent: linear-gradient(135deg, #8b5cf6, #7c3aed);
}
/* ParviData = rose (memory) */
[data-product="parvidata"] {
  --accent: #ec4899;
  --accent-2: #db2777;
  --accent-soft: rgba(236, 72, 153, 0.12);
  --accent-line: rgba(236, 72, 153, 0.35);
  --accent-glow: rgba(236, 72, 153, 0.25);
  --grad-accent: linear-gradient(135deg, #ec4899, #db2777);
}
/* Graph Files = teal-blue (documents) */
[data-product="graphfiles"] {
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --accent-line: rgba(56, 189, 248, 0.35);
  --accent-glow: rgba(56, 189, 248, 0.25);
  --grad-accent: linear-gradient(135deg, #38bdf8, #0ea5e9);
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul[role="list"], ol[role="list"] { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
svg { display: block; }

.sr-only, .skip-link {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link:focus {
  position: fixed; top: 12px; left: 12px; width: auto; height: auto;
  padding: 8px 14px; clip: auto; background: var(--accent); color: var(--text-on-accent);
  border-radius: var(--radius-xs); z-index: 200; font-weight: 600;
}

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* ---------- APP SHELL ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* Scrim is overlay-only — never occupies a grid cell on desktop */
.sidebar-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 45;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-4);
  gap: var(--space-5);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}

.brand {
  display: flex; align-items: baseline; gap: 6px;
  padding: 0 var(--space-2) var(--space-2);
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--space-4);
}
.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--grad-accent);
  color: var(--text-on-accent);
  border-radius: var(--radius-sm);
  align-self: center;
  margin-right: var(--space-2);
}
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.15rem; color: var(--text); }
.brand-suffix { font-size: 0.75rem; color: var(--text-dim); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }

.nav-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin: 0 0 var(--space-3);
  padding: 0 var(--space-2);
  font-weight: 600;
}

.products ul, .admin-nav ul { display: flex; flex-direction: column; gap: 2px; }

.product-btn {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "dot name" "dot sub";
  align-items: center;
  gap: 2px var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.product-btn .dot { grid-area: dot; align-self: center; width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.product-btn .product-name { grid-area: name; font-weight: 600; font-size: 0.9rem; color: var(--text); }
.product-btn .product-sub { grid-area: sub; font-size: 0.72rem; color: var(--text-dim); }
.product-btn:hover { background: var(--surface-hover); }
.product-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.product-btn.active .dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.product-btn.active .product-name { color: var(--accent); }

.admin-link {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.admin-link:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.admin-link .ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.sidebar-foot { margin-top: auto; }

.compliance-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
}
.compliance-head {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: 0.78rem; font-weight: 600; color: var(--text);
  margin-bottom: var(--space-3);
}
.compliance-head .ic { width: 16px; height: 16px; fill: none; stroke: var(--accent); stroke-width: 1.5; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 var(--space-2); }
.badge {
  font-family: var(--mono);
  font-size: 0.66rem;
  padding: 3px 7px;
  border-radius: var(--radius-xs);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  letter-spacing: 0.02em;
}
.compliance-note { font-size: 0.7rem; color: var(--text-dim); margin: 0; }

/* ---------- MAIN COLUMN ---------- */
.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* ---------- TOPBAR ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
}
.menu-btn { display: none; }
.topbar-title { display: flex; flex-direction: column; min-width: 0; }
.product-title { font-size: 1.1rem; font-weight: 600; line-height: 1.2; }
.crumb { font-size: 0.75rem; color: var(--text-dim); font-family: var(--mono); }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  position: relative;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--line-2); }

/* Theme toggle icon swap */
.theme-toggle .ic-moon { display: none; }
.theme-toggle .ic-sun { display: block; }
[data-theme="light"] .theme-toggle .ic-sun { display: none; }
[data-theme="light"] .theme-toggle .ic-moon { display: block; }

/* Tenant selector */
.tenant-select { position: relative; }
.tenant-select select {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--line-2);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 32px 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.tenant-select select:hover { border-color: var(--line-strong); }
.tenant-select .caret {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; fill: none; stroke: var(--text-dim); stroke-width: 1.5;
  pointer-events: none;
}

/* Language switch */
.lang-switch {
  display: flex; gap: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.lang-switch button {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 0.7rem; font-weight: 600;
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  text-transform: uppercase; letter-spacing: 0.04em;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.lang-switch button.active { background: var(--accent); color: var(--text-on-accent); }
.lang-switch button:hover:not(.active) { color: var(--text); }

/* Notifications */
.notif-pip {
  position: absolute; top: -4px; right: -4px;
  background: var(--accent); color: var(--text-on-accent);
  font-size: 0.62rem; font-weight: 700;
  min-width: 16px; height: 16px;
  display: grid; place-items: center;
  border-radius: 8px; padding: 0 4px;
  border: 2px solid var(--bg);
}

/* Profile */
.profile {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 4px var(--space-2) 4px 4px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.profile:hover { background: var(--surface-hover); border-color: var(--line-2); }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--grad-accent);
  color: var(--text-on-accent);
  display: grid; place-items: center;
  font-size: 0.74rem; font-weight: 700;
  font-family: var(--display);
}
.profile-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.profile-name { font-size: 0.82rem; font-weight: 600; }
.profile-role { font-size: 0.68rem; color: var(--text-dim); }

/* ---------- MAIN CONTENT ---------- */
.main {
  flex: 1;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  outline: none;
}

/* Product strip */
.product-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  padding: var(--space-5) var(--space-6);
}
.strip-title { font-size: 1.15rem; margin-bottom: 4px; }
.strip-desc { color: var(--text-muted); font-size: 0.9rem; margin: 0; max-width: 60ch; }
.strip-actions { display: flex; gap: var(--space-2); flex-shrink: 0; }

/* Buttons */
.btn {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad-accent); color: var(--text-on-accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--line-strong); }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }

/* ---------- KPI GRID ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  position: relative;
  overflow: hidden;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.kpi-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.kpi-head { display: flex; align-items: center; gap: var(--space-2); }
.kpi-icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius-sm);
}
.kpi-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.kpi-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
.kpi-value { font-family: var(--display); font-size: 1.85rem; font-weight: 700; line-height: 1.1; margin: 0; }
.kpi-value .unit { font-size: 0.95rem; color: var(--text-muted); margin-left: 2px; }
.kpi-delta { font-size: 0.78rem; margin: 0; font-weight: 600; }
.kpi-delta.up { color: var(--ok); }
.kpi-delta.down { color: var(--ok); }
.kpi-delta.up.bad, .kpi-delta.down.bad { color: var(--bad); }
.kpi-delta span { color: var(--text-dim); font-weight: 400; }
.spark { position: absolute; bottom: 0; left: 0; right: 0; height: 32px; opacity: 0.6; }
.spark svg { width: 100%; height: 100%; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- CONTENT GRID (chart + fleet) ---------- */
.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-4);
}
.lower-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-4);
}

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.panel-title { font-size: 1rem; }
.panel-sub { font-size: 0.78rem; color: var(--text-dim); margin: 2px 0 0; }

/* Segmented control */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 2px; }
.seg-btn { background: none; border: none; color: var(--text-muted); font-size: 0.76rem; font-weight: 600; padding: 5px 10px; border-radius: var(--radius-xs); transition: all var(--dur) var(--ease); }
.seg-btn.active { background: var(--accent); color: var(--text-on-accent); }
.seg-btn:hover:not(.active) { color: var(--text); }

/* Chips */
.chip { font-size: 0.72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; font-family: var(--mono); }
.chip.ok { background: rgba(16,185,129,0.14); color: var(--ok); }
.chip.warn { background: rgba(245,158,11,0.14); color: var(--warn); }
.chip.score { background: var(--accent-soft); color: var(--accent); }

/* Chart */
.chart-wrap { display: flex; flex-direction: column; gap: var(--space-3); }
.chart { width: 100%; height: 240px; }
.grid line { stroke: var(--grid-line); stroke-width: 1; }
.chart-area { fill: url(#areaGrad); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-legend { display: flex; gap: var(--space-4); font-size: 0.76rem; color: var(--text-muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.legend-dot.dim { background: var(--text-dim); }

/* Fleet list */
.fleet-list { display: flex; flex-direction: column; gap: var(--space-3); }
.fleet-row { display: grid; grid-template-columns: 90px 1fr 80px; align-items: center; gap: var(--space-3); }
.fleet-name { font-size: 0.85rem; font-weight: 600; }
.fleet-bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.fleet-fill { display: block; height: 100%; width: var(--w); background: var(--grad-accent); border-radius: 3px; }
.fleet-state { font-size: 0.74rem; font-weight: 600; text-align: right; }
.fleet-state.ok { color: var(--ok); }
.fleet-state.warn { color: var(--warn); }
.fleet-state.bad { color: var(--bad); }

/* Activity feed */
.activity-panel { min-height: 320px; }
.feed { display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0; list-style: none; }
.feed-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
}
.feed-row:last-child { border-bottom: none; }
.feed-icon {
  width: 28px; height: 28px;
  border-radius: var(--radius-xs);
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}
.feed-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.feed-icon.veto { background: rgba(239,68,68,0.14); color: var(--bad); }
.feed-icon.ok { background: rgba(16,185,129,0.14); color: var(--ok); }
.feed-body { min-width: 0; }
.feed-title { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.feed-meta { font-size: 0.74rem; color: var(--text-dim); font-family: var(--mono); }
.feed-hash { font-family: var(--mono); font-size: 0.7rem; color: var(--text-dim); background: var(--surface-2); padding: 2px 6px; border-radius: var(--radius-xs); }

/* Quality gauge */
.quality-panel { justify-content: space-between; }
.quality-body { display: flex; flex-direction: column; gap: var(--space-4); }
.gauge { position: relative; width: 100%; max-width: 200px; margin: 0 auto; }
.gauge svg { width: 100%; height: auto; }
.gauge-track { fill: none; stroke: var(--surface-2); stroke-width: 10; stroke-linecap: round; }
.gauge-fill { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 600ms var(--ease); }
.gauge-label { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); text-align: center; }
.gauge-value { font-family: var(--display); font-size: 1.8rem; font-weight: 700; display: block; line-height: 1; }
.gauge-max { font-size: 0.75rem; color: var(--text-dim); }
.quality-breakdown { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.quality-breakdown li { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--text-muted); }
.quality-breakdown strong { color: var(--text); font-family: var(--mono); }
.quality-note { font-size: 0.74rem; color: var(--text-dim); margin: 0; padding-top: var(--space-3); border-top: 1px solid var(--line); }

/* Footer */
.foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-5) 0 0;
  margin-top: var(--space-2);
  border-top: 1px solid var(--line);
  font-size: 0.76rem; color: var(--text-dim);
}
.foot-meta { font-family: var(--mono); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid, .lower-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  :root { --sidebar-w: 0px; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease);
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none;
    transition: opacity var(--dur) var(--ease);
    z-index: 45;
  }
  .sidebar-scrim.open { opacity: 1; pointer-events: auto; }
  .menu-btn { display: grid; }
  .topbar { padding: 0 var(--space-4); gap: var(--space-2); }
  .profile-meta { display: none; }
  .tenant-select select { font-size: 0.78rem; padding: 6px 26px 6px 10px; }
  .main { padding: var(--space-4); gap: var(--space-4); }
  .product-strip { flex-direction: column; align-items: flex-start; }
  .strip-actions { width: 100%; }
  .strip-actions .btn { flex: 1; }
}

@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .lang-switch button { padding: 4px 6px; font-size: 0.64rem; }
  .lang-switch { padding: 2px; }
  .tenant-select { display: none; }
  .fleet-row { grid-template-columns: 80px 1fr; }
  .fleet-row .fleet-state { grid-column: 2; text-align: left; }
  .feed-row { grid-template-columns: auto 1fr; }
  .feed-hash { grid-column: 2; }
  .foot { flex-direction: column; gap: var(--space-2); align-items: flex-start; }
}

/* ---------- MOTION REDUCTION ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- HIGH CONTRAST ---------- */
@media (prefers-contrast: more) {
  :root { --line: rgba(255,255,255,0.2); --line-2: rgba(255,255,255,0.3); }
  [data-theme="light"] { --line: rgba(15,23,42,0.25); --line-2: rgba(15,23,42,0.35); }
}
