/* Kagen Cloud status page. Same design tokens as the portal (spa/src/styles/index.css). No inline styles
   anywhere (the page is served with style-src 'self'). */
:root {
  color-scheme: light;
  --bg: #f4f4f5; --surface: #ffffff; --surface-2: #f8f8f9; --surface-3: #efeff1;
  --border: #e4e4e7; --border-strong: #d0d0d6;
  --text: #18181b; --muted: #52525b; --subtle: #71717a;
  --accent: #0051c3; --accent-hover: #003d99; --accent-soft: #e6effb; --accent-fg: #ffffff;
  --ok: #0a7d0a; --ok-soft: #e7f5e7; --warn: #9a6700; --warn-soft: #fdf3dc;
  --danger: #c42b2b; --danger-soft: #fbe9e9; --info: #0051c3; --info-soft: #e6effb;
  --serious: #c2410c; --serious-soft: #fdeee4; --maint: #4a3aa7; --maint-soft: #eeecfa;
  --bar-ok: #0ca30c; --bar-minor: #fab219; --bar-major: #ec835a; --bar-crit: #d03b3b; --bar-maint: #7c6fd6;
  --bar-none: #dcdce0;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --pop: 0 8px 24px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d; --surface: #1a1a19; --surface-2: #202020; --surface-3: #2a2a28;
    --border: #2e2e2c; --border-strong: #3d3d3a;
    --text: #f4f4f2; --muted: #c3c2b7; --subtle: #97968f;
    --accent: #4d94ec; --accent-hover: #6ea8f0; --accent-soft: #15253b; --accent-fg: #06121f;
    --ok: #3fbf3f; --ok-soft: #132813; --warn: #f0b429; --warn-soft: #2e2410;
    --danger: #f07070; --danger-soft: #3a1717; --info: #4d94ec; --info-soft: #15253b;
    --serious: #f59e6b; --serious-soft: #35200f; --maint: #9085e9; --maint-soft: #211d3d;
    --bar-none: #2f2f2d; --bar-maint: #9085e9;
    --shadow: 0 0 0 1px rgba(255, 255, 255, .02);
    --pop: 0 10px 30px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06);
  }
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d; --surface: #1a1a19; --surface-2: #202020; --surface-3: #2a2a28;
  --border: #2e2e2c; --border-strong: #3d3d3a;
  --text: #f4f4f2; --muted: #c3c2b7; --subtle: #97968f;
  --accent: #4d94ec; --accent-hover: #6ea8f0; --accent-soft: #15253b; --accent-fg: #06121f;
  --ok: #3fbf3f; --ok-soft: #132813; --warn: #f0b429; --warn-soft: #2e2410;
  --danger: #f07070; --danger-soft: #3a1717; --info: #4d94ec; --info-soft: #15253b;
  --serious: #f59e6b; --serious-soft: #35200f; --maint: #9085e9; --maint-soft: #211d3d;
  --bar-none: #2f2f2d; --bar-maint: #9085e9;
  --shadow: 0 0 0 1px rgba(255, 255, 255, .02);
  --pop: 0 10px 30px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/22px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 6px 10px; border-radius: 6px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---- top bar ---- */
.top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.top-in { max-width: 880px; margin: 0 auto; height: 56px; padding: 0 20px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.mark { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--accent-fg); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; letter-spacing: -.02em; }
.mark-svg { background: none; } .mark-svg svg { width: 32px; height: 32px; display: block; }
.brand-name { display: flex; color: var(--text); --kc-sub: var(--muted); }
.brand-name svg { height: 21px; width: auto; display: block; }
.brand-name + .brand-tag { margin-left: 2px; }
.brand .mark-svg { display: none; }
.brand-tag { font-size: 11px; font-weight: 600; color: var(--subtle); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; line-height: 20px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 0 8px; }
.btn-ghost:hover { color: var(--text); }
.btn svg { width: 16px; height: 16px; }
.icon-only { width: 32px; padding: 0; }

/* ---- layout ---- */
.wrap { max-width: 880px; margin: 0 auto; padding: 28px 20px 48px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.section { margin-top: 28px; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.section-h h2 { font-size: 15px; line-height: 22px; font-weight: 600; margin: 0; }
.section-h .aside { font-size: 12px; color: var(--subtle); }
.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.small { font-size: 12px; line-height: 18px; }

/* ---- announcement + snapshot banners ---- */
.banner { display: flex; gap: 10px; align-items: flex-start; border-radius: 8px; border: 1px solid; padding: 10px 12px; margin-bottom: 16px; font-size: 13px; line-height: 20px; }
.banner svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.banner-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.banner-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }

/* ---- hero ---- */
.hero { display: flex; align-items: center; gap: 16px; padding: 20px 22px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--ok); }
.hero-icon { width: 44px; height: 44px; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--ok-soft); color: var(--ok); }
.hero-icon svg { width: 24px; height: 24px; }
.hero h1 { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -.01em; }
.hero p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.hero.s-minor::before { background: var(--warn); } .hero.s-minor .hero-icon { background: var(--warn-soft); color: var(--warn); }
.hero.s-major::before { background: var(--serious); } .hero.s-major .hero-icon { background: var(--serious-soft); color: var(--serious); }
.hero.s-critical::before { background: var(--danger); } .hero.s-critical .hero-icon { background: var(--danger-soft); color: var(--danger); }
.hero.s-maintenance::before { background: var(--maint); } .hero.s-maintenance .hero-icon { background: var(--maint-soft); color: var(--maint); }

/* ---- incident / maintenance cards ---- */
.post { position: relative; overflow: hidden; padding: 16px 18px 14px 20px; }
.post + .post { margin-top: 12px; }
.post::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--danger); }
.post.i-minor::before { background: var(--warn); } .post.i-major::before { background: var(--serious); }
.post.i-critical::before { background: var(--danger); } .post.i-none::before { background: var(--subtle); }
.post.maint::before { background: var(--maint); } .post.resolved::before { background: var(--ok); }
.post-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.post-h h3 { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; }
.post-h h3 a { color: var(--text); }
.post-meta { font-size: 12px; color: var(--subtle); margin-top: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--muted); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.chip.c-investigating, .chip.c-critical, .chip.c-major_outage { background: var(--danger-soft); color: var(--danger); }
.chip.c-identified, .chip.c-partial_outage { background: var(--serious-soft); color: var(--serious); }
.chip.c-monitoring, .chip.c-scheduled { background: var(--info-soft); color: var(--info); }
.chip.c-degraded_performance { background: var(--warn-soft); color: var(--warn); }
.chip.c-resolved, .chip.c-completed, .chip.c-operational { background: var(--ok-soft); color: var(--ok); }
.chip.c-in_progress, .chip.c-under_maintenance { background: var(--maint-soft); color: var(--maint); }
.chip.c-cancelled { background: var(--surface-3); color: var(--subtle); }
.affects { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.affects span { font-size: 11px; line-height: 18px; padding: 0 7px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.updates { list-style: none; margin: 12px 0 0; padding: 0; }
.updates li { position: relative; padding: 0 0 12px 18px; }
.updates li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 7px; height: 7px; border-radius: 999px; background: var(--border-strong); }
.updates li::after { content: ""; position: absolute; left: 6px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.updates li:last-child::after { display: none; }
.updates li:last-child { padding-bottom: 0; }
.updates li:first-child::before { background: var(--accent); }
.u-head { font-size: 12px; color: var(--subtle); }
.u-head strong { color: var(--text); font-weight: 600; margin-right: 6px; }
.md { font-size: 14px; line-height: 22px; color: var(--text); overflow-wrap: anywhere; }
.md p { margin: 4px 0 0; }
.md ul { margin: 4px 0 0; padding-left: 20px; }
.md code { background: var(--surface-3); padding: 1px 4px; border-radius: 4px; }
details.more > summary { cursor: pointer; font-size: 12px; color: var(--accent); list-style: none; margin-top: 8px; }
details.more > summary::-webkit-details-marker { display: none; }

/* ---- components ---- */
.comps { padding: 4px 0; }
.comp { padding: 14px 18px 12px; }
.comp + .comp { border-top: 1px solid var(--border); }
.comp-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.comp-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.comp-name .hint { color: var(--subtle); display: inline-flex; cursor: help; position: relative; }
.comp-name .hint svg { width: 14px; height: 14px; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: currentColor; }
.st-operational { color: var(--ok); } .st-degraded_performance { color: var(--warn); }
.st-partial_outage { color: var(--serious); } .st-major_outage { color: var(--danger); }
.st-under_maintenance { color: var(--maint); }
.bars { display: flex; gap: 2px; height: 30px; margin-top: 10px; align-items: stretch; }
.bar { flex: 1 1 0; min-width: 2px; border-radius: 2px; background: var(--bar-ok); position: relative; outline-offset: 1px; }
.bar:hover, .bar:focus-visible { filter: brightness(.88); }
.b-degraded_performance { background: var(--bar-minor); } .b-partial_outage { background: var(--bar-major); }
.b-major_outage { background: var(--bar-crit); } .b-under_maintenance { background: var(--bar-maint); }
.b-none { background: var(--bar-none); }
.bar[data-tip]:hover::after, .bar[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--pop);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; line-height: 18px; white-space: pre; z-index: 30; pointer-events: none;
}
.bar.edge-l[data-tip]:hover::after, .bar.edge-l[data-tip]:focus-visible::after { left: 0; transform: none; }
.bar.edge-r[data-tip]:hover::after, .bar.edge-r[data-tip]:focus-visible::after { left: auto; right: 0; transform: none; }
.bars-legend { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--subtle); }
.bars-legend .rule { flex: 1; height: 1px; background: var(--border); align-self: center; }
@media (max-width: 720px) { .bar.old60 { display: none; } .d90l { display: none; } }
@media (min-width: 721px) { .d30l { display: none; } }

/* ---- past incidents ---- */
.days { list-style: none; margin: 0; padding: 0; }
.day { padding: 14px 0; border-top: 1px solid var(--border); }
.day:first-child { border-top: 0; padding-top: 0; }
.day h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.day .none { font-size: 13px; color: var(--subtle); }
.past { margin: 6px 0 0; }
.past a.t { font-weight: 600; font-size: 14px; }
.past .last { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---- forms / dialogs ---- */
.field { display: block; margin-top: 12px; }
.field > span { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.input { width: 100%; height: 36px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; padding: 0 10px; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-top: 8px; }
.checks label { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }
.modal { display: none; position: fixed; inset: 0; z-index: 40; background: rgba(9, 9, 11, .42); align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; overflow-y: auto; }
.modal:target, .modal.open { display: flex; }
.modal .card { width: 100%; max-width: 440px; padding: 20px 22px; box-shadow: var(--pop); }
.modal h2 { margin: 0; font-size: 17px; font-weight: 600; }
.modal-x { float: right; color: var(--subtle); font-size: 20px; line-height: 20px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.center-card { max-width: 480px; margin: 8vh auto 0; padding: 26px 26px 22px; text-align: left; }
.center-card h1 { margin: 0 0 6px; font-size: 20px; }
.center-card .ic { width: 40px; height: 40px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: var(--ok-soft); color: var(--ok); margin-bottom: 12px; }
.center-card .ic.warn { background: var(--warn-soft); color: var(--warn); }
.center-card .ic svg { width: 22px; height: 22px; }

.post-none { padding: 16px 18px; }
.wrap > h1 { font-size: 22px; line-height: 30px; margin: 4px 0 12px; letter-spacing: -.01em; }

/* ---- history ---- */
.month { margin-top: 24px; }
.month h2 { font-size: 15px; margin: 0 0 8px; }
.pager { display: flex; justify-content: space-between; margin-top: 24px; }

/* ---- footer ---- */
.foot { max-width: 880px; margin: 0 auto; padding: 0 20px 40px; display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; font-size: 12px; color: var(--muted); }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.foot a { color: var(--muted); }

@media (max-width: 560px) {
  .wrap { padding: 20px 14px 40px; }
  .top-in { padding: 0 14px; }
  .brand-name { display: none; }
  .brand .mark-svg { display: flex; }
  .hero { padding: 16px; gap: 12px; }
  .hero h1 { font-size: 17px; line-height: 24px; }
  .comp { padding: 12px 14px 10px; }
  .post { padding: 14px 14px 12px 18px; }
  .checks { grid-template-columns: 1fr; }
  .btn-label { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .top-actions, .modal, .foot nav { display: none !important; } }
