:root {
  --straye-navy: 210 55% 25%;
  --straye-blue: 210 45% 45%;
  --straye-light-blue: 210 50% 60%;

  --background: 0 0% 98%;
  --foreground: 210 55% 25%;
  --card: 0 0% 100%;
  --card-foreground: 210 55% 25%;
  --header-background: 0 0% 100%;

  --primary: 210 55% 25%;
  --primary-foreground: 0 0% 98%;
  --muted: 210 20% 96%;
  --muted-foreground: 210 25% 45%;
  --accent: 210 20% 94%;
  --accent-foreground: 210 55% 25%;
  --destructive: 0 84.2% 60.2%;
  --border: 210 25% 90%;
  --input: 210 20% 92%;
  --ring: 210 55% 25%;

  --chart-1: 210 55% 25%;
  --chart-2: 210 45% 45%;
  --chart-3: 142 71% 45%;
  --chart-4: 25 75% 55%;
  --chart-5: 195 50% 50%;

  --sidebar-background: 0 0% 100%;
  --sidebar-border: 210 25% 90%;

  --success: 142 71% 45%;
  --warning: 38 92% 50%;
  --info: 199 89% 48%;

  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;

  --font-sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-logo: "Exo 2", "Montserrat", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --row-h: 40px;
  --row-px: 14px;
  --card-pad: 20px;

  --grad-from: #3b82f6;
  --grad-to:   #4f46e5;
}

.dark {
  --background: 210 60% 8%;
  --foreground: 0 0% 98%;
  --card: 210 55% 12%;
  --card-foreground: 0 0% 98%;
  --header-background: 210 55% 12%;
  --primary: 210 50% 60%;
  --primary-foreground: 210 55% 10%;
  --muted: 210 40% 18%;
  --muted-foreground: 210 20% 70%;
  --accent: 210 45% 22%;
  --accent-foreground: 0 0% 98%;
  --border: 210 40% 20%;
  --input: 210 40% 18%;
  --ring: 210 50% 60%;
  --sidebar-background: 210 60% 10%;
  --sidebar-border: 210 45% 18%;
}

* { box-sizing: border-box; }

html { font-size: 90%; }

html, body {
  margin: 0; padding: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-sans);
  font-size: 0.875rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  overflow: hidden;
}
#root { height: 100vh; }

/* Shell */
.shell { display: grid; grid-template-columns: 248px 1fr; height: 100vh; }
.shell.collapsed { grid-template-columns: 64px 1fr; }
.sidebar {
  background: hsl(var(--sidebar-background));
  border-right: 1px solid hsl(var(--sidebar-border));
  display: flex; flex-direction: column; overflow: hidden;
  transition: width .3s ease-in-out;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid hsl(var(--sidebar-border));
}
.brand-tile {
  width: 36px; height: 36px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--grad-from), var(--grad-to));
  box-shadow: 0 4px 12px -2px hsl(var(--primary) / 0.35);
  display: grid; place-items: center; color: white;
  flex-shrink: 0; position: relative;
}
.brand-tile svg { width: 18px; height: 18px; }
.brand-wordmark {
  font-family: var(--font-logo); font-weight: 700;
  font-size: 18px; letter-spacing: 0.18em;
  color: hsl(var(--foreground)); line-height: 1;
}
.brand-sub {
  font-size: 10px; letter-spacing: 0.15em;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase; margin-top: 3px;
}
.nav-section { padding: 14px 12px 4px; }
.nav-section-title {
  font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: hsl(var(--muted-foreground));
  padding: 6px 8px; font-weight: 600;
}
.collapsed .nav-section-title,
.collapsed .brand-wordmark,
.collapsed .brand-sub { display: none; }

.nav-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px; border-radius: var(--radius-xl);
  cursor: pointer; color: hsl(var(--foreground));
  text-decoration: none; position: relative;
  transition: background 200ms;
}
.nav-item:hover { background: hsl(var(--accent)); }
.nav-item.active { background: hsl(var(--accent)); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute;
  left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 2px;
  background: linear-gradient(180deg, var(--grad-from), var(--grad-to));
}
.nav-icon {
  width: 28px; height: 28px; border-radius: var(--radius-lg);
  display: grid; place-items: center; color: white; flex-shrink: 0;
  background: linear-gradient(135deg, var(--g-from, #94a3b8), var(--g-to, #475569));
  box-shadow: 0 2px 6px -2px var(--g-from, #94a3b8);
}
.nav-icon svg { width: 14px; height: 14px; stroke-width: 2; }
.nav-label { font-size: 13px; flex: 1; }
.collapsed .nav-label { display: none; }
.nav-badge {
  font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 9999px;
  background: hsl(var(--muted)); color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
}
.collapsed .nav-badge { display: none; }

.sidebar-footer {
  margin-top: auto; padding: 12px;
  border-top: 1px solid hsl(var(--sidebar-border));
}
.user-tile { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-xl); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 9999px;
  background: linear-gradient(135deg, #a78bfa, #6366f1);
  color: white; font-weight: 600; font-size: 12px;
  display: grid; place-items: center; flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.collapsed .user-meta { display: none; }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: hsl(var(--muted-foreground)); }

/* Main */
.main { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  height: 56px; padding: 0 24px;
  background: hsl(var(--header-background));
  border-bottom: 1px solid hsl(var(--border));
  flex-shrink: 0;
}
.collapse-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card)); cursor: pointer;
  display: grid; place-items: center; color: hsl(var(--foreground));
}
.collapse-btn:hover { background: hsl(var(--accent)); }

.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; color: hsl(var(--muted-foreground)); }
.breadcrumbs .current { color: hsl(var(--foreground)); font-weight: 600; }
.crumb-link { cursor: pointer; border-radius: 4px; padding: 2px 6px; margin: 0 -4px; transition: background 120ms, color 120ms; }
.crumb-link:hover { background: hsl(var(--accent)); color: hsl(var(--primary)); }

.topbar-search {
  flex: 1; max-width: 520px;
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px;
  border-radius: var(--radius-xl);
  background: hsl(var(--muted));
  border: 1px solid transparent;
}
.topbar-search:focus-within { border-color: hsl(var(--ring)); background: hsl(var(--card)); }
.topbar-search input {
  flex: 1; background: transparent; border: 0; outline: 0;
  font-family: inherit; font-size: 13px; color: hsl(var(--foreground));
}
.topbar-search kbd, kbd {
  font-family: var(--font-mono); font-size: 10px;
  padding: 1px 6px; border-radius: 4px;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
}
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-xl);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card)); cursor: pointer;
  display: grid; place-items: center;
  color: hsl(var(--foreground)); position: relative;
}
.icon-btn:hover { background: hsl(var(--accent)); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 7px;
  width: 8px; height: 8px; border-radius: 9999px;
  background: hsl(var(--warning));
  box-shadow: 0 0 0 2px hsl(var(--card));
}
.topbar-agent-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 6px; margin-right: 4px;
  background: hsl(var(--muted)); border: 1px solid hsl(var(--border));
  border-radius: 999px; cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px; color: hsl(var(--primary)); font-weight: 500;
  transition: all 120ms;
}
.topbar-agent-btn:hover { background: hsl(var(--accent)); border-color: hsl(var(--primary) / 0.3); }
.agent-mini-icon {
  width: 20px; height: 20px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center; color: white;
  background: linear-gradient(135deg, var(--grad-from), var(--grad-to));
}

.view-scroll { flex: 1; overflow: auto; padding: 24px; }

/* Page head */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.page-head .subtitle { font-size: 13px; color: hsl(var(--muted-foreground)); margin: 4px 0 0; max-width: 720px; }
.page-head-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Cards */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-2xl);
  padding: var(--card-pad);
  box-shadow: 0 1px 2px hsl(var(--foreground) / 0.04);
}
.card.flush { padding: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-head .card-sub { font-size: 11px; color: hsl(var(--muted-foreground)); letter-spacing: 0.04em; font-weight: 500; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: hsl(var(--muted-foreground)); font-weight: 600; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-value.lg { font-size: 36px; }
.kpi-value.sm { font-size: 22px; }
.kpi-unit { font-size: 14px; color: hsl(var(--muted-foreground)); margin-left: 4px; font-weight: 500; }
.kpi-delta { font-size: 11px; display: inline-flex; align-items: center; gap: 4px; }
.kpi-delta.up { color: hsl(var(--success)); }
.kpi-delta.down { color: hsl(var(--destructive)); }
.kpi-delta.muted { color: hsl(var(--muted-foreground)); }

/* Grids */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.muted { color: hsl(var(--muted-foreground)); }
.mono { font-family: var(--font-mono); }
.tabular { font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border-radius: var(--radius-xl);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  cursor: pointer; font-family: inherit;
  font-size: 12px; font-weight: 500;
  color: hsl(var(--foreground));
  transition: all 200ms;
}
.btn:hover:not(:disabled) { background: hsl(var(--accent)); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }
.btn.primary {
  background: linear-gradient(135deg, var(--grad-from), var(--grad-to));
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px -2px hsl(var(--primary) / 0.4);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: hsl(var(--accent)); }
.btn.danger {
  background: hsl(var(--destructive)); color: white;
  border-color: hsl(var(--destructive));
}
.btn.sm { height: 26px; padding: 0 8px; font-size: 11px; }
.btn.lg { height: 38px; padding: 0 16px; font-size: 13px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 9999px;
  font-size: 11px; font-weight: 600;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
}
.badge.success { background: hsl(var(--success) / 0.12); color: hsl(var(--success)); }
.badge.warning { background: hsl(var(--warning) / 0.14); color: hsl(38 80% 38%); }
.badge.danger  { background: hsl(var(--destructive) / 0.12); color: hsl(var(--destructive)); }
.badge.info    { background: hsl(var(--info) / 0.12); color: hsl(var(--info)); }
.badge.navy    { background: hsl(var(--primary) / 0.1); color: hsl(var(--primary)); }
.badge.outline { background: transparent; border: 1px solid hsl(var(--border)); color: hsl(var(--foreground)); }
.badge.dot::before {
  content: ""; width: 6px; height: 6px;
  background: currentColor; border-radius: 9999px; margin-right: 2px;
}

/* Tables */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl thead th {
  text-align: left; font-weight: 600;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground));
  padding: 10px var(--row-px);
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  position: sticky; top: 0; z-index: 1;
  cursor: pointer; user-select: none;
}
.tbl thead th:hover { color: hsl(var(--foreground)); }
.tbl tbody td {
  padding: 0 var(--row-px);
  height: var(--row-h);
  border-bottom: 1px solid hsl(var(--border) / 0.6);
  vertical-align: middle;
}
.tbl tbody tr { transition: background 150ms; }
.tbl tbody tr:hover { background: hsl(var(--accent) / 0.4); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .truncate { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .check { width: 36px; padding-right: 0; }
.tbl .actions { width: 70px; text-align: right; }
.tbl.dense { font-size: 12px; }
.tbl.dense tbody td { height: 32px; }

.tbl input[type="checkbox"] { accent-color: hsl(var(--primary)); cursor: pointer; }

/* Facet sidebar */
.facet-panel { display: flex; flex-direction: column; gap: 18px; }
.facet-group h4 {
  margin: 0 0 8px; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: hsl(var(--muted-foreground)); font-weight: 600;
}
.facet-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; cursor: pointer;
  font-size: 12px; user-select: none;
}
.facet-row:hover { color: hsl(var(--primary)); }
.facet-row .count { margin-left: auto; font-size: 11px; color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; }
.facet-bar { height: 2px; background: hsl(var(--muted)); border-radius: 9999px; margin-top: 4px; overflow: hidden; }
.facet-bar .fill { height: 100%; background: linear-gradient(90deg, var(--grad-from), var(--grad-to)); }

/* Inputs */
.input, .select, .textarea {
  display: block; width: 100%; height: 34px;
  padding: 0 12px; border-radius: var(--radius-lg);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  font-family: inherit; font-size: 13px;
  outline: none; transition: border 150ms;
}
.input:focus, .select:focus, .textarea:focus { border-color: hsl(var(--ring)); }
.textarea { padding: 10px 12px; height: auto; min-height: 80px; resize: vertical; font-family: var(--font-mono); font-size: 12px; }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: hsl(var(--muted-foreground)); display: block; margin-bottom: 4px; }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: hsl(var(--muted));
  border: 1px solid transparent;
  border-radius: 999px; cursor: pointer;
  font-size: 11px; font-weight: 500;
  font-family: inherit; color: inherit;
  transition: all 120ms;
}
.chip:hover { background: hsl(var(--accent)); }
.chip.on { background: hsl(var(--primary)); color: white; }
.chip-count {
  background: rgba(0,0,0,0.08); padding: 1px 6px; border-radius: 999px;
  font-size: 10px; font-weight: 600;
}
.chip.on .chip-count { background: rgba(255,255,255,0.18); }

/* Status dots */
.dot-status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-status.green { background: hsl(var(--success)); box-shadow: 0 0 0 3px hsl(var(--success) / 0.18); }
.dot-status.amber { background: hsl(var(--warning)); box-shadow: 0 0 0 3px hsl(var(--warning) / 0.18); }
.dot-status.red   { background: hsl(var(--destructive)); box-shadow: 0 0 0 3px hsl(var(--destructive) / 0.18); }
.dot-status.pulse { animation: pulse 2s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px hsl(var(--success) / 0.2); }
  50%      { box-shadow: 0 0 0 6px hsl(var(--success) / 0.05); }
}

/* Stagger animation for view entry */
.fade-in { animation: fadeIn .35s ease-out both; }
.stagger > * { animation: fadeIn .4s ease-out both; }
.stagger > *:nth-child(2) { animation-delay: .05s; }
.stagger > *:nth-child(3) { animation-delay: .1s; }
.stagger > *:nth-child(4) { animation-delay: .15s; }
.stagger > *:nth-child(5) { animation-delay: .2s; }
.stagger > *:nth-child(6) { animation-delay: .25s; }
.stagger > *:nth-child(7) { animation-delay: .3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Gauge */
.gauge-wrap { display: flex; align-items: center; gap: 24px; padding: 10px 4px 0; }
.gauge { position: relative; }
.gauge-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 8px; pointer-events: none;
}
.gauge-pct {
  font-size: 38px; font-weight: 800;
  background: linear-gradient(135deg, var(--grad-from), var(--grad-to));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; line-height: 1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.gauge-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: hsl(var(--muted-foreground)); margin-top: 4px; }
.gauge-pot {
  font-size: 10px; margin-top: 6px; padding: 3px 8px; border-radius: 999px;
  background: hsl(var(--muted)); color: hsl(var(--muted-foreground));
  display: inline-flex; align-items: center; gap: 6px;
}
.gauge-pot .dot { width: 6px; height: 6px; border-radius: 50%; background: linear-gradient(135deg, var(--grad-from), var(--grad-to)); }

.legend { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-row .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.legend-row .sub { color: hsl(var(--muted-foreground)); font-size: 11px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.divider { height: 1px; background: hsl(var(--border)); margin: 4px 0; }

/* Scope flow */
.scope-flow {
  display: flex; gap: 0; align-items: stretch;
  border-radius: var(--radius-xl); overflow: hidden;
  container-type: inline-size;
}
.scope-band {
  flex: 1; min-width: 56px;
  padding: 12px 10px; color: white;
  display: flex; flex-direction: column;
  justify-content: center; gap: 4px;
  position: relative;
}
.scope-band .b-label { font-size: clamp(9px, 1.3cqi, 11px); opacity: 0.85; text-transform: uppercase; letter-spacing: 0.06em; line-height: 1.15; word-break: break-word; }
.scope-band .b-val   { font-size: clamp(13px, 2cqi, 18px); font-weight: 700; font-variant-numeric: tabular-nums; }
.scope-band.in     { background: linear-gradient(135deg, #3b82f6, #4f46e5); }
.scope-band.site   { background: linear-gradient(135deg, #f87171, #dc2626); }
.scope-band.drive  { background: linear-gradient(135deg, #fb923c, #ea580c); }
.scope-band.folder { background: linear-gradient(135deg, #facc15, #ca8a04); color: #4a3a07; }
.scope-band.ext    { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.scope-band.out    { background: linear-gradient(135deg, #22c55e, #059669); }

/* Treemap */
.treemap-wrap { container-type: inline-size; }
.treemap {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 64px;
  gap: 4px;
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.tm-cell {
  position: relative; padding: 10px 12px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: white; cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 200ms, box-shadow 200ms;
}
.tm-cell:hover { transform: translateY(-2px); box-shadow: 0 8px 22px -8px rgba(0,0,0,0.3); z-index: 2; }
.tm-cell.tm-active { outline: 2px solid white; outline-offset: -3px; }
.tm-cell .tm-name {
  font-size: 12px; font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  line-height: 1.2;
}
.tm-cell .tm-val { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Bar list */
.bar-list { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 60px 1fr 90px; align-items: center; gap: 10px; }
.bar-row .lbl { font-family: var(--font-mono); font-size: 11px; color: hsl(var(--muted-foreground)); }
.bar-row .v { font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; color: hsl(var(--muted-foreground)); }
.bar-track { position: relative; height: 8px; background: hsl(var(--muted)); border-radius: 4px; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--grad-from), var(--grad-to));
  transition: width 600ms cubic-bezier(0.4,0,0.2,1);
}
.bar-fill.muted-bar { background: linear-gradient(90deg, #94a3b8, #475569); opacity: 0.55; }

/* Activity feed */
.feed { display: flex; flex-direction: column; gap: 8px; }
.feed-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px; border-radius: 8px;
}
.feed-item:hover { background: hsl(var(--accent) / 0.4); }
.feed-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: white; flex-shrink: 0; }
.feed-icon svg { width: 13px; height: 13px; }
.feed-text { flex: 1; font-size: 12px; line-height: 1.4; min-width: 0; }
.feed-text .who { font-weight: 600; }
.feed-text strong { font-weight: 600; }
.feed-time { font-size: 11px; color: hsl(var(--muted-foreground)); flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* Impact strip (rule builder) */
.impact-strip {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: hsl(var(--border));
  border-radius: var(--radius-xl); overflow: hidden;
  margin-top: 14px;
}
.impact-cell {
  padding: 14px 16px; background: hsl(var(--card));
  display: flex; flex-direction: column; gap: 2px;
}
.impact-cell .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: hsl(var(--muted-foreground)); font-weight: 600; }
.impact-cell .val { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.impact-cell .sub { font-size: 11px; color: hsl(var(--muted-foreground)); display: flex; align-items: center; gap: 4px; }

/* Probe (search) */
.probe-shell { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }
.probe-hero {
  text-align: center; padding: 48px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.probe-hero h2 { font-size: 22px; margin: 0; font-weight: 700; }
.probe-hero p { margin: 0; color: hsl(var(--muted-foreground)); font-size: 13px; max-width: 480px; }
.probe-search {
  display: flex; align-items: center; gap: 12px;
  height: 52px; padding: 0 18px;
  border-radius: var(--radius-xl);
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  box-shadow: 0 8px 24px -12px rgba(29, 58, 92, 0.18);
}
.probe-search:focus-within { border-color: hsl(var(--ring)); box-shadow: 0 12px 32px -10px rgba(29, 58, 92, 0.25); }
.probe-search input {
  flex: 1; background: transparent; border: 0; outline: 0;
  font-family: inherit; font-size: 16px; color: hsl(var(--foreground));
}
.probe-row {
  display: flex; gap: 12px; padding: 14px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-xl);
  background: hsl(var(--card));
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 150ms;
  animation: fadeIn .35s ease-out both;
}
.probe-row:hover, .probe-row.sel {
  border-color: hsl(var(--primary) / 0.5);
  box-shadow: 0 4px 14px -6px hsl(var(--primary) / 0.25);
}
.probe-row.sel { background: hsl(var(--accent) / 0.4); }
.probe-tile {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; color: white; flex-shrink: 0;
}
.probe-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.probe-meta-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: hsl(var(--muted-foreground)); }
.probe-id { font-size: 10px; padding: 1px 5px; background: hsl(var(--muted)); border-radius: 3px; }
.probe-title { font-size: 14px; font-weight: 600; }
.probe-path { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.probe-snippet { font-size: 12px; line-height: 1.45; color: hsl(var(--muted-foreground)); }
.probe-snippet mark.hl, .probe-title mark.hl, .probe-path mark.hl {
  background: hsl(var(--warning) / 0.35); color: hsl(var(--foreground));
  border-radius: 3px; padding: 0 2px;
}
.probe-foot { display: flex; align-items: center; gap: 12px; margin-top: 6px; font-size: 11px; }
.probe-group-h { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: hsl(var(--muted-foreground)); margin: 16px 0 6px; }
.probe-skel { height: 88px; border-radius: 12px; background: linear-gradient(90deg, hsl(var(--muted)) 0%, hsl(var(--accent)) 50%, hsl(var(--muted)) 100%); background-size: 200% 100%; animation: skel 1.2s infinite; margin-bottom: 8px; }
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Callouts */
.callout {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 10px; font-size: 12px; line-height: 1.5;
}
.callout.info    { background: hsl(var(--info) / 0.08); color: hsl(var(--info)); }
.callout.warning { background: hsl(38 92% 50% / 0.1);   color: hsl(25 75% 35%); }
.callout.danger  { background: hsl(var(--destructive) / 0.08); color: hsl(var(--destructive)); }
.callout b { color: inherit; }
.callout .muted { color: hsl(var(--muted-foreground)) !important; }
.callout svg { flex-shrink: 0; margin-top: 1px; }

/* Login */
.login-shell {
  min-height: 100vh;
  display: grid; grid-template-columns: 1fr 320px;
  position: relative; overflow: hidden;
  background: hsl(var(--background));
}
.login-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(hsl(var(--border)) 1px, transparent 1px),
    linear-gradient(90deg, hsl(var(--border)) 1px, transparent 1px);
  background-size: 32px 32px; opacity: 0.25; pointer-events: none;
}
/* Sterkere grid kun i en sirkel rundt musepekeren — gir spotlight-effekt. */
.login-bg-spot {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(hsl(var(--primary)) 1px, transparent 1px),
    linear-gradient(90deg, hsl(var(--primary)) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.55;
  pointer-events: none;
  -webkit-mask: radial-gradient(
    circle 220px at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 0.6) 35%,
    rgba(0, 0, 0, 0) 70%
  );
          mask: radial-gradient(
    circle 220px at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 0.6) 35%,
    rgba(0, 0, 0, 0) 70%
  );
}
/* Myk fargeskinning som følger pekeren. */
.login-bg-cursor-glow {
  position: absolute; inset: 0;
  background: radial-gradient(
    circle 360px at var(--mouse-x, 50%) var(--mouse-y, 50%),
    hsl(var(--primary) / 0.14) 0%,
    hsl(var(--primary) / 0.04) 35%,
    transparent 65%
  );
  pointer-events: none;
}
/* Den statiske gradienten lengst bak — gir bilde-en dybde. */
.login-bg-glow {
  position: absolute; top: -120px; left: 30%; width: 600px; height: 600px;
  background: radial-gradient(circle, var(--grad-from) 0%, transparent 60%);
  opacity: 0.18; pointer-events: none;
}
.login-card {
  position: relative; z-index: 1; margin: auto; padding: 40px 44px;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: 20px; box-shadow: 0 24px 60px -20px rgba(0,0,0,0.18);
  width: 460px; max-width: calc(100vw - 360px);
}
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }
.login-title { font-size: 24px; font-weight: 700; margin: 0 0 6px; color: hsl(var(--primary)); letter-spacing: -0.01em; line-height: 1.2; }
.login-sub { font-size: 13px; color: hsl(var(--muted-foreground)); margin: 0 0 24px; line-height: 1.5; }
.login-tenant {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: hsl(var(--muted)); border-radius: 10px; margin-bottom: 20px;
}
.login-btn { width: 100%; padding: 14px; font-size: 14px; gap: 10px; height: auto; justify-content: center; }
.login-progress {
  display: flex; align-items: center; gap: 14px; padding: 14px;
  background: hsl(var(--muted)); border-radius: 10px;
  animation: fadeIn 0.3s;
}
.login-progress.success { background: hsl(var(--success) / 0.1); }
.spin { width: 20px; height: 20px; border: 2px solid hsl(var(--border)); border-top-color: var(--grad-from); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-footer {
  display: flex; gap: 8px; font-size: 11px; color: hsl(var(--muted-foreground));
  margin-top: 24px; padding-top: 16px; border-top: 1px solid hsl(var(--border));
  flex-wrap: wrap;
}
.login-footer a { cursor: pointer; text-decoration: underline; text-decoration-style: dotted; }
.login-side {
  position: relative; z-index: 1; background: linear-gradient(180deg, hsl(var(--primary)), hsl(210 60% 18%));
  color: white; padding: 40px 28px; display: flex; flex-direction: column; gap: 10px;
}
.login-stat-row {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 12px;
}
.login-stat-row .muted { color: rgba(255,255,255,0.55) !important; }

/* Agent bubble */
.agent-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 9000;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px 10px 10px;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: 999px;
  box-shadow: 0 12px 28px -8px rgba(29, 58, 92, 0.25), 0 2px 6px rgba(0,0,0,0.04);
  cursor: pointer; transition: all 180ms;
  font-family: var(--font-sans);
}
.agent-fab:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -10px rgba(29,58,92,0.3); }
.agent-fab-icon {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; color: white;
  background: linear-gradient(135deg, var(--grad-from), var(--grad-to));
  box-shadow: 0 4px 12px hsl(var(--primary) / 0.35);
}
.agent-fab-title { font-size: 13px; font-weight: 600; color: hsl(var(--primary)); text-align: left; }
.agent-fab-sub   { font-size: 10px; color: hsl(var(--muted-foreground)); text-align: left; }
.agent-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 9000;
  width: 380px; max-height: min(640px, calc(100vh - 80px));
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: 16px;
  box-shadow: 0 24px 60px -12px rgba(29, 58, 92, 0.35);
  display: flex; flex-direction: column;
  animation: agentSlide 220ms ease-out;
}
@keyframes agentSlide {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.agent-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid hsl(var(--border)); }
.agent-head-left { display: flex; gap: 10px; align-items: center; }
.agent-avatar {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; color: white;
  background: linear-gradient(135deg, var(--grad-from), var(--grad-to));
}
.agent-title { font-size: 13px; font-weight: 600; color: hsl(var(--primary)); }
.agent-sub { font-size: 10px; color: hsl(var(--muted-foreground)); display: flex; align-items: center; gap: 6px; }
.agent-status-dot { width: 6px; height: 6px; border-radius: 50%; background: hsl(var(--success)); box-shadow: 0 0 0 2px hsl(var(--success) / 0.2); animation: agentBlink 2s infinite; }
@keyframes agentBlink { 50% { opacity: 0.5; } }
.agent-head-right { display: flex; gap: 4px; }
.agent-icon-btn {
  width: 26px; height: 26px; border-radius: 6px;
  background: transparent; border: none; cursor: pointer;
  color: hsl(var(--muted-foreground));
  display: flex; align-items: center; justify-content: center;
}
.agent-icon-btn:hover { background: hsl(var(--muted)); color: hsl(var(--primary)); }
.agent-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; min-height: 220px; }
.agent-msg { display: flex; gap: 8px; }
.agent-msg.user { justify-content: flex-end; }
.agent-msg.user .agent-bubble-text {
  background: hsl(var(--primary)); color: white;
  padding: 8px 12px; border-radius: 14px 14px 4px 14px;
  font-size: 12px; max-width: 80%; line-height: 1.45;
}
.agent-msg.bot { align-items: flex-start; }
.agent-bot-avatar {
  width: 22px; height: 22px; border-radius: 7px; flex: none;
  display: flex; align-items: center; justify-content: center; color: white;
  margin-top: 2px;
  background: linear-gradient(135deg, var(--grad-from), var(--grad-to));
}
.agent-msg.bot .agent-bubble-text {
  background: hsl(var(--muted)); color: hsl(var(--foreground));
  padding: 8px 12px; border-radius: 14px 14px 14px 4px;
  font-size: 12px; line-height: 1.45;
}
.agent-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.agent-action {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  font-family: inherit;
}
.agent-action.primary { background: hsl(var(--primary)); color: white; }
.agent-action.ghost   { background: transparent; border-color: hsl(var(--border)); color: hsl(var(--muted-foreground)); }
.agent-action.ghost:hover { background: hsl(var(--muted)); }
.agent-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 12px; }
.agent-suggest-chip {
  padding: 5px 10px; border-radius: 999px;
  background: hsl(var(--muted)); border: 1px solid hsl(var(--border));
  font-size: 11px; color: hsl(var(--primary)); cursor: pointer;
  font-family: inherit;
}
.agent-input-row { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid hsl(var(--border)); }
.agent-input {
  flex: 1; border: 1px solid hsl(var(--border)); border-radius: 999px;
  padding: 8px 14px; font-size: 12px; font-family: var(--font-sans);
  background: hsl(var(--background)); outline: none;
}
.agent-input:focus { border-color: hsl(var(--primary)); }
.agent-send {
  width: 32px; height: 32px; border-radius: 50%;
  background: hsl(var(--primary)); color: white; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.agent-send:disabled { opacity: 0.4; cursor: not-allowed; }
.agent-foot { padding: 6px 14px 10px; font-size: 10px; color: hsl(var(--muted-foreground)); text-align: center; }

/* Tweaks panel */
.tweaks-fab {
  position: fixed; right: 20px; top: 80px; z-index: 8500;
  width: 36px; height: 36px; border-radius: 10px;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  display: grid; place-items: center; cursor: pointer;
  color: hsl(var(--muted-foreground));
  box-shadow: 0 4px 12px -4px rgba(0,0,0,0.1);
}
.tweaks-fab:hover { color: hsl(var(--primary)); }
.tweaks-panel {
  position: fixed; right: 20px; top: 124px; z-index: 8500;
  width: 300px; max-height: calc(100vh - 200px); overflow-y: auto;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: 16px; padding: 14px;
  box-shadow: 0 24px 60px -12px rgba(29, 58, 92, 0.25);
  animation: agentSlide 220ms ease-out;
}
.tweaks-panel h4 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: hsl(var(--muted-foreground)); font-weight: 600; }
.tweaks-panel section { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid hsl(var(--border)); }
.tweaks-panel section:last-child { border-bottom: 0; margin-bottom: 0; }
.tweak-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.tweak-row > .label { margin-bottom: 2px; }
.tweak-radio { display: flex; gap: 4px; flex-wrap: wrap; }
.tweak-radio .chip { font-size: 10px; padding: 3px 8px; }
.tweak-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.tweak-toggle .track { width: 32px; height: 18px; border-radius: 9px; background: hsl(var(--muted)); position: relative; transition: background .2s; }
.tweak-toggle .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: white; box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: left .2s; }
.tweak-toggle.on .track { background: hsl(var(--primary)); }
.tweak-toggle.on .track::after { left: 16px; }
.tweak-toggle span { font-size: 12px; }

/* Sections (card+head) */
.section-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 1100px) {
  .grid-3, .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
}

/* Density */
.density-compact { --row-h: 36px; --row-px: 12px; --card-pad: 16px; }
.density-tight   { --row-h: 32px; --row-px: 10px; --card-pad: 12px; }

/* Onboarding */
.onboarding-hero {
  padding: 28px 30px; border: 1px solid hsl(var(--border));
  border-radius: 16px;
  background: radial-gradient(800px 200px at 20% 0%, hsl(var(--chart-2) / 0.12), transparent 60%), hsl(var(--card));
}
.onboarding-step {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px;
  border: 1px solid hsl(var(--border)); border-radius: 12px; background: hsl(var(--card));
}
.onboarding-step-mark {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: hsl(var(--muted)); color: hsl(var(--muted-foreground));
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.onboarding-step-mark.done { background: hsl(var(--success) / 0.18); color: hsl(var(--success)); }

/* Snapshot list */
.snapshot-row {
  display: grid; grid-template-columns: 14px 1fr auto; gap: 12px;
  align-items: center; padding: 12px 14px;
  border: 1px solid hsl(var(--border)); border-radius: 12px;
  margin-bottom: 8px;
}
.snapshot-row:hover { background: hsl(var(--accent) / 0.3); }
.snapshot-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--grad-from), var(--grad-to));
  box-shadow: 0 0 0 3px hsl(var(--card)), 0 0 0 4px hsl(var(--border));
}

/* Misc helpers */
.code-block {
  font-family: var(--font-mono); font-size: 11px;
  background: hsl(var(--muted)); border-radius: 8px;
  padding: 10px 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  color: hsl(var(--foreground)); border: 1px solid hsl(var(--border));
}
.tabs { display: flex; gap: 4px; border-bottom: 1px solid hsl(var(--border)); margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  padding: 8px 14px; cursor: pointer;
  font-size: 12px; font-weight: 500; color: hsl(var(--muted-foreground));
  border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: hsl(var(--foreground)); }
.tab.active { color: hsl(var(--primary)); border-bottom-color: hsl(var(--primary)); font-weight: 600; }
.tab .count { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: hsl(var(--muted)); }
.tab.active .count { background: hsl(var(--primary) / 0.15); color: hsl(var(--primary)); }

/* Role matrix */
.role-row {
  display: grid; grid-template-columns: 28px 1fr auto auto; gap: 12px; align-items: center;
  padding: 12px 14px;
  border: 1px solid hsl(var(--border)); border-radius: 12px;
  margin-bottom: 8px; cursor: pointer; transition: all .15s ease;
}
.role-row:hover { border-color: hsl(var(--primary) / 0.4); }
.role-row.active { border-color: hsl(var(--primary)); background: hsl(var(--primary) / 0.04); box-shadow: 0 0 0 1px hsl(var(--primary) / 0.2); }
.role-matrix-row {
  display: grid; grid-template-columns: 1fr 90px 160px; gap: 12px;
  align-items: center; padding: 8px 12px; border-radius: 8px; font-size: 12px;
}
.role-matrix-head { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: hsl(var(--muted-foreground)); }
.role-matrix-row.perm-rw { background: hsl(var(--success) / 0.07); }
.role-matrix-row.perm-r  { background: hsl(var(--muted) / 0.5); }
.role-matrix-row.perm--  { opacity: 0.5; }

/* Vector map */
.vector-shell { display: grid; grid-template-columns: 240px 1fr 280px; gap: 14px; height: calc(100vh - 160px); min-height: 480px; }
.vector-canvas-wrap {
  position: relative; border-radius: 12px; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, hsl(210 30% 18%) 0%, hsl(210 60% 6%) 100%);
  border: 1px solid hsl(var(--border));
}
.vector-canvas { width: 100%; height: 100%; display: block; }
.vector-hud {
  position: absolute; top: 12px; left: 12px;
  background: rgba(10, 20, 35, 0.75); color: #d4f1ff;
  padding: 6px 10px; border-radius: 6px;
  font-family: var(--font-mono); font-size: 10px;
  border: 1px solid rgba(255,255,255,0.1);
}
.vector-strip {
  position: absolute; bottom: 12px; left: 12px; right: 12px;
  display: flex; gap: 12px;
  background: rgba(10, 20, 35, 0.75);
  padding: 8px 12px; border-radius: 8px;
  color: #d4f1ff; font-size: 11px;
  border: 1px solid rgba(255,255,255,0.1);
}
.vector-strip .lbl { color: rgba(212,241,255,0.6); margin-right: 4px; }

/* Inline range/select */
input[type=range] { accent-color: hsl(var(--primary)); }

/* Health pill */
.health-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: hsl(var(--muted)); border-radius: 999px; font-size: 11px; }

/* PII severity */
.sev-high   { color: hsl(var(--destructive)); background: hsl(var(--destructive) / 0.1); }
.sev-medium { color: hsl(38 80% 38%); background: hsl(38 92% 50% / 0.12); }
.sev-low    { color: hsl(var(--info)); background: hsl(var(--info) / 0.1); }

/* Mini-spark */
.mini-spark { display: inline-flex; align-items: flex-end; gap: 1px; }
.mini-spark .b { width: 3px; background: linear-gradient(180deg, var(--grad-from), var(--grad-to)); border-radius: 1px; }

/* Hide scroll bars in WebKit while still scrolling */
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 4px; }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* ───────────── Mobile (≤900 px) ─────────────
 * Smal layout: sidebar blir off-canvas drawer som åpnes via menyknapp i
 * topbaren. Alle multi-kolonne-grids stacker. Tabeller får horisontal
 * scroll så de ikke knuser layouten. Login-kortet fyller skjermen. */
@media (max-width: 900px) {
  html { font-size: 95%; }

  /* Shell: én kolonne; sidebar er fixed off-canvas.
   * På desktop er "collapsed" = ikon-strip. På mobil snur vi semantikken:
   * "collapsed" = drawer er ÅPEN. Default (ikke collapsed) = drawer skjult. */
  .shell { grid-template-columns: 1fr; }
  .shell.collapsed { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 1000;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 0 12px 40px -10px rgba(0,0,0,0.4);
  }
  .shell.collapsed .sidebar { transform: translateX(0); }
  .shell.collapsed .main::before {
    content: ""; position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    z-index: 999; animation: fadeIn .2s ease;
  }
  /* Vis tekst i sidebaren også når .collapsed (drawer åpen på mobil) */
  .collapsed .nav-section-title { display: block; }
  .collapsed .brand-wordmark    { display: block; }
  .collapsed .brand-sub         { display: block; }
  .collapsed .nav-label         { display: inline; flex: 1; }
  .collapsed .nav-badge         { display: inline-flex; }
  .collapsed .user-meta         { display: flex; flex-direction: column; }

  /* Topbar: fjern bred søk-input på mobil, kompakter spacing */
  .topbar { padding: 0 12px; gap: 8px; height: 52px; }
  .topbar-search { display: none; }
  .topbar-agent-btn span:not([class]) { display: none; }
  .topbar-agent-btn kbd { display: none; }
  .breadcrumbs { font-size: 11px; }
  .breadcrumbs > span:not(:last-child):not(.current) { display: none; }
  .breadcrumbs > span:not(:last-child) { display: none; }
  .breadcrumbs .current { display: inline; }

  /* View padding */
  .view-scroll { padding: 14px 12px 80px; }
  .page-head { flex-wrap: wrap; gap: 8px; }
  .page-head h1 { font-size: 20px; }
  .page-head-right { margin-left: 0; flex-wrap: wrap; }

  /* Stacking — alle grids til én kolonne */
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr !important; }
  .grid { gap: 12px; }
  .section-row { grid-template-columns: 1fr; }

  /* Cards */
  .card { padding: 14px; border-radius: 12px; }
  .card-head { flex-wrap: wrap; gap: 6px; }

  /* Gauge + scope flow */
  .gauge-wrap { flex-direction: column; align-items: stretch; gap: 12px; padding: 0; }
  .scope-flow { flex-direction: column; }
  .scope-band { min-width: 0; padding: 10px 12px; }
  .scope-band .b-label { font-size: 11px; }
  .scope-band .b-val { font-size: 14px; }

  /* Treemap: ikke nyttig som mosaikk på smal skjerm — fall til stacked bars */
  .treemap { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 56px; }
  .tm-cell { padding: 8px 10px; }
  .tm-cell .tm-name { font-size: 11px; }
  .tm-cell .tm-val { font-size: 12px; }

  /* Tabeller: scroll horisontalt heller enn å sprenge */
  .tbl { display: block; overflow-x: auto; white-space: nowrap; }
  .tbl thead, .tbl tbody { display: table; width: 100%; min-width: 600px; }

  /* KPI: mindre tall */
  .kpi-value { font-size: 22px; }
  .kpi-value.lg { font-size: 26px; }
  .kpi-value.sm { font-size: 18px; }

  /* Vektor-kart: enklere layout */
  .vector-shell { grid-template-columns: 1fr; height: auto; }
  .vector-canvas-wrap { height: 280px; }

  /* Probe / søk: full bredde */
  .probe-search { height: 44px; padding: 0 12px; font-size: 14px; }
  .probe-row { padding: 10px; gap: 8px; }

  /* Login: kortet fyller skjermen */
  .login-shell { grid-template-columns: 1fr !important; }
  .login-side { display: none; }
  .login-card {
    width: calc(100vw - 24px) !important; max-width: 460px;
    padding: 24px 20px; margin: 12px auto;
    border-radius: 14px;
  }
  .login-title { font-size: 20px; }
  .login-sub { font-size: 12px; }

  /* Agent FAB: passe størrelse, ikke over hele bunnen */
  .agent-fab { right: 12px; bottom: 12px; padding: 8px 12px 8px 8px; }
  .agent-fab-title { font-size: 12px; }
  .agent-fab-sub { font-size: 9px; }
  .agent-panel {
    right: 8px; left: 8px; bottom: 8px;
    width: auto; max-height: calc(100vh - 100px);
  }
  .tweaks-panel { right: 8px; left: 8px; width: auto; top: auto; bottom: 80px; }
  .tweaks-fab { right: 12px; top: 64px; }

  /* Onboarding hero — mindre på mobil */
  .onboarding-hero { padding: 20px 18px; }
  .onboarding-hero h1 { font-size: 22px !important; }
}

/* Ekstra-små skjermer (telefon stående, ≤ 480 px) */
@media (max-width: 480px) {
  .topbar-actions .icon-btn:not(:first-child) { display: none; }
  .topbar-agent-btn { padding: 6px; }
  .page-head-right .btn:not(.primary) { display: none; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tab { white-space: nowrap; }
}
