﻿/* EPG Manager mockup
   Layout: fixed left rail (navigation) + top status strip + scrolling work area.
   Look: broadcast control room. Cool slate neutrals, one indigo "signal" accent,
   status colors reserved for state and always paired with an icon and a label. */
:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #eaeef5;
  --line: #dde2ea;
  --line-strong: #c5ccd8;
  --fg: #111723;
  --fg-2: #485165;
  --muted: #747e92;
  --accent: #3b4bd8;
  --accent-ink: #2f3cb8;
  --accent-bg: #e8eafc;
  --on-accent: #ffffff;
  --rail: #121826;
  --rail-fg: #c9d0de;
  --rail-muted: #7f899d;
  --rail-active: #222b40;

  --ok: #0ca30c;      --ok-ink: #17701c;   --ok-bg: #e5f4e5;
  --warn: #fab219;    --warn-ink: #855300; --warn-bg: #fdf3dc;
  --rl: #ec835a;      --rl-ink: #a4441c;   --rl-bg: #fcebe3;
  --err: #d03b3b;     --err-ink: #b02a2a;  --err-bg: #fbe7e7;
  --run: #2a78d6;     --run-ink: #1d5fae;  --run-bg: #e3eefb;
  --idle: #8a93a6;    --idle-ink: #586174; --idle-bg: #edf0f4;

  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;

  --x-tag: #2f3cb8; --x-attr: #9a4a00; --x-val: #17701c; --x-com: #7a8396;

  --font-display: "Barlow Semi Condensed", "Arial Narrow", "Segoe UI", system-ui, sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --r-sm: 5px;
  --r: 8px;
  --shadow: 0 1px 2px rgba(17, 23, 35, .06), 0 4px 16px rgba(17, 23, 35, .06);
  --shadow-lg: 0 10px 40px rgba(17, 23, 35, .22);
  --rail-w: 236px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1018; --surface: #141a24; --surface-2: #19202c; --surface-3: #212938;
    --line: #262f40; --line-strong: #364056; --fg: #e7ebf3; --fg-2: #aab3c6; --muted: #7d879b;
    --accent: #8390ff; --accent-ink: #a5aeff; --accent-bg: #23295a; --on-accent: #0c1018;
    --rail: #090c12; --rail-fg: #c9d0de; --rail-muted: #6f798d; --rail-active: #1a2132;
    --ok-ink: #5ccf5c; --ok-bg: rgba(12, 163, 12, .16);
    --warn-ink: #f6c453; --warn-bg: rgba(250, 178, 25, .14);
    --rl-ink: #f2a582; --rl-bg: rgba(236, 131, 90, .16);
    --err-ink: #f08080; --err-bg: rgba(208, 59, 59, .18);
    --run: #3987e5; --run-ink: #84b4f0; --run-bg: rgba(57, 135, 229, .18);
    --idle-ink: #a2abbd; --idle-bg: rgba(138, 147, 166, .14);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --x-tag: #a5aeff; --x-attr: #f2b56b; --x-val: #7fd67f; --x-com: #7d879b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1018; --surface: #141a24; --surface-2: #19202c; --surface-3: #212938;
  --line: #262f40; --line-strong: #364056; --fg: #e7ebf3; --fg-2: #aab3c6; --muted: #7d879b;
  --accent: #8390ff; --accent-ink: #a5aeff; --accent-bg: #23295a; --on-accent: #0c1018;
  --rail: #090c12; --rail-fg: #c9d0de; --rail-muted: #6f798d; --rail-active: #1a2132;
  --ok-ink: #5ccf5c; --ok-bg: rgba(12, 163, 12, .16);
  --warn-ink: #f6c453; --warn-bg: rgba(250, 178, 25, .14);
  --rl-ink: #f2a582; --rl-bg: rgba(236, 131, 90, .16);
  --err-ink: #f08080; --err-bg: rgba(208, 59, 59, .18);
  --run: #3987e5; --run-ink: #84b4f0; --run-bg: rgba(57, 135, 229, .18);
  --idle-ink: #a2abbd; --idle-bg: rgba(138, 147, 166, .14);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --x-tag: #a5aeff; --x-attr: #f2b56b; --x-val: #7fd67f; --x-com: #7d879b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
table, input, select, textarea, button { font: inherit; color: inherit; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.fg2 { color: var(--fg-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 4px; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.s16 { gap: 16px; }
.stack.s6 { gap: 6px; }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 15px; height: 15px; }
.ic.xs { width: 13px; height: 13px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100%; }
.rail {
  background: var(--rail); color: var(--rail-fg);
  position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 14px 10px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand-mark { width: 32px; height: 32px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; color: #fff; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: .01em; color: #fff; line-height: 1.05; }
.brand-sub { font-size: 11px; color: var(--rail-muted); letter-spacing: .04em; }
.nav-group { margin-top: 10px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--rail-muted); padding: 6px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px;
  color: var(--rail-fg); text-decoration: none; font-size: 13.5px; position: relative;
}
.nav a:hover { background: var(--rail-active); }
.nav a.active { background: var(--rail-active); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav a .cnt { margin-left: auto; font-size: 11px; font-variant-numeric: tabular-nums; padding: 0 6px; border-radius: 9px; background: rgba(255,255,255,.08); color: var(--rail-fg); }
.nav a .cnt.bad { background: rgba(208, 59, 59, .3); color: #ffc9c9; }
.rail-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.07); font-size: 11.5px; color: var(--rail-muted); display: grid; gap: 4px; }
.rail-foot b { color: var(--rail-fg); font-weight: 500; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 8px 20px; min-height: 56px;
}
.menu-btn { display: none; }
.gsearch { position: relative; flex: 0 1 300px; min-width: 140px; }
.gsearch input { width: 100%; padding-left: 32px; }
.gsearch .ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.gsearch-res { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); z-index: 40; max-height: 320px; overflow: auto; }
.gsearch-res button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 7px 10px; border: 0; background: none; text-align: left; cursor: pointer; }
.gsearch-res button:hover { background: var(--surface-2); }
.chips { display: flex; gap: 6px; flex-wrap: nowrap; margin-left: auto; align-items: center; justify-content: flex-end; min-width: 0; overflow: hidden; flex: 1 1 auto; }
.topbar > .iconbtn, .topbar > div:last-child { flex: none; }
.schip {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.schip:hover { border-color: var(--line-strong); }
.schip b { font-weight: 600; }
.iconbtn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); display: inline-grid; place-items: center; cursor: pointer; position: relative; color: var(--fg-2); }
.iconbtn:hover { color: var(--fg); border-color: var(--line-strong); }
.iconbtn .dot { position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--err); color: #fff; font-size: 10.5px; font-weight: 600; display: grid; place-items: center; padding: 0 4px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-bg); color: var(--accent-ink); display: grid; place-items: center; font-weight: 600; font-size: 12.5px; cursor: pointer; border: 0; }

.content { padding-block: 22px 48px; padding-inline: 24px; max-width: 1440px; width: 100%; }
.page-h { display: flex; gap: 12px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.page-h h1 { font-family: var(--font-display); font-weight: 700; font-size: 28px; letter-spacing: .005em; line-height: 1.1; }
.page-h .sub { color: var(--fg-2); margin-top: 4px; max-width: 72ch; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h2, .card-h h3 { font-size: 14px; font-weight: 600; }
.card-h .hint { font-size: 12px; color: var(--muted); }
.card-b { padding: 14px 16px; }
.card-b.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; }
.span2 { grid-column: span 2; }

.kpi { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; position: relative; }
.kpi .lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .val { font-family: var(--font-display); font-weight: 700; font-size: 34px; line-height: 1; }
.kpi .val small { font-size: 16px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.kpi .meta { font-size: 12.5px; color: var(--fg-2); }
.kpi .bar { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: 6px; display: flex; gap: 2px; }
.kpi .bar i { display: block; height: 100%; }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: var(--line-strong); }
.sev { position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; }

.kv { display: grid; grid-template-columns: minmax(110px, auto) minmax(0, 1fr); gap: 7px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- status ---------- */
.st { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px 2px 6px; border-radius: 999px; white-space: nowrap; letter-spacing: .01em; line-height: 1.5; }
.st svg { width: 13px; height: 13px; flex: none; }
.st-ok { background: var(--ok-bg); color: var(--ok-ink); }
.st-warn { background: var(--warn-bg); color: var(--warn-ink); }
.st-rl { background: var(--rl-bg); color: var(--rl-ink); }
.st-err { background: var(--err-bg); color: var(--err-ink); }
.st-run { background: var(--run-bg); color: var(--run-ink); }
.st-idle { background: var(--idle-bg); color: var(--idle-ink); }
.st.plain { background: none; padding: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.rl { background: var(--rl); } .dot.err { background: var(--err); } .dot.run { background: var(--run); } .dot.idle { background: var(--idle); }
.dot.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.code-badge { font-family: var(--font-mono); font-size: 11.5px; padding: 1px 6px; border-radius: 4px; background: var(--surface-3); color: var(--fg-2); white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 7px; border-radius: 4px; background: var(--surface-3); color: var(--fg-2); white-space: nowrap; }
.tag.accent { background: var(--accent-bg); color: var(--accent-ink); }
.strip { display: flex; gap: 2px; }
.strip i { width: 7px; height: 18px; border-radius: 2px; display: block; }
.strip i.ok { background: var(--ok); } .strip i.warn { background: var(--warn); } .strip i.err { background: var(--err); } .strip i.rl { background: var(--rl); } .strip i.idle { background: var(--line-strong); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 7px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--fg); cursor: pointer; font-weight: 500; font-size: 13.5px; white-space: nowrap; line-height: 1.3;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err-ink); border-color: color-mix(in srgb, var(--err) 45%, var(--line)); }
.btn.danger.solid { background: var(--err); color: #fff; border-color: var(--err); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 6px; }
.btn[disabled], .btn.disabled { opacity: .45; cursor: not-allowed; filter: none; }
.input, .select, .textarea {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 7px; padding: 7px 10px; min-width: 0; font-size: 13.5px;
}
.input:focus, .select:focus, .textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; border-color: var(--accent); }
.input.sm, .select.sm { padding: 4px 8px; font-size: 12.5px; }
.textarea { width: 100%; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .flabel { font-size: 12.5px; font-weight: 600; color: var(--fg-2); }
.field .help { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; background: var(--surface); flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 5px 11px; cursor: pointer; font-size: 12.5px; color: var(--fg-2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent-bg); color: var(--accent-ink); font-weight: 600; }
.toggle { position: relative; width: 36px; height: 20px; flex: none; display: inline-block; }
.toggle input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.toggle span { position: absolute; inset: 0; border-radius: 10px; background: var(--line-strong); transition: background .15s; }
.toggle span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(16px); }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.qchips { display: flex; gap: 6px; flex-wrap: wrap; }
.qchip { border: 1px dashed var(--line-strong); background: none; border-radius: 999px; padding: 2px 10px; font-size: 12px; cursor: pointer; color: var(--fg-2); font-family: var(--font-mono); }
.qchip:hover, .qchip.on { border-style: solid; border-color: var(--accent); color: var(--accent-ink); background: var(--accent-bg); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--fg-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs button:hover { color: var(--fg); }
.tabs button.on { color: var(--accent-ink); border-bottom-color: var(--accent); }
.tabs .cnt { font-size: 11px; background: var(--surface-3); padding: 0 6px; border-radius: 8px; color: var(--fg-2); }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--fg); }
.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr.sel td { background: var(--accent-bg); }
.tbl tr.click { cursor: pointer; }
.tbl td.actions { white-space: nowrap; text-align: right; }
.tbl .num { text-align: right; }
.logo { width: 30px; height: 22px; border-radius: 4px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 11px; color: #fff; letter-spacing: .02em; flex: none; }
.chcell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chcell b { font-weight: 600; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; font-size: 12.5px; color: var(--fg-2); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.bulkbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 14px; background: var(--accent-bg); color: var(--accent-ink); border-bottom: 1px solid var(--line); font-size: 13px; }

/* ---------- logs / code ---------- */
.log { font-family: var(--font-mono); font-size: 12px; line-height: 1.6; background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; overflow: auto; max-height: 420px; white-space: pre; }
.log.tall { max-height: 560px; }
.log .l { display: block; padding: 0 4px; border-radius: 3px; }
.log .l:hover { background: var(--surface-3); }
.log .t { color: var(--muted); }
.lv-info { color: var(--fg-2); }
.lv-debug { color: var(--muted); }
.lv-warn { color: var(--warn-ink); }
.lv-err { color: var(--err-ink); }
.lv-crit { color: #fff; background: var(--err); padding: 0 3px; border-radius: 2px; }
.lv-ok { color: var(--ok-ink); }
.log mark, .tbl mark { background: color-mix(in srgb, var(--warn) 45%, transparent); color: inherit; border-radius: 2px; }
.secret { background: var(--surface-3); color: var(--muted); border-radius: 3px; padding: 0 3px; }
.xml { font-family: var(--font-mono); font-size: 12px; line-height: 1.6; white-space: pre; overflow: auto; background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; max-height: 520px; }
.xml .tg { color: var(--x-tag); } .xml .at { color: var(--x-attr); } .xml .av { color: var(--x-val); } .xml .cm { color: var(--x-com); font-style: italic; }
.editor { position: relative; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface-2); height: 520px; overflow: hidden; display: grid; grid-template-columns: 52px minmax(0, 1fr); }
.editor .gutter { font-family: var(--font-mono); font-size: 12px; line-height: 19px; padding: 10px 8px 10px 0; text-align: right; color: var(--muted); background: var(--surface-3); overflow: hidden; user-select: none; white-space: pre; }
.editor .gutter .bad { color: #fff; background: var(--err); border-radius: 3px; padding: 0 3px; }
.editor .layer { position: relative; overflow: hidden; }
.editor pre, .editor textarea {
  position: absolute; inset: 0; margin: 0; padding: 10px 12px; font-family: var(--font-mono); font-size: 12px; line-height: 19px;
  white-space: pre; overflow: auto; tab-size: 2; border: 0; background: none; letter-spacing: 0;
}
.editor pre { pointer-events: none; color: var(--fg); }
.editor textarea { color: transparent; caret-color: var(--fg); resize: none; outline: none; }
.editor textarea::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); color: transparent; }
.diff { font-family: var(--font-mono); font-size: 12px; line-height: 1.55; overflow: auto; max-height: 460px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.diff div { white-space: pre; padding: 0 10px; }
.diff .add { background: var(--ok-bg); color: var(--ok-ink); }
.diff .del { background: var(--err-bg); color: var(--err-ink); }
.diff .ctx { color: var(--fg-2); }
.diff .hunk { color: var(--muted); background: var(--surface-3); }

/* ---------- EPG timeline ---------- */
.tl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.tl { position: relative; min-width: 1440px; }
.tl-hours { display: grid; grid-template-columns: repeat(24, 1fr); border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.tl-hours span { padding: 4px 6px; border-left: 1px solid var(--line); }
.tl-row { position: relative; height: 58px; }
.tl-row + .tl-row { border-top: 1px solid var(--line); }
.prog {
  position: absolute; top: 5px; bottom: 5px; border-radius: 5px; padding: 4px 7px; overflow: hidden; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line-strong); font-size: 12px; line-height: 1.3; min-width: 3px;
}
.prog:hover { border-color: var(--accent); z-index: 2; }
.prog b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog span { color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; white-space: nowrap; }
.prog.now { border-color: var(--accent); background: var(--accent-bg); }
.prog.anom { border-color: var(--err); border-style: dashed; }
.prog.cat-sport { box-shadow: inset 3px 0 0 var(--s3); }
.prog.cat-news { box-shadow: inset 3px 0 0 var(--s1); }
.prog.cat-movie { box-shadow: inset 3px 0 0 var(--s2); }
.prog.cat-kids { box-shadow: inset 3px 0 0 var(--s5); }
.prog.cat-doc { box-shadow: inset 3px 0 0 var(--s6); }
.prog.cat-music { box-shadow: inset 3px 0 0 var(--s7); }
.prog.cat-series { box-shadow: inset 3px 0 0 var(--s4); }
.gap { position: absolute; top: 5px; bottom: 5px; border-radius: 5px; border: 1px dashed var(--err); background: repeating-linear-gradient(45deg, transparent 0 5px, color-mix(in srgb, var(--err) 18%, transparent) 5px 7px); display: grid; place-items: center; font-size: 11px; color: var(--err-ink); font-weight: 600; overflow: hidden; }
.nowline { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 3; pointer-events: none; }
.nowline::before { content: "SADA"; position: absolute; top: 2px; left: 4px; font-size: 9.5px; font-weight: 700; color: var(--accent-ink); letter-spacing: .08em; }
.guide { display: grid; grid-template-columns: 190px minmax(0, 1fr); }
.guide-names { border-right: 1px solid var(--line); background: var(--surface); }
.guide-names .gh { height: 25px; border-bottom: 1px solid var(--line); }
.guide-names .gn { height: 58px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-top: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.guide-names .gn:first-of-type { border-top: 0; }
.guide-names .gn:hover { background: var(--surface-2); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--fg-2); align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--line-strong); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover { fill: color-mix(in srgb, var(--fg) 6%, transparent); }
.tip { position: fixed; z-index: 90; pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px; box-shadow: var(--shadow-lg); padding: 8px 10px; font-size: 12px; min-width: 140px; }
.tip b { display: block; margin-bottom: 3px; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; }
.tip .r span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-2); }
.spark { width: 110px; height: 28px; display: block; }
.gauge { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.gauge i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.gauge i.warn { background: var(--warn); } .gauge i.err { background: var(--err); } .gauge i.ok { background: var(--ok); }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--run); border-radius: 3px; transition: width .6s linear; }

/* ---------- steps ---------- */
.steps { display: flex; gap: 0; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); padding: 6px 10px 6px 0; }
.step .b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-strong); font-size: 11px; font-weight: 600; flex: none; }
.step.done { color: var(--fg-2); }
.step.done .b { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.active { color: var(--run-ink); font-weight: 600; }
.step.active .b { border-color: var(--run); color: var(--run-ink); animation: pulse 1.2s infinite; }
.step.fail .b { background: var(--err); border-color: var(--err); color: #fff; }
.step.fail { color: var(--err-ink); }
.step + .step::before { content: ""; width: 14px; height: 1.5px; background: var(--line-strong); margin-right: 3px; }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8, 11, 18, .5); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; border: 1px solid var(--line); }
.modal.lg { width: min(880px, 100%); }
.modal.xl { width: min(1100px, 100%); }
.modal-h { padding: 16px 20px 12px; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; border-bottom: 1px solid var(--line); }
.modal-h h3 { font-family: var(--font-display); font-size: 21px; font-weight: 700; line-height: 1.15; }
.modal-h p { margin: 4px 0 0; color: var(--fg-2); font-size: 13px; }
.modal-b { padding: 16px 20px; overflow: auto; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.drawer-scrim { position: fixed; inset: 0; background: rgba(8, 11, 18, .35); z-index: 55; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); z-index: 56; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.drawer .modal-b { flex: 1; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100% - 32px)); }
.toast { background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow-lg); font-size: 13px; display: flex; gap: 9px; align-items: flex-start; animation: tin .2s ease-out; }
.toast.err { background: var(--err); color: #fff; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.callout { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--surface-2); padding: 10px 14px; border-radius: var(--r-sm); font-size: 13px; color: var(--fg-2); }
.callout.warn { border-left-color: var(--warn); }
.callout.err { border-left-color: var(--err); }
.callout.ok { border-left-color: var(--ok); }
.callout b { color: var(--fg); }
.list { display: flex; flex-direction: column; }
.list > .li { display: flex; gap: 10px; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.list > .li:last-child { border-bottom: 0; }
.list > .li.click { cursor: pointer; }
.list > .li.click:hover { background: var(--surface-2); }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.hr { height: 1px; background: var(--line); margin: 4px 0; }
.demo-banner { font-size: 11.5px; padding: 4px 20px; background: var(--accent-bg); color: var(--accent-ink); border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-lg); min-width: 220px; z-index: 45; padding: 6px; }
.menu button { display: flex; gap: 8px; align-items: center; width: 100%; border: 0; background: none; padding: 7px 10px; border-radius: 6px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--surface-2); }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.thumb { aspect-ratio: 16 / 9; max-width: 100%; border-radius: 6px; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 8px; color: #fff; }
.thumb span { font-size: 12px; font-weight: 600; line-height: 1.25; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.thumb small { font-size: 10.5px; opacity: .8; font-family: var(--font-mono); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 500px at 20% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%), var(--bg); }
.login .card { width: min(400px, 100%); padding: 26px; display: flex; flex-direction: column; gap: 14px; }

@media (max-width: 1320px) { .chips .schip.opt { display: none; } }
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; left: 0; top: 0; bottom: 0; z-index: 70; transform: translateX(-100%); transition: transform .2s; width: var(--rail-w); height: auto; }
  .app.nav-open .rail { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-grid; }
  .g-main, .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .content { padding-inline: 16px; }
  .topbar { padding-inline: 16px; }
}
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; }
  .topbar > .gsearch { flex: 1 1 100%; order: 5; }
}
@media (max-width: 560px) {
  .g4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-h h1 { font-size: 24px; }
  .btn { white-space: normal; max-width: 100%; }
  .guide { grid-template-columns: 120px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* slike emisija (preko naÅ¡eg servera) */
.pimg { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--r-sm, 8px); margin-bottom: 14px; background: var(--surface-2); }
.pthumb { display: block; width: 64px; height: 36px; object-fit: cover; border-radius: 4px; background: var(--surface-2); }
.thumb.click { cursor: pointer; }
.gthumb { float: left; height: calc(100% - 2px); aspect-ratio: 16 / 9; object-fit: cover; border-radius: 3px; margin: 1px 6px 1px 0; background: var(--surface-3); }
.tipp { max-width: 280px; display: grid; gap: 4px; }
.tipp img { width: 100%; max-height: 150px; object-fit: cover; border-radius: 6px; display: block; margin-bottom: 2px; }
.tipp b { font-size: 13px; }
.tipp div { font-size: 12px; line-height: 1.35; }

/* EPG Planet logo */
.brand-logo { width: 38px; height: 38px; flex: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.wm { font-family: var(--font-display); font-weight: 800; letter-spacing: .005em; white-space: nowrap; }
.wm b { font-weight: 800; color: inherit; }
.wm i { font-style: normal; background: linear-gradient(90deg, #1e88e5, #2fc3ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-brand { display: grid; justify-items: center; gap: 4px; text-align: center; margin-bottom: 6px; }
.login-brand img { width: 96px; height: 96px; filter: drop-shadow(0 6px 18px rgba(21, 101, 224, .35)); }
.login-wm { font-size: 32px; line-height: 1.05; color: var(--fg); }
.logo.img { background: #fff; padding: 2px 3px; border: 1px solid var(--line); width: 44px; height: 28px; }
.logo.img.on-dark { background: #16213a; border-color: #16213a; }
.logo.img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; max-height: 360px; overflow: auto; }
.logo-pick button { display: grid; gap: 4px; justify-items: center; padding: 8px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 11px; color: var(--fg-2); }
.logo-pick button:hover { border-color: var(--accent); }
.logo-pick img { width: 96px; height: 54px; object-fit: contain; background: linear-gradient(135deg, #16213a 50%, #f4f6fa 50%); border-radius: 4px; padding: 3px; }
