/* Watchtower in Decipher's look. The tokens are Decipher's frontend/app/globals.css, the shapes
   its components/ui: the app top bar (title, centred search pill, user menu), the sidebar on the
   page ground, the page as one raised surface (PageSurface), summary widgets (WidgetRow + Metric),
   SectionCard, Table, Badge, Button, ToggleGroup, InteractiveEmptyState.
   Light or dark follows the system; the theme item pins one (data-mode, set before paint).
   Every colour token is light-dark(light, dark), so one block serves both themes. */

@font-face { font-family: Geist; font-weight: 100 900; font-display: swap; src: url(fonts/geist-variable.woff2) format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-weight: 100 900; font-display: swap; src: url(fonts/geist-mono-variable.woff2) format('woff2'); }
@font-face { font-family: Montserrat; font-weight: 100 900; font-display: swap; src: url(fonts/montserrat-variable-latin.woff2) format('woff2'); }

:root {
  color-scheme: light dark;
  --background: light-dark(hsl(210 15% 97%), hsl(220 6% 0%));
  --foreground: light-dark(hsl(222 28% 11%), hsl(0 0% 95%));
  --card: light-dark(hsl(0 0% 100%), hsl(220 0% 9%));
  --popover: light-dark(hsl(0 0% 100%), hsl(220 6% 13%));
  --primary: light-dark(hsl(222 28% 28%), hsl(222 38% 57%));
  --primary-foreground: light-dark(hsl(210 20% 98%), hsl(0 0% 100%));
  --secondary-foreground: light-dark(hsl(222 28% 18%), hsl(0 0% 95%));
  --muted: light-dark(hsl(215 12% 94%), hsl(220 5% 18%));
  --muted-foreground: light-dark(hsl(220 10% 44%), hsl(220 5% 55%));
  /* Metric labels: Decipher's text-neutral-600 at 70%, neutral-400 in dark. */
  --label: light-dark(rgb(82 82 82 / 0.7), rgb(163 163 163 / 0.7));
  --strong: light-dark(hsl(222 28% 11%), hsl(0 0% 100%));
  --accent: light-dark(hsl(219 12% 90%), hsl(220 6% 17%));
  --border: light-dark(hsl(220 13% 88%), hsl(220 5% 22%));
  --card-border: light-dark(rgb(229 229 229 / 0.8), rgb(163 163 163 / 0.2));
  /* Button "outline" and the filter chips: white in light, black in dark, a hairline ring. */
  --field: light-dark(hsl(0 0% 100%), hsl(0 0% 0%));
  --field-ring: light-dark(rgb(229 229 229 / 0.8), hsl(220 5% 22%));
  /* A filter chip's edge: dashed in light; in dark the dash goes and the ring carries it. */
  --chip-dash: light-dark(rgb(212 212 212), transparent);
  /* Alpha overlays, as in Decipher: a field or chip darkens (lightens, in dark) whatever it sits on. */
  --input: light-dark(hsl(220 40% 25% / 6%), hsl(220 40% 84% / 12%));
  --pill: light-dark(hsl(220 10% 44% / 10%), hsl(0 0% 15%));
  --chip: light-dark(hsl(220 40% 25% / 7%), hsl(220 40% 84% / 12%));
  --ring: light-dark(hsl(222 47% 28%), hsl(222 57% 61%));
  --info: light-dark(hsl(222 55% 86%), hsl(222 25% 18%));
  --info-foreground: light-dark(hsl(222 45% 26%), hsl(222 40% 88%));
  --destructive: light-dark(hsl(0 70% 45%), hsl(0 62% 56%));
  --destructive-foreground: hsl(0 0% 100%);
  --success: light-dark(hsl(142 72% 29%), hsl(142 69% 58%));
  /* Decipher has no warning token; this is its "expired" status stroke, the one amber it ships. */
  --warning: light-dark(hsl(34 84% 32%), hsl(35 86% 58%));
  /* Badge tints Decipher ships: HubCard's success (emerald) and WARNING_BADGE_CLASS (amber). */
  --positive: light-dark(rgb(4 120 87), rgb(52 211 153));
  --positive-bg: light-dark(rgb(209 250 229), rgb(6 78 59 / 0.3));
  --amber: light-dark(rgb(180 83 9), rgb(252 211 77));
  --amber-bg: rgb(245 158 11 / 0.1);
  --amber-border: rgb(245 158 11 / 0.4);
  /* The chart palette: the brand hue stepped dark to light, one orange accent. */
  --chart-0: light-dark(hsl(222 47% 28%), hsl(222 50% 70%));
  --chart-1: light-dark(hsl(222 47% 32%), hsl(222 50% 65%));
  --chart-2: light-dark(hsl(222 28% 52%), hsl(222 28% 55%));
  --chart-3: light-dark(hsl(222 18% 70%), hsl(222 18% 42%));
  --chart-4: light-dark(hsl(25 80% 52%), hsl(25 75% 64%));
  --chart-6: light-dark(hsl(222 28% 42%), hsl(222 28% 48%));
  --chart-7: light-dark(hsl(222 18% 60%), hsl(222 18% 35%));
  --blick: light-dark(hsl(0 0% 100%), hsl(0 0% 16%));
  --shadow-color: light-dark(rgb(0 0 0 / 0.1), rgb(0 0 0 / 0.5));
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 var(--shadow-color), 0 1px 2px -1px var(--shadow-color);
  --shadow-md: 0 4px 6px -1px var(--shadow-color), 0 2px 4px -2px var(--shadow-color);
  --shadow-lg: 0 10px 15px -3px var(--shadow-color), 0 4px 6px -4px var(--shadow-color);
  --shadow-xl: 0 20px 25px -5px var(--shadow-color), 0 8px 10px -6px var(--shadow-color);
  /* blick-sm: the inset rim Decipher lifts an active item with (sidebar, segment, menu rows). */
  --blick-sm: var(--shadow),
    inset 0 1px 0 0 color-mix(in srgb, var(--blick) 50%, transparent),
    inset 1px 0 0 0 color-mix(in srgb, var(--blick) 50%, transparent),
    inset -1px 0 0 0 color-mix(in srgb, var(--blick) 50%, transparent),
    inset 0 -1px 0 0 color-mix(in srgb, var(--blick) 20%, transparent);
  /* The raised row (sidebar item, menu item): the card at 90% under the blick rim. */
  --raised: color-mix(in srgb, var(--card) 90%, transparent);
  --corner-scale: 1;
  --radius: calc(0.5rem * var(--corner-scale));
  --r-xl: calc(var(--radius) * 1.5);
  --sidebar-width: 15rem;
  --gutter: 1.5rem;
  --sans: Geist, ui-sans-serif, system-ui, sans-serif;
  --display: Montserrat, Geist, system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, Menlo, monospace;
  font-size: 14.5px;
}
:root[data-mode="light"] { color-scheme: light; }
:root[data-mode="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
/* Squircle corners, as Decipher draws them: where the browser has corner-shape the radii grow by
   half (a squircle at the same radius reads sharper). Pills and circles stay round. */
*, ::before, ::after { corner-shape: squircle; }
@supports (corner-shape: squircle) { :root { --corner-scale: 1.5; } }
:is(.search input, .user-btn, .avatar, .icon-btn.round, .status, .tabs a::after, .mix-bar, .mix-legend i, .waterfall .track, .waterfall .span) { corner-shape: round; }
html { background: var(--background); }
body {
  margin: 0; min-height: 100vh; background: var(--background); color: var(--foreground);
  font: 1rem/1.5 var(--sans); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--primary); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
svg { display: block; }
i { font-style: normal; }
.muted { color: var(--muted-foreground); }
.small { font-size: 0.75rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Icons: Fluent, regular by default, filled on the active item and while hovered (Decipher's bundleIcon). */
.i { width: 1.25rem; height: 1.25rem; flex: none; fill: currentColor; }
.i .f { display: none; }
:is(.on, :hover, :focus-visible, [aria-pressed="true"]) > .i .f { display: inline; }
:is(.on, :hover, :focus-visible, [aria-pressed="true"]) > .i .r { display: none; }

/* --- the shell: sidebar | top bar over the page surface --- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--sidebar-width); flex: none;
  display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem 0.5rem;
  font-family: var(--display);
}
.sb-head { display: flex; align-items: center; justify-content: space-between; height: 2.5rem; padding-left: 0.625rem; }
.logo { display: flex; align-items: center; gap: 0.5rem; font: 700 1.05rem var(--display); letter-spacing: -0.02em; color: color-mix(in srgb, var(--foreground) 90%, transparent); }
.logo svg { width: 1.3rem; height: 1.3rem; fill: var(--ring); }
.logo:hover { color: var(--foreground); }
.sb-nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; overflow-y: auto; scrollbar-width: none; padding: 0.75rem 0 0.25rem; }
/* Sections (nav-main's collapsible sections): a 9px tracked uppercase label, a chevron turned
   down while the section is open. */
.sb-group > .sb-item + .sb-item, .sb-label + .sb-item { margin-top: 0.25rem; }
.sb-label {
  display: flex; align-items: center; height: 2.25rem; margin-top: 0.5rem; padding: 0 0.625rem; border-radius: var(--r-xl);
  list-style: none; cursor: pointer; user-select: none;
  font: 600 0.6207rem var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--foreground);
}
.sb-label::-webkit-details-marker { display: none; }
.sb-label:hover { background: var(--border); }
.sb-label .i { width: 0.75rem; height: 0.75rem; margin-left: auto; color: var(--muted-foreground); }
.sb-group[open] > .sb-label .i { rotate: 90deg; }
.sb-item {
  display: flex; align-items: center; gap: 0.5rem; height: 2.25rem; padding: 0.625rem; border-radius: var(--r-xl);
  font-size: 0.7875rem; line-height: 1.125rem; color: var(--foreground); white-space: nowrap; overflow: hidden;
  text-shadow: 0 1px 0 rgb(255 255 255 / 0.15); transition: background-color 150ms ease-out;
}
.sb-item span { overflow: hidden; text-overflow: ellipsis; flex: 1; margin-left: 0.25rem; }
.sb-item > .i { opacity: 0.6; }
.sb-item:not(.on) span { color: light-dark(var(--foreground), var(--muted-foreground)); }
:is(.sb-item:hover, .sb-item.on, .dropdown .item:hover) { background: var(--raised); box-shadow: var(--blick-sm); color: var(--foreground); }
.sb-item.on { font-weight: 500; }
/* A project's initial in a small chip (sidebar, overview cards). */
.initial {
  display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; flex: none; border-radius: 0.375rem;
  background: var(--chip); font: 600 0.65rem var(--display); text-transform: uppercase; color: var(--muted-foreground);
}
.sb-item.on .initial { background: var(--primary); color: var(--primary-foreground); }

/* Collapsed: an icon column (Decipher's collapsible="icon"); below 1024px the sidebar is a sheet instead. */
@media (min-width: 1025px) {
  :root[data-sidebar="collapsed"] .sidebar { width: 4.5rem; }
  :root[data-sidebar="collapsed"] :is(.logo span, .sb-item span, .sb-label) { display: none; }
  :root[data-sidebar="collapsed"] .sb-head { flex-direction: column; height: auto; gap: 0.5rem; padding-left: 0; }
  :root[data-sidebar="collapsed"] .sb-item { width: 2.5rem; justify-content: center; margin-left: 0.5rem; }
  :root[data-sidebar="collapsed"] #collapse .i { transform: scaleX(-1); }
}

.inset { flex: 1; min-width: 0; display: flex; flex-direction: column; }
/* Decipher's .app-top-bar: title | centred search | actions, one 4rem row; on a phone the
   search takes a row of its own under the title. */
.topbar {
  position: sticky; top: 0; z-index: 20; display: grid; align-items: center;
  grid-template-rows: 4rem; grid-template-columns: auto minmax(0, 1fr) minmax(0, auto) minmax(min-content, 1fr);
  grid-template-areas: 'menu title search actions';
  padding: 0 var(--gutter); background: var(--background);
}
#menu { grid-area: menu; display: none; }
.topbar .title { grid-area: title; min-width: 0; display: flex; align-items: center; gap: 0.35rem; padding: 0 1rem 0 var(--gutter); }
.topbar h1 { font-size: 1rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumb { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted-foreground); font: 500 0.9rem var(--display); white-space: nowrap; }
.topbar .crumb:hover { color: var(--foreground); }
.topbar .crumb::after {
  content: ""; width: 0.8rem; height: 0.8rem; background: currentColor; opacity: 0.6;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.47a.5.5 0 0 1-.7-.71L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* GlobalSearch: a grey pill, an inner shadow, a boxed shortcut cap on the right. */
.search { grid-area: search; position: relative; width: 24rem; }
.search .i { position: absolute; left: 1.1rem; top: 50%; transform: translateY(-50%); width: 1rem; height: 1rem; opacity: 0.5; pointer-events: none; }
.search input[type=search] {
  width: 100%; height: 2.25rem; padding: 0 3.5rem 0 2.6rem; border-radius: 999px; background: var(--pill);
  box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05); font-size: 0.75rem;
}
.search input::placeholder { color: color-mix(in srgb, var(--muted-foreground) 85%, transparent); }
.search kbd {
  position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 0.25rem;
  height: 1.25rem; padding: 0 0.375rem; border-radius: 0.25rem; background: var(--card); box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.1);
  font: 500 0.6897rem var(--sans); color: var(--foreground); pointer-events: none;
}
.bar-actions { grid-area: actions; display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; }

/* UserMenu: the name and an avatar in a pill; a dropdown under it. */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.user-btn { display: flex; align-items: center; gap: 0.5rem; height: 2.5rem; padding: 0.25rem 0.25rem 0.25rem 0.75rem; border-radius: 999px; transition: background-color 150ms; }
.user-btn:hover, .menu[open] .user-btn { background: var(--accent); }
.user-btn span { font-size: 0.875rem; font-weight: 500; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem; flex: none; border-radius: 50%;
  background: var(--muted); color: var(--muted-foreground); font: 600 0.75rem var(--sans); text-transform: uppercase;
}
.avatar.lg { width: 2.5rem; height: 2.5rem; font-size: 0.875rem; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 0.4rem); z-index: 50; width: 18rem; padding: 0.25rem;
  background: var(--popover); border-radius: var(--r-xl); box-shadow: var(--shadow-lg), 0 0 0 1px light-dark(rgb(0 0 0 / 0.04), rgb(255 255 255 / 0.06));
}
.dropdown .who { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; }
.dropdown .who div { flex: 1; min-width: 0; }
.dropdown .who .avatar { margin-right: -0.375rem; }
.dropdown .who b { display: block; font-size: 0.875rem; line-height: 1.25rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.dropdown .who small { display: block; font-size: 0.75rem; color: var(--muted-foreground); }
.dropdown hr { margin: 0.25rem -0.25rem; border: 0; border-top: 1px solid var(--border); }
.dropdown form { margin: 0; }
.dropdown .item {
  display: flex; align-items: center; gap: 0.625rem; width: 100%; min-height: 2.75rem; padding: 0.625rem 0.75rem; border: 0; border-radius: calc(var(--r-xl) - 0.25rem);
  background: transparent; font-size: 0.875rem; text-align: left; color: var(--foreground); cursor: pointer;
}
.dropdown .item .i { width: 1rem; height: 1rem; color: var(--muted-foreground); }

/* PageBody + PageSurface: the raised card under the bar, near the full height. */
.page { flex: 1; display: flex; flex-direction: column; padding: 0 2rem var(--gutter) var(--gutter); min-width: 0; }
.surface {
  flex: 1; min-width: 0; background: var(--card); box-shadow: var(--shadow-xl);
  border-radius: calc(var(--r-xl) + 1.5rem); padding: 1.5rem;
}

/* --- inside the surface: a toolbar row, then sections --- */
.head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; min-height: 2.25rem; }
.head > p, .head > div > p { color: var(--muted-foreground); font-size: 0.8rem; max-width: 60rem; }
.head h2 { font-size: 1.15rem; letter-spacing: -0.01em; margin-bottom: 0.25rem; }
.head .actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 1.75rem 0 0.9rem; }
.section-title h2 { font: 700 0.6897rem var(--display); text-transform: uppercase; letter-spacing: 0.02em; }

/* Underlined tabs (Decipher's UnderlinedTabs): a project's Metrics / Logs / Errors. */
.tabs { display: flex; gap: 0.5rem; height: 3rem; margin: -0.75rem 0 1rem; overflow: visible; }
.tabs a {
  position: relative; display: inline-flex; align-items: center; height: 3rem; margin: 0 1rem; padding: 0.5rem 0 0.75rem;
  color: var(--muted-foreground); font-size: 0.875rem; white-space: nowrap;
}
.tabs a:first-child { margin-left: 0.25rem; }
.tabs a:hover { color: var(--foreground); }
.tabs a.on { color: var(--foreground); font-weight: 500; }
.tabs a.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; border-radius: 999px; background: var(--primary); box-shadow: var(--shadow-md); }

/* SegmentToggle (a dashboard card's view switch): a muted track, the chosen item a raised white chip. */
.seg { display: inline-flex; align-items: center; gap: 0.25rem; height: 1.75rem; padding: 0.125rem; border-radius: var(--radius); background: color-mix(in srgb, var(--muted) 60%, transparent); }
.seg a { display: inline-flex; align-items: center; height: 1.5rem; padding: 0 0.5rem; border-radius: calc(var(--radius) - 0.125rem); font-size: 0.75rem; font-weight: 500; color: var(--muted-foreground); transition: background-color 150ms, color 150ms, box-shadow 150ms; }
.seg a:hover { color: var(--foreground); }
.seg a.on {
  background: var(--card); color: var(--foreground);
  box-shadow: 0 0 0 1px light-dark(rgb(16 24 40 / 0.06), rgb(255 255 255 / 0.08)), 0 1px 2px light-dark(rgb(16 24 40 / 0.08), rgb(0 0 0 / 0.5)), 0 2px 6px light-dark(rgb(16 24 40 / 0.06), rgb(0 0 0 / 0.35));
}

/* --- cards (Decipher's Card + SectionCard) --- */
.card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--r-xl); padding: 1rem 1.25rem 1.25rem; min-width: 0; }
.card > h2 { font: 600 0.75rem/1 var(--display); letter-spacing: -0.01em; display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.75rem; }
.card > h2 small { font: 400 0.75rem var(--sans); color: var(--muted-foreground); letter-spacing: 0; }
.card > h2 small a { color: var(--primary); font-weight: 500; }
.card > p.desc { margin: -0.5rem 0 0.9rem; font-size: 0.75rem; color: var(--muted-foreground); }
.grid { display: grid; gap: 1rem; align-items: start; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g2 { grid-template-columns: minmax(0, 1fr); } }
.stack { display: grid; gap: 1rem; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }

/* Summary widget (Widget + WidgetMetrics + Metric): a tiny bold uppercase title, then the
   metrics spread across the card, a muted label over a large tabular number. */
.summary { padding: 1.5rem 2rem 2rem; margin-bottom: 1rem; }
.summary-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; flex-wrap: wrap; min-height: 1.75rem; margin: -0.375rem 0 1.125rem; }
.overline { font: 700 0.6897rem/1 var(--display); text-transform: uppercase; letter-spacing: -0.025em; color: var(--foreground); }
.summary-head .note { font-size: 0.75rem; color: var(--muted-foreground); }
.summary-head .note a { color: var(--primary); font-weight: 500; }
.summary-head .right-side { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.metrics { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.25rem 2.5rem; }
.metric { display: block; min-width: 0; }
.metric .label { font-size: 0.75rem; line-height: 1.5rem; color: var(--label); white-space: nowrap; }
.metric .value { font: 500 var(--metric-size, 1.875rem)/1.2 var(--sans); letter-spacing: -0.05em; color: var(--strong); white-space: nowrap; }
.metric .value small { font-size: 1rem; letter-spacing: -0.02em; margin-left: 0.1rem; }
.metric .sub { font-size: 0.6897rem; color: var(--muted-foreground); white-space: nowrap; }
a.metric:hover .value { color: var(--primary); }
/* StatusMixBar: one bar of shares in the brand-hue steps (1px seams, no hue implying meaning),
   a one-line legend of dot · name · count under it. */
.mix { margin-top: 1.5rem; }
.mix-bar { display: flex; gap: 1px; height: 0.375rem; overflow: hidden; border-radius: 999px; background: var(--card); }
.mix-bar span { min-width: 2px; }
.mix-legend { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; margin-top: 0.5rem; font-size: 0.7586rem; }
.mix-legend a { display: flex; align-items: center; gap: 0.375rem; min-width: 0; }
.mix-legend i { width: 0.375rem; height: 0.375rem; flex: none; border-radius: 50%; }
.mix-legend span { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted-foreground); }
.mix-legend b { font-weight: 500; color: var(--foreground); }
.mix-legend a:hover span { color: var(--foreground); }
:is(.mix-bar span, .mix-legend a) { --c: var(--border); }
:is(.mix-bar span, .mix-legend a):nth-child(6n + 1) { --c: var(--chart-1); }
:is(.mix-bar span, .mix-legend a):nth-child(6n + 2) { --c: var(--chart-6); }
:is(.mix-bar span, .mix-legend a):nth-child(6n + 3) { --c: var(--chart-2); }
:is(.mix-bar span, .mix-legend a):nth-child(6n + 4) { --c: var(--chart-7); }
:is(.mix-bar span, .mix-legend a):nth-child(6n + 5) { --c: var(--chart-3); }
:is(.mix-bar span, .mix-legend i) { background: var(--c); }
.metric.bad .value, .metric .bad { color: var(--destructive); }
.metric.warn .value { color: var(--warning); }

/* --- the overview: one card per project (HubCard's frame, a hero spark inside) --- */
.projects { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 27rem), 1fr)); }
.pcard { position: relative; display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem; transition: box-shadow 200ms, border-color 200ms; }
.pcard:hover { box-shadow: var(--shadow-md); border-color: var(--border); }
.pc-head { display: flex; align-items: flex-start; gap: 0.625rem; }
.pc-head .initial { margin-top: 0.05rem; }
.pc-head .who { flex: 1; min-width: 0; }
.pc-head h3 { font-size: 0.875rem; font-weight: 600; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-head h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.pc-head h3 a:hover { color: inherit; }
.pc-head .when { font-size: 0.75rem; line-height: 1.625; color: var(--muted-foreground); }
.pc-chart { position: relative; height: 4.25rem; margin: 0 -0.25rem; }
.pc-metrics { --metric-size: 1.5rem; display: grid; grid-template-columns: repeat(5, minmax(0, auto)); justify-content: space-between; gap: 0.75rem; padding-top: 0.9rem; border-top: 1px solid var(--border); }
.pc-metrics .label { line-height: 1.25rem; }
.pc-metrics .sub a { position: relative; z-index: 1; color: var(--destructive); font-weight: 500; }
.pc-metrics .sub a:hover { text-decoration: underline; }

/* Status pill (HubCard's badge): muted, emerald while the project is sending. */
.status { display: inline-flex; align-items: center; flex: none; padding: 0.125rem 0.5rem; border-radius: 999px; font-size: 0.6897rem; font-weight: 500; line-height: 1rem; white-space: nowrap; background: var(--muted); color: var(--muted-foreground); }
.status.live { background: var(--positive-bg); color: var(--positive); }

/* --- tables (Decipher's Table: no frame, small muted heads, hairline rows) --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.875rem; }
th { height: 2.5rem; padding: 0 0.5rem; text-align: left; vertical-align: middle; font-size: 0.75rem; font-weight: 500; color: var(--muted-foreground); white-space: nowrap; border-bottom: 1px solid var(--border); }
td { height: 2.9rem; padding: 0.5rem; vertical-align: middle; border-bottom: 1px solid var(--border); }
.card tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color 150ms; }
:is(th, td):first-child { padding-left: 1rem; }
:is(th, td):last-child { padding-right: 1rem; }
tbody tr:hover td {
  --row-edge: inset 0 1px 0 var(--border), inset 0 -1px 0 var(--border);
  background: light-dark(color-mix(in srgb, var(--muted) 50%, transparent), var(--muted)); box-shadow: var(--row-edge);
}
tbody tr:hover td:first-child { border-radius: var(--radius) 0 0 var(--radius); box-shadow: var(--row-edge), inset 1px 0 0 var(--border); }
tbody tr:hover td:last-child { border-radius: 0 var(--radius) var(--radius) 0; box-shadow: var(--row-edge), inset -1px 0 0 var(--border); }
tbody tr:hover td:only-child { border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--border); }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.strong > a { font-weight: 500; }
td.strong .lv { margin-right: 0.5rem; }
/* A route takes the room the numbers leave and ends in an ellipsis (its title has it whole). */
td.route { width: 100%; max-width: 0; min-width: 9rem; }
.route a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 0.8rem var(--mono); }
.method { display: inline-block; min-width: 3.4rem; margin-right: 0.35rem; font: 600 0.6897rem var(--sans); letter-spacing: 0.02em; color: var(--muted-foreground); }
.sub { margin-top: 0.1rem; font-size: 0.75rem; color: var(--muted-foreground); }
.table-spark { width: 9rem; height: 1.75rem; }

/* Empty states (InteractiveEmptyState): three tilted tiles, a bold line, a muted sentence. */
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted-foreground); font-size: 0.875rem; }
.empty b { display: block; margin-bottom: 0.35rem; font: 600 1rem var(--display); color: var(--foreground); }
.empty.standalone { padding: 3.5rem 1rem; }
.empty .btn { margin-top: 1.25rem; }
.tiles { display: flex; justify-content: center; margin-bottom: 1.25rem; isolation: isolate; }
.tiles span {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: var(--r-xl); border: 1px solid var(--border);
  background: var(--card); box-shadow: var(--shadow-sm); color: var(--muted-foreground);
}
.tiles span:nth-child(1) { transform: translate(0.5rem, 0.25rem) rotate(-6deg); z-index: 1; }
.tiles span:nth-child(2) { z-index: 2; }
.tiles span:nth-child(3) { transform: translate(-0.5rem, 0.25rem) rotate(6deg); z-index: 1; }

/* --- badges: Badge "secondary" for a plain word; StatusBadge tones for levels and states
   (monochrome; red only for failure, amber only for a warning) --- */
.badge, .lv { display: inline-flex; align-items: center; gap: 0.25rem; border: 1px solid; border-radius: calc(var(--radius) - 2px); line-height: 1.35; white-space: nowrap; vertical-align: 0.05em; }
.badge {
  padding: 0.125rem 0.625rem; border-color: color-mix(in srgb, var(--muted-foreground) 25%, transparent); background: var(--chip);
  font: 600 0.75rem/1.35 var(--sans); color: var(--secondary-foreground);
}
.lv {
  min-width: 4.4rem; justify-content: center; padding: 0.125rem 0.5rem; border-color: transparent;
  background: color-mix(in srgb, var(--chip) 60%, transparent); font: 500 0.7586rem/1.35 var(--sans); color: var(--muted-foreground);
}
.lv.debug { background: color-mix(in srgb, var(--chip) 40%, transparent); color: color-mix(in srgb, var(--muted-foreground) 60%, transparent); }
.badge.ok { border-color: transparent; color: var(--foreground); }
.lv.warning, .badge.warn { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-border); }
.lv.error, .badge.bad { background: color-mix(in srgb, var(--destructive) 6%, transparent); color: var(--destructive); border-color: color-mix(in srgb, var(--destructive) 30%, transparent); }
.lv.critical { background: var(--destructive); color: var(--destructive-foreground); border-color: transparent; font-weight: 600; box-shadow: 0 4px 6px -1px color-mix(in srgb, var(--destructive) 45%, transparent); }
.s4 { color: var(--warning); } .s5 { color: var(--destructive); font-weight: 600; }

/* --- charts: brand-hue steps, the orange accent for warnings / 4xx, red only for failure --- */
.chart .legend { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-bottom: 0.75rem; font-size: 0.75rem; color: var(--muted-foreground); }
.chart .key { display: inline-flex; align-items: center; gap: 0.4rem; }
.chart .key i { width: 0.55rem; height: 0.55rem; border-radius: 2px; display: inline-block; background: currentColor; }
.chart .plot { position: relative; height: 160px; margin-left: 2.6rem; }
.chart .plot svg { width: 100%; height: 100%; overflow: visible; }
.chart .y-axis span { position: absolute; left: -2.6rem; width: 2.2rem; text-align: right; transform: translateY(-50%); font-size: 0.6897rem; color: var(--muted-foreground); }
.chart .x-axis { display: flex; justify-content: space-between; margin: 0.4rem 0 0 2.6rem; font-size: 0.6897rem; color: var(--muted-foreground); }
.chart.wide .plot { margin-left: 3.6rem; }
.chart.wide .y-axis span { left: -3.6rem; width: 3.2rem; }
.chart.wide .x-axis { margin-left: 3.6rem; }
.chart .grid { stroke: color-mix(in srgb, var(--border) 50%, transparent); stroke-width: 1; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.chart .hit, .area .hit { fill: transparent; }
.chart g:hover .hit, .chart rect.hit:hover, .area rect.hit:hover { fill: color-mix(in srgb, var(--muted) 70%, transparent); }
.chart .line { fill: none; stroke-width: 1.75; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.c-info, .c-p50 { color: var(--chart-3); }
.c-ok { color: var(--chart-2); }
.c-warn, .c-p99 { color: var(--chart-4); }
.c-p95 { color: var(--chart-0); }
.c-ev { color: var(--chart-1); }
.c-err { color: var(--destructive); }
/* One line per series (a server's charts, a project's services): the palette in an order
   that keeps neighbours apart. */
.c-s0 { color: var(--chart-1); }
.c-s1 { color: var(--chart-4); }
.c-s2 { color: var(--chart-3); }
.c-s3 { color: var(--chart-6); }
.c-s4 { color: var(--chart-2); }
.c-s5 { color: var(--chart-7); }
/* A share used (memory, a disk): a thin track under its number. */
.meter { display: block; width: 100%; min-width: 4rem; height: 4px; margin-top: 0.3rem; border-radius: 999px; background: var(--muted); overflow: hidden; corner-shape: round; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--chart-2); }
.meter.warn i { background: var(--warning); }
.meter.bad i { background: var(--destructive); }
.chart rect:not(.hit) { fill: currentColor; }
.chart .line { stroke: currentColor; }
/* The spark area (cm-hero-spark-chart): a 1.5px line over a fade of its own colour. */
.area { width: 100%; height: 100%; overflow: visible; }
.area .stroke { fill: none; stroke: currentColor; stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.area .c-err .fill { opacity: 0.8; }
.legend-inline { display: inline-flex; gap: 0.75rem; font-size: 0.6897rem; color: var(--muted-foreground); }
.legend-inline i { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 2px; margin-right: 0.3rem; vertical-align: 0; background: currentColor; }

/* --- fields and buttons (Decipher's Input, Select, Button) --- */
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=search], input[type=date], input[type=number], input[type=password], input:not([type]), select {
  height: 2.25rem; padding: 0 0.75rem; border-radius: var(--r-xl); border: 0; background: var(--input);
  box-shadow: inset 0 1px 1px 0 rgb(0 0 0 / 0.04); font-size: 0.875rem; min-width: 0;
}
::placeholder { color: color-mix(in srgb, var(--muted-foreground) 70%, transparent); }
select { appearance: none; padding-right: 2rem; background: var(--input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23787e8a'%3E%3Cpath d='M15.85 7.65c.2.2.2.5 0 .7l-5.46 5.49a.55.55 0 0 1-.78 0L4.15 8.35a.5.5 0 1 1 .7-.7L10 12.8l5.15-5.16c.2-.2.5-.2.7 0'/%3E%3C/svg%3E") no-repeat right 0.6rem center / 1rem; }
input:focus-visible, select:focus-visible { outline: 0; box-shadow: inset 0 0 0 1px var(--ring); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; height: 2.25rem; padding: 0 1.25rem;
  border-radius: var(--r-xl); border: 0; background: var(--primary); color: var(--primary-foreground);
  font-size: 0.875rem; font-weight: 500; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow); transition: background-color 150ms;
}
.btn .i { width: 1rem; height: 1rem; }
.btn:hover { background: color-mix(in srgb, var(--primary) 90%, transparent); color: var(--primary-foreground); }
.btn.outline { background: var(--field); color: var(--foreground); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--field-ring); }
.btn.outline:hover { background: var(--accent); }
.btn.ghost { background: transparent; color: var(--foreground); box-shadow: none; }
.btn.ghost:hover { background: var(--accent); }
.btn.danger { background: var(--destructive); color: var(--destructive-foreground); box-shadow: var(--shadow-sm); }
.btn.danger:hover { background: color-mix(in srgb, var(--destructive) 90%, transparent); color: var(--destructive-foreground); }
.btn.sm { height: 2rem; padding: 0 0.75rem; font-size: 0.75rem; }
.btn.on { background: var(--primary); color: var(--primary-foreground); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 35%, transparent); }
.icon-btn {
  display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none; border-radius: var(--r-xl);
  border: 0; background: transparent; color: var(--muted-foreground); cursor: pointer;
}
.icon-btn:hover { background: var(--accent); color: var(--foreground); }
.icon-btn.round { border-radius: 50%; }
.icon-btn .i { width: 1.1rem; height: 1.1rem; }
/* DataView's toolbar: a filled search field with its icon, dashed filter chips, the action last. */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.filters .q { position: relative; flex: 0 1 17rem; min-width: 12rem; }
.filters .push { margin-left: auto; }
.filters .q .i { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); width: 1rem; height: 1rem; color: var(--muted-foreground); pointer-events: none; }
.filters .q input { width: 100%; padding-left: 2.25rem; }
.filters :is(select, input.short) {
  padding: 0 0.75rem 0 2rem; border: 1px dashed var(--chip-dash);
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23787e8a'%3E%3Cpath d='M6 10c0-.28.22-.5.5-.5h3v-3a.5.5 0 0 1 1 0v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3A.5.5 0 0 1 6 10m4 8a8 8 0 1 0 0-16 8 8 0 0 0 0 16m0-1a7 7 0 1 1 0-14 7 7 0 0 1 0 14'/%3E%3C/svg%3E") no-repeat 0.65rem center / 1rem;
  box-shadow: var(--shadow-sm), inset 0 0 0 1px light-dark(transparent, var(--field-ring)); font-size: 0.75rem; font-weight: 500; color: var(--foreground);
}
.filters input.short { width: 8.5rem; }
.filters input.short::placeholder { color: var(--muted-foreground); font-weight: 500; }
.filters :is(select, input.short):hover { background-color: var(--accent); }
.filters :is(select, input.short):focus-visible { border-style: solid; border-color: var(--ring); box-shadow: none; }
.filters label { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--muted-foreground); }
.inline { display: inline; }
.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* Notices (Decipher's info callout: rounded-xl, the info tint; red for failure). */
.msgs { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.5rem; }
.msgs li { padding: 0.65rem 0.9rem; border-radius: var(--r-xl); border: 1px solid color-mix(in srgb, var(--info) 70%, transparent); background: color-mix(in srgb, var(--info) 30%, transparent); color: var(--info-foreground); font-size: 0.875rem; }
.msgs li.error { border-color: color-mix(in srgb, var(--destructive) 25%, transparent); background: color-mix(in srgb, var(--destructive) 8%, var(--card)); color: var(--destructive); }
.msgs li.success { border-color: color-mix(in srgb, var(--success) 25%, transparent); background: color-mix(in srgb, var(--success) 8%, var(--card)); color: var(--success); }
.secret { font-family: var(--mono); background: var(--chip); padding: 0.7rem 0.9rem; border-radius: var(--radius); word-break: break-all; user-select: all; }
.card.fresh { border-color: color-mix(in srgb, var(--success) 45%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 10%, transparent); }

/* --- events --- */
.events { font-size: 0.875rem; }
.events td { height: auto; padding-top: 0.55rem; padding-bottom: 0.55rem; vertical-align: top; }
.events .ts { font-family: var(--mono); font-size: 0.75rem; color: var(--muted-foreground); white-space: nowrap; padding-top: 0.7rem; }
.events td:has(.lv) { padding-top: 0.6rem; }
.events .msg { word-break: break-word; }
.events .msg .meta { color: var(--muted-foreground); font-size: 0.75rem; margin-top: 0.15rem; }
.events .msg .meta a { text-decoration: underline dotted; text-underline-offset: 2px; }
.events tr.lv-error td, .events tr.lv-critical td { background: color-mix(in srgb, var(--destructive) 4%, transparent); }
.events tr.new td { animation: flash 2.5s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--primary) 12%, transparent); } }
pre { margin: 0; font: 0.8rem/1.55 var(--mono); background: var(--chip); padding: 0.8rem 1rem; border-radius: var(--radius); overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
pre + pre { margin-top: 0.75rem; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0; margin: 0; font-size: 0.875rem; }
dl.kv dt, dl.kv dd { padding: 0.55rem 0; border-bottom: 1px solid var(--border); }
dl.kv dt { color: var(--muted-foreground); padding-right: 1.5rem; }
dl.kv dd { margin: 0; word-break: break-all; }
dl.kv :is(dt, dd):nth-last-child(-n + 2) { border-bottom: 0; }
.pager {
  position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-top: 0.5rem; padding: 0.75rem 1rem 0.75rem 1.5rem; border-top: 1px solid var(--card); border-radius: 0.125rem 0.125rem var(--radius) var(--radius);
  background: color-mix(in srgb, var(--muted) 90%, transparent); font-size: 0.75rem; font-weight: 500;
}
.pager .btn { background: var(--card); }
.pager .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.live-state { font-size: 0.75rem; color: var(--muted-foreground); }
td details summary { cursor: pointer; font-size: 0.8rem; margin-top: 0.25rem; }
td details pre { margin-top: 0.4rem; }

/* --- trace --- */
.waterfall td.bar { width: 30%; min-width: 10rem; }
.waterfall .track { position: relative; overflow: hidden; height: 0.6rem; background: var(--chip); border-radius: 999px; margin-top: 0.45rem; }
.waterfall .mark { position: absolute; top: -1px; width: 3px; height: calc(100% + 2px); border-radius: 2px; background: var(--chart-0); }
.waterfall .mark.error, .waterfall .mark.critical { background: var(--destructive); }
.waterfall .mark.warning { background: var(--chart-4); }
.waterfall .span { position: absolute; top: 0; height: 100%; border-radius: 999px; background: color-mix(in srgb, var(--chart-2) 45%, transparent); }

/* --- log in: Decipher's sign-in page (as Sanctum draws it): a cover — the logo, a headline with
   the brand word in navy, one line under it and an isometric drawing — beside the card with the
   form. One column below 900px, where the drawing shrinks to a strip above the card. --- */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-inner { width: 100%; max-width: 68rem; display: grid; align-items: center; grid-template-columns: minmax(0, 1.25fr) minmax(0, 26rem); gap: clamp(2.5rem, 6vw, 6rem); }
.auth-cover { min-width: 0; }
.auth-top { display: inline-flex; }
.auth-hero { margin: 2.25rem 0 0; font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.05; letter-spacing: -0.03em; text-wrap: balance; }
.auth-hero span { color: var(--primary); }
.auth-lede { margin: 1rem 0 0; max-width: 40ch; font-size: 1.05rem; line-height: 1.5; color: var(--muted-foreground); }
.auth-more { display: inline-flex; align-items: center; gap: 0.25rem; margin-top: 1rem; font-weight: 500; color: var(--primary); }
.auth-more .i { width: 1rem; height: 1rem; }

/* The drawing (ui/_tower_drawing.svg): every block three faces, lit from the top-left; the lit
   ones are the brand navy, a few more half-lit around them. */
.iso {
  display: block; width: 100%; height: auto; margin-top: 2.5rem; overflow: visible;
  --box-top: light-dark(hsl(0 0% 100%), hsl(220 5% 20%));
  --box-left: light-dark(hsl(215 12% 94%), hsl(220 0% 9%));
  --box-right: light-dark(hsl(219 12% 90%), hsl(220 6% 13%));
  --box-edge: light-dark(hsl(220 13% 86%), hsl(220 5% 22%));
}
.iso polygon { stroke: var(--box-edge); stroke-width: 0.6; stroke-linejoin: round; }
.iso .t { fill: var(--box-top); }
.iso .l { fill: var(--box-left); }
.iso .r { fill: var(--box-right); }
.iso .hi polygon { stroke: var(--primary); }
.iso .hi .t { fill: var(--primary); }
.iso .hi .l { fill: color-mix(in srgb, var(--primary) 70%, var(--background)); }
.iso .hi .r { fill: color-mix(in srgb, var(--primary) 85%, var(--background)); }
.iso .mid polygon { stroke: color-mix(in srgb, var(--primary) 55%, var(--box-edge)); }
.iso .mid .t { fill: color-mix(in srgb, var(--primary) 18%, var(--box-top)); }
/* The servers' slots and lights, the shaft's rungs, the cab's lit windows and its roof. */
.iso .slot { fill: color-mix(in srgb, var(--box-edge) 60%, var(--box-right)); stroke: none; }
.iso .led { fill: var(--box-top); stroke: none; }
.iso .led-lit { fill: var(--primary); stroke: none; }
.iso .rung { fill: var(--box-edge); stroke: none; }
.iso .win { fill: color-mix(in srgb, var(--primary) 85%, var(--background)); stroke: var(--primary); }
.iso .roof-r { fill: var(--primary); stroke: var(--primary); }
.iso .roof-l { fill: color-mix(in srgb, var(--primary) 70%, var(--background)); stroke: var(--primary); }

/* The card: controls one size up (3rem), the submit centred and generous. */
.auth-card { min-width: 0; background: var(--card); border-radius: calc(var(--radius) * 2); box-shadow: var(--shadow-lg); padding: 1.5rem 2rem 2rem; }
.auth-card form { display: flex; flex-direction: column; gap: 1.5rem; }
.auth-head { margin-bottom: 1.75rem; }
.auth-title { margin: 0 0 0.75rem; font-size: 1.25rem; line-height: 1; letter-spacing: -0.025em; }
.auth-subtitle { font-size: 0.8125rem; }
.auth-field { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.auth-field label { font-weight: 500; font-size: 0.875rem; line-height: 1; }
.auth-control { position: relative; display: flex; align-items: center; }
.auth-control .i { position: absolute; left: 0.8rem; width: 1rem; height: 1rem; color: var(--muted-foreground); opacity: 0.7; pointer-events: none; }
.auth-control input { width: 100%; height: 3rem; padding: 0 1rem 0 2.5rem; }
.auth-submit { width: max-content; max-width: 100%; height: 3rem; margin: 0.25rem auto 0; padding: 0 2.5rem; }
.auth-foot { text-align: center; margin-top: 1.5rem; font-size: 0.8125rem; }
@media (max-width: 899px) {
  .auth-shell { place-items: start center; }
  .auth-inner { grid-template-columns: minmax(0, 1fr); max-width: 28rem; gap: 2rem; }
  .auth-hero { margin-top: 1.5rem; }
  .iso { margin-top: 1.5rem; max-height: 9rem; }
}
@media (max-width: 639px) {
  .auth-card { padding: 1.25rem 1.25rem 1.5rem; }
  .auth-submit { width: 100%; }
}

/* --- home (ui/home.html, `/` for a visitor): Sanctum's front door. One loud thing, the hero's
   rings (the tower at the core, what it watches around it); below, quiet sections: what it
   shows, a numbered journey, the facts, the way in. Widths are container queries on .hiw. --- */
.hiw-public { width: 100%; max-width: 68rem; align-self: start; }
.hiw-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.hiw-btns { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.hiw-hero-copy .hiw-btns { margin-top: 1.75rem; }
.hiw { container-type: inline-size; max-width: 68rem; margin: 0 auto; padding-bottom: 1.5rem; }
.hiw-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); align-items: center; gap: clamp(2rem, 5cqi, 4.5rem); padding: clamp(1.5rem, 4cqi, 3rem) 0 clamp(2.5rem, 5cqi, 4rem); }
.hiw-title { font-size: clamp(2.2rem, 5cqi, 3.3rem); line-height: 1.04; letter-spacing: -0.035em; text-wrap: balance; }
.hiw-lede { margin-top: 1.25rem; max-width: 32rem; font-size: 1.1rem; line-height: 1.6; color: var(--muted-foreground); text-wrap: pretty; }
.hiw-badges { margin-top: 1.25rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
/* A check mark drawn in CSS (the sprite has none): the badges and the facts. */
.check { flex: none; width: 0.4rem; height: 0.7rem; margin: 0 0.3rem 0.15rem 0.1rem; border: solid var(--success); border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* The rings: tint deepens toward the core, which is the brand navy with the tower on it. */
.rings { display: block; width: 100%; max-width: 26rem; height: auto; margin: 0 auto; overflow: visible; }
.rings-orbit { fill: none; stroke: var(--border); stroke-width: 1.25; stroke-dasharray: 2 7; stroke-linecap: round; }
.rings-1 { fill: color-mix(in srgb, var(--primary) 7%, var(--card)); stroke: color-mix(in srgb, var(--primary) 12%, var(--border)); }
.rings-2 { fill: color-mix(in srgb, var(--primary) 14%, var(--card)); stroke: color-mix(in srgb, var(--primary) 22%, var(--border)); }
.rings-3 { fill: color-mix(in srgb, var(--primary) 24%, var(--card)); stroke: color-mix(in srgb, var(--primary) 36%, var(--border)); }
.rings-core { fill: var(--primary); }
.rings-halo { fill: color-mix(in srgb, var(--primary) 22%, transparent); }
.rings-mark { fill: var(--primary-foreground); }
.rings-pill rect { fill: var(--card); stroke: var(--border); }
.rings-pill text { font: 600 10.5px var(--sans); fill: var(--foreground); text-anchor: middle; dominant-baseline: central; }
.rings-pill.is-gate rect { fill: color-mix(in srgb, var(--primary) 12%, var(--card)); stroke: none; }
.rings-pill.is-gate text { fill: var(--primary); }

/* A section: a heading, then its body. Space, not rules, divides them. */
.hiw-sec { margin-top: clamp(3rem, 7cqi, 4.5rem); }
.hiw h3, .hiw-cta h3 { margin: 0 0 1.5rem; font-size: clamp(1.25rem, 2.6cqi, 1.6rem); letter-spacing: -0.025em; text-wrap: balance; }

/* What it shows: one tile per page. */
.hiw-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.hiw-feat { min-width: 0; padding: 1.25rem 1.4rem 1.4rem; border-radius: calc(var(--radius) * 2); background: var(--card); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--field-ring); }
.hiw-feat-ico { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: var(--r-xl); background: color-mix(in srgb, var(--primary) 10%, var(--card)); color: var(--primary); }
.hiw-feat h4 { margin: 1.1rem 0 0.35rem; font: 600 1rem var(--display); letter-spacing: -0.01em; }
.hiw-feat p { color: var(--muted-foreground); line-height: 1.6; text-wrap: pretty; }

/* The journey: five numbered steps joined by a line that darkens toward the end; a column
   below 860px. */
.hiw-chain { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.25rem; }
.hiw-node { position: relative; min-width: 0; }
.hiw-node b { display: block; margin-top: 1rem; font: 600 0.95rem var(--display); letter-spacing: -0.01em; }
.hiw-node > span:last-child { display: block; margin-top: 0.3rem; font-size: 0.875rem; line-height: 1.5; color: var(--muted-foreground); text-wrap: pretty; }
.hiw-node:not(:last-child)::after {
  content: ""; position: absolute; top: 1.75rem; left: 4.25rem; right: -0.5rem; height: 2px; border-radius: 1px;
  background: linear-gradient(var(--chain-dir, 90deg), var(--border), color-mix(in srgb, var(--primary) 45%, var(--border)));
}
.hiw-ico { position: relative; display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: var(--r-xl); background: var(--card); color: var(--primary); box-shadow: var(--blick-sm); }
.hiw-ico .i { width: 1.4rem; height: 1.4rem; }
.hiw-step { position: absolute; top: -0.45rem; right: -0.45rem; display: grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; corner-shape: round; background: var(--card); box-shadow: inset 0 0 0 1px var(--field-ring); font-size: 0.7rem; font-weight: 700; color: var(--muted-foreground); }
.hiw-node.is-end .hiw-ico { background: var(--primary); color: var(--primary-foreground); }

/* The facts, and the one approximation. */
.hiw-facts { padding: clamp(1.5rem, 3.5cqi, 2.25rem); border-radius: calc(var(--radius) * 2); background: var(--card); box-shadow: inset 0 0 0 1px var(--field-ring), var(--shadow-xl); }
.hiw-facts ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 2rem; }
.hiw-facts li, .hiw-tradeoff { display: flex; align-items: flex-start; gap: 0.65rem; line-height: 1.55; color: var(--muted-foreground); }
.hiw-facts li .check { margin-top: 0.3rem; }
.hiw-facts b { color: var(--foreground); font-weight: 600; }
.hiw-tradeoff { margin-top: 1.5rem; padding: 1rem 1.1rem; border-radius: var(--r-xl); background: var(--amber-bg); }
.hiw-tradeoff .i { color: var(--warning); margin-top: 0.1rem; }

/* The way in: the page's one navy surface. */
.hiw-cta {
  margin-top: 2rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  padding: clamp(1.5rem, 3.5cqi, 2.25rem); border-radius: calc(var(--radius) * 2); background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-xl);
}
.hiw-cta h3 { margin: 0; }
.hiw-cta p { margin-top: 0.4rem; max-width: 34rem; color: color-mix(in srgb, var(--primary-foreground) 75%, transparent); }
.hiw-cta .btn { background: var(--primary-foreground); color: var(--primary); box-shadow: none; }
.hiw-cta .btn:hover { background: color-mix(in srgb, var(--primary-foreground) 88%, transparent); color: var(--primary); }

.hiw-specs { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; margin-top: 2rem; }

@container (max-width: 860px) {
  .hiw-chain { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
  .hiw-node { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); column-gap: 1rem; }
  .hiw-node .hiw-ico { grid-row: span 2; }
  .hiw-node b { margin: 0.35rem 0 0; }
  .hiw-node:not(:last-child)::after { top: 3.5rem; bottom: -1.4rem; left: 1.7rem; right: auto; width: 2px; height: auto; --chain-dir: 180deg; }
  .hiw-features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 720px) {
  .hiw-hero { grid-template-columns: minmax(0, 1fr); }
  .rings { max-width: 20rem; }
  .hiw-facts ul, .hiw-features { grid-template-columns: minmax(0, 1fr); }
}

/* --- narrower: the search shrinks, then (below 1024px) the sidebar becomes a sheet --- */
@media (max-width: 1280px) { .search { width: 18rem; } }
.scrim { display: none; }
@media (max-width: 1024px) {
  .sidebar {
    position: fixed; z-index: 40; left: 0; top: 0; width: 18rem; background: var(--background);
    transform: translateX(-100%); box-shadow: var(--shadow-xl);
  }
  #collapse { display: none; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / 0.3); }
  #menu { display: inline-grid; margin-left: -0.5rem; }
  .topbar { --gutter: 0.75rem; padding: 0 0.75rem; }
  .topbar .title { padding-left: 0.25rem; }
  .page { padding: 0 0.75rem 0.75rem; }
  .surface { border-radius: calc(var(--r-xl) + 0.75rem); padding: 0.75rem; }
  .summary { padding: 1.25rem; }
}
@media (max-width: 767px) {
  .topbar { grid-template-rows: 4rem auto; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'menu title actions' 'search search search'; }
  .search { width: auto; padding-bottom: 0.75rem; }
  .search input[type=search] { height: 2.75rem; font-size: 0.875rem; }
  .search kbd { display: none; }
  .search .i { top: calc(50% - 0.375rem); }
  .user-btn span { display: none; }
  .user-btn { padding: 0.25rem; }
  .metrics { justify-content: flex-start; gap: 1rem 2rem; }
  .metrics { --metric-size: 1.5rem; }
  .pc-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters .q { flex: 1 1 100%; }
}
