/* ============ SUM STREAM SERVER — dashboard ============ */
:root {
  --bg: #060a0f;
  --bg-2: #0a1119;
  --panel: #0c141d;
  --panel-2: #0f1a25;
  --line: #16242f;
  --line-bright: #1f3a48;
  --txt: #cfe3ec;
  --txt-dim: #6f8694;
  --txt-faint: #46606e;
  --cyan: #28e0d4;
  --cyan-dim: #119b96;
  --blue: #3aa0ff;
  --lime: #9fe870;
  --amber: #ffb547;
  --red: #ff4d5e;
  --red-glow: rgba(255, 77, 94, 0.55);
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", "Courier New", monospace;
  --disp: "Chakra Petch", var(--mono);
  --r: 6px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--mono);
  color: var(--txt);
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(40, 224, 212, 0.07), transparent 60%),
    radial-gradient(900px 600px at -5% 110%, rgba(58, 160, 255, 0.06), transparent 55%),
    linear-gradient(180deg, #060a0f, #04070b);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.18;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 80%);
}
a { color: var(--cyan); text-decoration: none; }

/* ---------- layout ---------- */
.wrap { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 0 20px 60px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 14px 20px; margin-bottom: 22px;
  background: linear-gradient(180deg, rgba(8, 14, 20, 0.95), rgba(8, 14, 20, 0.78));
  border-bottom: 1px solid var(--line-bright);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 0 22px rgba(40, 224, 212, 0.45);
  display: grid; place-items: center; color: #021016; font-weight: 700;
  font-family: var(--disp); font-size: 18px;
}
.brand b { font-family: var(--disp); font-weight: 600; letter-spacing: 2px; font-size: 16px; }
.brand small { color: var(--txt-faint); letter-spacing: 1px; font-size: 10px; display: block; }

.vitals { display: flex; gap: 22px; margin-left: auto; flex-wrap: wrap; }
.vital { text-align: right; }
.vital .k { font-size: 9px; letter-spacing: 1.5px; color: var(--txt-faint); text-transform: uppercase; }
.vital .v { font-family: var(--disp); font-size: 15px; color: var(--cyan); }
.vital .v small { color: var(--txt-dim); font-size: 10px; }

.btn-logout {
  background: transparent; border: 1px solid var(--line-bright); color: var(--txt-dim);
  font-family: var(--mono); font-size: 11px; letter-spacing: 1px;
  padding: 7px 12px; border-radius: var(--r); cursor: pointer; transition: 0.15s;
}
.btn-logout:hover { color: var(--red); border-color: var(--red); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 22px; flex-wrap: wrap; }
.tab {
  font-family: var(--disp); letter-spacing: 1.5px; font-size: 12px;
  padding: 10px 18px; border: 1px solid var(--line); border-bottom: none;
  background: var(--panel); color: var(--txt-dim); cursor: pointer;
  border-radius: var(--r) var(--r) 0 0; transition: 0.15s; position: relative;
}
.tab:hover { color: var(--txt); }
.tab.active { color: var(--cyan); background: var(--panel-2); border-color: var(--line-bright); }
.tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}
.tab .badge {
  display: inline-block; min-width: 16px; text-align: center; margin-left: 7px;
  font-family: var(--mono); font-size: 10px; padding: 1px 5px; border-radius: 20px;
  background: var(--red); color: #fff; box-shadow: 0 0 10px var(--red-glow);
}

.view { display: none; animation: fade 0.25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- panels / cards ---------- */
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r); padding: 18px;
}
.section-h {
  display: flex; align-items: center; gap: 10px; margin: 0 0 16px;
  font-family: var(--disp); letter-spacing: 2px; font-size: 13px; color: var(--txt-dim);
  text-transform: uppercase;
}
.section-h::before { content: "▌"; color: var(--cyan); }

.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }

/* live stream card */
.live-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-bright); border-radius: var(--r);
  overflow: hidden; position: relative;
}
.live-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--red), var(--amber));
  box-shadow: 0 0 14px var(--red-glow);
}
.lc-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px 18px; }
.lc-name { font-family: var(--disp); font-size: 15px; letter-spacing: 0.5px; flex: 1; }
.live-dot {
  display: inline-flex; align-items: center; gap: 6px; font-size: 10px; letter-spacing: 1.5px;
  color: var(--red); font-family: var(--disp);
}
.live-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red-glow); animation: pulse 1.3s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }
.rec-chip { font-size: 9px; letter-spacing: 1px; color: var(--amber); border: 1px solid var(--amber); border-radius: 3px; padding: 1px 5px; }

.lc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { background: var(--panel); padding: 11px 14px; }
.stat .k { font-size: 9px; letter-spacing: 1px; color: var(--txt-faint); text-transform: uppercase; }
.stat .v { font-family: var(--disp); font-size: 16px; color: var(--txt); margin-top: 3px; }
.stat .v.cyan { color: var(--cyan); }
.stat .v.lime { color: var(--lime); }
.stat .v.amber { color: var(--amber); }

.lc-meta { display: flex; justify-content: space-between; padding: 11px 18px; font-size: 11px; color: var(--txt-dim); }
.bitrate-bar { height: 4px; background: var(--bg); position: relative; overflow: hidden; }
.bitrate-bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--cyan-dim), var(--cyan)); transition: width 0.6s ease; box-shadow: 0 0 10px var(--cyan); }

/* empty state */
.empty { text-align: center; padding: 60px 20px; color: var(--txt-faint); }
.empty .big { font-family: var(--disp); font-size: 18px; letter-spacing: 2px; color: var(--txt-dim); margin-bottom: 8px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; font-family: var(--disp); font-weight: 500; letter-spacing: 1px; font-size: 10px;
  text-transform: uppercase; color: var(--txt-faint); padding: 10px 12px; border-bottom: 1px solid var(--line-bright); }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--txt); }
tr:hover td { background: rgba(40, 224, 212, 0.03); }
.mono-key { font-size: 11px; color: var(--txt-dim); word-break: break-all; }

.pill { font-size: 10px; letter-spacing: 1px; padding: 2px 8px; border-radius: 20px; font-family: var(--disp); }
.pill.live { background: rgba(255,77,94,0.15); color: var(--red); border: 1px solid rgba(255,77,94,0.4); }
.pill.ended { background: rgba(40,224,212,0.1); color: var(--cyan); border: 1px solid rgba(40,224,212,0.3); }
.pill.interrupted { background: rgba(255,181,71,0.12); color: var(--amber); border: 1px solid rgba(255,181,71,0.35); }
.pill.on { background: rgba(159,232,112,0.12); color: var(--lime); border: 1px solid rgba(159,232,112,0.3); }
.pill.off { background: rgba(111,134,148,0.12); color: var(--txt-dim); border: 1px solid var(--line-bright); }

/* ---------- buttons / inputs ---------- */
.btn {
  font-family: var(--disp); letter-spacing: 1px; font-size: 12px; cursor: pointer;
  padding: 9px 16px; border-radius: var(--r); border: 1px solid var(--cyan-dim);
  background: rgba(40, 224, 212, 0.08); color: var(--cyan); transition: 0.15s;
}
.btn:hover { background: rgba(40, 224, 212, 0.18); box-shadow: 0 0 16px rgba(40,224,212,0.25); }
.btn.ghost { border-color: var(--line-bright); background: transparent; color: var(--txt-dim); }
.btn.ghost:hover { color: var(--txt); box-shadow: none; background: rgba(255,255,255,0.03); }
.btn.danger { border-color: var(--red); color: var(--red); background: rgba(255,77,94,0.07); }
.btn.danger:hover { background: rgba(255,77,94,0.18); box-shadow: 0 0 16px var(--red-glow); }
.btn.sm { padding: 5px 10px; font-size: 11px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

input[type=text], input[type=password], select {
  font-family: var(--mono); font-size: 13px; color: var(--txt);
  background: var(--bg); border: 1px solid var(--line-bright); border-radius: var(--r);
  padding: 9px 12px; outline: none; transition: 0.15s;
}
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(40,224,212,0.12); }
label.fld { display: block; margin-bottom: 14px; }
label.fld span { display: block; font-size: 10px; letter-spacing: 1px; color: var(--txt-faint); text-transform: uppercase; margin-bottom: 6px; }
label.fld input { width: 100%; }
.row-inline { display: flex; gap: 10px; align-items: center; }

.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row code {
  flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
  padding: 8px 11px; font-size: 11.5px; color: var(--cyan); word-break: break-all;
}
.icon-btn { background: transparent; border: 1px solid var(--line-bright); color: var(--txt-dim);
  border-radius: var(--r); padding: 7px 9px; cursor: pointer; font-size: 12px; transition: 0.15s; }
.icon-btn:hover { color: var(--cyan); border-color: var(--cyan-dim); }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(3,6,10,0.78); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; padding: 20px; }
.overlay.show { display: flex; }
.modal { width: 100%; max-width: 540px; background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-bright); border-radius: 10px; padding: 24px; box-shadow: 0 30px 80px rgba(0,0,0,0.6); }
.modal h3 { font-family: var(--disp); letter-spacing: 2px; margin: 0 0 18px; font-size: 16px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- login ---------- */
.login-screen { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(800px 500px at 50% 20%, rgba(40,224,212,0.08), transparent 60%), #04070b; }
.login-box { width: 100%; max-width: 380px; background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-bright); border-radius: 12px; padding: 32px; }
.login-box .logo-lg { width: 56px; height: 56px; border-radius: 12px; margin: 0 auto 18px;
  background: linear-gradient(135deg, var(--cyan), var(--blue)); display: grid; place-items: center;
  font-family: var(--disp); font-weight: 700; font-size: 26px; color: #021016; box-shadow: 0 0 30px rgba(40,224,212,0.5); }
.login-box h1 { font-family: var(--disp); letter-spacing: 3px; text-align: center; font-size: 18px; margin: 0 0 4px; }
.login-box p { text-align: center; color: var(--txt-faint); font-size: 11px; letter-spacing: 1px; margin: 0 0 24px; }
.login-box .err { color: var(--red); font-size: 12px; text-align: center; min-height: 18px; margin-top: 8px; }

/* ---------- toast ---------- */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  z-index: 300; background: var(--panel-2); border: 1px solid var(--cyan-dim); color: var(--txt);
  padding: 12px 20px; border-radius: var(--r); font-size: 13px; opacity: 0; pointer-events: none;
  transition: 0.25s; box-shadow: 0 0 24px rgba(40,224,212,0.2); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--red); box-shadow: 0 0 24px var(--red-glow); }

video { width: 100%; border-radius: var(--r); background: #000; }
.muted { color: var(--txt-faint); }
.hide { display: none !important; }
