:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1e232b;
  --line: #2a313b;
  --text: #e6e9ee;
  --muted: #8a94a3;
  --accent: #4f8cff;
  --green: #2fbf71;
  --red: #ef5350;
  --amber: #f2a93b;
  --blue: #5aa9ff;
  --grey: #6b7480;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
[hidden] { display: none !important; }
h1, h2 { margin: 0; font-weight: 600; }
h2 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error-text { color: var(--red); min-height: 1em; margin: 6px 0 0; }
a { color: var(--blue); }

/* buttons & inputs */
.btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 7px;
  padding: 7px 12px; cursor: pointer; font: inherit; white-space: nowrap; }
.btn:hover { border-color: #3a4350; background: #242a33; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { background: none; border: 1px solid transparent; color: var(--muted); border-radius: 6px; padding: 3px 7px;
  cursor: pointer; font: inherit; font-size: 12px; }
.icon-btn:hover { color: var(--text); border-color: var(--line); background: var(--panel-2); }
.icon-btn.danger:hover { color: var(--red); }
input, select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 7px;
  padding: 7px 10px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px;
  width: min(360px, 100%); display: grid; gap: 12px; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line);
  background: var(--panel); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.spacer { flex: 1; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; }
.pill { flex-wrap: wrap; row-gap: 0; }
.pill > * { white-space: nowrap; }
.pill b { font-weight: 600; }
.pill .g { color: var(--green); } .pill .r { color: var(--red); } .pill .sep { color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grey); flex: none; }
.dot.ok { background: var(--green); } .dot.bad { background: var(--red); } .dot.warn { background: var(--amber); }

.tabs { display: flex; gap: 2px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--panel); overflow-x: auto; }
.tabs button { background: none; border: none; color: var(--muted); padding: 11px 14px; font: inherit; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; font-size: 11px; line-height: 18px;
  text-align: center; background: var(--panel-2); }
.badge.red { background: var(--red); color: #fff; }

main { padding: 20px; max-width: 2400px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.tab { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.card.down { border-color: var(--red); }
.card-head { display: flex; align-items: center; gap: 8px; }
.card-head h2 { font-size: 16px; }
.card-head .muted { margin-left: auto; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { background: var(--panel-2); border-radius: 8px; padding: 10px; }
.stat .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat.red .v { color: var(--red); } .stat.green .v { color: var(--green); } .stat.amber .v { color: var(--amber); }
.stat.clickable { cursor: pointer; } .stat.clickable:hover { outline: 1px solid var(--line); }
button.stat { border: none; color: inherit; font: inherit; text-align: left; }
.stats.two { grid-template-columns: repeat(2, 1fr); }
.ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-label { color: var(--muted); font-size: 12px; margin-bottom: -6px; }
#totp { letter-spacing: 3px; font-variant-numeric: tabular-nums; }
.kv { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 12px; }
.kv b { color: var(--text); font-weight: 600; }
.spark { width: 100%; height: 44px; display: block; }
.alert { background: rgba(239, 83, 80, .12); border: 1px solid rgba(239, 83, 80, .4); color: #ffb4b2; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.alert.warn { background: rgba(242, 169, 59, .12); border-color: rgba(242, 169, 59, .4); color: #ffd59a; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.grid2.tight { gap: 12px; grid-template-columns: 1fr 1fr; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.box-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.box-head h2 { flex: 1; }
.empty { color: var(--muted); padding: 14px 0; text-align: center; }

.list-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); min-width: 0; }
.list-row:first-child { border-top: none; }
.list-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; width: 118px; white-space: nowrap; }
.tag { white-space: nowrap; font-size: 11px; padding: 1px 7px; border-radius: 5px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); flex: none; }

/* toolbar */
.subtabs { display: flex; gap: 4px; margin: 0 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.subtabs button { background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted); padding: 8px 14px;
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.subtabs button:hover { color: var(--text); }
.subtabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.subtabs .n { font-weight: 400; margin-left: 6px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search] { width: 260px; max-width: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--panel); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 4px 11px;
  cursor: pointer; font: inherit; font-size: 12px; }
.chip.active { color: var(--text); border-color: var(--accent); background: rgba(79, 140, 255, .12); }
.chip .n { opacity: .7; margin-left: 4px; }
.bulkbar { display: flex; gap: 8px; align-items: center; background: rgba(79, 140, 255, .1); border: 1px solid rgba(79, 140, 255, .35);
  padding: 8px 12px; border-radius: 8px; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.box .table-wrap { border: none; background: none; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255, 255, 255, .02); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .cb { width: 32px; }
.actions-col { width: 1%; }
.actions { display: flex; gap: 2px; justify-content: flex-end; white-space: nowrap; }
.name-cell { display: flex; align-items: center; gap: 8px; min-width: 180px; }
.name-cell img { width: 26px; height: 26px; object-fit: contain; border-radius: 4px; background: var(--panel-2); flex: none; }
.name-cell .sub { color: var(--muted); font-size: 11px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; margin: 1px 8px 1px 0; white-space: nowrap; }
.more { text-align: center; }

/* Streams tab: detailed rows (logo, categories, provider, viewers, uptime, per-server status) */
#streamsTable td { vertical-align: middle; }
.st-name { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.st-logo { width: 52px; height: 52px; flex: none; border-radius: 8px; border: 2px solid var(--line); background: var(--panel-2);
  display: grid; place-items: center; overflow: hidden; }
.st-logo img { width: 100%; height: 100%; object-fit: contain; }
.st-logo .ini { font-weight: 700; font-size: 15px; color: var(--muted); letter-spacing: .02em; }
.st-logo.up { border-color: rgba(47, 191, 113, .55); } .st-logo.down { border-color: rgba(239, 83, 80, .6); }
.st-logo.degraded { border-color: rgba(242, 169, 59, .6); }
.st-title { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.st-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.st-cats { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.cat { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 6px; background: rgba(90, 169, 255, .14);
  color: var(--blue); white-space: nowrap; }
.cat.none { background: rgba(239, 83, 80, .15); color: var(--red); font-weight: 600; }
.th-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font: inherit; color: inherit; }
.th-sort:hover, .th-sort.active { color: var(--text); }
.th-sort:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 3px; }
.th-sort .arr { font-size: 10px; opacity: .7; }
.prov { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); white-space: nowrap; }
.viewers { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; font-weight: 600; }
.viewers svg { width: 16px; height: 16px; color: var(--muted); }
.uptime { display: inline-block; font-family: ui-monospace, Consolas, monospace; font-size: 12px; padding: 2px 9px; border-radius: 5px;
  white-space: nowrap; background: rgba(47, 191, 113, .13); color: var(--green); }
.uptime.down { background: rgba(239, 83, 80, .15); color: var(--red); }
.uptime.degraded { background: rgba(242, 169, 59, .15); color: var(--amber); }
.uptime.idle { background: rgba(138, 148, 163, .15); color: var(--muted); }
.uptime.starting { background: rgba(90, 169, 255, .15); color: var(--blue); }
.st-srvs { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.st-srv { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; padding: 3px 9px; border-radius: 6px;
  background: var(--panel-2); white-space: nowrap; }
.st-srv .dot { flex: none; }
@media (max-width: 760px) {
  /* Phone: each stream becomes a card. */
  #streamsTable thead { display: none; }
  #streamsTable, #streamsTable tbody { display: block; }
  #streamsTable tr { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px 10px; padding: 12px; border-bottom: 1px solid var(--line); }
  #streamsTable td { display: block; padding: 0; border: none; background: none !important; }
  #streamsTable td.cb { grid-row: 1; padding-top: 16px; }
  #streamsTable td.st-c-name { grid-column: 2 / 4; grid-row: 1; }
  #streamsTable td.st-c-cat { grid-column: 2 / 4; grid-row: 2; }
  #streamsTable td.st-c-cat .st-cats { flex-direction: row; flex-wrap: wrap; }
  #streamsTable td.st-c-up { grid-column: 2; grid-row: 3; }
  #streamsTable td.st-c-view { grid-column: 3; grid-row: 3; text-align: right; }
  #streamsTable td.st-c-prov { grid-column: 2 / 4; grid-row: 4; }
  #streamsTable td.st-c-prov:empty { display: none; }
  #streamsTable td.st-c-srv { grid-column: 2 / 4; grid-row: 5; }
  #streamsTable td.st-c-srv .st-srvs { flex-direction: row; flex-wrap: wrap; }
  #streamsTable td.st-c-act { grid-column: 1 / 4; grid-row: 6; }
  #streamsTable td.st-c-act .actions { justify-content: flex-start; flex-wrap: wrap; }
  #streamsTable td.empty { grid-column: 1 / 4; }
  .st-name { min-width: 0; }
  .st-logo { width: 44px; height: 44px; }
}

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 9px; border-radius: 999px; white-space: nowrap; font-weight: 500; }
.status.up { background: rgba(47, 191, 113, .13); color: var(--green); }
.status.down { background: rgba(239, 83, 80, .15); color: var(--red); }
.status.degraded { background: rgba(242, 169, 59, .15); color: var(--amber); }
.status.stopped, .status.unassigned { background: rgba(138, 148, 163, .15); color: var(--muted); }
.status.starting { background: rgba(90, 169, 255, .15); color: var(--blue); }
.status.on_demand { background: rgba(90, 169, 255, .1); color: #9cc8ff; }

.meter { width: 120px; height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--green); }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px 40px; align-items: center; gap: 10px; padding: 5px 0; }
.bar-row .meter { width: 100%; }
.bar-row .meter > i { background: var(--accent); }

/* modal */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 0;
  width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 40px); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
.modal { padding: 22px; display: grid; gap: 12px; }
.small-modal { width: min(420px, calc(100vw - 32px)); }
.modal label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.modal label.inline { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.modal input, .modal select, .modal textarea { color: var(--text); font-size: 14px; width: 100%; }
.modal input[type=checkbox] { width: 15px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 0; min-width: 0; }
legend { color: var(--muted); font-size: 12px; padding: 0 4px; }
.checklist { display: grid; gap: 4px; max-height: 140px; overflow: auto; }
.checklist.row { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.checklist label { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* overview: panel | everything | panel. Columns wrap on narrower screens. */
.ov-layout { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.ov-side { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.ov-mid { flex: 1.2 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.panel-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stats.five { grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); }
/* stat tiles, styled like the panel's own overview */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); grid-auto-flow: row dense; gap: 10px; }
.kpi { --tone: var(--line); background: var(--panel-2); border: 1px solid var(--line); border-bottom: 3px solid var(--tone);
  border-radius: 10px; padding: 12px 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.kpi.wide { grid-column: span 2; }
button.kpi { color: inherit; font: inherit; cursor: pointer; }
button.kpi:hover { border-color: var(--tone); }
.kpi .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.kpi .sub { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel);
  font-variant-numeric: tabular-nums; color: var(--muted); }
.kpi .g { color: var(--green); } .kpi .r { color: var(--red); } .kpi .a { color: var(--amber); } .kpi .m { color: var(--muted); }
.kpi.violet { --tone: #7c83ff; } .kpi.purple { --tone: #b07cff; } .kpi.teal { --tone: #2fbfa0; } .kpi.cyan { --tone: #38bdf8; }
.kpi.green { --tone: var(--green); } .kpi.red { --tone: var(--red); } .kpi.amber { --tone: var(--amber); }
.kpi.red .v { color: var(--red); }
.att { align-items: flex-start; padding: 10px 0; }
.att .what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.att .dot { margin-top: 5px; }
.srv-head { margin: 10px 0 4px; }
.srv-none { margin-bottom: 8px; }
.srv-list { display: flex; flex-direction: column; }
.srv { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(120px, 34%); gap: 4px 10px; align-items: center;
  padding: 7px 0; border-top: 1px solid var(--line); }
.srv .dot { align-self: start; margin-top: 6px; }
.srv-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.srv-name b { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.srv-ip { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); user-select: all; }
.srv-load { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.srv-load b { color: var(--text); font-weight: 600; } .srv-load .r { color: var(--red); }
.srv-load .bar { display: block; height: 4px; border-radius: 2px; background: var(--panel-2); margin-top: 4px; overflow: hidden; }
.srv-load .bar i { display: block; height: 100%; background: var(--green); border-radius: 2px; }
.srv-stats { grid-column: 2 / -1; font-variant-numeric: tabular-nums; }
.srv-stats b { color: var(--text); font-weight: 600; }
.srv-stats .g, td .g { color: var(--green); } .srv-stats .a, td .a { color: var(--amber); } .srv-stats .r, td .r { color: var(--red); }
td.nowrap { white-space: nowrap; }
.srv.off { background: rgba(239, 83, 80, .08); }
.srv.off .bar i { background: var(--red); }
.srv-empty { margin: 4px 0 8px; }
.srv-empty summary { cursor: pointer; color: var(--muted); font-size: 12px; padding: 6px 0; }
.srv-empty .srv-load .bar { display: none; }
@media (max-width: 640px) {
  .srv { grid-template-columns: auto minmax(0, 1fr); }
  .srv-load { grid-column: 2; text-align: left; }
}
.chart { width: 100%; height: auto; display: block; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 16px; }
.update-bar { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 8px 20px; font-size: 13px;
  background: rgba(79, 140, 255, .14); border-bottom: 1px solid rgba(79, 140, 255, .4); }
@media (max-width: 640px) { .ov-side, .ov-mid { flex-basis: 100%; } }

/* settings & users */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 16px; margin-bottom: 8px; }
.form-grid label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.form-grid label.inline { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.invite-result { margin-top: 12px; display: grid; gap: 8px; }
.invite-result .row { display: flex; gap: 8px; }
.invite-result input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

/* account setup page */
.setup-card { width: min(440px, 100%); }
.qr { display: grid; place-items: center; gap: 8px; }
.qr img { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 8px; image-rendering: pixelated; }
.secret { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; user-select: all; word-break: break-all; }
.steps { margin: 0; padding-left: 20px; color: var(--muted); display: grid; gap: 4px; }
.ok-text { color: var(--green); }

.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--green); padding: 10px 14px;
  border-radius: 8px; max-width: 380px; box-shadow: 0 6px 24px rgba(0, 0, 0, .4); }
.toast.err { border-left-color: var(--red); }

@media (max-width: 640px) {
  main { padding: 12px; }
  .topbar, .tabs { padding-left: 12px; padding-right: 12px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cards, .grid2, .grid2.tight { grid-template-columns: 1fr; }
}

/* optional features */
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 10px; }
.feat-group { margin: 6px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.feat-row { display: flex; gap: 14px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
.feat-row .what { flex: 1; min-width: 0; display: grid; gap: 2px; }
.feat-row select { flex: none; width: 170px; }
.modal-fields { display: grid; gap: 12px; }
.line-sec { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; display: grid; gap: 8px; }
.line-sec h3 { margin: 0; font-size: 13px; }
.line-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 6px 16px; font-size: 13px; }
.kv-grid span { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }
tr.clickable { cursor: pointer; }
#resTable tr.family td { background: rgba(255, 255, 255, .015); }

/* live connections and world map */
.live-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(260px, 1fr); gap: 16px; margin: 16px 0; }
.live-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.live-side .box { margin: 0; }
.map-box { position: relative; margin: 0; min-width: 0; }
.world { width: 100%; aspect-ratio: 2 / 1; }
.world svg { width: 100%; height: 100%; display: block; }
.world { border-radius: 10px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, #12233a 0%, #0c1626 55%, #090f19 100%); }
.world .c { fill: #1b2636; stroke: #2a3b54; transition: fill .15s; }
.world .c.has { cursor: pointer; }
.world .c.has:hover, .world .c.hot { stroke: #9fe9ff; }
.world { position: relative; touch-action: none; cursor: grab; }
.world .b { fill: url(#bubbleFill); stroke: #7fe6ff; stroke-opacity: .8; }
.world .pulse { fill: none; stroke: #5ee0f7; pointer-events: none; transform-box: fill-box; transform-origin: center;
  animation: map-pulse 2.6s ease-out infinite; }
@keyframes map-pulse { from { transform: scale(1); opacity: .7; } to { transform: scale(2.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .world .pulse { animation: none; opacity: 0; } }
.map-zoom { position: absolute; right: 8px; top: 8px; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.map-zoom .btn { min-width: 30px; background: rgba(23, 27, 33, .85); }
.world .bl { fill: #eaf6ff; font-weight: 600; text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: #08101b; }
.map-tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); max-width: 240px; z-index: 2; }
.map-tip b { font-size: 13px; }
.map-legend { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.map-legend .ramp { display: inline-flex; height: 8px; width: 160px; border-radius: 4px; overflow: hidden; }
.map-legend .ramp i { flex: 1; }
.lc-filters { flex-wrap: wrap; gap: 8px; }
.lc-filters h2 { margin-right: auto; }
.lc-filters input, .lc-filters select { width: auto; min-width: 140px; }
.flag { display: inline-block; min-width: 22px; font-size: 11px; font-weight: 700; color: var(--muted); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid3 .box { margin: 0; display: flex; flex-direction: column; }
.scroll-list { max-height: 450px; overflow-y: auto; padding-right: 6px; scrollbar-width: thin; }
.isp-foot { margin: 8px 0 0; }
.net-tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 6px; border-radius: 4px;
  margin-left: 6px; vertical-align: 1px; }
.net-tag.vpn { background: color-mix(in srgb, var(--red) 22%, transparent); color: var(--red); }
.net-tag.hosting { background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber); }
.bar-row.vpn .meter > i { background: var(--red); }
.bar-row.hosting .meter > i { background: var(--amber); }
@media (max-width: 900px) { .live-grid { grid-template-columns: 1fr; } }
@media (max-width: 1200px) { .grid3 { grid-template-columns: 1fr; } }

/* Security tab */
.risk { display: inline-flex; flex-direction: column; align-items: center; min-width: 52px; padding: 4px 8px; border-radius: 8px; font-weight: 700; }
.risk b { font-size: 18px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.risk span { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.risk.high { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.risk.medium { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }
.sec-kind { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; margin: 0 4px 3px 0; }
.sec-kind.sharing { background: rgba(124, 131, 255, .18); color: #a5aaff; }
.sec-kind.scraping { background: rgba(176, 124, 255, .18); color: #c9a6ff; }
.sec-kind.restream { background: rgba(47, 191, 160, .18); color: #4fd8b8; }
.sec-why { margin: 2px 0 0; padding-left: 16px; font-size: 12.5px; }
.sec-why li { margin: 1px 0; }
.sec-why .pts { color: var(--muted); font-size: 11px; margin-left: 4px; }
.sec-seen { font-size: 12.5px; line-height: 1.6; }
.sec-seen .flag { min-width: 0; margin-right: 4px; color: var(--text); }
.sec-ips { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; line-height: 1.5; }
#secTable td { vertical-align: top; }
#secMore { padding-top: 8px; }
.sec-evidence { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 6px; }
.sec-evidence span { font-size: 11.5px; padding: 1px 7px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.sec-evidence span b { color: var(--text); font-weight: 600; }
.sec-innocent { margin-top: 6px; font-size: 12px; color: var(--muted); padding: 4px 8px; border-left: 2px solid var(--green); background: color-mix(in srgb, var(--green) 7%, transparent); border-radius: 0 5px 5px 0; }
.sec-innocent b { color: var(--green); font-weight: 600; }
.sec-evidence span.hot { border-color: color-mix(in srgb, var(--amber) 55%, transparent); }
#secTable { min-width: 980px; }
#secTable td.sec-c-why { min-width: 260px; }

/* Providers */
.prov-bar { justify-content: space-between; margin-bottom: 10px; }
.prov-bar p { margin: 0; flex: 1; min-width: 240px; }
.prov-act { text-align: right; white-space: nowrap; }
.prov-name { font-weight: 600; }
.prov-login { color: var(--muted); }
.sf-prov { display: grid; gap: 8px; }
.sf-prov-row { display: flex; gap: 8px; align-items: center; }
.sf-prov-row select, .sf-prov-row input { flex: 1; min-width: 0; }
.sf-prov-row .btn { flex: none; }
.sf-prov label.inline.small { font-size: 12px; color: var(--muted); }
.sf-prov p { margin: 0; }
.sf-prov-list { max-height: 420px; overflow: auto; display: grid; gap: 10px; padding-right: 2px; }
.pv-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.pv-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 7px 10px; font-size: 13px;
  background: color-mix(in srgb, var(--accent) 16%, var(--panel-2)); border-bottom: 1px solid var(--line); border-left: 3px solid var(--accent); }
.pv-head .mono { color: var(--muted); font-size: 11px; }
.pv-count { margin-left: auto; color: var(--muted); font-size: 12px; }
.pv-rows { list-style: none; margin: 0; padding: 0; }
.pv-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "n btns" "meta btns"; gap: 3px 10px; align-items: center;
  padding: 7px 10px; font-size: 13px; }
.pv-row:nth-child(even) { background: var(--panel-2); }
.pv-row:hover { background: color-mix(in srgb, var(--accent) 8%, var(--panel-2)); }
.pv-row .n { grid-area: n; min-width: 0; overflow-wrap: anywhere; }
.pv-row .pv-meta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; min-width: 0; }
.pv-row .pv-btns { grid-area: btns; display: flex; gap: 6px; }
.pv-row .tag.ok { color: var(--green, #3fb950); border-color: color-mix(in srgb, var(--green, #3fb950) 45%, var(--line)); }
.pv-row .tag.pvcat { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.pv-row .pv-note { font-size: 11px; color: var(--amber, #e3a93b); }
.pv-row.near .n, .pv-row.unknown .n { color: var(--muted); }
.pv-row.other { opacity: .7; }
.pv-none { margin: 0; }
.sf-prov-list .id { color: var(--muted); font-size: 11px; font-family: ui-monospace, Consolas, monospace; }
@media (max-width: 640px) {
  .sf-prov-row { flex-wrap: wrap; }
  .sf-prov-list { max-height: none; overflow: visible; }
  .pv-row { grid-template-columns: 1fr; grid-template-areas: "n" "meta" "btns"; }
  .pv-row .pv-btns .btn { flex: 1; }
}

/* Backup sources, one box each, in priority order */
.sf-backups { display: grid; gap: 6px; }
.sf-bk-head { color: var(--muted); font-size: 12px; }
.sf-bk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sf-bk-list:empty { display: none; }
.sf-bk { display: grid; grid-template-columns: auto auto 1fr auto auto; gap: 6px 8px; align-items: center; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.sf-bk.dragging { opacity: .5; }
.sf-bk.drop { border-color: var(--accent); }
.sf-bk .grip { cursor: grab; color: var(--muted); user-select: none; padding: 0 2px; font-size: 14px; line-height: 1; }
.sf-bk .pri { min-width: 22px; height: 22px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; }
.sf-bk input { font-size: 13px; min-width: 0; }
.sf-bk .host { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.sf-bk .acts { display: flex; gap: 4px; }
.sf-bk .acts .btn { padding: 3px 7px; }
.sf-bk .sf-warn { grid-column: 3 / -1; }
.sf-warn { margin: 0; font-size: 12px; color: var(--amber, #e3a93b); }
@media (max-width: 640px) {
  .sf-bk { grid-template-columns: auto auto 1fr auto; }
  .sf-bk input { grid-column: 3 / -1; }
  .sf-bk .host { grid-column: 3; justify-self: start; }
  .sf-bk .acts { grid-column: 4; }
}

/* ----- Suggested fixes (a view under Streams) ----- */
.fix-panels { border-bottom: none; margin-top: -6px; }
.fix-panels button { padding: 5px 12px; font-size: 13px; }
.fx-trigger { color: var(--amber); border-color: rgba(242, 169, 59, .4); }
.form-sub { font-size: 14px; margin: 16px 0 8px; }
.fix-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.fix-bar p { flex: 1; margin: 0; }
.fx-list { display: grid; gap: 12px; margin-bottom: 16px; }
.fx-card { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.fx-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.fx-head h3 { margin: 0; font-size: 15px; }
.fx-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; font-size: 12px; }
.fx-meta .tag.fx-t { color: var(--text); border-color: #3a4350; }
.fx-cands { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fx-c { display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.fx-c.keep { grid-template-columns: 1fr auto; color: var(--muted); }
.fx-c.on { border-color: var(--accent); background: rgba(79, 140, 255, .07); }
.fx-conf { display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 8px; height: 40px; font-weight: 700; font-size: 15px; line-height: 1; }
.fx-conf small { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 3px; }
.fx-conf.high { background: rgba(47, 191, 113, .15); color: var(--green); }
.fx-conf.good { background: rgba(90, 169, 255, .15); color: var(--blue); }
.fx-conf.low { background: rgba(242, 169, 59, .15); color: var(--amber); }
.fx-main { min-width: 0; }
.fx-name { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fx-name b { overflow-wrap: anywhere; }
.fx-prov { font-size: 12px; color: var(--muted); margin-top: 2px; }
.fx-why { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 12px; }
.fx-why .ok { color: var(--green); }
.fx-why .warn { color: var(--amber); }
.fx-pick { display: flex; gap: 12px; font-size: 13px; white-space: nowrap; }
.fx-pick label { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.fx-plan { margin: 10px 0 8px; font-size: 13px; padding: 8px 10px; border-radius: 8px; background: rgba(79, 140, 255, .08); border: 1px dashed #34507f; }
.fx-plan.none { color: var(--muted); background: none; border-color: var(--line); }
.fx-plan ol { margin: 4px 0 0; padding-left: 20px; }
.fx-foot { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.fx-foot .opts { display: flex; flex-wrap: wrap; gap: 6px 14px; flex: 1; font-size: 13px; }
.fx-foot .opts label { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.fx-foot .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.fx-empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.fx-skip { font-size: 12px; color: var(--muted); margin-top: 8px; }
.fx-recent .status.applied { background: rgba(47, 191, 113, .13); color: var(--green); }
.fx-recent .status.rejected, .fx-recent .status.undone, .fx-recent .status.gone { background: rgba(138, 148, 163, .15); color: var(--muted); }
.fx-recent .status.recovered { background: rgba(90, 169, 255, .15); color: var(--blue); }
.fx-recent .status.no_match { background: rgba(242, 169, 59, .15); color: var(--amber); }
@media (max-width: 700px) {
  .fx-c { grid-template-columns: 42px 1fr; }
  .fx-pick { grid-column: 1 / -1; justify-content: flex-end; }
  .fx-c.keep { grid-template-columns: 1fr auto; }
  .fx-c.keep .fx-pick { grid-column: auto; }
  .fix-bar { flex-direction: column; align-items: stretch; }
}
/* load balancing */
.badge.amber { background: var(--amber); color: #1a1205; }
.lb-cards { display: grid; gap: 10px; }
.lb-card { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 12px 14px; background: var(--panel-2);
  display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: start; }
.lb-card.remove { border-left-color: var(--grey); }
.lb-card.capped { border-left-color: var(--amber); }
.lb-card h3 { margin: 0; font-size: 15px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.lb-card .why { margin: 4px 0 8px; color: var(--text); font-size: 13px; }
.lb-card .acts { display: flex; gap: 6px; align-self: center; }
.lb-flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.lb-flow .arrow { color: var(--muted); }
.lb-flow .per { font-variant-numeric: tabular-nums; font-weight: 600; }
.lb-srv { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); white-space: nowrap; }
.lb-srv.new { border-color: var(--green); color: var(--green); background: rgba(47, 191, 113, .1); }
.lb-srv.gone { border-color: var(--grey); color: var(--muted); text-decoration: line-through; }
.lb-srv.off { opacity: .55; }
.lb-srv.ours::after { content: "Omnicore"; font-size: 10px; color: var(--blue); }
.lb-srv .ld { color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-notes { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; grid-column: 1 / -1; }
.lb-notes li { margin: 2px 0; }
.lb-bar { display: inline-block; width: 54px; height: 6px; border-radius: 3px; background: var(--panel); vertical-align: middle; margin-left: 6px; overflow: hidden; }
.lb-bar i { display: block; height: 100%; background: var(--green); }
.lb-bar i.a { background: var(--amber); } .lb-bar i.r { background: var(--red); }
.lb-state { font-size: 12px; }
.lb-auto { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0 4px; padding: 10px 12px; border: 1px solid var(--amber); border-radius: 8px;
  background: rgba(242, 169, 59, .07); color: var(--text); font-size: 13px; line-height: 1.45; }
.lb-auto input { margin: 2px 0 0; flex: none; }
.lb-excl { margin: 10px 0 0; }
.lb-excl .checklist { max-height: none; }
@media (max-width: 700px) {
  .lb-card { grid-template-columns: 1fr; }
  .lb-card .acts { justify-self: start; }
}

/* Servers tab: sort picker, group headers, and cards on phones */
.srv-toolbar { margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: none; border: none; color: var(--muted); padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--panel-2); color: var(--text); font-weight: 600; }
.sv-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
#serversTable td.sv-name { font-weight: 500; min-width: 180px; }
#serversTable tr.srv-grp th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  color: var(--text); background: var(--panel-2); padding: 8px 12px; }
#serversTable tr.srv-grp th .muted { font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 8px; }
@media (max-width: 760px) {
  /* Phone: each server becomes a card: name and status, IP and panel, then the numbers in a row. */
  #serversTable thead { display: none; }
  #serversTable, #serversTable tbody { display: block; }
  #serversTable tr.srv-grp { display: block; }
  #serversTable tr.srv-grp th { display: block; }
  #serversTable tr:not(.srv-grp) { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 10px; padding: 12px;
    border-bottom: 1px solid var(--line); }
  #serversTable td { display: block; padding: 0; border: none; background: none !important; min-width: 0; }
  #serversTable td.sv-name { grid-column: 1 / 4; grid-row: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; }
  #serversTable td.sv-st { grid-column: 4; grid-row: 1; text-align: right; }
  #serversTable td.sv-ip { grid-column: 1 / 3; grid-row: 2; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
  #serversTable td.sv-panel { grid-column: 3 / 5; grid-row: 2; text-align: right; }
  #serversTable td.sv-meter { grid-column: 1 / 5; grid-row: 3; }
  #serversTable td.sv-meter .meter { width: 100%; }
  #serversTable td.sv-streams, #serversTable td.sv-up { grid-row: 4; text-align: left; }
  #serversTable td.sv-streams { grid-column: 1 / 3; } #serversTable td.sv-up { grid-column: 3 / 5; }
  #serversTable td.sv-x { grid-row: 5; text-align: left; }
  #serversTable td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
  #serversTable td.sv-net { grid-column: 1 / 5; grid-row: 6; white-space: normal; font-size: 12px; }
  #serversTable td.empty { grid-column: 1 / 5; }
}
/* Settings > Discord alerts */
.al-type { align-items: flex-start; }
.al-type .what label { cursor: pointer; }
.al-type input[type=checkbox] { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.al-on { border-color: var(--line); background: transparent; }
.al-log { margin-top: 12px; }
.al-log .list-row { font-size: 12px; }
.al-log .when { flex: none; width: 120px; color: var(--muted); }
.al-chan { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.al-chan input { flex: 1 1 260px; min-width: 0; padding: 5px 8px; font-size: 12px; }
.al-where { flex: none; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }
.al-where.own { color: var(--text); border-color: var(--accent, #5b8def); }

/* block lines from the list (Lines and Security tabs) */
#lBulkBar, #secBulkBar { flex-wrap: wrap; margin-bottom: 10px; }
.row-acts { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.bk-list { display: grid; max-height: min(46vh, 380px); overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.bk-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.bk-row:last-child { border-bottom: none; }
.bk-row .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-row .hint { grid-column: 1 / 3; font-size: 12px; color: var(--muted); }
.bk-row .hint.warn { color: var(--amber); }
.bk-row .st { font-size: 12px; white-space: nowrap; text-align: right; }
.bk-row .st.done { color: var(--green); }
.bk-row .st.failed, .bk-row .st.not_tried { color: var(--red); }
.bk-row .st.skipped, .bk-row .st.waiting { color: var(--muted); }
.bk-progress { display: grid; gap: 6px; }
.bk-bar { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.bk-bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
@media (max-width: 760px) {
  .row-acts { flex-direction: column; align-items: stretch; }
  #lBulkBar .btn, #secBulkBar .btn { flex: 1 1 auto; }
}
/* Row buttons stay quiet so a long list isn't a wall of red; the confirm box is the loud part. */
.row-acts .btn.danger { background: transparent; color: var(--red); border: 1px solid rgba(239, 83, 80, .45); }
.row-acts .btn.danger:hover { background: rgba(239, 83, 80, .12); }

/* reseller reports */
.rep-kpis { margin-bottom: 10px; }
.rep-list { display: grid; gap: 10px; }
.rep-case { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.rep-head { margin-bottom: 4px; }
.rep-who { margin: 4px 0; }
.rep-notes { margin-top: 4px; color: var(--text); opacity: .85; }
.rep-reason { margin: 6px 0; padding: 7px 10px; border-left: 3px solid var(--amber); background: var(--panel); border-radius: 6px; font-size: 13px; }
.rep-test { margin: 6px 0; font-size: 13px; padding: 6px 10px; border-radius: 6px; background: var(--panel); }
.rep-test.ok { border-left: 3px solid var(--green); } .rep-test.bad { border-left: 3px solid var(--red); }
.fixbox { background: #13202f; border: 1px solid #27405e; border-radius: 8px; padding: 6px 10px; font-size: 13px; margin: 6px 0; }
.rep-steps { list-style: none; margin: 6px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); display: grid; gap: 4px; font-size: 13px; }
.rep-steps li { position: relative; }
.rep-steps li::before { content: ""; position: absolute; left: -17px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.rep-steps li.ok::before { background: var(--green); } .rep-steps li.work::before { background: var(--amber); } .rep-steps li.bad::before { background: var(--red); }
.rep-steps time { color: var(--muted); font-size: 12px; margin-right: 6px; }
.rep-side { display: grid; align-content: start; justify-items: end; gap: 8px; min-width: 150px; }
.rep-acts { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.rep-st { display: inline-flex; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: #2a2f37; color: #c3cad4; }
.rep-st.red { background: #3d1d1d; color: #ff8a87; } .rep-st.green { background: #173a29; color: #6fe0a3; }
.rep-st.amber { background: #3a2e14; color: #f6c46a; } .rep-st.blue { background: #22304a; color: #9cc2ff; }
.rep-close { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.rep-close input { flex: 1; min-width: 200px; }
.rp-site { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.rp-invite input { flex: 1; min-width: 180px; }
@media (max-width: 700px) {
  .rep-case { grid-template-columns: 1fr; }
  .rep-side { justify-items: start; }
  .rep-acts { flex-direction: row; flex-wrap: wrap; }
}

/* Settings: a side menu of sections (a picker on phones), search across all of them. */
.set-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.set-nav { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.set-nav input[type=search] { width: 100%; margin-bottom: 8px; }
.set-nav select { display: none; }
.set-nav button { display: flex; align-items: center; gap: 8px; text-align: left; background: none; border: none; color: var(--muted);
  padding: 8px 10px; border-radius: 7px; font: inherit; cursor: pointer; border-left: 2px solid transparent; }
.set-nav button:hover { color: var(--text); background: var(--panel-2); }
.set-nav button.active { color: var(--text); background: var(--panel-2); border-left-color: var(--accent); }
.set-nav button[hidden] { display: none; }
.set-hits { margin-left: auto; font-size: 11px; color: var(--text); background: var(--accent); border-radius: 9px; padding: 0 6px; }
.set-nav p { margin: 6px 4px 0; }
.set-body { display: grid; gap: 16px; min-width: 0; }
.set-sec { display: grid; gap: 16px; min-width: 0; }
.set-sec[hidden] { display: none; }
.set-body.searching .set-sec:not(.set-all) :is(.form-grid > label, label.inline, .feat-group, .feat-row, .list-row, .box > p, .rp-site, h3.form-sub):not(.set-hit, .set-hit *) { display: none; }
.set-hit { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 4px; }
@media (max-width: 760px) {
  .set-layout { grid-template-columns: minmax(0, 1fr); }
  .set-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 8px; padding: 8px; }
  .set-nav input[type=search] { flex: 1 1 100%; margin: 0; }
  .set-nav select { display: block; flex: 1 1 100%; font-size: 15px; padding: 9px 10px; }
  .set-nav button { display: none; }
}

/* lineup builder (Providers › Channels and Lineup) */
.prov-views { margin-top: -6px; }
.prov-views button { font-weight: 500; font-size: 13px; padding: 7px 12px; }
.prov-view { display: grid; gap: 12px; min-width: 0; }
.lu-tag { white-space: nowrap; font-size: 11px; padding: 1px 7px; border-radius: 5px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.lu-tag.ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.lu-tag.bad { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.lu-tag.warn, .tag.warn { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.lu-tag.blue { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 45%, var(--line)); }
.lu-feeds { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.lu-feed { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 3px; min-width: 0; }
.lu-feed .t { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.lu-feed .t span.nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lu-feed .err { color: var(--red); }
.lu-filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(130px, 1fr)); gap: 8px; padding: 12px; }
.lu-filters input, .lu-filters select { width: 100%; min-width: 0; }
.lu-bulk { flex-wrap: wrap; }
.lu-bulk select { max-width: 260px; }
.lu-logo { width: 38px; height: 24px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center;
  font-size: 9px; font-weight: 700; color: var(--muted); flex: none; overflow: hidden; letter-spacing: .02em; }
.lu-logo img { width: 100%; height: 100%; object-fit: contain; }
.lu-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lu-name b { font-weight: 500; }
.lu-table tr.sel td { background: rgba(79, 140, 255, .06); }
.lu-table td.actions-col, .lu-items td.actions-col { white-space: nowrap; }
.lu-pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.lu-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.lu-cats { display: grid; gap: 2px; max-height: 70vh; overflow: auto; }
.lu-catrow { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; }
.lu-catrow:hover { background: rgba(255, 255, 255, .03); }
.lu-catrow.active { background: rgba(79, 140, 255, .12); border-color: rgba(79, 140, 255, .45); }
.lu-catrow.drop { border-top: 2px solid var(--accent); }
.lu-catrow .grip { color: var(--muted); cursor: grab; user-select: none; }
.lu-catrow .nm { flex: 1; min-width: 0; }
.lu-catrow .nm div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lu-catrow .nm small { color: var(--muted); font-size: 11px; }
.lu-catrow .n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.lu-catrow .mv { visibility: hidden; }
.lu-catrow:hover .mv, .lu-catrow.active .mv { visibility: visible; }
.lu-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 10px; }
.lu-head h2 { flex: 1; min-width: 160px; }
.lu-link { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.lu-link select { max-width: 320px; }
.lu-tools { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin-bottom: 10px; }
.lu-tools label { display: grid; gap: 4px; font-size: 11px; color: var(--muted); }
.lu-tools input { width: 150px; }
.lu-items .rename { display: grid; gap: 2px; min-width: 180px; }
.lu-items .rename input { padding: 4px 8px; width: 100%; font-weight: 500; }
.lu-items .was { color: var(--muted); font-size: 11px; text-decoration: line-through; }
.lu-items .epg { padding: 3px 7px; width: 150px; font-size: 12px; }
.lu-items tr.drop td { border-top: 2px solid var(--accent); }
.lu-items .grip { color: var(--muted); cursor: grab; user-select: none; width: 18px; }
.lu-src { font-size: 12px; color: var(--muted); white-space: nowrap; }
.lu-src b { color: var(--text); font-weight: 500; }
.lu-phone, .lu-phone-inline { display: none; }
.lu-panel-list { max-height: 220px; overflow: auto; columns: 2; font-size: 12px; color: var(--muted); margin: 6px 0 10px; padding: 8px 10px; background: var(--bg); border-radius: 8px; }
.lu-panel-list div { break-inside: avoid; }
@media (max-width: 900px) {
  .lu-grid { grid-template-columns: 1fr; }
  .lu-cats, .lu-desk { display: none; }
  .lu-phone { display: block; width: 100%; }
  .lu-filters { grid-template-columns: 1fr 1fr; }
  .lu-filters input[type=search] { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  /* Channel and lineup tables become cards on phones. */
  .lu-table thead, .lu-items thead { display: none; }
  .lu-table, .lu-table tbody, .lu-items, .lu-items tbody { display: grid; gap: 8px; }
  .lu-table tr, .lu-items tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .lu-table td, .lu-items td { padding: 0; border: none; }
  .lu-table td.c-name, .lu-items td.c-name { flex: 1 1 calc(100% - 40px); min-width: 0; }
  .lu-table td.c-group, .lu-items td.c-group { flex-basis: 100%; order: 3; }
  .lu-table .c-empty, .lu-items .c-empty { display: none; }
  .lu-table tr.sel { background: rgba(79, 140, 255, .08); }
  .lu-table tr.sel td { background: none; }
  .lu-items .grip { display: none; }
  .lu-phone-inline { display: inline; }
  .lu-items .rename { min-width: 0; }
  .lu-tools input { width: 120px; }
  .lu-panel-list { columns: 1; }
}
