/* Clubs Controller — "sukno i kreda": felt-green band, cool paper surfaces, cue-chalk blue data.
   One memorable element: the availability rail with diamond sights, like a table cushion. */
:root {
  color-scheme: light;
  --felt: #0d4a3f;
  --felt-2: #0a3b32;
  --felt-ink: #e8f3ef;
  --felt-muted: #a9cbc0;
  --bg: #eef1ee;
  --surface: #fbfcfb;
  --ink: #142420;
  --ink-2: #3d4f49;
  --muted: #61716b;
  --grid: #dfe5e1;
  --axis: #c2ccc7;
  --line: rgba(20, 36, 32, 0.12);
  --s1: #2a78d6;
  --s2: #eb6834;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --nodata: #cfd6d2;
  --focus: #2a78d6;
  --display: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
  --text: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --felt: #0f3b33; --felt-2: #0b2e28; --felt-ink: #e3efeb; --felt-muted: #8fb3a7;
    --bg: #0c1513; --surface: #13201c; --ink: #e6efec; --ink-2: #b9c8c3; --muted: #8a9b95;
    --grid: #22332e; --axis: #2f423c; --line: rgba(230, 239, 236, 0.1);
    --s1: #3987e5; --s2: #d95926; --nodata: #2a3a35; --focus: #6aa6f0;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --felt: #0f3b33; --felt-2: #0b2e28; --felt-ink: #e3efeb; --felt-muted: #8fb3a7;
  --bg: #0c1513; --surface: #13201c; --ink: #e6efec; --ink-2: #b9c8c3; --muted: #8a9b95;
  --grid: #22332e; --axis: #2f423c; --line: rgba(230, 239, 236, 0.1);
  --s1: #3987e5; --s2: #d95926; --nodata: #2a3a35; --focus: #6aa6f0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 var(--text); font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: 0.005em; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.error { color: var(--critical); min-height: 1.5em; margin: 0; font-weight: 500; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- felt band ---------------------------------------------------------- */
.band { background: var(--felt); color: var(--felt-ink); }
.band-inner { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.band > .band-inner:first-child { display: flex; align-items: center; gap: 28px; min-height: 56px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 20px/1 var(--display); letter-spacing: 0.01em; }
.brand-mark { width: 14px; height: 14px; fill: var(--felt-ink); }
.modules { display: flex; gap: 4px; }
.module {
  color: var(--felt-muted); text-decoration: none; font: 600 16px/1 var(--display);
  padding: 8px 12px; border-radius: 6px;
}
.module.active { color: var(--felt-ink); background: var(--felt-2); }
.band-right { margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--felt-muted); }
.link-btn { background: none; border: 0; color: var(--felt-ink); padding: 6px 2px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.summary { display: flex; gap: 10px; padding-bottom: 14px; overflow-x: auto; }
.chip {
  display: flex; align-items: center; gap: 10px; background: var(--felt-2); color: var(--felt-ink);
  border: 0; border-radius: 8px; padding: 8px 14px 8px 10px; cursor: pointer; white-space: nowrap; text-align: left;
}
.chip strong { font: 600 16px/1.1 var(--display); display: block; }
.chip small { color: var(--felt-muted); font-size: 13px; }

/* ---- status markers (icon + label, never colour alone) ------------------ */
.st { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; flex: none; color: #fff; }
.st svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.st.good { background: var(--good); }
.st.warning { background: var(--warning); color: #1a1405; }
.st.serious { background: var(--serious); }
.st.critical { background: var(--critical); }
.st.nodata { background: var(--muted); }

/* ---- login -------------------------------------------------------------- */
.login-wrap { min-height: calc(100vh - 56px); display: grid; place-items: center; padding: 24px 16px; }
.login { width: min(100%, 360px); display: grid; gap: 10px; }
.login h1 { font-size: 34px; }
.login label { font-weight: 500; margin-top: 8px; }
.login input { background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; padding: 10px 12px; }
.primary { background: var(--felt); color: var(--felt-ink); border: 0; border-radius: 8px; padding: 11px 16px; font-weight: 600; cursor: pointer; margin-top: 6px; }

/* ---- layout ------------------------------------------------------------- */
main { max-width: 1240px; margin: 0 auto; padding: 24px 16px 48px; }
.net-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.net-head h1 { font-size: 30px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 6px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--felt); color: var(--felt-ink); }

.club { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px 22px 18px; margin-bottom: 22px; scroll-margin-top: 16px; }
.club-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.club-head h2 { font-size: 28px; font-weight: 700; }
.state { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.seen { color: var(--muted); font-size: 14px; }
.club-head .seen { margin-left: auto; }
.alert {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 10px 14px; border-radius: 8px;
  background: color-mix(in srgb, var(--critical) 10%, var(--surface)); color: var(--ink);
}
.alert.warn { background: color-mix(in srgb, var(--warning) 16%, var(--surface)); }

/* figures row: plain numbers, no tiles */
.figures { display: flex; flex-wrap: wrap; gap: 8px 36px; margin: 18px 0 6px; }
.fig .v { font: 600 26px/1.1 var(--display); }
.fig .v small { font: 500 15px var(--text); color: var(--muted); margin-left: 3px; }
.fig .l { font-size: 14px; color: var(--muted); }

/* ---- the rail ----------------------------------------------------------- */
.rail-wrap { margin: 18px 0 8px; }
.rail-title, .chart-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.rail-title h3, .chart-title h3 { font-size: 17px; }
.rail-title span, .chart-title span { font-size: 13px; color: var(--muted); }
.rail { position: relative; padding: 6px; border-radius: 9px; background: var(--felt); }
.rail svg { display: block; width: 100%; height: 30px; }
.rail-cell { cursor: default; }
.sights { position: relative; height: 26px; margin: 0 6px; }
.sight { position: absolute; top: 4px; transform: translateX(-50%); display: grid; justify-items: center; gap: 1px; font-size: 12px; color: var(--muted); }
.sight i { width: 8px; height: 8px; background: var(--axis); transform: rotate(45deg); display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---- charts ------------------------------------------------------------- */
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 22px; }
@media (max-width: 860px) { .charts { grid-template-columns: 1fr; } }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 190px; overflow: visible; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-family: var(--text); }
.chart .ser { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: 0.12; }
.chart .cross { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .dlabel { font-size: 12px; font-weight: 600; fill: var(--ink-2); font-family: var(--text); }
.chart .empty { fill: var(--muted); font-size: 13px; font-family: var(--text); }
.chart-legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.chart-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; vertical-align: middle; margin-right: 6px; }
details.data { margin-top: 8px; font-size: 13px; color: var(--muted); }
details.data summary { cursor: pointer; width: max-content; }
details.data table { border-collapse: collapse; margin-top: 6px; font-size: 13px; color: var(--ink-2); }
details.data td, details.data th { padding: 3px 12px 3px 0; text-align: right; }
details.data th:first-child, details.data td:first-child { text-align: left; }

/* ---- checks & router ---------------------------------------------------- */
.lower { display: grid; grid-template-columns: 1.6fr 1fr; gap: 26px; margin-top: 24px; }
@media (max-width: 860px) { .lower { grid-template-columns: 1fr; } }
.lower h3 { font-size: 17px; margin-bottom: 8px; }
.checks { list-style: none; margin: 0; padding: 0; columns: 2 260px; column-gap: 26px; }
.checks li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--grid); break-inside: avoid; }
.checks .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checks .kind { color: var(--muted); font-size: 13px; }
.checks .rtt { font-size: 14px; color: var(--ink-2); min-width: 64px; text-align: right; }
.router dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.router dt { color: var(--muted); }
.router dd { margin: 0; font-weight: 500; }
.ifbar { display: grid; gap: 3px; margin-top: 2px; }
.ifbar span { font-size: 14px; }

/* ---- events ------------------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.events-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.events-head h2 { font-size: 24px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-left: auto; font-size: 14px; }
.filters select { background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; padding: 6px 10px; }
.check { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-2); }
.table-wrap { overflow-x: auto; }
table.events { width: 100%; border-collapse: collapse; font-size: 15px; }
.events th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--axis); padding: 8px 10px 8px 0; }
.events td { border-bottom: 1px solid var(--grid); padding: 9px 10px 9px 0; white-space: nowrap; }
.events .num { text-align: right; }
.events .what { display: flex; align-items: center; gap: 8px; }
.events tr.open td { font-weight: 600; }
.events .empty td { color: var(--muted); white-space: normal; padding: 18px 0; }

.tip {
  position: fixed; pointer-events: none; z-index: 20; background: var(--ink); color: var(--bg);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; line-height: 1.4; max-width: 280px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.tip b { font-weight: 600; }

@media (max-width: 560px) {
  .club { padding: 16px 14px; border-radius: 12px; }
  .club-head h2 { font-size: 24px; }
  .club-head .seen { margin-left: 0; width: 100%; }
  .figures { gap: 8px 24px; }
  .band-right .updated { display: none; }
}

/* keep wide content inside the card on narrow screens */
.charts > *, .lower > *, .club > * { min-width: 0; }
details.data { overflow-x: auto; }
.rail-title, .chart-title { flex-wrap: wrap; }
@media (max-width: 560px) {
  .sight:nth-child(even) { display: none; }
  .checks { columns: 1; }
}


/* ---- time range ---------------------------------------------------------- */
.net-head { flex-wrap: wrap; }
.range { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }
.seg { flex-wrap: wrap; }
.shift { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.shift button { border: 0; background: none; padding: 5px 10px; border-radius: 6px; cursor: pointer; color: var(--ink); font-size: 16px; line-height: 1; }
.shift button:hover:not(:disabled) { background: var(--bg); }
.shift button:disabled { color: var(--axis); cursor: default; }
.shift span { font-size: 14px; color: var(--ink-2); min-width: 9em; text-align: center; }
.r-custom { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; justify-content: flex-end; margin: -6px 0 14px; font-size: 14px; color: var(--ink-2); }
.r-custom label { display: grid; gap: 4px; }
.r-custom input { background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; padding: 6px 8px; }
.r-custom .primary { margin: 0; padding: 8px 16px; }
.hint { font-size: 13px; color: var(--muted); margin: -8px 0 16px; text-align: right; }
.rail-wrap { position: relative; }
.zoomable, .chart svg .hit { cursor: crosshair; touch-action: pan-y; }
.zoomsel { position: absolute; background: color-mix(in srgb, var(--s1) 22%, transparent); border: 1px solid var(--s1); border-radius: 4px; pointer-events: none; z-index: 5; }
@media (max-width: 560px) { .hint { text-align: left; } .range { justify-content: flex-start; } }
