/* Opsentry design tokens and shared components.
 *
 * One stylesheet for every surface: the admin console and marketing site use
 * the dark theme (the :root default), public status pages add .theme-light.
 * Status is always encoded twice, by colour and by glyph shape, so it survives
 * colour-blindness and monochrome screenshots.
 */

:root {
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --ground: #0B0E14;
  --panel: #0E121A;
  --panel-2: #121722;
  --raise: #1B2230;
  --line: #232B3A;
  --line-2: #3A4558;
  --text: #E9EDF3;
  --text-2: #A7B1C2;
  --text-3: #8390A6;

  --accent: #3DDC97;
  --accent-hover: #6FE8B4;
  --on-accent: #04231A;

  --ok: #3DDC97;
  --warn: #FFB547;
  --partial: #FF9A52;
  --down: #FF6B6B;
  --info: #7AB2FF;
  --on-warn: #1A1200;
  --on-down: #2A0606;

  --radius: 6px;
  --radius-sm: 4px;
}

.theme-light {
  --ground: #F5F6F8;
  --panel: #FFFFFF;
  --panel-2: #FFFFFF;
  --raise: #EEF1F5;
  --line: #D9DEE7;
  --line-2: #B9C2D0;
  --text: #0B0E14;
  --text-2: #4A566B;
  --text-3: #4A566B;
  --accent: #0B7A53;
  --accent-hover: #075C3E;
  --on-accent: #FFFFFF;
  --ok: #0B7A53;
  --warn: #8A5A00;
  --partial: #A34A00;
  --down: #B42323;
  --info: #0B5FA8;
}

/* ---- type ---- */
.ops { font-family: var(--sans); color: var(--text); background: var(--ground); -webkit-font-smoothing: antialiased; }
.mono { font-family: var(--mono); }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }

/* ---- status: colour + shape ---- */
.st { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 12.5px; font-weight: 500; white-space: nowrap; color: var(--text-2); }
.st::before { content: ""; width: 10px; height: 10px; flex: 0 0 auto; background: currentColor; border-radius: 50%; }
.st-ok { color: var(--ok); }
.st-warn { color: var(--warn); }
.st-warn::before { border-radius: 0; clip-path: polygon(50% 4%, 100% 96%, 0 96%); }
.st-partial { color: var(--partial); }
.st-partial::before { border-radius: 0; clip-path: polygon(50% 4%, 100% 96%, 0 96%); }
.st-down { color: var(--down); }
.st-down::before { border-radius: 0; }
.st-info { color: var(--info); }
.st-info::before { border-radius: 0; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.st-mute { color: var(--text-3); }
.st-box { padding: 3px 10px; border: 1px solid currentColor; border-radius: 2px; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--radius-sm); font-family: var(--sans); font-size: 14px; font-weight: 500; line-height: 1; text-decoration: none; cursor: pointer; transition: background-color .12s, border-color .12s, color .12s; }
.btn-primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn-ghost:hover { border-color: var(--text-3); color: var(--text); }
.btn-danger { background: var(--down); color: var(--on-down); font-weight: 600; }
.btn-danger:hover { filter: brightness(1.08); color: var(--on-down); }
.btn-lg { min-height: 54px; padding: 0 26px; font-size: 16.5px; }
.btn:focus-visible, .side-link:focus-visible, .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- panels, key numbers, tables ---- */
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--ground); min-width: 0; }
.panel-fill { background: var(--panel); }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 16px; min-height: 44px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { margin: 0; font-family: var(--sans); font-size: 15.5px; font-weight: 600; color: var(--text); letter-spacing: 0; }
.panel-head a { font-size: 13.5px; color: var(--accent); text-decoration: none; }
.panel-head a:hover { color: var(--accent-hover); }
.panel-note { font-family: var(--mono); font-size: 12px; color: var(--text-2); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 1px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); overflow: hidden; }
.kpi { display: flex; align-items: center; gap: 14px; min-height: 44px; padding: 10px 16px; background: var(--panel); color: var(--text); text-decoration: none; }
a.kpi:hover { background: var(--panel-2); color: var(--text); }
.kpi-value { font-family: var(--mono); font-weight: 600; font-size: 26px; line-height: 1; letter-spacing: -0.02em; }
.kpi-label { display: block; font-size: 13.5px; color: var(--text); }
.kpi-note { display: block; font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.is-warn { color: var(--warn); }
.is-down { color: var(--down); }
.is-ok { color: var(--ok); }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { padding: 8px 10px; text-align: left; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-top: 1px solid var(--line); color: var(--text); }
.tbl th:first-child, .tbl td:first-child { padding-left: 16px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 16px; }
.tbl .num { text-align: right; font-family: var(--mono); font-size: 13px; }
.tbl .meta { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.tbl a { color: var(--text); font-weight: 600; text-decoration: none; }
.tbl a:hover { color: var(--accent); }
.tbl-empty { padding: 28px 16px; text-align: center; color: var(--text-2); font-size: 14px; }

.scene { position: relative; min-width: 0; }
.scene canvas { display: block; width: 100%; height: 100%; }

/* ---- admin shell ---- */
.strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 24px; padding: 4px 20px; background: var(--panel-2); color: var(--text); border-bottom: 1px solid var(--line-2); font-size: 14px; }
.strip a { color: inherit; text-decoration: none; }
.strip-left { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; min-width: 0; }
.strip-right { display: flex; align-items: center; gap: 6px; }
.strip-brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; font-size: 16px; }
.strip-state { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.strip-open { display: none; align-items: center; min-height: 34px; padding: 0 12px; border-radius: var(--radius-sm); background: var(--on-warn); color: var(--warn) !important; font-weight: 600; font-size: 13.5px; }
.strip-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: transparent; color: inherit; font-family: var(--sans); font-size: 13.5px; cursor: pointer; }
.strip-btn kbd { font-family: var(--mono); font-size: 12px; }
.strip-icon { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.strip.is-incident { background: var(--warn); color: var(--on-warn); border-bottom-color: #A56A0C; }
.strip.is-incident .strip-btn { border-color: #A56A0C; }
.strip.is-incident .strip-open { display: inline-flex; }
.strip.is-incident .st { color: var(--on-warn); }

.shell { display: flex; flex-wrap: wrap; flex: 1 1 auto; }
.side { flex: 1 1 216px; box-sizing: border-box; padding: 14px 10px 20px; border-right: 1px solid var(--line); background: var(--panel); }
.side nav { display: flex; flex-direction: column; gap: 12px; }
.side-group { display: flex; flex-direction: column; gap: 1px; }
.side-label { padding: 0 10px 4px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.side-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--text-2); font-size: 14px; text-decoration: none; }
.side-link:hover { background: var(--panel-2); color: var(--text); }
.side-link.is-active { background: var(--raise); color: var(--text); font-weight: 600; }
.side-link.is-out { border: 1px solid var(--line); }
.main { flex: 999 1 560px; min-width: 0; box-sizing: border-box; padding: 18px 24px 28px; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; }
.page-head h1 { margin: 0; font-family: var(--sans); font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; color: var(--text); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.cols { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.col-wide { flex: 2.1 1 520px; min-width: 0; }
.col-narrow { flex: 1 1 300px; min-width: 0; }
.col-half { flex: 1 1 420px; min-width: 0; }

.event { display: flex; gap: 10px; padding: 8px 16px; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; }
.event:first-of-type { border-top: 0; }
.event:hover { background: var(--panel); color: var(--text); }
.event .st { margin-top: 3px; }
.event-title { display: block; font-size: 14px; font-weight: 500; }
.event-meta { display: block; font-family: var(--mono); font-size: 12px; color: var(--text-2); }

/* overview: one card per service (small fleets) */
.svc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 14px; }
.svc-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); text-decoration: none; }
.svc-card:hover { border-color: var(--line-2); color: var(--text); }
.svc-card.is-warn { border-color: var(--warn); }
.svc-card.is-down { border-color: var(--down); }
.svc-card.is-info { border-color: var(--info); }
.svc-card-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.svc-card-name { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.svc-card-meta { margin-top: -8px; font-family: var(--mono); font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-card-nums { display: flex; flex-wrap: wrap; gap: 6px 32px; }
.svc-card-nums b { display: block; font-family: var(--mono); font-size: 26px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }
.svc-card-nums span span { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.svc-card .sp-bars { height: 28px; }
.svc-card-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: -6px; font-family: var(--mono); font-size: 12px; color: var(--text-3); }

/* incident room: stage picker, composer, timeline, facts */
.stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.stages legend { padding: 0 0 8px; font-size: 13.5px; color: var(--text-2); }
.stage { position: relative; display: block; cursor: pointer; }
.stage input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.stage span { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); color: var(--text-2); font-size: 15px; font-weight: 600; }
.stage span b { font-family: var(--mono); font-size: 12px; font-weight: 400; }
.stage input:checked + span { background: var(--warn); border-color: var(--warn); color: var(--on-warn); }
.stage.is-resolve input:checked + span { background: var(--ok); border-color: var(--ok); color: var(--on-accent); }
.stage input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13.5px; color: var(--text-2); }
.field textarea, .field input { box-sizing: border-box; width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--ground); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
.field textarea:focus-visible, .field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tl-row { display: flex; flex-wrap: wrap; gap: 4px 24px; padding: 12px 16px; border-top: 1px solid var(--line); }
.tl-row:first-child { border-top: 0; }
.tl-when { flex: 0 0 170px; display: flex; flex-direction: column; gap: 2px; font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.tl-row p { flex: 1 1 300px; min-width: 0; margin: 0; font-size: 14.5px; color: var(--text); }
.fact-list { margin: 0; padding: 4px 16px; }
.fact-list div { display: flex; justify-content: space-between; gap: 24px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.fact-list div:first-child { border-top: 0; }
.fact-list dt { color: var(--text-2); }
.fact-list dd { margin: 0; text-align: right; }
details.panel > summary { list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: "+"; font-family: var(--mono); color: var(--text-3); }
details.panel[open] > summary::after { content: "\2013"; }

/* breadcrumb, tabs, panel footer */
.crumb { font-family: var(--mono); font-size: 12px; color: var(--text-2); padding: 4px 0; }
.crumb a { color: var(--text-2); text-decoration: none; }
.crumb a:hover { color: var(--text); }
.tabs { display: flex; flex-wrap: wrap; gap: 0 2px; border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text-2); font-family: var(--sans); font-size: 14px; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.panel-foot { padding: 8px 16px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.flash { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--ok); border-radius: var(--radius-sm); color: var(--ok); font-size: 14px; }
.flash.is-error { border-color: var(--down); color: var(--down); }
.btn-ghost.is-danger { color: var(--down); border-color: var(--down); }

/* jump-to palette */
.jump { position: fixed; inset: 0; z-index: 60; display: none; align-items: flex-start; justify-content: center; padding: 12vh 16px 0; background: rgba(4, 6, 10, 0.72); }
.jump.is-open { display: flex; }
.jump-box { width: 100%; max-width: 520px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel-2); overflow: hidden; }
.jump-box input { box-sizing: border-box; width: 100%; height: 52px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font-family: var(--sans); font-size: 16px; outline: none; }
.jump-list { max-height: 320px; overflow-y: auto; padding: 6px; }
.jump-list a { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--text); font-size: 14px; text-decoration: none; }
.jump-list a span { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.jump-list a.is-sel, .jump-list a:hover { background: var(--raise); }

/* ---- public status page ---- */
.sp-hero { background: var(--ground); color: var(--text); border-bottom: 1px solid var(--line); overflow: hidden; }
.sp-hero-in { padding: 32px; display: flex; flex-direction: column; align-items: flex-start; gap: 22px; }
.sp-hero-copy { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.sp-hero h1 { margin: 0; font-family: var(--sans); font-weight: 700; font-size: clamp(30px, 4.2vw, 52px); line-height: 1.04; letter-spacing: -0.03em; }
.sp-facts { display: flex; flex-wrap: wrap; gap: 16px 0; margin: 0; }
.sp-facts div { display: flex; flex-direction: column-reverse; gap: 2px; padding: 0 24px; border-left: 1px solid var(--line); }
.sp-facts div:first-child { padding-left: 0; border-left: 0; }
.sp-facts dd { margin: 0; font-family: var(--mono); font-size: 26px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }
.sp-facts dt { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.sp-hero-note { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.sp-hero.is-degraded { background: #FFB547; color: #1A1200; border-bottom-color: #C98A1E; }
.sp-hero.is-degraded .sp-hero-note, .sp-hero.is-degraded .sp-facts dt { color: #3D2C00; }
.sp-hero.is-degraded .sp-facts div { border-left-color: #C98A1E; }
.sp-hero.is-outage { background: #B42323; color: #FFFFFF; border-bottom-color: #8E1B1B; }
.sp-hero.is-outage .sp-hero-note, .sp-hero.is-outage .sp-facts dt { color: #FFE3E3; }
.sp-hero.is-outage .sp-facts div { border-left-color: #D45A5A; }
.sp-hero.is-maint { background: #0B5FA8; color: #FFFFFF; border-bottom-color: #084A83; }
.sp-hero.is-maint .sp-hero-note, .sp-hero.is-maint .sp-facts dt { color: #DCEBFF; }
.sp-hero.is-maint .sp-facts div { border-left-color: #4A8BC7; }

.sp-section { display: flex; flex-direction: column; gap: 14px; margin-top: 40px; }
.sp-section > h2, .sp-h2 { margin: 0; font-family: var(--sans); font-weight: 600; font-size: 24px; letter-spacing: -0.02em; color: var(--text); }
.sp-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.sp-group { padding: 8px 24px; border-bottom: 1px solid var(--line); background: var(--raise); font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-2); }
.sp-svc { padding: 18px 24px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.sp-svc:last-child { border-bottom: 0; }
.sp-svc-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 24px; }
.sp-svc-name { font-weight: 600; font-size: 17px; color: var(--text); text-decoration: none; }
.sp-svc-name:hover { color: var(--accent); }
.sp-svc-up { font-family: var(--mono); font-size: 16px; font-weight: 500; color: var(--text); }
.sp-bars { display: flex; gap: 2px; height: 34px; }
.sp-bars i { flex: 1 1 0; min-width: 0; background: #1FA971; }
.sp-bars i.d1 { background: #7BCFA9; }
.sp-bars i.d2 { background: #E8A019; }
.sp-bars i.d3 { background: #E0762B; }
.sp-bars i.d4 { background: #D64545; }
.sp-svc-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.sp-inc { border-top: 4px solid var(--warn); }
.sp-inc.is-down { border-top-color: var(--down); }
.sp-inc-head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 32px; }
.sp-inc-head h3 { margin: 4px 0 0; font-family: var(--sans); font-weight: 600; font-size: 22px; line-height: 1.2; letter-spacing: -0.02em; color: var(--text); }
.sp-inc-meta { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.sp-update { padding: 16px 24px; display: flex; flex-wrap: wrap; gap: 4px 24px; border-bottom: 1px solid var(--line); }
.sp-update:last-child { border-bottom: 0; }
.sp-update-when { flex: 0 0 170px; display: flex; flex-direction: column; font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.sp-update-when b { font-weight: 500; color: var(--text); }
.sp-update p { flex: 1 1 320px; min-width: 0; margin: 0; font-size: 15px; color: var(--text); }
.sp-chip { display: inline-flex; padding: 2px 8px; border: 1px solid var(--line); border-radius: 2px; font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.sp-row { padding: 16px 24px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 28px; border-bottom: 1px solid var(--line); }
.sp-row:last-child { border-bottom: 0; }
.sp-row-title { flex: 1 1 280px; font-weight: 600; font-size: 15.5px; color: var(--text); }
.sp-subscribe { margin-top: 40px; padding: 32px; border-radius: var(--radius); background: #0B0E14; color: #E9EDF3; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 40px; }
.sp-subscribe h2 { margin: 0 0 4px; font-family: var(--sans); font-weight: 600; font-size: 26px; letter-spacing: -0.02em; color: #E9EDF3; }
.sp-subscribe p { margin: 0; color: #A7B1C2; font-size: 15px; }
.sp-subscribe .btn-primary { background: #3DDC97; color: #04231A; }
