/* ==== WAN Show Bingo Admin — theme (LTT / WAN Show) ==== */
@font-face {
  font-family: 'Dosis';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/dosis-latin.woff2') format('woff2');
}

:root {
  --bg: #0E0F11;
  --surface: #16181B;
  --surface2: #1E2125;
  --border: #2B3036;
  --text: #ECECEE;
  --muted: #9AA0A8;
  --accent: #C13E05;       /* WAN Show burnt orange (fills) */
  --accent-hot: #F24405;   /* hover */
  --accent-300: #FF7A45;   /* small orange text/links on dark */
  --accent-ink: #FFFFFF;
  --danger: #DC3741;
  --success: #3FB950;
  --warn: #E8A33D;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.45);
  --font: 'Dosis', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.5; font-weight: 500;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-weight: 800; margin: 0; letter-spacing: .2px; }
.muted { color: var(--muted); }
.centered { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

/* ---- forms & inputs ---- */
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 600; }
label.row { flex-direction: row; align-items: center; gap: 9px; color: var(--text); }
input, select, textarea {
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; font: inherit; font-weight: 500; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
textarea { resize: vertical; }

/* ---- buttons ---- */
.btn {
  cursor: pointer; border: 1px solid var(--border); background: var(--surface2); color: var(--text);
  border-radius: var(--radius); padding: 10px 15px; font: inherit; font-weight: 700; letter-spacing: .2px;
  transition: filter .12s, border-color .12s, background .12s;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hot); border-color: var(--accent-hot); }
.btn.ghost { background: transparent; }
.btn.outline { background: transparent; border-color: var(--accent); color: var(--accent-300); }
.btn.outline:hover { background: rgba(193,62,5,.12); }
.btn.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn.danger:hover { filter: brightness(1.08); }
.btn.danger-ghost { color: var(--danger); background: transparent; border-color: transparent; }
.btn.danger-ghost:hover { border-color: var(--danger); }
.btn.small { padding: 6px 10px; font-size: 14px; }
.btn.big { padding: 14px 18px; font-size: 17px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; }

/* ---- auth cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; box-shadow: var(--shadow); }
.auth-card { width: min(390px, 92vw); display: flex; flex-direction: column; gap: 15px; }
.auth-brand { text-align: center; margin-bottom: 2px; }
.auth-brand .wm { font-size: 26px; font-weight: 800; }
.auth-brand .wm .o { color: var(--accent-300); }
.auth-note { font-size: 13px; text-align: center; }

/* ---- app shell / header ---- */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 14px 22px;
  background: linear-gradient(45deg, #C13E05, #912700); color: #fff; box-shadow: var(--shadow);
}
.wordmark { font-weight: 800; font-size: 22px; letter-spacing: .5px; display: flex; align-items: baseline; gap: 8px; }
.wordmark .sub { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; opacity: .85; }
.topbar .user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-weight: 600; }
.topbar .btn { background: rgba(0,0,0,.18); border-color: rgba(255,255,255,.35); color: #fff; }
.topbar .btn:hover { background: rgba(0,0,0,.30); border-color: #fff; }

/* ---- nav ---- */
.nav { display: flex; gap: 2px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 14px; position: sticky; top: 0; z-index: 5; }
.tab {
  background: transparent; border: none; border-bottom: 3px solid transparent; color: var(--muted);
  padding: 13px 16px; cursor: pointer; font: inherit; font-weight: 700; font-size: 16px;
}
.tab:hover { color: var(--text); }
.tab.active { color: #fff; border-bottom-color: var(--accent); }

.tab-panel { padding: 22px; max-width: 1080px; margin: 0 auto; }
/* The live console uses the full window so the whole board fits on one screen. */
#tab-live { max-width: none; padding: 12px 14px; }
.page-title { font-size: 22px; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.grow { flex: 1 1 220px; }
.toolbar select { width: auto; }
.count { color: var(--muted); margin-bottom: 10px; font-size: 14px; }
.safe-note { background: rgba(63,185,107,.10); border: 1px solid rgba(63,185,107,.30); color: #bfe9cd; border-radius: var(--radius); padding: 9px 13px; font-size: 14px; margin-bottom: 14px; }

/* ---- home dashboard ---- */
.hero {
  border-radius: 14px; padding: 22px 24px; margin-bottom: 20px; display: flex; align-items: center; gap: 18px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.hero.ok { background: linear-gradient(135deg, rgba(63,185,107,.16), rgba(63,185,107,.05)); border-color: rgba(63,185,107,.4); }
.hero.warn { background: linear-gradient(135deg, rgba(232,163,61,.18), rgba(232,163,61,.05)); border-color: rgba(232,163,61,.5); }
.hero .big-dot { font-size: 34px; line-height: 1; }
.hero h2 { font-size: 22px; }
.hero p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.hero .spacer { flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.stat .n { font-size: 30px; font-weight: 800; line-height: 1.1; }
.stat .n.orange { color: var(--accent-300); }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 4px; font-weight: 600; }

.section-title { font-size: 15px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 22px 0 10px; font-weight: 700; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.action-grid .btn { justify-content: center; text-align: center; }

.help-box { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 16px 18px; margin-top: 20px; font-size: 14.5px; }
.help-box h3 { font-size: 15px; margin-bottom: 8px; }
.help-box ul { margin: 0; padding-left: 18px; color: var(--muted); }
.help-box li { margin: 4px 0; }

/* mini chart */
.chart { display: flex; align-items: flex-end; gap: 5px; height: 90px; padding: 8px 0; }
.chart .bar { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 3px; opacity: .85; }
.chart .bar:hover { background: var(--accent-hot); opacity: 1; }
.chart-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table.grid { width: 100%; border-collapse: collapse; min-width: 720px; }
table.grid th, table.grid td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.grid thead th { background: var(--surface); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
table.grid tbody tr:hover { background: var(--surface); }
table.grid tbody tr:last-child td { border-bottom: none; }
.c-id { width: 46px; color: var(--muted); } .c-cat { width: 140px; } .c-en { width: 84px; }
.c-meta { width: 175px; color: var(--muted); font-size: 13px; } .c-act { width: 150px; text-align: right; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.pill { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); font-weight: 700; }
.cat-pill { background: var(--surface2); }
.pill.you { background: rgba(193,62,5,.15); border-color: var(--accent); color: var(--accent-300); }
.pill.owner { background: rgba(193,62,5,.15); border-color: var(--accent); color: var(--accent-300); }
.pill.archived { background: rgba(154,160,168,.12); }
.c-perf { width: 150px; }
/* performance badges */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.badge.good { background: rgba(63,185,107,.15); color: #7fe0a0; border-color: rgba(63,185,107,.4); }
.badge.ok   { background: var(--surface2); color: var(--muted); border-color: var(--border); }
.badge.warn { background: rgba(232,163,61,.15); color: #f0c07a; border-color: rgba(232,163,61,.45); }
.badge.bad  { background: rgba(220,55,65,.15); color: #f39098; border-color: rgba(220,55,65,.45); }
.badge.muted{ background: transparent; color: var(--muted); border-color: var(--border); }
.perf-rate { font-weight: 800; font-size: 14px; }
.perf-sub { font-size: 11px; color: var(--muted); }

/* on/off switch */
.switch { position: relative; display: inline-block; width: 44px; height: 25px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #3a4552; border-radius: 999px; transition: .15s; cursor: pointer; }
.slider::before { content: ""; position: absolute; height: 19px; width: 19px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::before { transform: translateX(19px); }

/* ---- services ---- */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.svc { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; box-shadow: var(--shadow); }
.svc h3 { font-size: 17px; }
.svc .desc { color: var(--muted); font-size: 13.5px; margin: 4px 0 12px; }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.status .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--muted); }
.status.up .dot { background: var(--success); box-shadow: 0 0 8px rgba(63,185,107,.6); }
.status.down .dot { background: var(--danger); }
.status.busy .dot { background: var(--warn); animation: pulse 1s infinite; }
.status.na .dot { background: var(--muted); }
@keyframes pulse { 50% { opacity: .35; } }
.svc .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tech { margin-top: 12px; font-size: 13px; color: var(--muted); }
.tech summary { cursor: pointer; color: var(--muted); }
.tech .tech-body { margin-top: 8px; padding: 10px; background: var(--surface2); border-radius: var(--radius); border: 1px solid var(--border); }
.tech code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

/* ---- live show console ---- */
.live-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 14px; margin-bottom: 8px; box-shadow: var(--shadow);
}
.live-bar .live-count { font-size: 20px; }
.live-bar .spacer { flex: 1; }
.live-pill { background: var(--danger); color: #fff; font-weight: 800; font-size: 12px; padding: 3px 9px; border-radius: 999px; animation: livepulse 1.6s infinite; }
@keyframes livepulse { 50% { opacity: .55; } }
.live-count { font-size: 26px; font-weight: 800; color: var(--accent-300); }

.cat-block { margin-bottom: 22px; }
.cat-head { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; margin: 0 0 8px; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }

/* Balanced columns so every square fits one screen (1080p target, chat beside it) */
.live-columns { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 10px; align-items: start; }
.live-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.live-columns .cat-head { margin: 6px 0 2px; font-size: 11px; }
.live-columns .live-col > .cat-head:first-child { margin-top: 0; }

.tile-btn {
  display: flex; align-items: center; gap: 10px; text-align: left; width: 100%;
  min-height: 62px; padding: 12px 14px; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font: inherit; font-weight: 600; font-size: 15px; touch-action: manipulation;
  transition: background .12s, border-color .12s;
}
/* Compact rows — the whole board visible without scrolling.
   --tile-font is tuned at runtime by fitLiveGrid() so everything always fits. */
.live-columns.compact { --tile-font: 12.5px; }
.live-columns.compact .live-col { gap: 2px; }
.live-columns.compact .tile-btn {
  min-height: 0; font-size: var(--tile-font); padding: calc(var(--tile-font) * 0.30) 8px;
  border-radius: 5px; gap: 6px; line-height: 1.2;
}
.live-columns.compact .cat-head { margin: 5px 0 1px; font-size: calc(var(--tile-font) * 0.82); }
.live-columns.compact .tile-btn .mark {
  width: calc(var(--tile-font) * 1.15); height: calc(var(--tile-font) * 1.15);
  border-radius: 3px; border-width: 1.5px; font-size: calc(var(--tile-font) * 0.8);
}
.live-columns.compact .tile-btn .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-btn .txt { min-width: 0; }
.tile-btn:hover { border-color: var(--muted); }
.tile-btn .mark { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--border); flex: 0 0 auto; display: grid; place-items: center; font-size: 14px; }
.tile-btn.on { background: rgba(63,185,107,.16); border-color: var(--success); }
.tile-btn.on .mark { background: var(--success); border-color: var(--success); color: #08260f; }
.tile-btn .who { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.tile-btn.busy { opacity: .55; pointer-events: none; }

/* ---- history ---- */
.hist-tile { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.hist-tile:last-child { border-bottom: none; }
.hist-tile .mark { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; font-size: 12px; flex: 0 0 auto; background: var(--surface2); color: var(--muted); }
.hist-tile.on .mark { background: var(--success); color: #08260f; font-weight: 800; }
.hist-tile.off { color: var(--muted); }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.bar-row .name { flex: 0 0 46%; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { flex: 1; display: block; background: var(--surface2); border-radius: 999px; height: 16px; overflow: hidden; }
/* must be block — an inline span ignores width/height */
.bar-row .fill { display: block; background: var(--accent); height: 100%; border-radius: 999px; min-width: 3px; }
.bar-row .val { flex: 0 0 84px; text-align: right; font-size: 13px; color: var(--muted); font-weight: 700; }

/* ---- modals ---- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 20px; z-index: 40; }
.modal-card { width: min(480px, 94vw); display: flex; flex-direction: column; gap: 15px; }
.modal-card h2 { font-size: 19px; }
.modal-card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.reveal { display: flex; gap: 8px; }
.reveal input { font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---- toast ---- */
.toast-wrap { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(560px, 92vw); }
.toast { background: var(--surface2); border: 1px solid var(--border); padding: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 12px; width: 100%; }
.toast.err { border-color: var(--danger); }
.toast.ok { border-color: var(--success); }
.toast .msg { flex: 1; font-weight: 600; font-size: 14.5px; }
.toast .x { cursor: pointer; color: var(--muted); background: none; border: none; font-size: 18px; line-height: 1; }

/* spinner */
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .topbar .user { width: 100%; }
  .nav { overflow-x: auto; }
  .hero { flex-direction: column; text-align: center; }
}
