/* =========================================================================
   StreamCast — desktop app theme
   Dark navy sidebar (streams + system status) and an airy light work area.
   ========================================================================= */

:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e6e9f0;
  --border-strong: #d5dae4;
  --text: #121726;
  --text-2: #3a4254;
  --muted: #7b8497;
  --accent: #3b5bfd;
  --accent-2: #6a8bff;
  --accent-hover: #2a45e0;
  --accent-soft: #eef2ff;
  --live: #f0304a;
  --live-soft: #fff0f2;
  --ok: #10b981;
  --ok-soft: #e7faf2;
  --warn: #f59e0b;

  --side-bg: #141a2e;
  --side-bg-2: #1b2340;
  --side-text: #c9d1e6;
  --side-muted: #7482a3;
  --side-line: rgba(255,255,255,.07);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.04), 0 2px 6px rgba(16,24,40,.05);
  --shadow-md: 0 4px 12px rgba(16,24,40,.06), 0 12px 28px rgba(16,24,40,.07);
  --shadow-lg: 0 8px 24px rgba(16,24,40,.08), 0 24px 56px rgba(16,24,40,.10);
  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

a { color: var(--accent); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--accent-hover); }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ring { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(3); opacity: 0; } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* ---- App shell ---- */
.app { display: flex; height: 100vh; }
.main { flex: 1; overflow-y: auto; position: relative; }
.main::before {
  content: ""; position: fixed; inset: 0 0 0 256px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 90% -10%, rgba(106,139,255,.13), transparent 60%),
    radial-gradient(700px 500px at 10% 110%, rgba(16,185,129,.07), transparent 60%);
}
.content { max-width: 1180px; margin: 0 auto; padding: 34px 36px 64px; }

/* ---- Sidebar ---- */
.sidebar {
  width: 256px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--side-bg), #10152a);
  color: var(--side-text);
  display: flex; flex-direction: column;
  padding: 18px 14px 14px;
  overflow-y: auto;
}
.side-brand {
  display: flex; align-items: center; gap: 11px;
  color: #fff; font-weight: 800; font-size: 18px; letter-spacing: -.02em;
  padding: 4px 8px 20px;
}
.side-brand img { width: 30px; height: 30px; border-radius: 8px; }
.side-brand:hover { color: #fff; }

.nav-item, .side-stream {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 9px;
  color: var(--side-text); font-weight: 600; font-size: 14px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-item svg { opacity: .8; flex-shrink: 0; }
.nav-item:hover, .side-stream:hover { background: var(--side-line); color: #fff; }
.nav-item.active, .side-stream.active { background: var(--side-bg-2); color: #fff; box-shadow: inset 3px 0 0 var(--accent-2); }

.side-section {
  display: flex; align-items: center; justify-content: space-between;
  margin: 22px 4px 6px 11px;
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--side-muted);
}
.side-add {
  width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center;
  color: var(--side-text); background: var(--side-line);
  font-size: 17px; font-weight: 500; line-height: 1;
}
.side-add:hover { background: var(--accent); color: #fff; }
.side-streams { display: flex; flex-direction: column; gap: 2px; }
.side-stream { font-weight: 500; }
.side-stream .sname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.side-stream .stag { font-size: 10px; font-weight: 800; letter-spacing: .06em; color: #ff6b80; }
.side-empty { color: var(--side-muted); font-size: 13px; padding: 6px 11px; }
.sdot { width: 8px; height: 8px; border-radius: 50%; background: #46506b; flex-shrink: 0; position: relative; }
.sdot.on { background: var(--live); }
.sdot.on::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--live); animation: ring 1.6s var(--ease) infinite; }
.sdot.warn { background: var(--warn); }

.side-spacer { flex: 1; min-height: 20px; }

.sys {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--side-line);
  border-radius: 12px;
  padding: 13px 13px 11px;
  font-size: 12.5px;
}
.sys-head { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 13px; margin-bottom: 10px; }
.sys-head svg { color: #76e3b5; }
.sys-row { margin-bottom: 9px; }
.sys-row .lbl { display: flex; justify-content: space-between; color: var(--side-muted); margin-bottom: 4px; }
.sys-row .lbl b { color: var(--side-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.meter { height: 5px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #5b7cff, #8aa2ff); transition: width .8s var(--ease); }
.meter i.hot { background: linear-gradient(90deg, #f59e0b, #f0304a); }
.sys-foot { display: flex; justify-content: space-between; color: var(--side-muted); border-top: 1px solid var(--side-line); padding-top: 9px; margin-top: 4px; }
.sys-foot b { color: var(--side-text); font-weight: 600; }

/* ---- Typography & page head ---- */
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.03em; margin: 0; }
h2 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 14px; }
.subtitle { color: var(--muted); margin: 4px 0 0; font-size: 14.5px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 26px; animation: rise .45s var(--ease) both;
}
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: inline-block; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 30px 0 14px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

/* ---- Buttons ---- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: var(--radius-sm);
  font: 600 14px/1.2 inherit; font-family: inherit;
  cursor: pointer; white-space: nowrap; overflow: hidden;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: var(--muted); color: var(--text); }
.btn:active { transform: none; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(59,91,253,.3); }
.btn-primary:hover { color: #fff; box-shadow: 0 8px 22px rgba(59,91,253,.4); border-color: transparent; }
.btn-live { background: linear-gradient(135deg, #ff5a70, var(--live)); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(240,48,74,.32); }
.btn-live:hover { color: #fff; box-shadow: 0 8px 22px rgba(240,48,74,.42); border-color: transparent; }
.btn-danger { color: var(--live); }
.btn-danger:hover { color: var(--live); background: var(--live-soft); border-color: #ffc9d2; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-lg { padding: 13px 24px; font-size: 15px; border-radius: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; }
form.inline { display: inline; margin: 0; }

/* ---- Cards ---- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px; margin-bottom: 20px;
  animation: rise .5s var(--ease) both;
}
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head h2 { margin: 0; }

/* ---- Stat tiles ---- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px 20px;
  display: flex; gap: 14px; align-items: center;
  animation: rise .5s var(--ease) both;
}
.stat:nth-child(2) { animation-delay: .05s; } .stat:nth-child(3) { animation-delay: .1s; } .stat:nth-child(4) { animation-delay: .15s; }
.stat-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.stat-ico.red { background: var(--live-soft); color: var(--live); }
.stat-ico.blue { background: var(--accent-soft); color: var(--accent); }
.stat-ico.green { background: var(--ok-soft); color: var(--ok); }
.stat-ico.amber { background: #fff6e6; color: #d98200; }
.stat .val { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); font-size: 13px; }

/* ---- Stream cards (overview) ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.stream-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
  animation: rise .5s var(--ease) both;
}
.stream-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stream-card.is-live { border-color: #ffd3da; box-shadow: 0 0 0 3px rgba(240,48,74,.06), var(--shadow-sm); }
.stream-card .top { display: flex; align-items: center; gap: 10px; }
.stream-card .name { font-weight: 700; font-size: 17px; letter-spacing: -.01em; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stream-card .name:hover { color: var(--accent); }
.now-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; min-height: 66px; }
.now-box .k { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.now-box .v { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.now-box .v.off { color: var(--muted); font-weight: 500; }
.meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.card-actions { display: flex; gap: 8px; margin-top: auto; }
.card-actions .btn { flex: 1; }

/* ---- Pills ---- */
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 800; letter-spacing: .06em; padding: 5px 11px; border-radius: 999px; white-space: nowrap; }
.pill .pdot { width: 7px; height: 7px; border-radius: 50%; position: relative; }
.pill-live { background: var(--live-soft); color: var(--live); box-shadow: inset 0 0 0 1px rgba(240,48,74,.15); }
.pill-live .pdot { background: var(--live); }
.pill-live .pdot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--live); animation: ring 1.6s var(--ease) infinite; }
.pill-off { background: #eef0f5; color: var(--muted); }
.pill-off .pdot { background: #a3aab8; }
.pill-soft { background: var(--accent-soft); color: var(--accent); }

/* ---- Progress ---- */
.bar { height: 5px; border-radius: 99px; background: #e9edf5; overflow: hidden; margin-top: 9px; }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width 1s linear; }
.bar.live i { background: linear-gradient(90deg, #ff7a8c, var(--live)); }

/* ---- Onboarding (empty overview) ---- */
.onboard { padding: 40px; text-align: center; }
.onboard-ico { width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 20px; display: grid; place-items: center; background: linear-gradient(135deg, #1b2742, #10152a); box-shadow: var(--shadow-md); }
.onboard h2 { font-size: 22px; letter-spacing: -.02em; margin-bottom: 6px; }
.onboard > p { color: var(--muted); margin: 0 auto 30px; max-width: 520px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; text-align: left; margin: 0 0 30px; padding: 0; list-style: none; }
.steps li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.steps .n { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 800; display: grid; place-items: center; margin-bottom: 10px; }
.steps b { display: block; margin-bottom: 4px; }
.steps span { color: var(--muted); font-size: 13.5px; }

/* ---- On-air panel (stream page) ---- */
.onair {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
  background: linear-gradient(135deg, #151c33, #1e2a50);
  color: #e6ebf8; border: none; padding: 24px 26px;
}
.onair.off { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.onair .k { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #8fa0c8; display: flex; align-items: center; gap: 8px; }
.onair.off .k { color: var(--muted); }
.onair .title { font-size: 21px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.onair.off .title { color: var(--text); }
.onair .times { display: flex; justify-content: space-between; font-size: 12.5px; color: #8fa0c8; font-variant-numeric: tabular-nums; margin-top: 7px; }
.onair .bar { background: rgba(255,255,255,.12); height: 6px; }
.onair .next { margin-top: 12px; font-size: 13px; color: #8fa0c8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.onair .next b { color: #dfe6f7; font-weight: 600; }
.onair-side { display: flex; flex-direction: column; gap: 10px; align-items: stretch; min-width: 190px; }
.onair-kpi { display: flex; gap: 22px; margin-bottom: 4px; }
.onair-kpi div { text-align: left; }
.onair-kpi .v { font-size: 20px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.onair.off .onair-kpi .v { color: var(--text); }
.onair-kpi .l { font-size: 12px; color: #8fa0c8; }
.onair.off .onair-kpi .l { color: var(--muted); }
.onair .btn:not(.btn-live) { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.14); }
.onair .btn:not(.btn-live):hover { background: rgba(255,255,255,.16); }
.onair.off .btn:not(.btn-live) { background: var(--surface); color: var(--text); border-color: var(--border-strong); }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 1050px) { .cols { grid-template-columns: 1fr; } }

/* ---- Queue ---- */
.queue { list-style: none; margin: 0; padding: 0; }
.qitem {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: 8px; background: var(--surface);
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.qitem:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.qitem.dragging { opacity: .45; }
.qitem.drag-over { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,91,253,.12); }
.qnum { width: 22px; text-align: right; color: #b3bac8; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.qhandle { cursor: grab; color: #c3c9d4; font-size: 16px; user-select: none; }
.qitem:hover .qhandle { color: var(--accent); }
.qthumb { width: 38px; height: 38px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: #aab1bf; flex-shrink: 0; }
.qbody { flex: 1; min-width: 0; }
.qname { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qsub { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qitem .bar { margin-top: 6px; height: 4px; }
.qitem.on-air { border-color: #ffc2cc; background: linear-gradient(180deg, #fff, #fff6f7); box-shadow: 0 0 0 3px rgba(240,48,74,.07); }
.qitem.on-air .qthumb { background: var(--live); border-color: var(--live); color: #fff; }
.qitem.on-air .qname { color: var(--live); }
.qactions { display: flex; gap: 6px; opacity: .55; transition: opacity .15s var(--ease); }
.qitem:hover .qactions { opacity: 1; }

.status-tag { font-size: 11.5px; font-weight: 700; padding: 4px 9px; border-radius: 7px; white-space: nowrap; }
.st-waiting_encode { background: #eef0f5; color: var(--muted); }
.st-encoding { background: linear-gradient(90deg, #eaf0ff, #d9e4ff, #eaf0ff); background-size: 200% 100%; color: var(--accent); animation: shimmer 1.3s linear infinite; }
.st-completed { background: var(--ok-soft); color: #0a946a; }
.st-error { background: var(--live-soft); color: var(--live); cursor: help; }

/* ---- Upload ---- */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: 14px;
  padding: 26px 18px; text-align: center; color: var(--muted); cursor: pointer;
  background: var(--surface-2);
  transition: border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
}
.dropzone svg { color: #b3bac8; margin-bottom: 6px; transition: color .2s var(--ease); }
.dropzone b { color: var(--text-2); }
.dropzone:hover, .dropzone.hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone:hover svg, .dropzone.hover svg { color: var(--accent); }

/* ---- Forms ---- */
label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 7px; color: var(--text-2); }
input[type=text], input[type=password], input[type=url], input[type=datetime-local] {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; background: var(--surface-2); color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
input::placeholder { color: #aab1bf; }
input:focus { outline: none; background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(59,91,253,.14); }
.field { margin-bottom: 20px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 6px; line-height: 1.45; }
.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row label { margin: 0; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.key-wrap { position: relative; }
.key-wrap input { padding-right: 90px; }
.key-wrap .btn { position: absolute; right: 5px; top: 5px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .form-grid { grid-template-columns: 1fr; } }
.help-list { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13.5px; }
.help-list li { margin-bottom: 8px; }
.danger-zone { border-color: #ffd6dc; }

/* ---- Flash ---- */
.flash { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; font-weight: 600; animation: rise .35s var(--ease) both; }
.flash-ok { background: var(--ok-soft); color: #0a7f5b; border: 1px solid #a9ecd2; }
.flash-error { background: var(--live-soft); color: #c31832; border: 1px solid #ffc9d2; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty svg { opacity: .35; margin-bottom: 10px; }

/* ---- Streams table ---- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.tbl td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .15s var(--ease); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tr.row-live { background: linear-gradient(90deg, rgba(240,48,74,.05), transparent 40%); }
.tbl-name { font-weight: 700; color: var(--text); }
.tbl-name:hover { color: var(--accent); }
select {
  padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer;
}
input[type=search] {
  padding: 9px 13px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; width: 100%;
}
input[type=search]:focus { outline: none; background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(59,91,253,.14); }

/* ---- Media library ---- */
.media-cols { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1050px) { .media-cols { grid-template-columns: 1fr; } }
.side-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.folder {
  display: block; padding: 8px 11px; border-radius: 9px; color: var(--text-2);
  font-weight: 500; font-size: 14px; transition: background .15s var(--ease);
}
.folder:hover { background: var(--surface-2); color: var(--text); }
.folder.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.folder-row { display: flex; align-items: center; gap: 4px; }
.folder-row .folder { flex: 1; }
.folder-row form { opacity: 0; transition: opacity .15s var(--ease); }
.folder-row:hover form { opacity: 1; }
.bulk { background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
input[type=checkbox].pick { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }

.lib-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; padding: 6px; }
.lib-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 8px;
  cursor: pointer; font-size: 13.5px;
}
.lib-item:hover { background: var(--surface-2); }
.lib-item input { width: 16px; height: 16px; accent-color: var(--accent); }
.lib-item .qname { flex: 1; font-weight: 500; }

/* ---- Phones and small windows ---- */
@media (max-width: 760px) {
  body { overflow: auto; }
  .app { flex-direction: column; height: auto; }
  /* Sidebar becomes a top bar: brand, sections and streams scroll sideways. */
  .sidebar {
    width: 100%; flex-direction: row; align-items: center; gap: 6px;
    padding: 10px 12px; overflow-x: auto; position: sticky; top: 0; z-index: 50;
  }
  .side-brand { padding: 0 8px 0 0; font-size: 16px; white-space: nowrap; }
  .side-brand img { width: 26px; height: 26px; }
  .nav-item, .side-stream { padding: 7px 10px; white-space: nowrap; }
  .nav-item.active, .side-stream.active { box-shadow: inset 0 -2px 0 var(--accent-2); }
  .side-section { margin: 0 4px 0 8px; }
  .side-section span { display: none; }
  .side-streams { flex-direction: row; gap: 4px; }
  .side-stream .sname { max-width: 110px; }
  .side-spacer, .sys { display: none; }   /* GPU panel is desktop-only */
  .main::before { inset: 0; }
  .content { padding: 18px 14px 40px; }

  h1 { font-size: 21px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-head .row { flex-wrap: wrap; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 12px 14px; gap: 10px; }
  .stat .val { font-size: 19px; }
  .stat-ico { width: 34px; height: 34px; }

  /* Wide tables scroll inside their card instead of stretching the page. */
  .card { padding: 16px; }
  .card > .tbl, .card .tbl { display: block; overflow-x: auto; white-space: nowrap; }
  .onair { grid-template-columns: 1fr; gap: 16px; }
  .onair-side { min-width: 0; }
  .onair .title { font-size: 18px; }
  .cols, .media-cols, .form-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .qitem { flex-wrap: wrap; gap: 8px; }
  .qactions { opacity: 1; }
  input[type=search], select { width: 100%; }
}

/* ---- Login ---- */
body.login-page { overflow: auto; background: radial-gradient(900px 600px at 50% -10%, rgba(106,139,255,.22), transparent 60%), var(--bg); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #fff; border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 38px; width: 100%; max-width: 380px; animation: rise .5s var(--ease) both; text-align: center; }
.login-card img { width: 56px; height: 56px; border-radius: 14px; margin-bottom: 12px; }
.login-card form { text-align: left; margin-top: 22px; }

.viewers { font-weight: 700; color: var(--live); font-variant-numeric: tabular-nums; }
