/* SP9MOA ClubHub — operational console theme.
   Adapted from the WarnFlux admin UI (Apache-2.0, github.com/szporwolik/WarnFlux):
   same palette, spacing, card and badge grammar, trimmed to what a single-page
   read-only status console needs. Fonts (Inter, JetBrains Mono, SIL OFL) are
   self-hosted; the dashboard makes no external requests at all.

   Every family ships TWO subsets with explicit unicode-range declarations: the
   "latin" file stops at U+00FF and carries no Polish letter, so without the
   "latin-ext" subset the browser would mix in a system face for ą/ć/ę/ł/ń/ś/ź/ż. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-latin-ext-500-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---- design tokens: graphite surfaces, WarnFlux orange accent ---- */
:root {
  --bg:             #0f1419;
  --surface:        #151b21;
  --surface-raised: #1b232b;
  --surface-muted:  #202a33;

  --border:        #303c46;
  --border-strong: #46545f;

  --text:           #eef2f5;
  --text-secondary: #b4bec7;
  --text-muted:     #87939e;

  --brand:       #f06828;
  --brand-hover: #f47b42;
  --brand-soft:  #342018;
  --on-brand:    #101418;

  --accent:      var(--brand);
  --accent-soft: var(--brand-soft);
  --link:        #6eadd0;
  --link-hover:  #9bc6d8;
  --focus:       #8abbd0;

  --ok:      #5dbb88;
  --ok-bg:   rgba(93, 187, 136, 0.16);
  --warn:    #e0a63c;
  --warn-bg: rgba(224, 166, 60, 0.16);
  --bad:     #f05a69;
  --bad-bg:  rgba(240, 90, 105, 0.16);
  --info:    #6eadd0;
  --info-bg: rgba(110, 173, 208, 0.16);
  --muted-bg: rgba(135, 147, 158, 0.14);

  --ok-border:   rgba(93, 187, 136, 0.45);
  --warn-border: rgba(224, 166, 60, 0.45);
  --bad-border:  rgba(240, 90, 105, 0.45);
  --info-border: rgba(110, 173, 208, 0.45);

  --header:      #0b0f13;
  --input-bg:    #11171c;
  --code-bg:     #0b1014;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-pop:  0 8px 24px rgba(0, 0, 0, 0.5);
  --logo-ring:   rgba(255, 255, 255, 0.15);

  --radius: 6px;
  --font-sans: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

html[data-theme="light"] {
  --bg:             #f6f8fa;
  --surface:        #ffffff;
  --surface-raised: #fbfcfd;
  --surface-muted:  #eef2f4;

  --border:        #d8e0e5;
  --border-strong: #bcc7cf;

  --text:           #202a32;
  --text-secondary: #56636e;
  --text-muted:     #77838c;

  --brand:       #d06038;
  --brand-hover: #b84e2b;
  --brand-soft:  #f7e7e0;
  --on-brand:    #ffffff;

  --link:       #2f6b84;
  --link-hover: #214f63;
  --focus:      #3b7896;

  --ok:      #287a55;
  --ok-bg:   rgba(40, 122, 85, 0.12);
  --warn:    #b47a18;
  --warn-bg: rgba(180, 122, 24, 0.14);
  --bad:     #b52d3e;
  --bad-bg:  rgba(181, 45, 62, 0.1);
  --info:    #32759a;
  --info-bg: rgba(50, 117, 154, 0.12);
  --muted-bg: rgba(104, 114, 123, 0.12);

  --ok-border:   rgba(40, 122, 85, 0.4);
  --warn-border: rgba(180, 122, 24, 0.4);
  --bad-border:  rgba(181, 45, 62, 0.4);
  --info-border: rgba(50, 117, 154, 0.4);

  --header:      #ffffff;
  --input-bg:    #ffffff;
  --code-bg:     #eef2f4;
  --card-shadow: 0 1px 2px rgba(31, 41, 51, 0.08);
  --logo-ring:   rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.006em;
}

button, input, select, textarea { font-family: inherit; }

h1 { font-family: var(--font-sans); font-size: 1rem; font-weight: 600; margin: 0; }
h2 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  margin: 0 0 0.75rem;
  color: var(--text);
}
h2 .icon { color: var(--text-muted); }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

.muted { color: var(--text-muted); }
.small { font-size: 0.78rem; }
.mono { font-family: var(--font-mono); font-size: 0.8rem; }
code, kbd, samp { font-family: var(--font-mono); }

.icon {
  display: block;
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: none;
  shape-rendering: geometricPrecision;
}

/* ---- shell ---- */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 48px;
  padding: 0.35rem 1rem;
  background: var(--header);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; color: var(--text); }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--logo-ring);
}
.brand-mark .icon { width: 16px; height: 16px; }

.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-name { font-weight: 600; font-size: 0.95rem; white-space: nowrap; }
.brand-tagline {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-spacer { flex: 1; }

.version-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  white-space: nowrap;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text-muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--focus); }
.theme-toggle .ico-moon { display: none; }
html[data-theme="light"] .theme-toggle .ico-sun { display: none; }
html[data-theme="light"] .theme-toggle .ico-moon { display: block; }

/* ---- layout ---- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1.25rem 1.25rem 2rem;
  flex: 1 0 auto;
  align-content: start;
}

@media (min-width: 900px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .grid > .card.span-2 { grid-column: 1 / -1; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--card-shadow);
  min-width: 0;
}

/* ---- overall status banner ---- */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}
.hero-main { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.hero-meta { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }

.status-dot {
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 0 0 4px var(--muted-bg);
}
.status-dot.ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-bg); }
.status-dot.bad { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-bg); }

.hero-text { display: flex; flex-direction: column; min-width: 0; }
.hero-state {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.2;
  text-transform: capitalize;
}
.hero-sub { font-size: 0.8rem; color: var(--text-muted); }

/* ---- key/value panels ---- */
.kv-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  font-size: 0.85rem;
}
.kv { display: contents; }
.kv .k { color: var(--text-muted); }
.kv .v {
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow-wrap: anywhere;
}
.kv .v.mono { font-size: 0.8rem; }

/* ---- badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-transform: lowercase;
  white-space: nowrap;
}
.badge-row { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-border); }
.badge.muted { background: var(--muted-bg); color: var(--text-muted); border-color: var(--border); }

.count {
  background: var(--muted-bg);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

/* ---- stat tiles ---- */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.6rem;
  margin-top: 0.85rem;
}
.stat-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.stat-tile .stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-tile .stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.note {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin-top: 0.85rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text-muted);
  font-size: 0.78rem;
}
.note .icon { width: 15px; height: 15px; margin-top: 1px; }
.note[hidden] { display: none; }
.note.warn { border-left-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.note.bad { border-left-color: var(--bad); color: var(--bad); background: var(--bad-bg); }

/* ---- footer ---- */
.footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  padding: 0.75rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--header);
  flex: 0 0 auto;
}
.footer .sep { color: var(--border-strong); margin: 0 0.4rem; }
.footer-name { color: var(--text); font-weight: 600; }
.footer a { display: inline-flex; align-items: center; gap: 0.3rem; }
.footer .icon { width: 14px; height: 14px; }
.commit-link { font-family: var(--font-mono); }

/* ---- live indicator ---- */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.7rem;
  white-space: nowrap;
}
.live-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}
.live-pill.stale { color: var(--warn); border-color: var(--warn-border); }
.live-pill.stale::before { background: var(--warn); }
.live-pill.down { color: var(--bad); border-color: var(--bad-border); }
.live-pill.down::before { background: var(--bad); }

@media (max-width: 620px) {
  .topbar { gap: 0.5rem; padding: 0.35rem 0.75rem; }
  .brand-tagline { display: none; }
  .live-pill { display: none; }
  .grid { padding: 0.9rem 0.75rem 1.5rem; gap: 0.75rem; }
  .hero-meta { margin-left: 0; }
}

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