/* Mining Monitor V2 — extracted from mockup v5, fonts swapped to Outfit + Space Mono. */

:root {
  --bg: #0A0F14; --bg-elevated: #131B23; --card: #1A242E; --card-hover: #1E2A38;
  --border: #1E2A38; --border-strong: #2A3640;
  --text: #E8ECF0; --text-dim: #A8B4C0; --text-mute: #6B7A8D;
  --accent: #F7931A; --accent-bright: #FFA833; --accent-soft: rgba(247, 147, 26, 0.12);
  --link: #2EC4B6; --link-hover: #4DD8CB;
  --green: #34D399; --green-soft: rgba(52, 211, 153, 0.12);
  --red: #F87171; --red-soft: rgba(248, 113, 113, 0.14);
  --amber: #FBBF24; --amber-soft: rgba(251, 191, 36, 0.14);
  --radius: 12px; --radius-sm: 8px;
  --shadow-2: 0 6px 20px rgba(0,0,0,0.30);
  --shadow-modal: 0 30px 80px rgba(0,0,0,0.55);
  --maxw: 1240px;
}

/* ══════════════════════════════════════════════════════════════════════
   LIGHT THEME — opt-in via <html data-theme="light"> (default = dark).
   Mirrors ONLY the colour tokens; :root (dark) is never touched. Anchors
   are identical to the dashboard's light theme so a same-origin btc-theme
   switch looks like one product across both apps.

   Untouched on purpose (these work on both themes, same as the dashboard):
     --accent / --accent-bright / --accent-soft  (Bitcoin orange)
     --link / --link-hover                        (teal)
     --green-soft / --red-soft / --amber-soft     (12-14% alpha tints read
                                                   fine over a light bg —
                                                   they inherit from :root)
   Dimension tokens (--radius, --radius-sm, --maxw) carry no colour and
   stay in :root only.

   Semantic green/red/amber are darkened to clear WCAG AA 4.5:1 as TEXT on
   the worst-case light background (the deeper --bg #E7ECF1). Measured
   ratios (bg #E7ECF1 / bg-elevated #ECF0F4 / card #FFFFFF):
     --green #0a7a4f : 4.52 / 4.69 / 5.37   (dashboard-matched)
     --red   #c2283c : 4.82 / 5.01 / 5.73   (dashboard-matched)
     --amber #8F6000 : 4.60 / 4.77 / 5.47   (dark #FBBF24 was 1.40 — unusable)

   Shadows: --shadow-2 takes the dashboard's soft light drop-shadow.
   --shadow-modal keeps more depth than a card but the dark 0.55 black would
   read as a heavy smudge on light, so it is softened to a blue-black 0.22.
   ══════════════════════════════════════════════════════════════════════ */
html[data-theme="light"] {
  --bg: #E7ECF1; --bg-elevated: #ECF0F4; --card: #FFFFFF; --card-hover: #F4F7FA;
  --border: #CFD8E1; --border-strong: #C2CCD6;
  --text: #0F1923; --text-dim: #3D4A57; --text-mute: #5A6977;
  --green: #0a7a4f; --red: #c2283c; --amber: #8F6000;
  --shadow-2: 0 4px 16px rgba(15,25,35,0.10);
  --shadow-modal: 0 24px 60px rgba(15,25,35,0.22);
}

/* ── Light-mode breaker overrides ──────────────────────────────────────
   Selectors whose colour is hardcoded (not token-driven) and would render
   wrong on light. The dark rules stay untouched; these win on specificity.
   Scope is strictly the documented breakers — nothing else is touched. */

/* Per-miner banner tiles use explicit dark gradients (a gradient can't be
   token-relative). Light variants use white-ish card tones; the fleet tile
   is kept a touch greyer than the miner tiles so it stays distinct, mirror-
   ing the slightly-darker fleet treatment in dark. */
html[data-theme="light"] .miner-banner-tile {
  background: linear-gradient(180deg, #FFFFFF 0%, #F1F5F9 100%);
}
html[data-theme="light"] .miner-banner-fleet {
  background: linear-gradient(180deg, #ECF0F4 0%, #DDE4EC 100%);
}

/* Empty timeline cell: the diagonal hatch is white-on-dark and vanishes on
   light. Invert to a dark hatch at the same 0.04 strength. */
html[data-theme="light"] .timeline-cell.h-empty {
  background-image: repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(0,0,0,0.04) 3px, rgba(0,0,0,0.04) 5px);
}

/* Neutral grey tracks/dividers inside the miner tiles (#6B7280 @ 0.15)
   wash out on the now white-ish tiles. Lift to a theme-aware tint that
   reads on light. */
html[data-theme="light"] .mb-tile-healthbar {
  background: color-mix(in srgb, var(--text-mute) 20%, transparent);
}
html[data-theme="light"] .mb-tile-ministats {
  border-top-color: color-mix(in srgb, var(--text-mute) 20%, transparent);
  border-bottom-color: color-mix(in srgb, var(--text-mute) 20%, transparent);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  background: var(--bg); color: var(--text);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body {
  background-image: radial-gradient(ellipse 70% 40% at 30% -5%, rgba(247, 147, 26, 0.04), transparent 60%);
  background-attachment: fixed; min-height: 100vh;
}
.mono { font-family: 'Space Mono', ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* Preliminary "today" earnings — visual distinction so users never
   confuse a still-accumulating value with a settled one. */
.tag-preliminary {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: rgba(46, 196, 182, 0.15);
  color: var(--link);
  border: 1px solid rgba(46, 196, 182, 0.35);
  cursor: help;
}
.row-preliminary { background: rgba(46, 196, 182, 0.04); }
.row-preliminary td { font-style: italic; }

/* Price-source fallback indicator — applied when today's BTC price
   couldn't be fetched live and we're showing the most recent settled
   reference instead. Dashed underline + muted hint that there's a
   tooltip; the asterisk in the cell is the visual cue users notice
   first. */
.price-fallback {
  color: var(--amber);
  border-bottom: 1px dashed var(--amber);
  cursor: help;
}
.preliminary-note {
  margin: 12px 0 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(46, 196, 182, 0.08);
  border: 1px solid rgba(46, 196, 182, 0.25);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}
a { color: var(--link); text-decoration: none; transition: color .15s; }
a:hover { color: var(--link-hover); }
button { font-family: inherit; cursor: pointer; }

/* ========== TOP BAR ========== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  /* color-mix tilts with the theme: in dark --bg-elevated is #131B23, so
     this is byte-identical to the old rgba(19,27,35,0.88); in light it
     follows the light --bg-elevated. Same fix as the dashboard topbar. */
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  padding: 14px 24px;
  display: flex; align-items: center; gap: 0;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: white;
  display: grid; place-items: center;
  font-family: Arial, sans-serif; font-weight: 700; font-size: 16px;
}
.brand-text { color: var(--text); }
.brand-text em { font-style: normal; color: var(--accent); font-weight: 700; }
.nav-tabs { display: flex; gap: 4px; margin-left: 18px; padding-left: 14px; border-left: 1px solid var(--border); }
.nav-tab {
  padding: 7px 14px; border-radius: 7px; font-size: 13px; color: var(--text-dim);
  border: none; background: transparent; transition: all .15s; font-weight: 500;
  text-decoration: none; display: inline-block;
}
.nav-tab:hover { background: var(--card); color: var(--text); }
.nav-tab.active { background: var(--card); color: var(--text); font-weight: 600; }
.nav-tab.active::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 7px; vertical-align: middle;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.currency-pill {
  display: inline-flex; background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 3px;
}
.currency-pill button {
  background: transparent; border: none; color: var(--text-dim);
  padding: 5px 12px; font-size: 12px; font-weight: 600; border-radius: 6px;
  transition: all .15s;
}
.currency-pill button.active { background: var(--accent); color: white; }
.topbar-btn {
  height: 32px; padding: 0 14px; border-radius: 7px;
  background: var(--card); border: 1px solid var(--border); color: var(--text-dim);
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; transition: all .15s;
}
.topbar-btn:hover { border-color: var(--border-strong); color: var(--text); }
.topbar-btn svg { width: 14px; height: 14px; }

main {
  max-width: var(--maxw); margin: 0 auto; padding: 28px 24px 80px;
  display: grid; gap: 18px;
  /* minmax(0, 1fr) voorkomt dat de impliciete grid-kolom auto-sized
     tot max-content van een kind (zoals miner-banner met breed
     scroll-content). Zonder dit groeit main breder dan max-width
     omdat grid auto-track sizing op max-content valt (sessie 13). */
  grid-template-columns: minmax(0, 1fr);
}

/* ========== SUB-TABS (V2.7 — Overzicht / Performance / Verdiensten / Instellingen) ========== */
.sub-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
  margin-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tab {
  position: relative;
  padding: 12px 18px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color .15s;
  white-space: nowrap;
  margin-bottom: -1px;
}
.sub-tab:hover { color: var(--text); }
.sub-tab.active { color: var(--text); }
.sub-tab.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}
.page { display: none; gap: 18px; min-width: 0; }
/* minmax(0, 1fr) voorkomt dat een grid-item met max-content kinderen
   (bv. miner-banner met overflow-x scroll) de grid-track wijder maakt
   dan de viewport. min-width: 0 overrult de default 'auto' op grid
   items zodat .page niet uit zijn track barst (sessie 13). */
.page.active { display: grid; grid-template-columns: minmax(0, 1fr); }

/* ========== OVERZICHT — page header ========== */
.page-header { display: grid; gap: 4px; }
.page-title {
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em; color: var(--text);
  margin: 0;
}
.page-subtitle { font-size: 13px; color: var(--text-dim); margin: 0; }
/* Maand-context regel boven de KPI-strip op Overzicht (sessie 13
   vervolg). Eén plek voor alle 5 KPI's i.p.v. herhaling per kaart. */
.overview-kpi-context {
  font-size: 12px; color: var(--text-mute); margin: 14px 0 -4px 0;
}
.overview-kpi-context:empty { display: none; }

/* ========== OVERZICHT — status-banner ========== */
.overview-banner {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 22px;
  display: flex; align-items: center; gap: 22px;
  position: relative; overflow: hidden;
}
.overview-banner::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent) 30%, var(--accent) 70%, transparent);
  opacity: 0.7;
}
.overview-banner.s-ok::before  { background: linear-gradient(90deg, transparent, var(--green) 30%, var(--green) 70%, transparent); }
.overview-banner.s-warn::before { background: linear-gradient(90deg, transparent, var(--amber) 30%, var(--amber) 70%, transparent); }
.overview-banner.s-bad::before { background: linear-gradient(90deg, transparent, var(--red) 30%, var(--red) 70%, transparent); }
.overview-banner-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; flex-shrink: 0; font-size: 20px;
}
.overview-banner.s-ok  .overview-banner-icon { background: var(--green-soft); color: var(--green); }
.overview-banner.s-warn .overview-banner-icon { background: var(--amber-soft); color: var(--amber); }
.overview-banner.s-bad .overview-banner-icon { background: var(--red-soft);   color: var(--red); }
.overview-banner-content { flex: 1; min-width: 0; }
.overview-banner-headline { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.overview-banner-detail { font-size: 13px; color: var(--text-dim); }
.overview-banner-detail strong { color: var(--text); font-weight: 600; }
.overview-banner-stats { display: flex; gap: 22px; flex-shrink: 0; }
.overview-banner-stat { display: grid; gap: 2px; text-align: right; }
.overview-banner-stat-value {
  font-family: 'Space Mono', ui-monospace, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.01em;
}
.overview-banner-stat-label {
  font-size: 10px; color: var(--text-mute); text-transform: uppercase;
  letter-spacing: 0.06em; font-weight: 600;
}
.overview-banner-loading { font-size: 13px; color: var(--text-dim); }

/* ========== OVERZICHT — main grid ========== */
/* Stretched cells so the right-side column always matches the live-card
   height. Live-card pins itself to a 10-miner footprint (header + 10
   rows + paginering) so 6 miners and 10 miners look equally balanced. */
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}
@media (max-width: 980px) {
  .overview-grid { grid-template-columns: 1fr; align-items: start; }
}
.overview-card.overview-live {
  display: flex;
  flex-direction: column;
  min-height: 620px;
}
#overviewLiveHost { flex: 1 1 auto; min-width: 0; }
.overview-side {
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
}

/* ========== OVERZICHT — card shell ========== */
.overview-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.overview-card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.overview-card-title-block { display: grid; gap: 2px; min-width: 0; }
.overview-card-title { font-size: 14px; font-weight: 600; color: var(--text); margin: 0; }
.overview-card-meta { font-size: 11px; color: var(--text-mute); margin: 0;
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; }

/* Bitcoin Orange outline link-button used on Overzicht cards. */
.btn-link-orange {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-link-orange:hover { background: var(--accent-soft); color: var(--accent-bright); border-color: var(--accent-bright); }

/* ========== OVERZICHT — Live miner-status tabel ========== */
.overview-live-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.overview-live-table th {
  text-align: left; padding: 8px 12px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-mute); font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.overview-live-table th.num { text-align: right; }
.overview-live-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text-dim); vertical-align: middle; }
.overview-live-table tr:last-child td { border-bottom: none; }
.overview-live-table td.num { text-align: right; font-family: 'Space Mono', ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; }
.overview-live-pill {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 700;
  font-family: 'Space Mono', ui-monospace, Menlo, monospace;
}
.overview-live-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--green-soft); color: var(--green);
}
.overview-live-status.offline { background: var(--red-soft); color: var(--red); }
.overview-live-status::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.overview-live-model { color: var(--text); font-weight: 500; }
.overview-live-model small { display: block; color: var(--text-mute); font-size: 11px; font-weight: 400; margin-top: 2px; }
.overview-live-eff.pos { color: var(--green); }
.overview-live-eff.warn { color: var(--amber); }
.overview-live-eff.neg { color: var(--red); }

/* ========== OVERZICHT — Hashrate sparkline ========== */
.overview-spark-host { padding: 4px 0 8px; }
.overview-spark-host svg { width: 100%; height: 110px; display: block; }
.overview-spark-stats {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 12px; color: var(--text-dim); margin-top: 8px;
}
.overview-spark-stats strong { color: var(--text); font-weight: 600; }
.overview-spark-stats .mono { font-family: 'Space Mono', ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; }

/* ========== VERDIENSTEN-PAGINA — header met maand-dropdown ========== */
.verdiensten-head {
  display: flex; flex-direction: row; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.verdiensten-head-actions { display: flex; align-items: center; gap: 8px; }
.page-title-sub {
  display: inline-block; margin-left: 6px;
  font-size: 13px; font-weight: 500; color: var(--text-dim); letter-spacing: 0;
}
.verdiensten-foot {
  display: flex; justify-content: flex-end; padding: 6px 0 0;
}
.verdiensten-foot .modal-stats {
  display: flex; gap: 18px; font-size: 12px; color: var(--text-dim);
  flex-wrap: wrap; justify-content: flex-end;
}
.verdiensten-foot .modal-stats strong { color: var(--text); font-weight: 600; }

/* ========== KRENT 3 — PER-MINER TEGEL-BANNER ========== */
.miner-banner {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 14px;
  /* Geist Mono ontbreekt in deze build — Space Mono is de bestaande
     monospace; gebruiken we als equivalent voor alle 'Geist Mono' calls
     in deze widget. */
}
.miner-banner-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.miner-banner-title-block { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.miner-banner-title {
  font-size: 15px; font-weight: 500; color: var(--text); margin: 0;
}
.miner-banner-sub {
  font-size: 12px; color: var(--text-mute); margin: 0;
  font-family: 'Space Mono', ui-monospace, Menlo, monospace;
}
.miner-banner-period-pill {
  display: inline-flex; gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.miner-banner-period-pill button {
  background: transparent; border: none;
  padding: 5px 11px; border-radius: 6px;
  color: var(--text-mute);
  font-family: 'Space Mono', ui-monospace, Menlo, monospace;
  font-size: 11px; font-weight: 500;
  cursor: pointer; transition: all .12s;
}
.miner-banner-period-pill button:hover { color: var(--text); }
.miner-banner-period-pill button.active {
  background: #2EC4B6; color: #0B0F14;
}
.miner-banner-body {
  display: flex; min-width: 0;
}
.miner-banner-fleet {
  /* Sessie 13 ronde 5: fleet-tegel zit voortaan IN .miner-banner-scroll
     als eerste tegel — dus dezelfde flex/dimensies als miner-tegels.
     Iets donkerder gradient + FLEET-badge houden 'm visueel
     onderscheidend tijdens het scrollen. */
  flex: 0 0 240px; min-width: 0;
  aspect-ratio: 1 / 1;
  background: linear-gradient(180deg, #0d1218 0%, #0a0e14 100%);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  display: flex; flex-direction: column; gap: 0;
}
.miner-banner-scroll {
  flex: 1 1 auto; min-width: 0;
  display: flex; gap: 10px; align-items: stretch;
  overflow-x: auto;
  cursor: grab;
  user-select: none;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  /* touch-action: pan-y zorgt dat verticaal scrollen op mobiel niet
     wordt geblokkeerd, terwijl horizontaal slepen wel wordt opgevangen
     door pointermove + preventDefault. align-items: stretch zorgt dat
     fleet + miner-tegels exact dezelfde hoogte krijgen ongeacht
     content-verschil (sessie 13 ronde 5). */
  touch-action: pan-y;
}
.miner-banner-scroll::-webkit-scrollbar { height: 8px; }
.miner-banner-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.miner-banner-scroll::-webkit-scrollbar-track { background: transparent; }
.miner-banner-foot {
  display: flex; gap: 10px; justify-content: center;
  margin-top: 4px;
}
.miner-banner-pager {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 5px 14px;
  border-radius: 6px;
  font-family: 'Space Mono', ui-monospace, Menlo, monospace;
  font-size: 11px; font-weight: 500;
  cursor: pointer; transition: all .12s;
}
.miner-banner-pager:hover { background: var(--accent-soft); color: var(--accent-bright); border-color: var(--accent-bright); }

/* Fleet-tegel — Mockup B (sessie 13 ronde 4). Hergebruikt veel van de
   miner-tile classes (mb-tile-head/-net/-ministats/-details). Het
   enige fleet-eigene is de FLEET badge en de gesegmenteerde
   status-bar i.p.v. de health-bar. */
.mb-fleet-badge {
  position: absolute;
  top: 12px; right: 12px;
  padding: 3px 7px; border-radius: 4px;
  background: rgba(247, 147, 26, 0.12);
  color: var(--accent);
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 9px; letter-spacing: 0.8px; font-weight: 700;
  z-index: 1;
}
/* Status-bar gesegmenteerd — 1 segment per miner tot 20. Komt op de
   plek waar miner-tegels hun health-bar tonen, dezelfde verticale
   ritme zodat tegels naast elkaar uitlijnen. */
.mb-fleet-statusbar {
  display: flex; gap: 2px; height: 4px;
  margin-bottom: 14px; margin-top: 2px;
}
.mb-fleet-statusbar-seg {
  flex: 1; height: 100%; border-radius: 2px;
}
.mb-fleet-statusbar-seg.is-online  { background: #5DCAA5; }
.mb-fleet-statusbar-seg.is-offline { background: #F09595; }
.mb-fleet-statusbar-text {
  text-align: center;
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 11px; color: var(--text-dim);
  margin-bottom: 14px; margin-top: 4px;
}
.mb-fleet-statusbar-text strong { color: var(--text); font-weight: 600; }

/* Miner-tegel — Mockup B (sessie 13 ronde 4). Donkere gradient
   achtergrond met subtiele border zodat tegel een eigen visuele
   eenheid is (ipv. inblendend zoals in ronde 2). Hoofdgetal NETTO
   centraal, mini-stats rij eronder. Geen linker-balk-accent meer —
   uptime-status communiceren we via de health-bar bovenin. */
.miner-banner-tile {
  flex: 0 0 240px; min-width: 0;
  aspect-ratio: 1 / 1;
  background: linear-gradient(180deg, #0f141b 0%, #0a0e14 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  display: flex; flex-direction: column; gap: 0;
}
/* Tegel-header — sessie 13 ronde 5: block layout, modelnaam pakt
   volledige tegel-breedte. Status-pill is verplaatst naar onderaan
   (.mb-tile-pill-row) zodat alle tegels exact dezelfde header-hoogte
   hebben ongeacht modelnaam-lengte. */
.mb-tile-header {
  display: block;
  margin-bottom: 12px;
}
.mb-tile-name {
  font-size: 13px; font-weight: 500; color: var(--text);
  line-height: 1.25; word-break: break-word;
}
.mb-tile-worker {
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 9px; color: var(--text-mute); letter-spacing: 0.5px;
  margin-top: 2px;
}
/* Pill-row — onderaan miner-tegel, gecentreerd. Plaatst de status-
   pill onder de mini-stats en boven 'Klik voor details'. Sessie 13
   ronde 5: hierdoor blijven tegels uniform ongeacht modelnaam-lengte. */
.mb-tile-pill-row {
  display: flex; justify-content: center;
  margin: 8px 0;
}
.mb-tile-pill {
  flex-shrink: 0;
  padding: 3px 7px; border-radius: 4px;
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 9px; font-weight: 600; letter-spacing: 0.3px;
  display: inline-flex; align-items: center; gap: 5px;
}
.mb-tile-pill.is-online  { background: rgba(46, 196, 182, 0.15); color: #5DCAA5; }
.mb-tile-pill.is-offline { background: rgba(226, 75, 74, 0.15);  color: #F09595; }
/* Pulserende teal dot bij ONLINE pill — laat zien dat de miner echt
   'leeft'. Sessie 14: 8px diameter, expliciet teal #2EC4B6 (niet
   currentColor — anders blendt 'm met de pill-tekst-kleur en valt
   visueel weg), opacity 1.0 -> 0.4 -> 1.0 in 1.5s. Offline pills
   krijgen geen dot. */
.mb-pill-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #2EC4B6;
  animation: pulse-online 1.5s ease-in-out infinite;
  will-change: opacity;
  flex-shrink: 0;
}
@keyframes pulse-online {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@media (prefers-reduced-motion: reduce) {
  .mb-pill-dot { animation: none; opacity: 0.9; }
}
/* Settings attention-dot — pulsende terracotta dot die de gebruiker
   wijst naar incomplete configuratie (sessie 14). Verschijnt naast de
   nav-tab 'Instellingen' en/of de widget-headers wanneer hun data
   incompleet is. Aparte keyframes (pulse-attention) van de online
   pulse zodat kleur+timing-betekenis gescheiden blijven. */
.settings-attention-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: #D4816B;
  margin-left: 7px;
  vertical-align: middle;
  animation: pulse-attention 1.5s ease-in-out infinite;
  will-change: opacity;
  position: relative;  /* voor de [data-tip] tooltip */
}
@keyframes pulse-attention {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@media (prefers-reduced-motion: reduce) {
  .settings-attention-dot { animation: none; opacity: 0.9; }
}
/* Health-bar bovenin de miner-tegel — uptime% indicator. Container
   krijgt subtiele neutrale achtergrond, vulling de gradient die qua
   kleur de drempel-categorie communiceert. */
.mb-tile-healthbar {
  position: relative; height: 6px;
  background: rgba(107, 114, 128, 0.15);
  border-radius: 3px; overflow: hidden;
  margin-bottom: 14px;
}
.mb-tile-healthbar-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  border-radius: 3px;
  transition: width .25s ease-out;
}
/* Hoofdgetal NETTO — gecentreerd, dominant. */
.mb-tile-net {
  text-align: center;
  margin: 4px 0 12px 0;
  display: flex; flex-direction: column; gap: 2px;
}
.mb-tile-net-label {
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 9px; color: var(--text-mute);
  letter-spacing: 1px;
}
.mb-tile-net-value {
  font-size: 28px; font-weight: 600; line-height: 1.1; color: var(--text);
}
.mb-tile-net-value.pos { color: #5DCAA5; }
.mb-tile-net-value.neg { color: #F09595; }
/* Mini-stats rij — 3 kolommen onder hoofdgetal, met dunne border-top
   en border-bottom om visueel los te koppelen van de Klik-voor-details
   regel eronder. */
.mb-tile-ministats {
  display: flex;
  border-top: 1px solid rgba(107, 114, 128, 0.15);
  border-bottom: 1px solid rgba(107, 114, 128, 0.15);
  padding: 8px 0;
  margin-bottom: 12px;
}
.mb-tile-ministat { flex: 1; text-align: center; min-width: 0; }
.mb-tile-ministat-label {
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 9px; color: var(--text-mute); letter-spacing: 0.5px;
}
.mb-tile-ministat-value {
  font-size: 12px; font-weight: 500; margin-top: 2px;
}
/* 'Klik voor details' — expliciete modal-trigger onderaan elke tegel.
   Gescheiden van de drag-actie (die op de scroll-container ligt) zodat
   sleep en klik niet meer concurreren. Bitcoin Orange tekst, geen
   knop-styling, sessie 13 vervolg. */
.mb-tile-details {
  margin-top: auto; padding: 0;
  background: transparent; border: none;
  color: var(--accent);
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 11px; font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: color .12s;
  width: 100%;
}
.mb-tile-details:hover { color: var(--accent-bright); text-decoration: underline; }

/* ========== INSTELLINGEN-PAGINA — info-notice ========== */
/* Teal-balk linksaf en teal info-icoon zorgen dat de notice direct
   opvalt bij snelle scan, zonder de gebruikelijke widget-achtergrond
   te verlaten. Padding matcht andere widgets zodat hij visueel uitrijst
   en niet als afterthought voelt. */
.instellingen-notice {
  position: relative;
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 20px 16px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.instellingen-notice::before {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  background: var(--link); /* Mojo Labs teal #2EC4B6 */
}
.instellingen-notice-icon {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: rgba(46, 196, 182, 0.12);
  color: var(--link);
}
.instellingen-notice-icon svg { width: 18px; height: 18px; }
.instellingen-notice-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.instellingen-notice-title {
  font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.4;
}
.instellingen-notice-text { font-size: 13px; color: var(--text-dim); line-height: 1.5; }

/* ========== OVERZICHT — Verdiensten samenvatting ========== */
.overview-profit-rows { display: grid; gap: 0; }
.overview-profit-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13px;
}
.overview-profit-row:last-child { border-bottom: none; padding-top: 14px; font-weight: 600; }
.overview-profit-row .l { color: var(--text-dim); }
.overview-profit-row .v { color: var(--text); font-weight: 600;
  font-family: 'Space Mono', ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; }
.overview-profit-row .v.pos { color: var(--green); }
.overview-profit-row .v.neg { color: var(--red); }

/* ========== VERIFY BANNER (email_not_verified) ========== */
.verify-banner {
  background: var(--amber-soft); border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius); padding: 14px 18px;
  display: none; gap: 14px; align-items: center;
}
.verify-banner-icon {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--amber); color: var(--bg);
  display: grid; place-items: center; flex-shrink: 0; font-weight: 700;
}
.verify-banner-text { flex: 1; font-size: 13px; color: var(--text); line-height: 1.5; }
.verify-banner-text strong { font-weight: 600; }

/* ========== KPI ROW ========== */
.kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.kpi {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  transition: border-color .15s;
}
.kpi:hover { border-color: var(--border-strong); }
.kpi-head {
  display: flex; align-items: center; gap: 6px; margin-bottom: 10px;
  font-size: 11px; color: var(--text-dim); font-weight: 500;
}
.kpi-help {
  width: 13px; height: 13px; border-radius: 50%;
  background: transparent; border: 1px solid var(--text-mute); color: var(--text-mute);
  display: inline-grid; place-items: center; font-size: 8px; font-weight: 700;
  cursor: help; transition: all .15s; line-height: 1;
}
.kpi-help:hover { background: var(--accent); border-color: var(--accent); color: white; }
.kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; margin-bottom: 4px; color: var(--text); }
.kpi-value.pos { color: var(--green); }
.kpi-value.neg { color: var(--red); }
.kpi-value.warn { color: var(--amber); }
.kpi-value.muted { color: var(--text-mute); font-size: 18px; }
.kpi-meta { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; color: var(--text-dim); }
/* Sub-tekst kwalificatie-kleuren — gebruikt door de Uptime KPI op de
   Overzicht-tab (sessie 13). Drempels: 98 / 90 / 70. */
.kpi-meta .pos  { color: var(--green); font-weight: 600; }
.kpi-meta .teal { color: var(--link); font-weight: 600; }
.kpi-meta .warn { color: var(--amber); font-weight: 600; }
.kpi-meta .neg  { color: var(--red); font-weight: 600; }

/* ========== STATUS BANNER ========== */
.status-banner {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 22px;
  display: flex; align-items: center; gap: 22px;
  position: relative; overflow: hidden;
}
.status-banner::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent) 30%, var(--accent) 70%, transparent);
  opacity: 0.7;
}
.status-banner.s-ok::before { background: linear-gradient(90deg, transparent, var(--green) 30%, var(--green) 70%, transparent); }
.status-banner.s-warn::before { background: linear-gradient(90deg, transparent, var(--amber) 30%, var(--amber) 70%, transparent); }
.status-banner.s-bad::before { background: linear-gradient(90deg, transparent, var(--red) 30%, var(--red) 70%, transparent); }
.status-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; flex-shrink: 0; font-size: 20px;
}
.status-banner.s-ok .status-icon { background: var(--green-soft); color: var(--green); }
.status-banner.s-warn .status-icon { background: var(--amber-soft); color: var(--amber); }
.status-banner.s-bad .status-icon { background: var(--red-soft); color: var(--red); }
.status-content { flex: 1; min-width: 0; }
.status-headline { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.status-meta { font-size: 13px; color: var(--text-dim); }
.status-meta strong { color: var(--text); font-weight: 600; }
.status-meta .pulse-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); margin-right: 6px; vertical-align: middle;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
}

/* ========== SECTION ========== */
.section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.section-head {
  padding: 16px 22px; display: flex; align-items: center; gap: 14px;
  cursor: pointer; user-select: none;
  background: transparent; border: none; width: 100%; text-align: left; color: var(--text);
}
.section-head:hover { background: var(--card-hover); }
.section-icon-emoji { font-size: 18px; line-height: 1; }
.section-title-block { flex: 1; min-width: 0; }
.section-title { font-size: 15px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 10px; }
.section-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.section-stats {
  font-size: 12px; color: var(--text-dim); padding: 4px 10px;
  background: var(--bg-elevated); border-radius: 6px; border: 1px solid var(--border);
  flex-shrink: 0;
}
.section-stats .pos { color: var(--green); font-weight: 600; }
.section-stats .neg { color: var(--red); font-weight: 600; }
.section-stats .warn { color: var(--amber); font-weight: 600; }
.chev { width: 24px; height: 24px; color: var(--text-mute); display: grid; place-items: center; transition: transform .25s; flex-shrink: 0; }
.section.open .chev { transform: rotate(180deg); }
.chev svg { width: 12px; height: 12px; }
.section-body { max-height: 0; overflow: hidden; transition: max-height .35s ease; }
.section.open .section-body { max-height: 9000px; }
.section-content { padding: 0 22px 22px; border-top: 1px solid var(--border); padding-top: 20px; }

/* ========== TABLE ========== */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th {
  text-align: left; padding: 10px 14px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-mute); font-weight: 600;
  background: var(--bg-elevated); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th.num { text-align: right; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text-dim); }
.table tr:last-child td { border-bottom: none; }
.table td.num { text-align: right; }
.table td.strong { color: var(--text); font-weight: 500; }
/* Specificity bump for P&L cells in tables — .table td (0,1,1) and
   .table td.strong (0,2,0) would otherwise outrank the generic
   .pos/.neg utility classes on .table cells. Defined here, after
   the .strong rule, so source order also tips the tie. The
   tr.totals variants (specificity 0,3,2) outrank the totals-row
   default (.table tr.totals td = 0,2,2) which forces text colour. */
.table td.pos,
.table tr.totals td.pos { color: var(--green); }
.table td.neg,
.table tr.totals td.neg { color: var(--red); }
.table tr.totals td { background: var(--bg-elevated); font-weight: 600; color: var(--text); border-top: 1px solid var(--border); border-bottom: none; }

/* ========== DISCLAIMER ========== */
.disclaimer {
  font-size: 12px; color: var(--text-dim); padding: 10px 14px;
  background: var(--bg-elevated); border-left: 2px solid var(--text-mute);
  border-radius: 4px; margin-bottom: 14px; line-height: 1.5;
}
.disclaimer strong { color: var(--text); font-weight: 600; }

/* ========== INSIGHT ========== */
.insight-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.insight-card h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-mute); font-weight: 600; margin-bottom: 14px;
}
.insight-highlight {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 16px;
}
.insight-highlight-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px;
}
.insight-highlight-label {
  font-size: 11px; color: var(--text-mute); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px;
}
.insight-highlight-value {
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1;
}
.insight-highlight-value.pos { color: var(--green); }
.insight-highlight-value.neg { color: var(--red); }
.insight-highlight-sub { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.insight-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 24px; }
.insight-stat-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px;
}
.insight-stat-row .l { color: var(--text-dim); }
.insight-stat-row .v { color: var(--text); font-weight: 600; }
.insight-stat-row.pos .v { color: var(--green); }
.insight-stat-row.neg .v { color: var(--red); }

/* Generic P&L utility classes — paired with fmtPnl() in app.js. The
   scoped rules above (.kpi-value.pos, .insight-highlight-value.pos,
   .section-stats .pos, .insight-stat-row.pos .v) take precedence by
   specificity; these bare-class rules cover everything else (table
   cells, ad-hoc spans). */
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ========== HASHRATE CHART ========== */
.chart-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.chart-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
  flex-wrap: wrap; gap: 12px;
}
.chart-title { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 10px; }
.chart-title small { color: var(--text-dim); font-weight: 400; font-size: 11px; }
.chart-stat { font-size: 12px; color: var(--text-dim); }
.chart-stat strong { color: var(--text); font-weight: 600; }
.chart-notice { font-size: 11px; color: var(--text-mute); margin-top: 6px; min-height: 14px; }

/* Standalone hashrate widget — top-level card, no collapse mechanic.
   Reuses .chart-card visuals but as a flat container so it lines up
   with the section cards above and below in the main grid. */
.widget-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.widget-card .chart-card--standalone {
  background: transparent; border: none; padding: 0; margin: 0;
}

/* Timeframe selector — same affordance as .month-pill but recoloured
   to Mojo Labs teal so the active state pops against the orange
   accent used elsewhere for month navigation. */
.period-pill {
  display: inline-flex; gap: 3px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 8px; padding: 3px;
}
.period-pill button {
  background: transparent; border: none; color: var(--text-dim);
  padding: 5px 14px; font-size: 12px; font-weight: 500;
  border-radius: 6px; cursor: pointer; transition: all .15s;
  font-family: inherit;
}
.period-pill button:hover:not(.active):not(:disabled) {
  color: var(--text); background: rgba(46, 196, 182, 0.08);
}
.period-pill button.active {
  background: var(--link); color: white; font-weight: 600;
}
.period-pill button:disabled { color: var(--text-mute); cursor: not-allowed; }

.uptime-table-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; flex-wrap: wrap; gap: 12px;
}
.uptime-table-head h4 { margin: 0; }

/* ========== EFFICIENCY TIMELINE GRID (modal) ========== */
/* Subtle bucket tints on cells — at 8-10% opacity the colour reads
   as a hint, not a highlight. Reading down a column lets the user
   spot the pattern (red wave on the right of an aging-out miner)
   without each cell screaming for attention. Text colour stays
   var(--text) so the percentage itself is always legible. */
.eff-cell-peak { background: rgba(46, 196, 182, 0.08); }
.eff-cell-high { background: rgba(52, 211, 153, 0.08); }
.eff-cell-mid  { background: rgba(251, 191, 36, 0.10); }
.eff-cell-low  { background: rgba(248, 113, 113, 0.10); }
.eff-cell-null { color: var(--text-mute); }

.efficiency-grid th, .efficiency-grid td { white-space: nowrap; }
.efficiency-grid th.num, .efficiency-grid td.num {
  text-align: right; font-variant-numeric: tabular-nums;
}
/* Periode-kolom-headers wat compacter zodat 10 columns in 1100px
   modal passen zonder horizontale scrollbar bij MauriceZ' setup. */
.efficiency-grid th.period { padding: 10px 8px; min-width: 64px; }
.efficiency-grid td.period { padding: 9px 8px; }

/* Gem.-kolom helemaal rechts: subtiele linker-border lift hem visueel
   los van de chronologische periode-kolommen. */
.efficiency-grid th.avg-col,
.efficiency-grid td.avg-col {
  border-left: 1px solid var(--border-strong);
  padding-left: 14px;
}
.efficiency-grid td.avg-col { font-weight: 600; color: var(--text); }

/* ========== TIMELINE ========== */
.timeline-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;
  flex-wrap: wrap; gap: 12px;
}
.timeline-head h4 { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.timeline-head h4 small { color: var(--text-dim); font-weight: 400; font-size: 11px; }
.month-pill { display: inline-flex; gap: 3px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.month-pill button {
  background: transparent; border: none; color: var(--text-dim);
  padding: 5px 12px; font-size: 12px; border-radius: 6px; transition: all .15s;
}
.month-pill button.active { background: var(--accent); color: white; font-weight: 600; }
.month-pill button:hover:not(.active) { color: var(--text); }
.month-pill button:disabled { color: var(--text-mute); cursor: not-allowed; }
.timeline-grid { display: grid; gap: 2px; margin-bottom: 6px; align-items: center; }
.timeline-label { font-size: 12.5px; padding-right: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-label strong { color: var(--text); font-weight: 600; }
.timeline-spark { height: 28px; padding: 2px 6px; overflow: hidden; }
.timeline-spark svg { width: 100%; height: 100%; display: block; }
.timeline-cell {
  height: 26px; border-radius: 3px; background: var(--card);
  position: relative; cursor: pointer; transition: transform .1s, filter .15s;
}
.timeline-cell:hover { transform: scaleY(1.3); z-index: 2; filter: brightness(1.2); }
.timeline-cell.h-100 { background: #4ADE80; }
.timeline-cell.h-90  { background: #15803D; }
.timeline-cell.h-70  { background: var(--amber); }
.timeline-cell.h-50  { background: #C18415; }
.timeline-cell.h-0   { background: var(--red); opacity: 0.85; }
.timeline-cell.h-empty {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  background-image: repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(255,255,255,0.04) 3px, rgba(255,255,255,0.04) 5px);
}
.timeline-axis { display: grid; gap: 2px; margin-top: 6px; margin-bottom: 14px; }
.timeline-headers {
  display: grid; gap: 2px; margin-bottom: 6px;
  /* Static fallback — JS sets grid-template-columns inline with the
     same shape (200px sparkline-tooltip-band 90px N day-cells). Without
     this fallback, a stale-cached page that misses the inline-style
     pass would collapse all header cells into column 1 and overlap. */
  grid-template-columns: 200px 90px 1fr;
}
.timeline-axis-label { color: var(--text-mute); font-size: 10px; text-align: center; padding-top: 4px; }
.timeline-axis-label.spacer { grid-column: 1; }
.timeline-axis-label.spark-header,
.timeline-axis-label.heatmap-header {
  /* Prominent sub-section labels — louder than the axis ticks below
     so they read as section-headings, not axis-text. Colour from
     muted to dim, size up to 13px, weight to 600. */
  color: var(--text); font-size: 13px; font-weight: 600;
  padding-top: 0; padding-bottom: 4px;
}
.timeline-axis-label.spark-header { grid-column: 2; }
.timeline-axis-label.heatmap-header { grid-column: 3 / -1; }
.timeline-legend { display: flex; gap: 16px; font-size: 11px; color: var(--text-dim); flex-wrap: wrap; align-items: center; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 2px; }

/* ========== UPTIME TABLE ========== */
.uptime-table { margin-top: 22px; }
.uptime-table h4 {
  font-size: 13px; font-weight: 600; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.uptime-table h4 small { color: var(--text-dim); font-weight: 400; font-size: 11px; }
.uptime-bar-cell { display: flex; align-items: center; gap: 12px; min-width: 160px; }
.uptime-bar-track {
  flex: 1; height: 6px; background: var(--card); border-radius: 3px; overflow: hidden;
  min-width: 80px;
}
.uptime-bar-fill { height: 100%; border-radius: 3px; }
.uptime-bar-fill.peak { background: var(--link); }  /* ≥ 95% — efficiency topconditie */
.uptime-bar-fill.high { background: var(--green); }
.uptime-bar-fill.mid { background: var(--amber); }
.uptime-bar-fill.low { background: var(--red); }

/* ========== EFFICIENCY ========== */
/* The widget reuses .section, .insight-card, .insight-highlight,
   .table, .uptime-bar-cell and .period-pill — only the toolbar row,
   the search input, the bucket-counted filter pills, and the
   sortable header arrows need their own rules. */

.efficiency-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin: 16px 0 14px; flex-wrap: wrap;
}
.efficiency-toolbar-right {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}

/* Below 720px the filter-pill row (5 buckets) and the period-pill
   row (6 timeframes) can no longer fit on a single line at any
   sensible width — let them stack and span full width so the touch
   targets stay legible on mobile. */
@media (max-width: 720px) {
  .efficiency-toolbar { flex-direction: column; align-items: stretch; }
  .efficiency-toolbar-right { justify-content: space-between; }
  .efficiency-search { min-width: 0; flex: 1; }
}

.efficiency-search {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
  color: var(--text); font: 400 12px 'Outfit', sans-serif;
  outline: none; transition: border-color .15s;
  min-width: 220px;
}
.efficiency-search::placeholder { color: var(--text-mute); }
.efficiency-search:focus { border-color: var(--link); }

/* Filter pill recoloured for buckets — semantic dot before the
   label so each bucket carries a colour even when not active. */
#efficiencyFilterPill button { display: inline-flex; align-items: center; gap: 6px; }
#efficiencyFilterPill button[data-filter]::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-mute);
}
#efficiencyFilterPill button[data-filter="topconditie"]::before { background: var(--link); }
#efficiencyFilterPill button[data-filter="gezond"]::before      { background: var(--green); }
#efficiencyFilterPill button[data-filter="aandacht"]::before    { background: var(--amber); }
#efficiencyFilterPill button[data-filter="probleem"]::before    { background: var(--red); }
#efficiencyFilterPill button .pill-count {
  font-size: 10px; color: var(--text-mute); font-weight: 500;
}
#efficiencyFilterPill button.active .pill-count { color: rgba(255,255,255,0.85); }

/* Sortable column headers — same .table th base; we only add the
   click affordance and the active-direction arrow. */
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text-dim); }
.table th.sortable .sort-arrow {
  display: inline-block; margin-left: 4px; color: var(--text-mute); font-size: 9px;
}
.table th.sortable.active { color: var(--text); }
.table th.sortable.active .sort-arrow { color: var(--link); }

/* Pagination strip — left status, right controls. Same visual
   weight as the rest of the widget chrome (no card, no border). */
.efficiency-pagination {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; font-size: 12px; color: var(--text-dim);
  flex-wrap: wrap; gap: 10px;
}
.efficiency-pagination .pages { display: inline-flex; gap: 4px; }
.efficiency-pagination .pages button {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 6px; padding: 4px 9px; font: 500 12px 'Outfit', sans-serif;
  cursor: pointer; transition: all .15s; min-width: 28px;
}
.efficiency-pagination .pages button:hover:not(:disabled):not(.active) {
  color: var(--text); border-color: var(--border-strong);
}
.efficiency-pagination .pages button.active {
  background: var(--link); border-color: var(--link); color: white; font-weight: 600;
}
.efficiency-pagination .pages button:disabled { opacity: 0.4; cursor: not-allowed; }
.efficiency-pagination .pages .ellipsis {
  padding: 4px 4px; color: var(--text-mute);
}

/* Generic pagination — used by widgets that need page-toggles below
   their lists. Same DOM contract as .efficiency-pagination (`<button
   data-page="N">…</button>` plus optional `<span class="ellipsis">…`)
   but with two opt-in modifiers:
   - .pagination.center      — justify-content: center (default is
                               space-between to leave room for an
                               info-line on the left)
   - .pagination.accent-orange — Bitcoin Orange active state instead
                                 of the default teal
   The .efficiency-pagination rules above stay as-is so the existing
   widget keeps its current look (productowner: bewuste inconsistentie). */
.pagination {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; font-size: 12px; color: var(--text-dim);
  flex-wrap: wrap; gap: 10px;
}
.pagination.center { justify-content: center; }
.pagination .pages { display: inline-flex; gap: 4px; }
.pagination .pages button {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 6px; padding: 4px 9px; font: 500 12px 'Outfit', sans-serif;
  cursor: pointer; transition: all .15s; min-width: 28px;
}
.pagination .pages button:hover:not(:disabled):not(.active) {
  color: var(--text); border-color: var(--border-strong);
}
.pagination .pages button.active {
  background: var(--link); border-color: var(--link); color: white; font-weight: 600;
}
.pagination.accent-orange .pages button.active {
  background: var(--accent); border-color: var(--accent);
}
.pagination .pages button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .pages .ellipsis {
  padding: 4px 4px; color: var(--text-mute);
}

/* ========== MINER LIVE CARDS ========== */
.miners-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.miner-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; transition: all .15s; }
.miner-card:hover { border-color: var(--border-strong); }
.miner-card.offline { border-color: rgba(248, 113, 113, 0.25); background: rgba(248, 113, 113, 0.03); }
.miner-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.miner-status { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.miner-status.online { background: var(--green); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); }
.miner-status.offline { background: var(--red); }
.miner-name { font-weight: 600; font-size: 13px; flex: 1; min-width: 0; }
.miner-name small { color: var(--text-mute); font-weight: 400; font-size: 11px; display: block; margin-top: 1px; }
.miner-hashrate { color: var(--text-dim); font-size: 12px; text-align: right; }
.miner-hashrate strong { color: var(--text); font-weight: 600; font-size: 13px; }
.miner-hashrate small { color: var(--text-mute); font-size: 10px; display: block; }
.miner-bar { height: 4px; background: var(--card); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.miner-bar-fill { height: 100%; border-radius: 2px; background: var(--green); }
.miner-bar-fill.low { background: var(--amber); }
.miner-bar-fill.bad { background: var(--red); }
.miner-meta { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--text-mute); }
.miner-meta .v { color: var(--text-dim); font-weight: 500; }

/* ========== WATCHERLINKS ========== */
.wl-banner {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 10px; padding: 13px 16px;
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 16px;
}
.wl-banner-icon {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--link); color: white;
  display: grid; place-items: center; flex-shrink: 0; font-weight: 700; font-size: 13px;
}
.wl-banner-text { font-size: 12.5px; color: var(--text-dim); flex: 1; line-height: 1.5; }
.wl-banner-text strong { color: var(--text); font-weight: 600; }
.wl-list { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.wl-row { display: grid; grid-template-columns: 1.5fr 2fr 1fr auto; gap: 14px; align-items: center; background: var(--bg-elevated); padding: 14px 18px; }
.wl-row.head { background: var(--card); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-mute); font-weight: 600; padding: 10px 18px; }
.wl-name { font-weight: 600; color: var(--text); font-size: 13px; }
.wl-name small { color: var(--text-mute); font-weight: 400; font-size: 11px; display: block; margin-top: 1px; }
.wl-key { font-family: 'Space Mono', monospace; font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  background: var(--green-soft); color: var(--green); font-weight: 600;
}
.wl-status.warn { background: var(--amber-soft); color: var(--amber); }
.wl-status.bad { background: var(--red-soft); color: var(--red); }
.wl-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.wl-actions { display: flex; gap: 6px; }
.icon-btn-mini {
  width: 26px; height: 26px; border-radius: 6px;
  background: transparent; border: 1px solid var(--border); color: var(--text-mute);
  display: grid; place-items: center; transition: all .15s;
}
.icon-btn-mini:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn-mini.danger:hover { color: var(--red); border-color: rgba(248,113,113,0.4); }
.icon-btn-mini svg { width: 12px; height: 12px; }
.wl-add {
  margin-top: 14px; padding: 14px 18px;
  background: var(--bg-elevated); border: 1px dashed var(--border-strong);
  border-radius: 10px;
  display: flex; gap: 10px; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 13px; transition: all .15s; cursor: pointer;
  width: 100%; font-family: inherit;
}
.wl-add:hover { border-color: var(--accent); color: var(--accent); }

/* ========== SETTINGS ========== */
.settings-banner {
  background: var(--accent-soft); border: 1px solid rgba(247, 147, 26, 0.2);
  border-radius: 10px; padding: 13px 16px;
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 18px; flex-wrap: wrap;
}
.settings-banner-icon {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--accent); color: white;
  display: grid; place-items: center; flex-shrink: 0; font-weight: 700; font-size: 13px;
}
.settings-banner-text { font-size: 12.5px; color: var(--text-dim); flex: 1; line-height: 1.5; min-width: 200px; }
.settings-banner-text strong { color: var(--text); font-weight: 600; }
.settings-actions { display: flex; gap: 8px; }
.btn {
  padding: 7px 14px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-weight: 500; font-size: 12.5px;
  transition: all .15s;
}
.btn:hover { border-color: var(--border-strong); background: var(--card-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); }

/* BP2 — destructive-action button used in soft-delete + reset modals. */
.btn-danger { background: var(--red); color: white; border-color: var(--red); font-weight: 600; }
.btn-danger:hover { filter: brightness(1.08); }

/* BP2 — disclaimer list used in delete-confirm and historical-match
   modals. Compact, neutral, no horizontal scroll for long item text. */
.bp2-disclaimer-list {
  margin: 8px 0 12px; padding: 0; list-style: none;
  font-size: 13px; color: var(--text-dim); line-height: 1.55;
}
.bp2-disclaimer-list li {
  position: relative; padding-left: 18px; margin-bottom: 4px;
}
.bp2-disclaimer-list li::before {
  content: ""; position: absolute; left: 0; top: 0.55em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-mute);
}
.bp2-disclaimer-meta {
  margin: 12px 0 0; font-size: 12px; color: var(--text-mute);
  border-top: 1px solid var(--border); padding-top: 10px;
}

/* BP2 §9 — "Gevaarlijke zone" row layout in instellingen. */
.danger-row {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 14px;
  background: rgba(248, 113, 113, 0.06);
  border: 1px solid rgba(248, 113, 113, 0.30);
  border-radius: 10px;
}
.danger-row-text { flex: 1; font-size: 13px; line-height: 1.5; color: var(--text-dim); }
.danger-row-text strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }

/* BP2 §9.2 — strikethrough-style bullets in the reset confirmation
   modal. Communicates "wordt verwijderd" stronger than plain dots. */
.bp2-disclaimer-list.danger-list li::before { background: var(--red); }
.bp2-disclaimer-list.danger-list li { color: var(--text); }

/* BP2 §8.2 — banner shown above a miner-detail view when the miner's
   watcherlink has been soft-deleted (historical data only). */
.historical-banner {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  padding: 10px 14px; margin-bottom: 14px;
  font-size: 13px; color: var(--text-dim); line-height: 1.5;
}
.historical-banner strong { color: var(--amber); font-weight: 600; }

/* BP3a Commit 2 — Tracking-coverage disclaimer at the top of the uptime
   modal. Sits between the h4 and the insight-highlight grid; subdued
   styling so it informs without competing with the headline KPIs. */
.modal-coverage-disclaimer {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: -8px;     /* tuck under the h4 (which has 14px margin-bottom) */
  margin-bottom: 12px;
  line-height: 1.4;
  font-style: italic;
}

.btn-ghost { background: transparent; color: var(--text-dim); border-color: transparent; }
.btn-ghost:hover { color: var(--text); background: var(--card); }
.settings-grid {
  display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.settings-row {
  display: grid; grid-template-columns: 1.4fr 1.4fr 1.7fr 1.1fr;
  gap: 14px; align-items: center;
  background: var(--bg-elevated); padding: 12px 16px;
}
.settings-row.head {
  background: var(--card);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-mute); font-weight: 600; padding: 10px 16px;
}
.miner-id { font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 10px; font-size: 13px; }
.miner-id-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.miner-id-dot.online { background: var(--green); }
.miner-id-dot.offline { background: var(--red); }
.miner-id-text { display: flex; flex-direction: column; min-width: 0; }
.miner-id-text small { color: var(--text-mute); font-weight: 400; font-size: 11px; }
.input-wrap {
  position: relative; display: inline-flex; align-items: center;
  background: var(--card); border: 1px solid var(--border); border-radius: 7px;
  width: 100%; transition: border-color .15s;
}
.input-wrap:focus-within { border-color: var(--accent); }
.input-wrap input {
  background: transparent; border: none; outline: none;
  color: var(--text); font: 500 12.5px 'Space Mono', monospace;
  padding: 7px 10px; width: 100%; min-width: 0;
}
.input-wrap input.text-input { font-family: 'Outfit', sans-serif; font-weight: 500; }
.input-wrap .unit { color: var(--text-mute); font-size: 11px; padding-right: 10px; flex-shrink: 0; }
.input-wrap.hint { border-style: dashed; }
.input-wrap.hint input { color: var(--text-mute); }
.input-wrap.unset {
  border-color: var(--amber);
  background: rgba(245, 158, 11, 0.06);
}
.input-wrap.unset input::placeholder {
  color: var(--amber); font-weight: 600; opacity: 1;
}
.input-wrap.set {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.05);
}
.model-select {
  position: relative; width: 100%;
  background: var(--card); border: 1px solid var(--border); border-radius: 7px;
  padding: 7px 32px 7px 10px; font-size: 12.5px; color: var(--text);
  cursor: pointer; user-select: none;
  transition: border-color .15s;
  display: flex; align-items: center; gap: 8px;
}
.model-select:hover { border-color: var(--border-strong); }
.model-select.detected { border-color: rgba(52, 211, 153, 0.4); background: linear-gradient(90deg, rgba(52,211,153,0.06), transparent); }
.model-select.custom { border-style: dashed; }
.model-select::after {
  content: ""; position: absolute; right: 10px; top: 50%;
  width: 8px; height: 8px; border-right: 2px solid var(--text-mute);
  border-bottom: 2px solid var(--text-mute);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
.model-select-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auto-badge {
  flex-shrink: 0; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--green); padding: 2px 6px; border-radius: 4px; background: var(--green-soft);
  display: inline-flex; align-items: center; gap: 3px;
}
.auto-badge::before { content: "🎯"; font-size: 9px; }
.custom-badge {
  flex-shrink: 0; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-mute); padding: 2px 6px; border-radius: 4px; background: var(--card);
}
.status-badge {
  flex-shrink: 0; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 7px; border-radius: 4px; white-space: nowrap;
}
.status-badge.confirmed { color: var(--green); background: var(--green-soft); }
.status-badge.suggested { color: var(--amber); background: rgba(245, 158, 11, 0.12); }
.status-badge.not-set   { color: var(--red); background: rgba(239, 68, 68, 0.10); }
.model-select.suggested { border-color: rgba(245, 158, 11, 0.45); background: rgba(245, 158, 11, 0.04); }
.model-select.unset     { border-style: dashed; border-color: rgba(239, 68, 68, 0.35); }
.reset-btn {
  width: 26px; height: 26px; border-radius: 6px;
  background: transparent; border: 1px solid var(--border); color: var(--text-mute);
  display: grid; place-items: center; transition: all .15s;
}
.reset-btn:hover { color: var(--accent); border-color: var(--accent); }
.reset-btn svg { width: 11px; height: 11px; }

/* ========== DROPDOWN PANEL ==========
   Floats in front of all sibling content via fixed positioning so an
   ancestor with overflow:hidden cannot clip it. JS sets inline
   top/left/width when toggled open. */
.dropdown-panel {
  position: fixed; top: 0; left: 0; width: auto;
  background: var(--card); border: 1px solid var(--border-strong);
  border-radius: 8px; box-shadow: var(--shadow-modal);
  max-height: 360px; overflow-y: auto;
  z-index: 9999; display: none;
}
.dropdown-panel.open { display: block; }
.dropdown-search {
  position: sticky; top: 0; background: var(--card); padding: 10px;
  border-bottom: 1px solid var(--border);
}
.dropdown-search input {
  width: 100%; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 6px; padding: 7px 10px; color: var(--text); font: 400 12px 'Outfit';
  outline: none;
}
.dropdown-search input:focus { border-color: var(--accent); }
.dropdown-section { padding: 6px 0; border-bottom: 1px solid var(--border); }
.dropdown-section:last-child { border-bottom: none; }
.dropdown-group-label {
  padding: 8px 14px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-mute); font-weight: 700;
}
.dropdown-item {
  padding: 8px 14px; cursor: pointer; font-size: 12.5px; color: var(--text-dim);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  transition: background .1s;
}
.dropdown-item:hover { background: var(--card-hover); color: var(--text); }
.dropdown-item.selected { background: var(--accent-soft); color: var(--text); }
.dropdown-item.suggested { background: var(--green-soft); }
.dropdown-item.custom-row { background: rgba(247, 147, 26, 0.06); color: var(--text); }
.dropdown-item.custom-row:hover { background: var(--accent-soft); }
.dropdown-item-text { flex: 1; min-width: 0; }
.dropdown-item-title { color: var(--text); font-weight: 500; }
.dropdown-item-sub { font-size: 11px; color: var(--text-mute); margin-top: 2px; }
.dropdown-item-meta { font-size: 10.5px; color: var(--text-mute); font-family: 'Space Mono', monospace; flex-shrink: 0; }
.dropdown-item-icon { font-size: 14px; flex-shrink: 0; }

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5, 8, 12, 0.7);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  z-index: 100; display: none; align-items: center; justify-content: center; padding: 24px;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.open { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.modal {
  background: var(--card); border: 1px solid var(--border-strong);
  border-radius: 14px; box-shadow: var(--shadow-modal);
  width: 100%; max-width: 1100px; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  animation: slideUp 0.25s ease;
}
.modal.modal-narrow { max-width: 580px; }
.modal-head {
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-title small { color: var(--text-dim); font-weight: 400; font-size: 12px; margin-left: 8px; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px; background: var(--bg-elevated);
  border: 1px solid var(--border); color: var(--text-dim);
  display: grid; place-items: center; transition: all .15s;
}
.modal-close:hover { color: var(--text); border-color: var(--border-strong); }
.modal-head-actions { display: flex; align-items: center; gap: 10px; }
.modal-month-select {
  height: 32px; border-radius: 8px; background: var(--bg-elevated);
  border: 1px solid var(--border); color: var(--text);
  padding: 0 10px; font-size: 13px; font-family: inherit;
  cursor: pointer; transition: all .15s;
}
.modal-month-select:hover { border-color: var(--border-strong); }
.modal-month-select:focus { outline: none; border-color: var(--accent); }
.modal-filter-row {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 14px; padding: 10px 0;
}
.modal-filter-label {
  font-size: 12px; color: var(--text-dim); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.modal-body { padding: 22px 26px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 14px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-elevated); flex-wrap: wrap; gap: 10px;
}
.modal-stats { font-size: 12px; color: var(--text-dim); display: flex; gap: 14px; flex-wrap: wrap; }
.modal-stats strong { color: var(--text); font-weight: 600; }
.modal-actions { display: flex; gap: 8px; }
.modal-filter-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px;
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.modal-filter-tabs button {
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-dim);
  padding: 6px 12px; border-radius: 7px; font-size: 12px; transition: all .15s;
}
.modal-filter-tabs button:hover { color: var(--text); border-color: var(--border-strong); }
.modal-filter-tabs button.active { background: var(--accent); color: white; border-color: var(--accent); font-weight: 600; }
.miner-filter-wrap { width: 320px; max-width: 100%; }
.dropdown-item.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }

/* ========== SETUP MODAL ========== */
.setup-intro { margin-bottom: 20px; }
.setup-intro h3 { font-size: 22px; font-weight: 700; margin-bottom: 10px; letter-spacing: -0.01em; }
.setup-intro p { color: var(--text-dim); font-size: 14px; line-height: 1.55; }
.setup-why {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-left: 3px solid var(--link);
  border-radius: 8px; padding: 14px 16px; margin-top: 14px;
  font-size: 13px; color: var(--text-dim); line-height: 1.6;
}
.setup-why strong { color: var(--text); font-weight: 600; }
.setup-why ul { margin-top: 8px; padding-left: 18px; }
.setup-why li { margin-bottom: 4px; }
.setup-form { margin-top: 18px; display: grid; gap: 12px; }
.setup-field { display: grid; gap: 6px; }
.setup-field label { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.setup-input {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 8px; padding: 11px 14px;
  color: var(--text); font: 400 13px 'Space Mono', monospace;
  outline: none; transition: border-color .15s; width: 100%;
}
.setup-input:focus { border-color: var(--accent); }
.setup-input.text-input { font-family: 'Outfit', sans-serif; }
.setup-error {
  margin-top: 10px; padding: 10px 12px;
  background: var(--red-soft); border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 8px; color: var(--text); font-size: 13px;
  display: none;
}
.setup-error.show { display: block; }

.welcome-secondary {
  background: transparent; border: none; color: var(--text-dim);
  font-size: 13px; padding: 6px 4px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
  transition: color .15s;
}
.welcome-secondary:hover { color: var(--text); }

/* ========== WELCOME MODAL (onboarding) ========== */
.welcome-overlay { background: rgba(0, 0, 0, 0.55); }
.welcome-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 540px;
  font-family: 'Outfit', sans-serif;
}
.welcome-head {
  display: flex; justify-content: flex-end;
  padding: 14px 14px 0 14px;
  border-bottom: none;
}
.welcome-close {
  width: 30px; height: 30px; border-radius: 8px;
  background: transparent; border: 1px solid transparent;
  color: var(--text-dim);
}
.welcome-close:hover { color: var(--text); border-color: var(--border); background: var(--bg); }
.welcome-body {
  padding: 4px 28px 24px 28px;
  text-align: center;
  color: var(--text);
}
.welcome-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: rgba(247, 147, 26, 0.15);
  color: #F7931A;
  display: grid; place-items: center;
  margin: 4px auto 18px auto;
}
.welcome-title {
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 12px 0;
}
.welcome-intro {
  font-size: 14px; line-height: 1.55;
  color: var(--text-dim);
  margin: 0 auto 18px auto;
  max-width: 440px;
}
.welcome-explain {
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid #F7931A;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px; line-height: 1.6;
  color: var(--text-dim);
  margin-bottom: 22px;
}
.welcome-steps {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 10px;
  text-align: left;
}
.welcome-step {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.welcome-step-num {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(247, 147, 26, 0.2);
  color: #F7931A;
  font: 600 14px 'Space Mono', monospace;
  display: grid; place-items: center;
}
.welcome-step-text { flex: 1; }
.welcome-step-title {
  font-size: 14px; font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}
.welcome-step-desc {
  font-size: 13px; line-height: 1.5;
  color: var(--text-dim);
}
.welcome-foot {
  padding: 4px 28px 24px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  border-top: none;
  background: transparent;
}
.welcome-primary {
  width: 100%;
  background: #F7931A;
  color: #0d1117;
  font-weight: 600; font-size: 14px;
  font-family: inherit;
  border: none; border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.welcome-primary:hover { background: #FFA833; }
.welcome-primary:active { transform: translateY(1px); }

/* ========== LOADING + ERROR STATES (NEW) ========== */
.loading-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 10px; padding: 28px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  color: var(--text-mute); font-size: 13px;
}
.loading-card .label { color: var(--text-dim); }
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border-strong); border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-skeleton {
  background: linear-gradient(90deg, var(--card) 0%, var(--card-hover) 50%, var(--card) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.error-card {
  background: rgba(248, 113, 113, 0.05); border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 10px; padding: 16px 20px;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
.error-card-icon {
  width: 28px; height: 28px; border-radius: 7px;
  background: rgba(248, 113, 113, 0.15); color: var(--red);
  display: grid; place-items: center; flex-shrink: 0; font-weight: 700; font-size: 14px;
}
.error-card-text {
  flex: 1; color: var(--text-dim); font-size: 13px; line-height: 1.5; min-width: 200px;
}
.error-card-text strong { color: var(--text); font-weight: 600; display: block; margin-bottom: 2px; }
.error-retry {
  padding: 7px 14px; border-radius: 7px;
  background: var(--card); border: 1px solid var(--border-strong); color: var(--text);
  font-size: 12.5px; font-weight: 500; transition: all .15s; flex-shrink: 0;
}
.error-retry:hover { border-color: var(--red); color: var(--red); }

.empty-card {
  background: var(--bg-elevated); border: 1px dashed var(--border-strong);
  border-radius: 10px; padding: 28px 20px;
  text-align: center; color: var(--text-mute); font-size: 13px; line-height: 1.55;
}
.empty-card strong { color: var(--text-dim); display: block; margin-bottom: 4px; font-weight: 600; }
.empty-card--with-icon { padding-top: 22px; }
.empty-card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--card); color: var(--text-dim);
  margin: 0 auto 12px; border: 1px solid var(--border);
}

/* Toast for ephemeral errors / confirmations */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 12px 18px;
  color: var(--text); font-size: 13px;
  box-shadow: var(--shadow-modal);
  z-index: 300; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); pointer-events: auto; }
.toast.error { border-color: rgba(248, 113, 113, 0.4); }
.toast.success { border-color: rgba(52, 211, 153, 0.4); }

/* ========== TOOLTIP ========== */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus::after, [data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--card); color: var(--text); font-size: 11.5px; font-weight: 400;
  /* Body-tekst, niet header-stijl: tooltips hangen vaak in een <th>
     waar text-transform/letter-spacing uppercase zijn -- die erven we
     niet. Expliciete font-family vangt toekomstige th-overrides af. */
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  text-transform: none; letter-spacing: normal;
  padding: 7px 11px; border-radius: 6px; border: 1px solid var(--border-strong);
  white-space: normal; width: max-content; max-width: 240px;
  z-index: 200; box-shadow: var(--shadow-2);
  pointer-events: none; line-height: 1.4;
}
/* Tooltips inside a <th> expand DOWNWARD instead of upward. Without
   this override, the bubble would escape `.modal-body`'s `overflow-y`
   scroll area when the thead sits at the top of the visible region —
   `z-index` does not help here, it is pure overflow-clipping. Placing
   the bubble below the header keeps it inside the visible table area.
   Sessie 14 mini-fix.

   NOTE: this rule shares its CSS approach (`top: calc(100% + 6px);
   bottom: auto`) with the `.uptime-table-head .kpi-help[data-tip]`
   exception below, but the root cause is different:
     - This rule: modal-body `overflow-y` scroll-area clipping.
     - Below rule: `.section-body` collapse-animation `overflow: hidden`
       clipping.
   Two different problems, identical fix shape — do not merge or
   generalise without re-checking that both ancestors are still
   handled. See docs/data_tip_design_guideline.md for the
   upward-vs-downward decision rule. */
th [data-tip]:hover::after,
th [data-tip]:focus::after,
th [data-tip]:focus-visible::after {
  bottom: auto;
  top: calc(100% + 6px);
}

/* BP5 Commit 2 (s45-2) — Uptime-section header-tooltip overflow fix.
   Trigger sits inside `.section-body`, which has overflow: hidden for
   the collapse animation. Upward expansion (the global default,
   `bottom: calc(100% + 6px)`) clips the tooltip vertically because
   position:absolute pseudo-elements do not escape an overflowing
   ancestor.

   Solution: expand downward (`top: calc(100% + 6px); bottom: auto`).
   The trigger has room below (table-body fills it) and the bubble is
   no longer clipped. Right-align (`right: 0; left: auto`) preserved
   from BP3d Commit 6 — without it the bubble would now run off the
   right edge of the section.

   Strict scope per PO-choice sessie 47/51: only this tooltip. Every
   other `[data-tip]` in the UI keeps its default upward expansion;
   they live outside `overflow: hidden` ancestors and don't need it.

   NOTE: shares its CSS approach (`top: calc(100% + 6px); bottom:
   auto`) with the `th [data-tip]` rule above, but the root cause is
   different:
     - Above rule: modal-body `overflow-y` scroll-area clipping.
     - This rule: `.section-body` collapse-animation `overflow: hidden`
       clipping.
   Same fix shape, two different problems. Future refactors must
   re-verify both ancestors before merging or generalising.

   Future-proof alternative (portal pattern, JS-based): see
   docs/data_tip_design_guideline.md §"Future-proof alternative".
   Tracked in V2_5_V3_Backlog.md. */
.uptime-table-head .kpi-help[data-tip]:hover::after,
.uptime-table-head .kpi-help[data-tip]:focus::after,
.uptime-table-head .kpi-help[data-tip]:focus-visible::after {
  left: auto;
  right: 0;
  transform: none;
  bottom: auto;
  top: calc(100% + 6px);
}

/* ========== FOOTER ========== */
footer {
  max-width: var(--maxw); margin: 60px auto 0; padding: 24px;
  border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
  color: var(--text-mute); font-size: 12px;
}
footer .powered { color: var(--text-dim); }
footer .powered strong { color: var(--text); font-weight: 600; }
footer .links { display: flex; gap: 16px; }
footer .links a { color: var(--text-mute); }
footer .links a:hover { color: var(--text); }

/* ========== RESPONSIVE ========== */
@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .insight-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .insight-highlight { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .nav-tabs { display: none; }
  .topbar-btn span { display: none; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .settings-row, .wl-row { grid-template-columns: 1fr; gap: 8px; padding: 14px; }
  .settings-row.head, .wl-row.head { display: none; }
  .status-banner { flex-direction: column; align-items: flex-start; }
  .insight-grid-3 { grid-template-columns: 1fr; }
}
