/* CostWatch UI
 * =============================================================================
 * Design decisions, so the next person does not have to reverse engineer them.
 *
 * COLOR. Neutrals are biased blue, never a default grey: this is an instrument
 * that reads money moving through infrastructure, and the greys should feel
 * chosen. The accent is a cool instrument blue used ONLY for chrome and
 * interaction (links, active nav, primary buttons, ordinary data bars). That
 * leaves the warm half of the wheel free to carry meaning exclusively, and it
 * means the accent never competes with the data:
 *     amber  = an expected purchase (a reservation buy, not a runaway VM)
 *     red    = an anomaly, or cost moving up
 *     green  = savings, or cost moving down
 * Semantic color is deliberately not the accent, per dashboard practice.
 *
 * TYPE. System sans for prose and UI, paired with a monospace stack for every
 * figure: dollar amounts, resource ids, az commands, table numerals. A cost
 * tool where all the numbers are monospaced reads like an instrument, and the
 * columns line up without fighting. Tabular numerals on top of that.
 *
 * LAYOUT. A fixed left rail carries global nav plus, inside a subscription,
 * that subscription's own sections; content sits beside it and stays fluid.
 * Under 900px the rail becomes a horizontally scrolling chip row so nothing is
 * buried in a hamburger. Marketing pages use a separate centered shell with no
 * rail at all.
 *
 * THEMES. Bare :root is the complete light palette. Dark redefines tokens only,
 * guarded so an explicit light choice beats a dark OS. Components read tokens
 * and never declare a color inside a media or [data-theme] block.
 * =============================================================================
 */

@font-face {
  font-family: "Inter var";
  src: url("/static/inter-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* neutrals, biased blue */
  --page: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --sunken: #eceff4;
  --ink: #111722;
  --ink-2: #414c5c;
  --muted: #737e8d;
  --line: #e0e5ec;
  --line-strong: #ccd4de;

  /* chrome accent: interaction and ordinary data */
  --accent: #2557c7;
  --accent-2: #5b3df5;
  --accent-hover: #1c449e;
  --accent-quiet: rgba(37, 87, 199, 0.09);
  --on-accent: #ffffff;

  /* semantics, reserved for meaning */
  --good: #0d7a52;
  --good-quiet: rgba(13, 122, 82, 0.10);
  --warn: #a2650a;
  --warn-quiet: rgba(162, 101, 10, 0.12);
  --crit: #c0392f;
  --crit-quiet: rgba(192, 57, 47, 0.10);
  --on-crit: #ffffff;

  --grid: rgba(17, 23, 34, 0.07);
  --shadow: 0 1px 2px rgba(17, 23, 34, 0.05), 0 8px 24px rgba(17, 23, 34, 0.05);
  --shadow-lift: 0 12px 40px rgba(17, 23, 34, 0.18);
  --focus: #2557c7;

  --sheen: none;
  --sans: "Inter var", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --rail: 232px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0a0d13;
    --surface: #131a27;
    --surface-2: #1b2334;
    --sunken: #0f141c;
    --ink: #e7ebf2;
    --ink-2: #a9b4c4;
    --muted: #76828F;
    --line: #232c3a;
    --line-strong: #34404f;

    --accent: #4f7df7;
    --accent-2: #7c5cf6;
    --accent-hover: #6b93f9;
    --accent-quiet: rgba(106, 151, 245, 0.14);
    --on-accent: #ffffff;

    --good: #3cc78f;
    --good-quiet: rgba(60, 199, 143, 0.14);
    --warn: #e0a44a;
    --warn-quiet: rgba(224, 164, 74, 0.15);
    --crit: #f2695c;
    --crit-quiet: rgba(242, 105, 92, 0.15);
    --on-crit: #0c1017;

    --grid: rgba(231, 235, 242, 0.07);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lift: 0 12px 40px rgba(0, 0, 0, 0.6);
    --focus: #8fb1f8;
    --sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 46%);
  }
}

:root[data-theme="dark"] {
  --page: #0a0d13;
  --surface: #131a27;
  --surface-2: #1b2334;
  --sunken: #0f141c;
  --ink: #e7ebf2;
  --ink-2: #a9b4c4;
  --muted: #76828F;
  --line: #232c3a;
  --line-strong: #34404f;

  --accent: #4f7df7;
  --accent-2: #7c5cf6;
  --accent-hover: #6b93f9;
  --accent-quiet: rgba(106, 151, 245, 0.14);
  --on-accent: #ffffff;

  --good: #3cc78f;
  --good-quiet: rgba(60, 199, 143, 0.14);
  --warn: #e0a44a;
  --warn-quiet: rgba(224, 164, 74, 0.15);
  --crit: #f2695c;
  --crit-quiet: rgba(242, 105, 92, 0.15);
  --on-crit: #0c1017;

  --grid: rgba(231, 235, 242, 0.07);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lift: 0 12px 40px rgba(0, 0, 0, 0.6);
  --focus: #8fb1f8;
  --sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 46%);
}

/* ---------- base ---------- */

body {
  font-family: var(--sans);
  background: var(--page);
  color: var(--ink);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 { line-height: 1.25; text-wrap: balance; font-weight: 650; }
h1 { font-size: 1.5rem; letter-spacing: -0.015em; }
h2 { font-size: 1.05rem; letter-spacing: -0.005em; }
h3 { font-size: 0.95rem; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

.mono, .statnum, .price, .findingcost, code, pre {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- shell ---------- */

.appshell { display: block; }
body.has-rail .appshell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  padding: 0 8px;
}
.brand span { color: var(--accent); }
.brand::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 4px;
  margin-right: 8px;
  vertical-align: -1px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.navgroup { display: flex; flex-direction: column; gap: 2px; }
.navlabel {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--muted);
  padding: 0 8px 6px;
}
.navlink {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 2px solid transparent;
}
.navlink:hover { background: var(--surface-2); color: var(--ink); }
.navlink.active {
  background: var(--accent-quiet);
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
}
.navlink .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.navlink.active .count { color: var(--accent); }

.railfoot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 16px; }
.railfoot .navlink { font-size: 0.85rem; }
.railuser {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0 9px;
  word-break: break-all;
}

/* top bar carries the brand on marketing pages and on mobile */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--page) 78%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
body.has-rail .topbar { display: none; }
.navlinks { display: flex; align-items: center; gap: 18px; }
.navlinks a { color: var(--ink-2); text-decoration: none; font-size: 0.92rem; }
.navlinks a:hover { color: var(--ink); }

.content { padding: 26px 28px 64px; min-width: 0; }
.container { max-width: 880px; margin: 0 auto; padding: 30px 20px 64px; }
.wide { max-width: 1120px; margin: 0 auto; }

.sitefoot {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 28px 20px 40px;
  border-top: 1px solid var(--line);
}
.sitefoot a { color: var(--muted); }

@media (max-width: 900px) {
  body.has-rail .appshell { grid-template-columns: minmax(0, 1fr); }
  body.has-rail .topbar { display: flex; }
  .rail {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 12px;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .rail .brand, .navlabel, .railuser { display: none; }
  .navgroup { flex-direction: row; gap: 4px; }
  .navlink { white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; }
  .navlink.active { border-left: 0; border-bottom-color: var(--accent); }
  .railfoot { margin-top: 0; flex-direction: row; padding-top: 0; }
  .content { padding: 20px 16px 56px; }
}

/* ---------- cards and surfaces ---------- */

.card {
  background: var(--surface);
  background-image: var(--sheen);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card > h2 { margin-bottom: 4px; }
.card > h2 + .muted, .card > h2 + p { margin-bottom: 12px; }
.card > table, .card > .chartframe { margin-top: 12px; }

.cardlist { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.rowcard {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--ink);
  margin-bottom: 0;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.rowcard:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  color: var(--ink);
}
.rowcard .rowmain { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rowcard .muted { margin-left: auto; }
.rowcard .badge-alert { margin-left: 0; }

.emptystate {
  text-align: center;
  padding: 34px 20px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.emptystate h2 { color: var(--ink); margin-bottom: 6px; }
.emptystate p { max-width: 46ch; margin: 0 auto; }

/* ---------- buttons and controls ---------- */

.btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--on-accent);
  border: 1px solid transparent;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 650;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: filter 0.12s ease, transform 0.12s ease;
}
.btn:hover { filter: brightness(1.12); color: var(--on-accent); transform: translateY(-1px); }
.btn-sm { padding: 6px 11px; font-size: 0.82rem; }
.btn-lg { padding: 11px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: var(--accent-quiet); color: var(--accent); }
.btn-danger { background: var(--crit); color: var(--on-crit); }
.btn-danger:hover { background: var(--crit); filter: brightness(0.92); color: var(--on-crit); }

.linklike {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.linklike:hover { color: var(--ink); }
.danger { color: var(--crit); }
.inline { display: inline; }

button[disabled] { opacity: 0.55; cursor: default; }

/* ---------- forms ---------- */

label {
  display: block;
  margin-bottom: 14px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
}
label.nomb { margin-bottom: 0; }
label .muted { font-weight: 400; }
label .muted.small, label span.muted {
  display: inline;
}
label > .muted:not(.inline) { font-size: 0.82rem; }

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.92rem;
  background: var(--surface-2);
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  background: var(--surface);
  border-color: var(--accent);
}
input[type="file"] { padding: 7px 9px; background: var(--surface-2); }
input::placeholder { color: var(--muted); }
.stacked button { margin-top: 6px; }
.formcard { max-width: 560px; }
.authbox { max-width: 400px; margin: 56px auto; }
.inlineform { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 12px; }
.inlineform input { width: auto; margin-top: 0; }

/* ---------- text utilities ---------- */

.center { text-align: center; }
.small { font-size: 0.84rem; }
.muted { color: var(--muted); font-weight: 400; }
p + p, p + .metrictable { margin-top: 10px; }
.card p + p { margin-top: 8px; }

.flash {
  background: var(--accent-quiet);
  border: 1px solid transparent;
  border-left: 3px solid var(--accent);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: 1px;
}
.badge-pro { background: var(--accent); color: var(--on-accent); }
.badge-alert { background: var(--crit-quiet); color: var(--crit); margin-left: auto; }
.badge-actual { background: var(--good-quiet); color: var(--good); }
.badge-estimate { background: var(--sunken); color: var(--muted); }
.badge-locked { background: var(--warn-quiet); color: var(--warn); }

/* ---------- page furniture ---------- */

.pagehead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.pagehead h1 { margin-bottom: 0; }
.pagehead .subhead { color: var(--muted); font-size: 0.88rem; margin-top: 2px; }
.sharebar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.crumbs {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- stat tiles ---------- */

.statrow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--surface);
  background-image: var(--sheen);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 15px 17px;
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
  justify-content: flex-end;
}
.stat .muted {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 650;
  color: var(--muted);
  line-height: 1.35;
}
.statnum {
  font-size: 1.7rem;
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.12;
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
}
.stat-good .statnum { color: var(--good); }
.stat-crit .statnum { color: var(--crit); }
.delta-up { color: var(--crit); font-weight: 650; font-family: var(--mono); }
.delta-down { color: var(--good); font-weight: 650; font-family: var(--mono); }

.stat.rangebar { flex-direction: row; align-items: center; justify-content: center; gap: 6px; }
.rangebar { display: flex; gap: 6px; align-items: center; justify-content: center; }
.rangelink {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink-2);
  border: 1px solid var(--line-strong);
  font-size: 0.82rem;
  font-family: var(--mono);
}
.rangelink:hover { border-color: var(--accent); color: var(--accent); }
.rangelink.active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* ---------- chart ---------- */

.chartframe {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 12px 12px 6px;
}
.chartscale {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--mono);
  margin-bottom: 4px;
}
.chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 210px;
  overflow-x: auto;
  padding-top: 8px;
  background-image: repeating-linear-gradient(to top, var(--grid) 0 1px, transparent 1px 25%);
  border-bottom: 1px solid var(--line-strong);
}
.chartcol {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 0 13px;
  min-width: 13px;
  height: 100%;
  justify-content: flex-end;
}
.bartrack { width: 100%; height: 100%; display: flex; align-items: flex-end; }
.bar {
  width: 100%;
  background: linear-gradient(180deg, var(--accent) 0%,
              color-mix(in srgb, var(--accent) 45%, transparent) 100%);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: filter 0.12s ease;
}
.chartcol:hover .bar { filter: brightness(1.25); }
.chartcol:not(:nth-child(5n + 1)) .barlabel { visibility: hidden; }
.bar-anom { background: var(--crit); }
.bar-purchase {
  background: repeating-linear-gradient(
    45deg, var(--warn) 0 3px, var(--warn-quiet) 3px 6px);
  border: 1px solid var(--warn);
  border-bottom: 0;
}
.barlabel {
  font-size: 0.64rem;
  color: var(--muted);
  margin-top: 6px;
  font-family: var(--mono);
  white-space: nowrap;
}
.chartkey {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--muted);
}
.chartkey span { display: inline-flex; align-items: center; gap: 6px; }
.keyswatch {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--accent);
  flex: none;
}
.keyswatch.anom { background: var(--crit); }
.keyswatch.purchase {
  background: repeating-linear-gradient(
    45deg, var(--warn) 0 3px, var(--warn-quiet) 3px 6px);
  border: 1px solid var(--warn);
}

/* ---------- tables ---------- */

.tablewrap { overflow-x: auto; }
.metrictable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.metrictable th, .metrictable td {
  text-align: left;
  padding: 8px 14px 8px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.metrictable tbody tr:last-child td { border-bottom: 0; }
.metrictable th {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  border-bottom-color: var(--line-strong);
  white-space: nowrap;
}
.metrictable td.num, .metrictable .muted:not(a) { font-variant-numeric: tabular-nums; }
.metrictable a { text-decoration: none; font-weight: 550; }
.metrictable a:hover { text-decoration: underline; }
.status-good { color: var(--good); font-family: var(--mono); }
.status-miss { color: var(--crit); font-family: var(--mono); }

.sharecell { width: 34%; min-width: 90px; }
.hbartrack {
  display: block;
  width: 100%;
  height: 7px;
  border-radius: 4px;
  background: var(--sunken);
  overflow: hidden;
}
.hbar { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.hbartrack.wide { width: 100%; max-width: 460px; }
.hbar.over { background: var(--crit); }

/* ---------- code ---------- */

pre {
  background: var(--sunken);
  border: 1px solid var(--line);
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
pre code { font-size: 0.82rem; color: var(--ink-2); }
code { font-size: 0.86em; }

.codeblock { position: relative; }
.codeblock pre { padding-right: 74px; }
.copybtn {
  position: absolute;
  top: 7px;
  right: 7px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  border-radius: var(--radius-sm);
  padding: 3px 9px;
  font-size: 0.74rem;
  font-family: var(--sans);
  font-weight: 600;
  cursor: pointer;
}
.copybtn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- savings ---------- */

.savingscard {
  border-left: 3px solid var(--good);
  background: linear-gradient(to right, var(--good-quiet), transparent 60%), var(--surface);
}
.savingscard h2 { color: var(--good); font-size: 1.25rem; }

.finding {
  border-top: 1px solid var(--line);
  padding: 14px 0 14px 14px;
  border-left: 3px solid var(--line-strong);
  margin-left: -2px;
}
.finding:first-of-type { border-top: none; }
.finding-high { border-left-color: var(--crit); }
.finding-med { border-left-color: var(--warn); }
.finding-low { border-left-color: var(--accent); }
.findinghead {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}
.findingcost { white-space: nowrap; font-weight: 650; font-size: 0.95rem; }
.findingfoot { display: flex; gap: 14px; align-items: center; margin-top: 8px; }
.azcmd {
  overflow-x: auto;
  background: var(--sunken);
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  margin-top: 8px;
}

/* ---------- container apps ---------- */

.profilebox {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 14px 0;
  background: var(--surface-2);
}
.profilebox h3 { margin-bottom: 4px; }
.allocrow { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.alloclabel { font-size: 0.84rem; font-variant-numeric: tabular-nums; }
.headroom {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--good);
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
}

/* ---------- danger zone ---------- */

.dangerzone {
  border: 1px solid var(--crit-quiet);
  border-left: 3px solid var(--crit);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px 20px;
  margin-top: 26px;
}
.dangerzone h2 { color: var(--crit); }
.dangerzone p { color: var(--ink-2); font-size: 0.88rem; }
.dangerzone ul { margin: 8px 0 12px 20px; font-size: 0.88rem; color: var(--ink-2); }
.dangerzone li { margin: 3px 0; }

/* ---------- marketing ---------- */

.hero {
  padding: 64px 0 44px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 56px;
  align-items: center;
}
@media (max-width: 920px) { .hero { grid-template-columns: 1fr; gap: 32px; } }
.hero h1 { font-size: 2.35rem; line-height: 1.12; letter-spacing: -0.03em; margin-bottom: 16px; }
.hero .sub { font-size: 1.05rem; color: var(--ink-2); margin-bottom: 26px; max-width: 60ch; }
.eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 14px;
}
.fineprint { color: var(--muted); font-size: 0.84rem; margin-top: 14px; }
.ctarow { display: flex; gap: 12px; flex-wrap: wrap; }

.section { margin: 56px 0; }
.section > h2 { font-size: 1.5rem; letter-spacing: -0.02em; margin-bottom: 6px; }
.section > .lede { color: var(--ink-2); max-width: 62ch; margin-bottom: 22px; }

.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 920px) { .cols3 { grid-template-columns: 1fr; } }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.feature { margin-bottom: 0; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--ink-2); font-size: 0.9rem; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.step { padding-top: 14px; border-top: 2px solid var(--accent); }
.stepnum {
  display: block;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.step h3 { margin-bottom: 4px; }
.step p { color: var(--ink-2); font-size: 0.9rem; }

.pricegrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 380px));
  justify-content: center;
  gap: 20px;
}
@media (max-width: 760px) { .pricegrid { grid-template-columns: 1fr; } }
.plan { margin-bottom: 0; display: flex; flex-direction: column; }
.plan-featured {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
              var(--shadow-lift);
}
.planname { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--muted); }
.price { font-size: 2.1rem; font-weight: 700; letter-spacing: -0.03em; margin: 6px 0 2px; }
.permo { font-size: 0.9rem; font-weight: 500; color: var(--muted); font-family: var(--sans); }
.plan .planfor { color: var(--ink-2); font-size: 0.88rem; margin-bottom: 14px; }
.plan ul { list-style: none; margin: 0 0 18px; color: var(--ink-2); font-size: 0.89rem; }
.plan li { padding: 4px 0 4px 20px; position: relative; }
.plan li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 12px;
  width: 9px;
  height: 5px;
  border-left: 2px solid var(--good);
  border-bottom: 2px solid var(--good);
  transform: rotate(-45deg);
}
.plan .btn { margin-top: auto; text-align: center; }

.faq .faqgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 760px) { .faq .faqgrid { grid-template-columns: 1fr; } }
.faq .card { margin-bottom: 0; }
.faq h3 { margin-bottom: 4px; }

/* blog and long-form */
.post { max-width: 700px; }
.post h1 { margin: 6px 0 18px; }
.post h2 { margin: 26px 0 8px; font-size: 1.2rem; }
.post p { margin: 0 0 14px; }
.post ul, .post ol { margin: 0 0 14px 22px; }
.post li { margin: 6px 0; }
.post .card { margin-top: 28px; }

/* ---------- busy overlay ---------- */

.busyoverlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(12, 16, 23, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.busyoverlay[hidden] { display: none; }
.busycard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 30px;
  text-align: center;
  max-width: 330px;
  box-shadow: var(--shadow-lift);
}
.busycard .busymsg { font-weight: 650; margin: 14px 0 4px; }
.busycard p:last-child { margin-bottom: 0; }
.spinner {
  display: inline-block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .spinner { animation-duration: 2.4s !important; }
}


/* Hero product mock: a miniature of the real dashboard, pure divs. */
.mock {
  background: var(--surface);
  background-image: var(--sheen);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lift);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mock-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mock-stat {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 9px 11px;
}
.mock-stat .lbl {
  display: block;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 650;
  margin-bottom: 3px;
}
.mock-stat .val {
  font-size: 1.02rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.mock-stat .val.crit { color: var(--crit); }
.mock-chart {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 92px;
  padding-top: 6px;
  background-image: repeating-linear-gradient(to top, var(--grid) 0 1px, transparent 1px 25%);
}
.mock-chart i {
  flex: 1;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, var(--accent) 0%,
              color-mix(in srgb, var(--accent) 45%, transparent) 100%);
}
.mock-chart i.crit { background: var(--crit); }
.mock-chart i.warn {
  background: repeating-linear-gradient(45deg, var(--warn) 0 3px, var(--warn-quiet) 3px 6px);
}
.mock-finding {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--good-quiet);
  border: 1px solid color-mix(in srgb, var(--good) 30%, transparent);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.78rem;
}
.mock-finding .amt { color: var(--good); font-weight: 750; white-space: nowrap; }
.mock-finding code {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* The meta row: context, not headline. Same markup as a statrow, demoted to a
 * quiet inline strip so the money row above keeps the stage. */
.metabar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 26px;
  margin: -6px 2px 20px;
}
.metabar .stat {
  background: transparent;
  background-image: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  flex-direction: row;
  align-items: baseline;
  gap: 7px;
}
.metabar .statnum {
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.metabar .rangebar { margin-left: auto; }


/* Range switcher as a segmented control. */
.rangebar {
  display: inline-flex;
  gap: 2px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
}
.rangelink {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.rangelink:hover { color: var(--ink); }
.rangelink.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

/* Table refinement: quieter headers, hover rows, tighter rhythm. */
.metrictable th {
  font-size: 0.66rem;
  letter-spacing: 0.09em;
  font-weight: 650;
  padding-bottom: 9px;
}
.metrictable tbody tr { transition: background 0.1s ease; }
.metrictable tbody tr:hover { background: color-mix(in srgb, var(--ink) 3.5%, transparent); }
.metrictable td { padding-top: 11px; padding-bottom: 11px; }

/* Share bars: thin, rounded, gradient. */
.hbartrack { height: 5px; border-radius: 99px; }
.hbar { border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.hbar.over { background: var(--crit); }

/* Delta chips read as pills, not stray mono text. */
.delta-up, .delta-down {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  vertical-align: 2px;
}
.delta-up { color: var(--crit); background: var(--crit-quiet); }
.delta-down { color: var(--good); background: var(--good-quiet); }

/* Hero atmosphere: two soft glows, one behind the copy, one behind the mock. */
.hero { position: relative; }
.hero::before {
  content: "";
  position: absolute;
  inset: -80px -120px;
  background:
    radial-gradient(420px 300px at 18% 20%,
      color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    radial-gradient(460px 340px at 82% 55%,
      color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 70%);
  pointer-events: none;
  z-index: -1;
}
.hero h1 { font-size: clamp(2.3rem, 3.6vw, 3.05rem); letter-spacing: -0.035em; }
.mock {
  box-shadow: 0 24px 70px color-mix(in srgb, var(--accent-2) 16%, rgba(0, 0, 0, 0.35));
}

/* Section rhythm and headline presence. */
.section { margin-top: 76px; }
.section > h2 { font-size: 1.55rem; letter-spacing: -0.025em; margin-bottom: 8px; }
.section .lede { margin-bottom: 22px; }
h1 { letter-spacing: -0.03em; }
.card > h2 { font-size: 1.08rem; letter-spacing: -0.015em; }

/* Ledger verbs and the numeric cell. */
.badge-new { background: var(--accent-quiet); color: var(--accent); }
.badge-gone { background: var(--good-quiet); color: var(--good); }
.badge-up { background: var(--crit-quiet); color: var(--crit); }
.badge-down { background: var(--good-quiet); color: var(--good); }
.numcell { text-align: right; white-space: nowrap; }
.ledger td:first-child { width: 52px; }

/* ---------- resource drawers ---------- */
.filterbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  margin: 0 0 18px;
}
.filterbar label { margin-bottom: 0; }
.filterbar select, .filterbar input { min-width: 180px; }

.drawer { border-bottom: 1px solid var(--line); }
.drawer:last-child { border-bottom: 0; }
.drawerhead {
  display: flex; align-items: center; gap: 12px; padding: 11px 2px;
  cursor: pointer; list-style: none;
}
.drawerhead::-webkit-details-marker { display: none; }
.drawerhead::before {
  content: "\203A"; color: var(--muted); font-size: 1.1rem; line-height: 1;
  transition: transform .15s ease; flex: none; width: 12px;
}
.drawer[open] > .drawerhead::before { transform: rotate(90deg); }
.drawerhead:hover { background: var(--raise); }
.drawermain { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.drawermain strong { overflow-wrap: anywhere; }
.drawercost { flex: none; font-variant-numeric: tabular-nums; }
.drawerbody { padding: 6px 2px 18px 14px; }

/* On anything wider than a phone the name and what it is fit on one line
   together, and there is room to spare. Stacking them cost 96px a row, which
   on a 264 resource estate was most of a 19,000px page. */
@media (min-width: 860px) {
  .drawerhead { padding: 7px 2px; }
  .drawermain {
    flex-direction: row; align-items: baseline; gap: 10px;
  }
  .drawermain strong { flex: none; overflow-wrap: normal; }
  .drawermain > .muted {
    min-width: 0; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.panelgrid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.panelcol h4 { margin: 0 0 8px; font-size: .82rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); }
.panelfindings { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.panelfindings h4 { margin: 0 0 6px; font-size: .82rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); }

.barcell { width: 90px; }
.gaugebar {
  display: block; height: 7px; width: 100%; border-radius: 4px;
  background: var(--raise); overflow: hidden;
}
.gaugefill { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.gaugefill-low { background: var(--muted); }
.gaugefill-high { background: var(--crit); }

.spark { display: flex; align-items: flex-end; gap: 1px; height: 42px; margin-top: 8px; }
.sparkbar { flex: 1 1 auto; min-height: 1px; background: var(--accent); border-radius: 1px 1px 0 0; }
.sparkbar:hover { filter: brightness(1.25); }
.sectionhead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 4px;
}
.sectionhead h2 { margin: 0; }

/* ---------- collapsible category sections ----------
   A real subscription is a few hundred resources across eleven categories.
   Rendered open that is roughly twenty screens of scrolling before you can
   even see what the estate contains, so a section is a shut drawer whose
   head is worth reading on its own: what it is, how many, what it costs and
   whether anything in it needs attention. */
.sectiontools {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 10px;
}
.sectiontools .spacer { flex: 1 1 auto; }

.catsection { padding: 0; margin-bottom: 12px; }
.cathead {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  justify-content: space-between; margin: 0;
  padding: 15px 20px; cursor: pointer; list-style: none;
  border-radius: 12px;
}
.cathead::-webkit-details-marker { display: none; }
.cathead::before {
  content: "\203A"; color: var(--muted); font-size: 1.15rem; line-height: 1;
  transition: transform .15s ease; flex: none; width: 12px;
  align-self: center;
}
.catsection[open] > .cathead::before { transform: rotate(90deg); }
.cathead:hover { background: var(--raise); }
.cathead h2 { margin: 0; flex: 1 1 auto; }
.catmeta {
  display: flex; align-items: center; gap: 8px; flex: none;
  font-variant-numeric: tabular-nums;
}
/* the section head owns the alignment here, so the badge must not shove
   itself to the far right the way it does on a resource row */
.catmeta .badge-alert { margin-left: 0; }
.catsection[open] > .cathead {
  border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0;
}
.catbody { padding: 2px 20px 10px; }
.spark-tall { height: 84px; }
.stat-bad .statnum { color: var(--crit); }
