/* TaxFigure design tokens: Daylight in :root, deep indigo for dark. Fonts self-hosted. */
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500 700; font-display: swap;
             src: url("fonts/space-grotesk-latin.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
             src: url("fonts/dm-sans-latin.woff2") format("woff2"); }

:root {
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #fcfcfc;                 /* --tf-app-canvas */
  --surface: #ffffff;            /* --tf-app-card */
  --surface-2: #edf1f6;          /* --tf-app-card-deep */
  --text: #0f172a;               /* --tf-app-text-hi */
  --text-2: #475569;             /* --tf-app-text-med */
  --muted: #64748b;              /* --tf-app-text-lo */
  --border: rgba(15, 23, 42, .1);
  --border-strong: rgba(15, 23, 42, .2);
  --primary: #5f6dc0;            /* --tf-brand-primary */
  --primary-hover: #525ea5;
  --primary-ink: #5f6dc0;
  --primary-soft: rgba(95, 109, 192, .12);
  --accent: #f7d043;             /* --tf-brand-accent (highlighter gold) */
  --on-accent: #1a2332;
  --brand-ink: #a16207;
  --op: #0f766e;   --op-soft: rgba(15, 118, 110, .12);    /* --tf-app-success */
  --deg: #ca8a04;  --deg-soft: rgba(247, 208, 67, .22);   /* gold accent tint */
  --par: #b45309;  --par-soft: rgba(180, 83, 9, .12);     /* --tf-app-sev-warn */
  --maj: #c53030;  --maj-soft: rgba(197, 48, 48, .12);    /* --tf-app-danger */
  --maint: #5f6dc0; --maint-soft: rgba(95, 109, 192, .12);
  --none: #e2e8f0;
  --radius: 20px;                /* --r-card */
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .08);   /* --tf-elev-card */
  --header-bg: rgba(252, 252, 252, .85);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101227;
    --surface: #15182f;
    --surface-2: #12152a;
    --text: #f3f4fb;
    --text-2: #ced2e6;
    --muted: #9aa0c3;
    --border: rgba(255, 255, 255, .1);
    --border-strong: rgba(255, 255, 255, .2);
    --primary-ink: #a9b0dd;      /* --tf-brand-primary-lift */
    --primary-soft: rgba(95, 109, 192, .18);
    --brand-ink: #d8b777;
    --op: #6fb8ac;   --op-soft: rgba(111, 184, 172, .14);
    --deg: #d8b777;  --deg-soft: rgba(216, 183, 119, .14);
    --par: #e08a4b;  --par-soft: rgba(224, 138, 75, .14);
    --maj: #e05252;  --maj-soft: rgba(197, 48, 48, .2);
    --maint: #8b95d6; --maint-soft: rgba(95, 109, 192, .2);
    --none: #262a48;
    --shadow: 0 1px 0 rgba(255, 255, 255, .02), 0 8px 24px rgba(0, 0, 0, .35);
    --header-bg: rgba(16, 18, 39, .85);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); letter-spacing: -0.015em; }
h2 { font-size: 16px; font-weight: 650; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }
.small { font-size: 13px; }
.muted { color: var(--muted); }

/* ---------------------------------------------------------------- header */
.top { position: sticky; top: 0; z-index: 5; background: var(--header-bg);
       backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
       border-bottom: 1px solid var(--border); }
.top-row { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 21px; letter-spacing: -0.025em; }
.brand-div { width: 1px; height: 18px; background: var(--border-strong); }
.brand-sub { color: var(--muted); font-weight: 500; font-size: 16px; }
.top-nav { display: flex; gap: 8px; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px;
       font-size: 14px; font-weight: 550; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn-ghost { border: 1px solid var(--border); color: var(--text-2); background: var(--surface); }
.btn-ghost:hover { border-color: var(--muted); color: var(--text); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

main.wrap { padding-top: 36px; padding-bottom: 32px; }

/* ---------------------------------------------------------------- hero */
.hero {
  --tone: var(--op); --tone-soft: var(--op-soft);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px;
  padding: 24px 26px; margin-bottom: 20px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--tone-soft), var(--surface) 70%);
  border: 1px solid color-mix(in srgb, var(--tone) 28%, var(--border));
  box-shadow: var(--shadow);
}
.hero-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
             background: var(--tone); color: var(--surface); box-shadow: 0 0 0 6px color-mix(in srgb, var(--tone) 18%, transparent); }
.hero-icon svg { width: 26px; height: 26px; }
.hero h1 { font-size: 24px; font-weight: 700; line-height: 1.25; }
.hero-sub { margin: 4px 0 0; color: var(--text-2); font-size: 14.5px; }
.hero-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; align-self: start; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); position: relative; }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--tone);
                opacity: 0; animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.4); opacity: .7; } 100% { transform: scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pulse::after { animation: none; } }
.hero-loading { --tone: var(--muted); --tone-soft: var(--surface-2); }
.hero-maintenance { --tone: var(--maint); --tone-soft: var(--maint-soft); }
.hero-degraded { --tone: var(--deg); --tone-soft: var(--deg-soft); }
.hero-partial { --tone: var(--par); --tone-soft: var(--par-soft); }
.hero-major { --tone: var(--maj); --tone-soft: var(--maj-soft); }
.hero-stale { --tone: var(--muted); --tone-soft: var(--surface-2); }

/* ---------------------------------------------------------------- incidents */
.stack:empty { display: none; }
.stack { display: grid; gap: 14px; margin-bottom: 20px; }
.incident {
  --tone: var(--maj); --tone-soft: var(--maj-soft);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.incident.i-degraded { --tone: var(--deg); --tone-soft: var(--deg-soft); }
.incident.i-partial { --tone: var(--par); --tone-soft: var(--par-soft); }
.incident.i-maintenance { --tone: var(--maint); --tone-soft: var(--maint-soft); }
.inc-head { padding: 16px 22px; background: var(--tone-soft); border-bottom: 1px solid var(--border); }
.inc-head h3 { font-size: 16.5px; font-weight: 650; margin-top: 6px; }
.inc-body { padding: 6px 22px 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-ink); font-weight: 500; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 650; text-transform: uppercase;
        letter-spacing: .04em; color: var(--tone); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tone); }

.updates { list-style: none; margin: 0; padding: 0; }
.upd { position: relative; padding: 12px 0 2px 22px; }
.upd::before { content: ""; position: absolute; left: 4px; top: 19px; width: 8px; height: 8px; border-radius: 50%;
               background: var(--surface); border: 2px solid var(--border-strong); }
.upd:first-child::before { border-color: var(--tone); background: var(--tone); }
.upd::after { content: ""; position: absolute; left: 8px; top: 31px; bottom: -12px; width: 2px; background: var(--border); }
.upd:last-child::after { display: none; }
.upd-status { font-weight: 650; text-transform: capitalize; }
.upd-msg { color: var(--text-2); }
.upd-when { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.stats:empty { display: none; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-v { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------------------------------------------------------------- components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 36px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 18px 22px 6px; }
.components { list-style: none; margin: 0; padding: 0 22px; }
.comp { padding: 18px 0; border-bottom: 1px solid var(--border); }
.comp:last-child { border-bottom: 0; }
.comp.skeleton { height: 108px; background: linear-gradient(90deg, var(--surface-2), var(--none), var(--surface-2));
                 background-size: 200% 100%; animation: shimmer 1.4s infinite linear; border-radius: 8px; margin: 12px 0; border: 0; opacity: .5; }
@keyframes shimmer { to { background-position: -200% 0; } }
.comp-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.comp-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.comp-icon { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--surface); }
.comp-icon svg { width: 12px; height: 12px; }
.ic-operational { background: var(--op); } .ic-maintenance { background: var(--maint); }
.ic-degraded { background: var(--deg); } .ic-partial { background: var(--par); } .ic-major { background: var(--maj); }
.comp-name { font-weight: 600; }
.comp-desc { color: var(--muted); font-size: 13px; margin: 2px 0 0 30px; }
.comp-right { display: flex; align-items: baseline; gap: 12px; white-space: nowrap; }
.comp-status { font-size: 13px; font-weight: 600; }
.st-operational { color: var(--op); } .st-maintenance { color: var(--maint); } .st-degraded { color: var(--deg); }
.st-partial { color: var(--par); } .st-major { color: var(--maj); }
.comp-uptime { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.bars { display: flex; gap: 3px; height: 36px; margin-top: 12px; align-items: stretch; }
.bar { flex: 1 1 0; min-width: 0; border-radius: 3px; background: var(--none); cursor: pointer;
       transition: transform .12s ease, filter .12s ease; transform-origin: bottom; }
.bar:hover, .bar:focus-visible { transform: scaleY(1.12); filter: brightness(1.08); outline: none; }
.b-op { background: var(--op); } .b-deg { background: var(--deg); } .b-par { background: var(--par); }
.b-maj { background: var(--maj); } .b-maint { background: var(--maint); } .b-none { background: var(--none); }
.bars-foot { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 14px 22px; border-top: 1px solid var(--border);
          background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------------------------------------------------------------- history */
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-day { display: grid; grid-template-columns: 112px 1fr; gap: 18px; padding: 16px 0; border-top: 1px solid var(--border); }
.tl-date { font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--text-2); padding-top: 2px; }
.tl-quiet { color: var(--muted); font-size: 14px; }
.past-inc { --tone: var(--maj); margin-bottom: 10px; }
.past-inc:last-child { margin-bottom: 0; }
.past-inc.i-degraded { --tone: var(--deg); } .past-inc.i-partial { --tone: var(--par); } .past-inc.i-maintenance { --tone: var(--maint); }
.past-inc details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.past-inc summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; }
.past-inc summary::-webkit-details-marker { display: none; }
.past-inc summary::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); margin-top: 7px; }
.past-inc .s-title { font-weight: 600; }
.past-inc .s-meta { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.past-inc .chev { margin-left: auto; color: var(--muted); transition: transform .15s; }
.past-inc details[open] .chev { transform: rotate(90deg); }
.past-inc .updates { padding: 0 14px 10px 18px; }

/* ---------------------------------------------------------------- footer */
.foot { border-top: 1px solid var(--border); margin-top: 24px; }
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 22px; padding-bottom: 36px; }
.foot-brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; }
.foot-links { display: flex; gap: 18px; }
.foot-links a { color: var(--muted); text-decoration: none; }
.foot-links a:hover { color: var(--text); }

/* ---------------------------------------------------------------- tooltip */
.tip {
  position: fixed; z-index: 20; width: 240px; pointer-events: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.16);
}
.tip-date { font-weight: 650; margin-bottom: 6px; }
.tip-row { display: flex; justify-content: space-between; gap: 10px; color: var(--text-2); }
.tip-row i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.tip-inc { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); color: var(--text-2); }
.tip-ok { color: var(--op); font-weight: 550; }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .btn-ghost span { display: none; }
  .btn { padding: 0 12px; }
  .hero { grid-template-columns: auto 1fr; padding: 20px; }
  .hero-meta { grid-column: 1 / -1; }
  .hero h1 { font-size: 20px; }
  .hero-icon { width: 44px; height: 44px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:last-child { grid-column: 1 / -1; }
  .bars { gap: 2px; height: 30px; }
  .comp-desc { display: none; }
  .comp-uptime { display: none; }
  .tl-day { grid-template-columns: 1fr; gap: 6px; }
  .components, .card-head, .legend { padding-left: 16px; padding-right: 16px; }
}

/* app-style focus ring (--focus-ring) */
a:focus-visible, .btn:focus-visible, summary:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(95, 109, 192, .45); border-radius: 8px; }
.brand-sub { font-family: var(--font-display); }
.upd-status, .s-title, .comp-name { font-family: var(--font-body); }
