:root {
  color-scheme: dark;
  --ink: #f6f7f2;
  --muted: #9aa6a1;
  --surface: #111917;
  --surface-2: #16221f;
  --line: #2b3a35;
  --green: #51d88a;
  --amber: #f7c868;
  --red: #ff716c;
  --blue: #86b9ff;
  --bg: #09110f;
  --tile-green: #16794d;
  --tile-orange: #a95c0b;
  --tile-red: #a93437;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 70% -20%, rgba(54, 132, 99, .26), transparent 35rem),
    var(--bg);
  font: 15px/1.6 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button {
  color: #07100d;
  background: var(--green);
  border: 0;
  border-radius: .65rem;
  padding: .65rem .9rem;
  font-weight: 750;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.secondary { color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); }
button.danger { color: var(--ink); background: #6a2828; }

.site-header, footer {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-header { min-height: 80px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; font-weight: 800; }
.brand-mark {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem;
  border: 1px solid rgba(81, 216, 138, .5); border-radius: .65rem;
  color: var(--green); background: rgba(81, 216, 138, .08); letter-spacing: -.04em;
}
.eyebrow, .legend, .updated { color: var(--muted); font-size: .82rem; }
.shell { width: min(1000px, calc(100% - 2rem)); margin: 0 auto; padding: 5rem 0; }
.hero { max-width: 760px; padding: 2rem 0 5rem; }
.hero.compact { padding-bottom: 2rem; }
.kicker { color: var(--green); text-transform: uppercase; letter-spacing: .15em; font-size: .72rem; font-weight: 850; margin: 0 0 .7rem; }
h1, h2, h3 { line-height: 1.12; letter-spacing: -.025em; }
h1 { font-size: clamp(2.4rem, 7vw, 5rem); margin: 0; max-width: 13ch; }
h2 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: 0; }
h3 { margin-top: 2.4rem; }
.lede { color: var(--muted); font-size: 1.08rem; max-width: 56ch; margin: 1.2rem 0 .8rem; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin: 0 0 1.5rem; }
section + section { margin-top: 5rem; }
.health-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem 1rem; color: var(--muted); font-size: .78rem; }
.health-legend span { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.legend-dot { width: .62rem; height: .62rem; border-radius: 50%; background: var(--muted); }
.legend-dot.healthy { background: var(--tile-green); }
.legend-dot.degraded { background: var(--tile-orange); }
.legend-dot.outage { background: var(--tile-red); }
/* ==========================================================================
   Full-screen status board (public page only — scoped under body.board)
   ========================================================================== */
.board {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.board .site-header,
.board .board-footer {
  width: 100%;
  margin: 0;
  padding: 0 clamp(1rem, 2.5vw, 2.25rem);
}
.board-header {
  flex: 0 0 auto;
  min-height: 68px;
  gap: 1.5rem;
}
.board-footer { min-height: 52px; font-size: .82rem; }
.board .brand { font-size: 1.05rem; }
.board-overall { display: flex; align-items: center; gap: .9rem; min-width: 0; flex: 1; }
.overall-pill {
  --pill-color: var(--tile-orange);
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  flex: 0 0 auto;
  padding: .4rem .85rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pill-color) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--pill-color) 45%, transparent);
  color: var(--ink);
  font-weight: 800;
  font-size: .92rem;
  white-space: nowrap;
}
.overall-pill.healthy { --pill-color: var(--tile-green); }
.overall-pill.degraded { --pill-color: var(--tile-orange); }
.overall-pill.outage { --pill-color: var(--tile-red); }
.overall-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--pill-color); box-shadow: 0 0 0 .28rem color-mix(in srgb, var(--pill-color) 22%, transparent); }
.overall-detail { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-header-right { display: flex; align-items: center; gap: 1.4rem; flex: 0 0 auto; }

.incident-banner {
  flex: 0 0 auto;
  display: grid;
  gap: .55rem;
  padding: .85rem clamp(1rem, 2.5vw, 2.25rem);
  background: color-mix(in srgb, var(--tile-red) 22%, var(--bg));
  border-bottom: 1px solid color-mix(in srgb, var(--tile-red) 50%, transparent);
}
.incident-banner .banner-item { display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap; }
.incident-banner .banner-item strong { font-size: .98rem; }
.incident-banner .banner-item span { color: rgba(246, 247, 242, .82); font-size: .86rem; }
.incident-banner time { color: rgba(246, 247, 242, .7); font-size: .78rem; margin-left: auto; white-space: nowrap; }

.board-main {
  flex: 1 1 auto;
  min-height: 0;
  padding: clamp(.5rem, 1.2vw, .85rem);
}
.component-grid {
  display: grid;
  gap: clamp(.5rem, 1vw, .85rem);
  height: 100%;
  grid-template-columns: repeat(auto-fit, minmax(clamp(240px, 22vw, 340px), 1fr));
  grid-auto-rows: minmax(180px, 1fr);
}
.service-tile {
  --tile-color: var(--tile-orange);
  position: relative;
  min-width: 0;
  padding: clamp(1.1rem, 1.8vw, 1.9rem);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  color: #fff;
  text-align: left;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, .12), transparent 60%),
    var(--tile-color);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: .5rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}
.service-tile.healthy { --tile-color: var(--tile-green); }
.service-tile.degraded { --tile-color: var(--tile-orange); }
.service-tile.outage { --tile-color: var(--tile-red); }
.service-tile:hover {
  filter: brightness(1.07);
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.service-tile:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.tile-topline { display: flex; align-items: flex-start; justify-content: flex-end; gap: .75rem; }
.tile-arrow path, .dialog-close path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tile-arrow {
  width: 1.45rem;
  height: 1.45rem;
  flex: 0 0 auto;
  opacity: .7;
  transition: transform .18s ease, opacity .18s ease;
}
.service-tile:hover .tile-arrow { transform: translateX(4px); opacity: 1; }
.tile-body { margin-top: auto; display: grid; gap: .25rem; }
.tile-name {
  font-size: clamp(1.15rem, 1.6vw, 1.55rem);
  font-weight: 850;
  line-height: 1.12;
  letter-spacing: -.03em;
}
.tile-state { font-size: clamp(.9rem, 1.1vw, 1.05rem); font-weight: 700; color: rgba(255, 255, 255, .92); }
.tile-meta { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; border-top: 1px solid rgba(255, 255, 255, .2); padding-top: .75rem; }
.tile-metric { font-size: .95rem; font-weight: 850; }
.tile-label, .tile-checked { color: rgba(255, 255, 255, .78); font-size: .68rem; font-weight: 650; line-height: 1.35; }
.tile-checked { text-align: right; }
.service-detail {
  width: min(620px, calc(100% - 2rem));
  color: var(--ink);
  background: #101a17;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}
.service-detail::backdrop { background: rgba(3, 8, 7, .76); backdrop-filter: blur(5px); }
.service-detail-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.service-detail h2 { font-size: clamp(1.7rem, 5vw, 2.6rem); }
.dialog-close {
  width: 2.7rem;
  height: 2.7rem;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: .72rem;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 50%;
}
.dialog-close svg { width: 100%; height: 100%; }
.detail-state {
  --state-color: var(--tile-orange);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-top: 1.5rem;
  padding: .45rem .72rem;
  color: #fff;
  background: var(--state-color);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.detail-state.healthy { --state-color: var(--tile-green); }
.detail-state.degraded { --state-color: var(--tile-orange); }
.detail-state.outage { --state-color: var(--tile-red); }
.detail-description { max-width: 56ch; margin: 1.2rem 0 1.5rem; color: var(--muted); font-size: 1rem; }
.detail-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; margin: 0; }
.detail-metrics div { min-width: 0; padding: .9rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: .7rem; }
.detail-metrics dt { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.detail-metrics dd { margin: .35rem 0 0; font-weight: 800; overflow-wrap: anywhere; }
.uptime { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; }
.status { display: inline-flex; align-items: center; gap: .45rem; color: var(--muted); text-transform: capitalize; }
.status::before { content: ""; width: .65rem; height: .65rem; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 .25rem rgba(154, 166, 161, .09); }
.status.operational::before, .status.pass::before, .status.sent::before { background: var(--green); box-shadow: 0 0 0 .25rem rgba(81, 216, 138, .1); }
.status.degraded::before, .status.advisory::before, .status.suppressed::before { background: var(--amber); }
.status.major_outage::before, .status.outage::before, .status.fail::before, .status.failed::before { background: var(--red); }
.incident-list { display: grid; gap: .8rem; }
.incident, .empty, .setting-row {
  border: 1px solid var(--line); border-radius: .9rem; background: var(--surface); padding: 1.1rem 1.2rem;
}
.incident header, .setting-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.incident h3 { margin: 0; font-size: 1.05rem; }
.incident p { color: var(--muted); margin-bottom: 0; }
.incident time { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.updates { padding-left: 1.1rem; color: var(--muted); }
footer { min-height: 100px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }

.admin-shell { width: min(1200px, calc(100% - 2rem)); padding-top: 3rem; }
.admin-shell h1 { font-size: clamp(2.2rem, 5vw, 4rem); }
.admin-nav { position: sticky; top: .5rem; z-index: 10; display: flex; flex-wrap: wrap; gap: .4rem; padding: .55rem; border: 1px solid var(--line); border-radius: .85rem; background: rgba(9, 17, 15, .93); backdrop-filter: blur(12px); }
.admin-nav a { padding: .55rem .8rem; text-decoration: none; color: var(--muted); }
.admin-nav button { margin-left: auto; }
.panel { margin-top: 3rem; scroll-margin-top: 6rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: .8rem; }
table { width: 100%; border-collapse: collapse; min-width: 760px; background: var(--surface); }
th, td { text-align: left; padding: .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
td code { color: var(--blue); }
.inline-form, .form-grid { display: grid; gap: .8rem; margin: 1rem 0 1.5rem; }
.inline-form { grid-template-columns: 2fr 1.5fr auto; align-items: end; }
.form-grid { grid-template-columns: repeat(2, 1fr); }
label { display: grid; gap: .35rem; color: var(--muted); font-size: .83rem; }
input, select, textarea {
  width: 100%; color: var(--ink); background: #0d1513; border: 1px solid var(--line);
  border-radius: .6rem; padding: .65rem .75rem;
}
select[multiple] { min-height: 8rem; }
.checkbox { display: flex; align-items: center; gap: .5rem; }
.checkbox input { width: auto; }
.wide { grid-column: 1 / -1; }
.settings-list { display: grid; gap: .6rem; }
.setting-row small { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .45rem; }
#toast { position: fixed; right: 1rem; bottom: 1rem; max-width: 24rem; padding: .8rem 1rem; border-radius: .7rem; background: var(--ink); color: var(--bg); opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.visible { opacity: 1; }

@media (max-width: 700px) {
  .shell { padding-top: 3rem; }
  .hero { padding-bottom: 3rem; }
  .component-grid, .inline-form, .form-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .health-legend { justify-content: flex-start; }
  .service-tile { min-height: 220px; }
  .detail-metrics { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .site-header .eyebrow { display: none; }
  .incident header, .setting-row { align-items: flex-start; flex-direction: column; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; }

  /* Board header collapses to a stacked, scrollable layout on phones */
  .board-header { flex-wrap: wrap; align-items: flex-start; gap: .7rem; padding-top: .7rem; padding-bottom: .7rem; }
  .board-overall { order: 3; flex-basis: 100%; }
  .board-header-right { order: 2; margin-left: auto; }
  .overall-detail { display: none; }
  .board-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: .3rem; padding-top: .7rem; padding-bottom: .7rem; }
}

@media (min-width: 701px) and (max-width: 980px) {
  .component-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .service-tile, .tile-arrow { transition: none; }
}
