/* Sparkle Status: app styles, built on the Sparkle Design System tokens (see design/).
   Rules kept from the design system: Montserrat; pill buttons and badges; big soft cards with warm shadows
   and no borders or coloured left edges; ink text on brand colours; green glow under primary actions;
   a soft green focus ring; fast ease-out motion. The brand has no red, so "major outage" is the deepest
   orange. Status is always also written in words, never colour alone. */

:root {
  /* Derived shades (design system allows tints/shades for states) */
  --orange-700: #B84A00;
  --navy-100:   #E6EAF1;

  /* Legacy names used throughout the templates, mapped onto the tokens */
  --bg:       var(--surface-page);
  --surface:  var(--surface-card);
  --muted:    var(--text-muted);
  --line:     var(--border-subtle);
  --brand:    var(--sparkle-green);
  --brand-ink: var(--ink);
  --radius:   var(--radius-card);
  --shadow:   var(--shadow-md);

  /* Status colours: text/solid, fill (bars), soft background */
  --ok:        var(--green-700);   --ok-fill: var(--sparkle-green);  --ok-soft: var(--green-100);
  --degraded:  #8A6D00;            --degraded-fill: var(--sparkle-beige); --degraded-soft: var(--beige-100);
  --partial:   var(--orange-700);  --partial-fill: var(--sparkle-orange); --partial-soft: var(--orange-100);
  --major:     var(--orange-700);  --major-fill: var(--orange-700);   --major-soft: var(--orange-100);
  --maint:     var(--sparkle-navy); --maint-soft: var(--navy-100);
  --nodata:    var(--ink-10);
  --minor:     var(--degraded);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-body);
  font: var(--fw-regular) var(--fs-body)/var(--lh-body) var(--font-body);
}
a { color: var(--green-700); text-decoration: none; font-weight: var(--fw-semibold); }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; color: var(--text-strong); font-family: var(--font-display); line-height: var(--lh-heading); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 var(--space-4); }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(70, 184, 57, .35); border-radius: var(--radius-xs); }

/* Eyebrow + display type */
.eyebrow { font-weight: var(--fw-bold); font-size: var(--fs-xs); letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase; color: var(--green-700); }
.display { font-weight: var(--fw-extra); text-transform: uppercase; letter-spacing: var(--ls-display);
  line-height: var(--lh-tight); color: var(--text-strong); font-size: clamp(2.5rem, 9vw, var(--fs-display-l)); margin: 10px 0 0; }
.display .gradient { background: var(--gradient-sparkle-diag); -webkit-background-clip: text; background-clip: text;
  color: transparent; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 68px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo .mark { display: block; flex: none; }
.logo .word { font-weight: var(--fw-extra); font-size: 24px; letter-spacing: -0.045em; line-height: 1; color: var(--ink); }
.logo small { font-weight: var(--fw-semibold); font-size: var(--fs-sm); letter-spacing: 0; color: var(--muted);
  padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--ink-20); }

/* Buttons: pills, never rounded rectangles */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 44px; padding: 0 22px; border: 0; border-radius: var(--radius-pill);
  background: var(--ink-10); color: var(--ink); font: var(--fw-bold) 15px/1 var(--font-display);
  letter-spacing: .01em; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-spring), filter var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.btn:hover { text-decoration: none; background: var(--ink-20); }
.btn:active { transform: scale(.96); }
.btn:focus-visible { box-shadow: 0 0 0 4px rgba(70, 184, 57, .35); border-radius: var(--radius-pill); }
.btn-primary { background: var(--sparkle-green); color: var(--text-on-brand); box-shadow: var(--shadow-brand); }
.btn-primary:hover { background: var(--sparkle-green); filter: brightness(1.06); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink); filter: brightness(1.25); }
.btn-danger { background: var(--orange-100); color: var(--orange-700); }
.btn-danger:hover { background: #FFD9BF; }
.btn-sm { height: 36px; padding: 0 16px; font-size: var(--fs-sm); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* Overall banner: a big full-bleed colour card, like a Sparkle balance card */
.banner {
  display: flex; align-items: center; gap: 16px; padding: 24px 28px; border-radius: var(--radius-xl);
  font-size: clamp(1.15rem, 3.4vw, 1.5rem); font-weight: var(--fw-extra); letter-spacing: var(--ls-tight);
  margin: 28px 0 32px; color: var(--text-on-brand);
}
.banner .icon { width: 40px; height: 40px; border-radius: 50%; background: rgba(34, 31, 32, .12);
  display: grid; place-items: center; flex: none; font-size: 20px; font-weight: var(--fw-extra); }
.banner.operational { background: var(--sparkle-green); box-shadow: var(--shadow-brand); }
.banner.degraded { background: var(--sparkle-beige); }
.banner.partial { background: var(--sparkle-orange); box-shadow: 0 10px 28px rgba(255, 105, 0, .30); }
.banner.major { background: var(--orange-700); color: #fff; box-shadow: 0 10px 28px rgba(184, 74, 0, .30); }
.banner.major .icon { background: rgba(255, 255, 255, .2); }
.banner.maintenance { background: var(--sparkle-navy); color: #fff; box-shadow: var(--shadow-lg); }
.banner.maintenance .icon { background: rgba(255, 255, 255, .16); }

/* Cards: soft, borderless, warm shadow */
.card { background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-md); }
.section { margin: 0 0 var(--space-6); }
.section-title { font-size: var(--fs-h3); font-weight: var(--fw-bold); margin: 0 0 var(--space-3);
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-title .muted { font-size: var(--fs-sm); font-weight: var(--fw-regular); }

/* Active incident notices: tinted soft cards (no coloured edges) */
.notice { padding: 20px 24px; margin-bottom: 12px; background: var(--partial-soft); box-shadow: none; }
.notice.minor { background: var(--degraded-soft); }
.notice.major { background: var(--partial-soft); }
.notice.critical { background: #FFD9BF; }
.notice.none { background: var(--surface-sunk); }
.notice.maintenance { background: var(--maint-soft); }
.notice h3 { font-size: var(--fs-lg); font-weight: var(--fw-bold); margin-bottom: 6px; }
.notice h3 a { color: var(--ink); }
.notice p { margin: 4px 0; }

/* Components */
.group + .group { border-top: 1px solid var(--line); }
.group-name { padding: 20px 24px 0; font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase; color: var(--green-700); }
.component { padding: 16px 24px; }
.group .component + .component { border-top: 1px solid var(--line); }
.component-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.component-name { font-weight: var(--fw-bold); color: var(--ink); }
.component-desc { font-size: var(--fs-sm); color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 12px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: .02em; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.s-operational { background: var(--green-100); color: var(--green-700); }
.s-degraded_performance { background: var(--beige-100); color: var(--degraded); }
.s-partial_outage { background: var(--orange-100); color: var(--orange-700); }
.s-major_outage { background: var(--orange-700); color: #fff; }
.s-under_maintenance { background: var(--maint-soft); color: var(--maint); }

/* Uptime bars */
.bars { display: flex; gap: 2px; height: 34px; margin-top: 12px; position: relative; }
.bar { flex: 1 1 0; min-width: 2px; border-radius: 3px; background: var(--ok-fill); cursor: pointer; border: 0; padding: 0;
  transition: transform var(--dur-fast) var(--ease-out); }
.bar.minor { background: var(--degraded-fill); }
.bar.partial { background: var(--partial-fill); }
.bar.major { background: var(--major-fill); }
.bar.nodata { background: var(--nodata); }
.bar:hover, .bar:focus-visible { transform: scaleY(1.12); border-radius: 3px; }
.bars-legend { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted);
  margin-top: 8px; gap: 8px; }
.bars-legend .line { flex: 1; border-top: 1px solid var(--line); align-self: center; }
.range-30, .range-60 { display: none; }
@media (max-width: 720px) {
  .bars .bar:nth-child(-n+30) { display: none; }
  .range-90 { display: none; } .range-60 { display: inline; }
}
@media (max-width: 480px) {
  .bars .bar:nth-child(-n+60) { display: none; }
  .range-60 { display: none; } .range-30 { display: inline; }
}
.tooltip { position: fixed; z-index: 50; background: var(--ink); color: #fff; border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: var(--fs-sm); max-width: 260px; pointer-events: none; display: none;
  box-shadow: var(--shadow-lg); }
.tooltip strong { display: block; }
.tooltip ul { margin: 6px 0 0; padding-left: 16px; }

/* Past incidents */
.day { padding: 16px 0; border-bottom: 1px solid var(--line); }
.day:last-child { border-bottom: 0; }
.day h3 { font-size: var(--fs-body); font-weight: var(--fw-bold); margin-bottom: 6px; }
.past-incident { margin: 8px 0 0; }
.past-incident a { font-weight: var(--fw-bold); }
.impact-minor a, a.impact-minor { color: var(--degraded); }
.impact-major a, a.impact-major { color: var(--orange-600); }
.impact-critical a, a.impact-critical { color: var(--orange-700); }
.impact-maintenance a, a.impact-maintenance { color: var(--maint); }
.impact-none a, a.impact-none { color: var(--ink); }

/* Incident page */
.incident-title { font-size: var(--fs-h1); font-weight: var(--fw-extra); letter-spacing: var(--ls-display); margin: 8px 0 8px; }
.timeline { padding: 6px 28px; }
.update { display: grid; grid-template-columns: 130px 1fr; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.update:last-child { border-bottom: 0; }
.update .status { font-weight: var(--fw-bold); color: var(--ink); }
.update p { margin: 0 0 6px; white-space: pre-line; }
@media (max-width: 560px) { .update { grid-template-columns: 1fr; gap: 4px; } }
.affected { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tag { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: .02em; background: var(--ink-10); color: var(--ink-80); }

/* Subscribe: the signature gradient as a full-bleed CTA card */
.subscribe { padding: 28px 32px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
  justify-content: space-between; background: var(--gradient-sparkle-diag); color: var(--ink);
  box-shadow: var(--shadow-lg); border-radius: var(--radius-xl); }
.subscribe strong { font-size: var(--fs-h3); font-weight: var(--fw-extra); letter-spacing: var(--ls-tight); color: var(--ink); }
.subscribe .muted { color: var(--ink-80); }
.subscribe form { display: flex; gap: 8px; flex: 1 1 320px; max-width: 440px; }

/* Forms */
input, select, textarea {
  font: var(--fw-regular) 15px/1.4 var(--font-body); color: var(--text-strong); background: var(--surface);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-md); padding: 0 16px; height: 48px; width: 100%;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
textarea { height: auto; min-height: 96px; padding: 12px 16px; }
input::placeholder, textarea::placeholder { color: var(--ink-40); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sparkle-green); box-shadow: 0 0 0 4px var(--green-100); }
input[type=checkbox] { width: 18px; height: 18px; padding: 0; accent-color: var(--sparkle-green); box-shadow: none; }
.flash { padding: 14px 20px; border-radius: var(--radius-md); margin: 16px 0; font-weight: var(--fw-semibold); }
.flash.success { background: var(--green-100); color: var(--green-700); }
.flash.error { background: var(--orange-100); color: var(--orange-700); }
.flash.info { background: var(--maint-soft); color: var(--maint); }

/* Footer */
.site-footer { margin-top: var(--space-8); padding: 32px 0 48px; color: var(--muted); font-size: var(--fs-sm);
  background: var(--surface-sunk); }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--ink-80); font-weight: var(--fw-semibold); }
.site-footer .signoff { font-weight: var(--fw-extra); color: var(--ink); letter-spacing: var(--ls-tight); }
.pager { display: flex; justify-content: space-between; margin-top: 16px; }

/* ---------------- Admin ---------------- */
.admin-nav { background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10; }
.admin-nav .wrap { max-width: 1100px; display: flex; align-items: center; gap: 4px; min-height: 68px; flex-wrap: wrap; }
.admin-nav .logo { margin-right: 18px; }
.admin-nav nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.admin-nav nav a { color: var(--ink-80); padding: 8px 16px; border-radius: var(--radius-pill); font-weight: var(--fw-bold);
  font-size: var(--fs-sm); transition: background var(--dur-fast) var(--ease-out); }
.admin-nav nav a:hover { background: var(--ink-10); color: var(--ink); text-decoration: none; }
.admin-nav nav a.active { background: var(--green-100); color: var(--green-700); }
.admin main.wrap, body.admin main.wrap { max-width: 1100px; padding-top: 28px; padding-bottom: 56px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-h1); font-weight: var(--fw-extra); letter-spacing: var(--ls-display); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-main { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .grid-2, .grid-main { grid-template-columns: 1fr; } }
.pad { padding: 20px 24px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { padding: 18px 22px; }
.stat b { display: block; font-size: 2rem; font-weight: var(--fw-extra); letter-spacing: var(--ls-display); color: var(--ink); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--ls-eyebrow); color: var(--muted); font-weight: var(--fw-bold); }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: var(--fw-semibold); margin-bottom: 8px; font-size: 13px; color: var(--ink); letter-spacing: .01em; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; font-size: var(--fs-sm); color: var(--ink-80); }
.check input { margin-top: 2px; flex: none; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }
.inline-form { display: inline; }
.comp-impact { display: grid; grid-template-columns: 1fr 200px; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line); }
.comp-impact:last-child { border-bottom: 0; }
.comp-impact select { height: 40px; }
@media (max-width: 520px) { .comp-impact { grid-template-columns: 1fr; gap: 4px; } }
.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 11px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: .02em; background: var(--ink-10); color: var(--ink-80);
  white-space: nowrap; }
.badge.up, .badge.lvl-0 { background: var(--green-100); color: var(--green-700); }
.badge.degraded, .badge.lvl-1 { background: var(--beige-100); color: var(--degraded); }
.badge.lvl-2 { background: var(--orange-100); color: var(--orange-700); }
.badge.down, .badge.lvl-3 { background: var(--orange-700); color: #fff; }
.badge.draft { background: var(--maint-soft); color: var(--maint); }
.status-select { width: auto; min-width: 200px; height: 40px; padding: 0 12px; }
details summary { cursor: pointer; font-weight: var(--fw-semibold); }
.login-box { max-width: 400px; margin: 10vh auto; padding: 32px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code { font-size: .9em; background: var(--ink-10); padding: 1px 6px; border-radius: var(--radius-xs); }

/* Detection (admin): tinted soft cards, never a coloured edge */
.callout { padding: 18px 24px; margin-bottom: 20px; background: var(--maint-soft); box-shadow: none; }
.callout.warn { background: var(--beige-100); }
.callout.bad { background: var(--orange-100); }
.callout.ok { background: var(--green-100); }
.callout h2 { font-size: var(--fs-lg); font-weight: var(--fw-extra); letter-spacing: var(--ls-tight); margin-bottom: 4px; }
.callout p { margin: 4px 0; }
pre.evidence { white-space: pre-wrap; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(255, 255, 255, .7); border-radius: var(--radius-md); padding: 12px 16px; margin: 10px 0; color: var(--ink); }
.spark { display: inline-flex; gap: 2px; align-items: flex-end; height: 16px; vertical-align: middle; }
.spark i { display: block; width: 4px; border-radius: 2px; background: var(--ok-fill); height: 4px; }
.spark i.l1 { background: var(--degraded-fill); height: 8px; }
.spark i.l2 { background: var(--partial-fill); height: 12px; }
.spark i.l3 { background: var(--major-fill); height: 16px; }
.spark i.err { background: var(--ink-40); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Layout fixes */
.page-head .row > * { flex: 0 0 auto; }
.page-head h1 + .small { margin-top: 6px; }
