/* ==========================================================================
   Softcrafter Status — dark-first, no framework.
   Replaces app.min.css (82 KB of UIKit) with ~13 KB of what is actually used.
   ========================================================================== */

/* --- Tokens ------------------------------------------------------------- */
/* Dark is the default: this page lives on wall dashboards and on-call
   laptops at 3am. Light is opt-in via the toggle or the OS preference. */
:root {
  --bg: #0b1017;
  --panel: #131a26;
  --panel-2: #182131;
  --panel-hi: #1c2637;
  --line: #212937;
  --line-2: #2b3648;
  --fg: #e6e9ef;
  --fg-dim: #9aa7bd;
  --fg-mute: #6b788e;

  --up: #3bd671;
  --down: #df484a;
  --deg: #f29030;
  --info: #4a9eff;
  --idle: #55617340;
  --idle-solid: #46515f;

  --up-soft: #3bd67122;
  --down-soft: #df484a22;
  --deg-soft: #f2903022;
  --info-soft: #4a9eff22;

  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
  --radius: 12px;
  --radius-sm: 8px;
  --ring: 0 0 0 3px #3bd67133;

  --font: "Chakra Petch", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, monospace;
}

:root[data-theme="light"] {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --panel-hi: #f1f5f9;
  --line: #e3e8f0;
  --line-2: #cfd8e3;
  --fg: #101725;
  --fg-dim: #4d5a70;
  --fg-mute: #7b8798;

  --up: #22a95a;
  --down: #d0353a;
  --deg: #cf7411;
  --info: #2b7fd4;
  --idle: #cbd5e1;
  --idle-solid: #b6c2d0;

  --up-soft: #22a95a18;
  --down-soft: #d0353a18;
  --deg-soft: #cf741118;
  --info-soft: #2b7fd418;

  --shadow: 0 1px 2px rgba(16, 23, 37, .06), 0 8px 24px -14px rgba(16, 23, 37, .18);
  --ring: 0 0 0 3px #22a95a2e;
}

/* --- Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* A wash of colour behind the hero so the page has some depth without an image. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 420px;
  background: radial-gradient(80% 100% at 50% 0%, #3bd6710e, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--up); }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 6px;
}

.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1020px;
  margin: 0 auto;
  padding: 0 20px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- Header ------------------------------------------------------------- */
.top {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.top-in {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
}

.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; min-width: 0; }
.brand img { display: block; height: 26px; width: auto; max-width: 100%; }
:root[data-theme="light"] .brand img.on-dark { display: none; }
:root:not([data-theme="light"]) .brand img.on-light { display: none; }

.brand-txt { font-size: 13px; color: var(--fg-mute); border-left: 1px solid var(--line-2); padding-left: 12px; }

/* Live pill: the page's proof that it is actually updating. */
.live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 12px;
  color: var(--fg-dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow: hidden;
}

#live-t { overflow: hidden; text-overflow: ellipsis; }

.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--up);
  flex: none;
}
.live[data-conn="live"] .live-dot { animation: pulse 2.4s ease-in-out infinite; }
.live[data-conn="stale"] .live-dot { background: var(--deg); }
.live[data-conn="error"] .live-dot { background: var(--down); }
.live[data-conn="paused"] .live-dot { background: var(--idle-solid); animation: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 #3bd67166; }
  50%      { opacity: .65; box-shadow: 0 0 0 5px #3bd67100; }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--fg-dim);
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: var(--fg); border-color: var(--line-2); background: var(--panel-hi); }
.icon-btn[aria-pressed="true"] { color: var(--up); border-color: #3bd67155; background: var(--up-soft); }
.icon-btn svg { width: 16px; height: 16px; display: block; }

:root[data-theme="light"] .ico-sun { display: none; }
:root:not([data-theme="light"]) .ico-moon { display: none; }

/* --- Hero --------------------------------------------------------------- */
.hero {
  margin: 28px 0 22px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}

/* Left edge takes the colour of the current state. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent, var(--up));
}
.hero[data-state="operational"] { --accent: var(--up); }
.hero[data-state="degraded"], .hero[data-state="partial_outage"] { --accent: var(--deg); }
.hero[data-state="major_outage"] { --accent: var(--down); }
.hero[data-state="maintenance"] { --accent: var(--info); }
.hero[data-state="unknown"] { --accent: var(--idle-solid); }

.beacon {
  position: relative;
  width: 44px; height: 44px;
  flex: none;
  display: grid;
  place-items: center;
}
.beacon i {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--accent);
  z-index: 1;
}
.beacon::before, .beacon::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0;
  inset: 0;
  animation: ripple 2.8s cubic-bezier(.2, .6, .3, 1) infinite;
}
.beacon::after { animation-delay: 1.4s; }
@keyframes ripple {
  0%   { transform: scale(.36); opacity: .65; }
  100% { transform: scale(1);   opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .beacon::before, .beacon::after, .live-dot { animation: none !important; }
}

.hero-txt { flex: 1 1 260px; min-width: 0; }
.hero-txt h1 { font-size: 24px; line-height: 1.2; }
.hero-sub { margin-top: 5px; font-size: 13.5px; color: var(--fg-dim); }

.stats {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.stat {
  min-width: 96px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}
.stat-k {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--fg-mute);
}
.stat-v {
  margin-top: 3px;
  font-size: 19px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.stat-v small { font-size: 12px; font-weight: 500; color: var(--fg-mute); margin-left: 1px; }

/* --- Notice banners ----------------------------------------------------- */
.notice {
  display: flex;
  gap: 12px;
  padding: 13px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
  border-radius: var(--radius-sm);
  background: var(--info-soft);
  font-size: 13.5px;
}
.notice.is-warn { border-left-color: var(--deg); background: var(--deg-soft); }
.notice strong { display: block; margin-bottom: 2px; }
.notice p { margin: 0; color: var(--fg-dim); }

/* --- Section + group ---------------------------------------------------- */
.sec-head {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin: 26px 0 12px;
  flex-wrap: wrap;
}
.sec-head h2 { font-size: 16px; }
.sec-head .hint { font-size: 12.5px; color: var(--fg-mute); margin-right: auto; }

/* Uptime window switch */
.seg {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}
.seg button {
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 12px;
  color: var(--fg-mute);
  transition: color .15s, background .15s;
}
.seg button:hover { color: var(--fg); }
.seg button[aria-selected="true"] {
  color: var(--fg);
  background: var(--panel-hi);
  box-shadow: inset 0 0 0 1px var(--line);
}

.group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
}
.group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.group-head h3 { font-size: 13px; letter-spacing: .01em; }
.group-head .blurb { font-size: 12px; color: var(--fg-mute); margin-right: auto; }
.group-tally {
  font-size: 11.5px;
  color: var(--fg-mute);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* --- Monitor row -------------------------------------------------------- */
.row {
  padding: 15px 18px 17px;
  border-top: 1px solid var(--line);
  transition: background .15s;
}
.row:first-child { border-top: 0; }
.row:hover { background: var(--panel-2); }

.row-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 11px;
}

.dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--idle-solid);
}
.is-up .dot { background: var(--up); }
.is-down .dot { background: var(--down); }
.is-degraded .dot { background: var(--deg); }
.is-maintenance .dot { background: var(--info); }

.row-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-host {
  font-size: 11.5px;
  color: var(--fg-mute);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-host:hover { color: var(--fg-dim); }

.spacer { margin-left: auto; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  flex: none;
}
.tag svg { width: 11px; height: 11px; }
.is-up .tag { color: var(--up); background: var(--up-soft); }
.is-down .tag { color: var(--down); background: var(--down-soft); }
.is-degraded .tag { color: var(--deg); background: var(--deg-soft); }
.is-maintenance .tag { color: var(--info); background: var(--info-soft); }
.is-prelaunch .tag, .is-paused .tag, .is-pending .tag { color: var(--fg-mute); background: var(--idle); }

.row-pct {
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 66px;
  text-align: right;
  flex: none;
  color: var(--fg-dim);
}
.row-pct.is-perfect { color: var(--up); }
.row-pct.is-poor { color: var(--deg); }
.row-pct.is-bad { color: var(--down); }
.row-pct.is-na { color: var(--fg-mute); }

/* Downtime reason / prelaunch note */
.row-note {
  margin: -4px 0 10px 19px;
  font-size: 12px;
  color: var(--fg-dim);
}
.row-note code {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--panel-hi);
  border: 1px solid var(--line);
}

/* --- Uptime bar --------------------------------------------------------- */
.bar {
  display: flex;
  gap: 2px;
  height: 26px;
  align-items: stretch;
}
/* Each day is a green column; the downtime portion fills up from the bottom
   in amber or red. Severity is therefore readable without hovering, which is
   the convention the established status pages settled on. */
.bar-i {
  position: relative;
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--up);
  transition: transform .12s, filter .12s;
  transform-origin: center bottom;
}
.bar-i[data-s="nodata"] { background: var(--idle); }
.bar-i > i {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: block;
  background: var(--deg);
}
.bar-i[data-s="down"] > i { background: var(--down); }
.bar-i:hover { filter: brightness(1.25); transform: scaleX(1.6); z-index: 2; }
:root[data-theme="light"] .bar-i:hover { filter: brightness(.92); }

.bar-legend {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--fg-mute);
}

/* Per-service report strip: all four uptime windows at once. */
.sla { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.sla-i { display: inline-flex; align-items: baseline; gap: 4px; }
.sla-i em {
  font-style: normal;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--fg-mute);
  opacity: .8;
}
.sla-i b {
  font-weight: 600;
  font-size: 11px;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}
.sla-i b.is-low { color: var(--deg); }

/* The window currently driving the headline number on the right. */
.sla-i.is-active em { color: var(--fg-dim); opacity: 1; }
.sla-i.is-active b { color: var(--fg); }
.sla-i.is-active { position: relative; }
.sla-i.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 1px;
  background: var(--line-2);
}

/* One shared tooltip element instead of 90 per row. */
#tip {
  position: fixed;
  z-index: 60;
  padding: 7px 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--panel-hi);
  color: var(--fg);
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 8px 26px -8px rgba(0, 0, 0, .6);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity .12s;
  white-space: nowrap;
  max-width: 250px;
}
#tip[data-show="1"] { opacity: 1; }
#tip b { display: block; font-weight: 600; }
#tip span { color: var(--fg-dim); }

/* --- Incidents ---------------------------------------------------------- */
.timeline { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.inc {
  display: flex;
  gap: 13px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}
.inc:first-child { border-top: 0; }
.inc-mark {
  width: 8px; height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  flex: none;
  background: var(--down);
}
.inc[data-state="resolved"] .inc-mark { background: var(--idle-solid); }
.inc[data-state="ongoing"] .inc-mark { background: var(--down); box-shadow: 0 0 0 3px var(--down-soft); }
.inc-body { min-width: 0; flex: 1; }
.inc-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.inc-h strong { font-size: 13.5px; }
.inc-dur {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--idle);
  color: var(--fg-dim);
}
.inc[data-state="ongoing"] .inc-dur { background: var(--down-soft); color: var(--down); }
.inc-meta { margin-top: 3px; font-size: 12px; color: var(--fg-mute); }
.inc-meta code { font-family: var(--mono); font-size: 11.5px; color: var(--fg-dim); }

.empty { padding: 30px 18px; text-align: center; color: var(--fg-mute); font-size: 13px; }

.more {
  display: block;
  width: 100%;
  padding: 11px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--fg-dim);
  background: var(--panel-2);
}
.more:hover { color: var(--fg); background: var(--panel-hi); }

/* --- Skeleton ----------------------------------------------------------- */
.skel { padding: 18px; }
.skel i {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--panel-hi) 37%, var(--panel-2) 63%);
  background-size: 400% 100%;
  animation: sweep 1.3s ease-in-out infinite;
  margin-bottom: 10px;
}
.skel i:nth-child(odd) { width: 34%; }
.skel i:nth-child(even) { height: 24px; width: 100%; margin-bottom: 20px; }
@keyframes sweep { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* --- Footer ------------------------------------------------------------- */
.foot {
  margin: 42px 0 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--fg-mute);
}
.foot a:hover { color: var(--up); }
.foot .spacer { margin-left: auto; }
.foot img { height: 18px; width: auto; vertical-align: middle; opacity: .8; }

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 760px) {
  .hero { padding: 20px; gap: 18px; }
  .hero-txt h1 { font-size: 20px; }
  .stats { width: 100%; }
  .stat { flex: 1 1 0; min-width: 0; }
  .brand-txt { display: none; }
}

@media (max-width: 560px) {
  .shell { padding: 0 14px; }

  /* Two rows rather than one overflowing row: brand + controls, then the
     live pill full width. Nothing gets pushed off the viewport. */
  .top-in { flex-wrap: wrap; gap: 10px; padding: 9px 0; min-height: 0; }
  .brand { order: 1; }
  .brand img { height: 22px; }
  #bell, #theme { order: 2; }
  .live { order: 3; flex: 1 1 100%; justify-content: center; }

  .row-top { flex-wrap: wrap; gap: 8px 9px; }
  .row-host { display: none; }
  .row-pct { min-width: 0; }
  .spacer { margin-left: auto; }
  .bar { height: 30px; }
  .foot { flex-direction: column; align-items: flex-start; gap: 8px; }
  .foot .spacer { margin-left: 0; }
}

/* --- Uptime bar legend -------------------------------------------------- */
/* Without this, the grey stretch on a recently-added monitor reads as
   "broken" rather than "we were not watching yet". */
.key {
  display: flex;
  gap: 14px;
  margin: 0 auto 0 0;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--fg-mute);
}
.key li { display: inline-flex; align-items: center; gap: 6px; }
.key li::before {
  content: "";
  width: 8px; height: 10px;
  border-radius: 2px;
  background: var(--up);
}
.key li[data-s="degraded"]::before {
  background: linear-gradient(to bottom, var(--up) 55%, var(--deg) 55%);
}
.key li[data-s="down"]::before {
  background: linear-gradient(to bottom, var(--up) 25%, var(--down) 25%);
}
.key li[data-s="nodata"]::before { background: var(--idle); }

@media (max-width: 900px) {
  /* Keep the strip on one line by dropping the widest window first. */
  .sla { gap: 9px; }
  .sla-i[data-w="1"] { display: none; }
}

@media (max-width: 640px) {
  .key { gap: 10px; font-size: 11px; }
  .key li[data-s="degraded"] { display: none; }
  .sla-i[data-w="7"] { display: none; }
  .bar-legend > span:first-child { display: none; }
}
