/* Control panel and sign-in page: dark, responsive (3 columns → 2 under 1200 px → 1 under 760 px). */
:root {
  --bg: #08080c; --card: #111118; --card2: #17171f; --line: rgba(255, 255, 255, .07); --line2: rgba(255, 255, 255, .12);
  --text: #f5f5f7; --muted: #8e8e9c;
  --gold: #ffb800; --orange: #ff6a00; --brand: linear-gradient(135deg, #ffc93c, #ff8a00 55%, #ff5a00);
  --ok: #22c55e; --bad: #ef4444; --warn: #f59e0b; --info: #60a5fa;
  --font: "Inter", "Noto Sans Ethiopic", "Nyala", "Abyssinica SIL", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
body { background: radial-gradient(1200px 600px at 10% -10%, rgba(255, 138, 0, .10), transparent 60%), radial-gradient(900px 500px at 110% 0, rgba(124, 58, 237, .10), transparent 60%), var(--bg); min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line2); background: var(--card2); border-radius: 10px; padding: 8px 13px; font-weight: 600; transition: border-color .15s, background .15s, transform .05s; }
button:hover { border-color: rgba(255, 255, 255, .22); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--brand); color: #111; border: 0; }
button.ghost { background: transparent; }
button.danger { border-color: rgba(239, 68, 68, .45); color: #fca5a5; }
input, select, textarea { background: #0c0c12; border: 1px solid var(--line2); border-radius: 10px; padding: 9px 11px; width: 100%; min-width: 0; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: rgba(255, 184, 0, .6); box-shadow: 0 0 0 3px rgba(255, 184, 0, .15); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; color: var(--muted); font-size: 12px; font-weight: 600; margin: 12px 0 6px; }
label > input { margin-top: 6px; color: var(--text); font-size: 14px; }
.hint { font-weight: 500; opacity: .75; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- sign-in ---------- */
body.login { display: grid; place-items: center; padding: 16px; }
.box { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.box h1 { margin: 0 0 4px; font-size: 22px; }
.box h1 span { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.box button { width: 100%; margin-top: 18px; padding: 11px; }
.err { color: #fca5a5; min-height: 1.4em; margin: 10px 0 0; }

/* ---------- app bar ---------- */
.appbar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 18px; background: rgba(8, 8, 12, .8); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.brand b { font-weight: 800; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #111; display: grid; place-items: center; font-weight: 900; box-shadow: 0 6px 18px rgba(255, 106, 0, .35); }
.env { padding: 3px 9px; border-radius: 7px; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.env.dev { background: rgba(245, 158, 11, .15); color: #fcd34d; border: 1px solid rgba(245, 158, 11, .4); }
.env.prod { background: rgba(239, 68, 68, .15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .45); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line2); font-size: 12px; color: var(--muted); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #55555f; }
.chip.ok { color: #bbf7d0; border-color: rgba(34, 197, 94, .35); background: rgba(34, 197, 94, .08); }
.chip.ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.chip.warn { color: #fde68a; border-color: rgba(245, 158, 11, .35); background: rgba(245, 158, 11, .08); }
.chip.warn::before { background: var(--warn); }
.chip.bad { color: #fecaca; border-color: rgba(239, 68, 68, .4); background: rgba(239, 68, 68, .08); }
.chip.bad::before { background: var(--bad); }
.chip.live { color: #fff; border-color: transparent; background: var(--bad); font-weight: 700; }
.chip.live::before { background: #fff; animation: blink 1.2s infinite; }
.spacer { flex: 1; }
.user { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #7c3aed); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
@keyframes blink { 50% { opacity: .3; } }

/* ---------- layout ---------- */
main { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(340px, 1.2fr) minmax(320px, 1fr); gap: 16px; padding: 16px 18px 48px; max-width: 1680px; margin: 0 auto; }
@media (max-width: 1199px) { main { grid-template-columns: 1fr 1fr; } }
@media (max-width: 759px) { main { grid-template-columns: 1fr; padding: 12px 16px 40px; } .user .who, .chips #obsPill { display: none; } }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 40%), var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.card h2 { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: .02em; color: #d4d4dc; display: flex; align-items: center; gap: 8px; }
.card h2 > .ic { color: var(--gold); }
.card h2 > :last-child:not(.ic) { margin-left: auto; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.row > input { flex: 1; }
.icon-btn { padding: 6px; display: grid; place-items: center; border-radius: 8px; }

/* switches */
.switches { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 420px) { .switches { grid-template-columns: 1fr; } }
.sw { display: flex; align-items: center; gap: 10px; text-align: left; padding: 9px 11px; font-weight: 600; background: #0e0e15; }
.sw .knob { position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px; background: #2a2a35; transition: background .15s; }
.sw .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #9a9aa8; transition: transform .15s, background .15s; }
.sw.on { border-color: rgba(255, 184, 0, .45); background: rgba(255, 184, 0, .07); }
.sw.on .knob { background: var(--brand); }
.sw.on .knob::after { transform: translateX(14px); background: #fff; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: #0c0c12; border: 1px solid var(--line2); gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 10px; border-radius: 7px; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--card2); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 2px 8px rgba(0, 0, 0, .35); }
.seg.small button { padding: 4px 8px; font-size: 12px; }
#msgDur + button { margin-left: auto; }

/* ---------- auctions ---------- */
.auctions { display: flex; flex-direction: column; gap: 8px; max-height: 560px; overflow: auto; }
.auc { display: grid; grid-template-columns: 56px 1fr; gap: 3px 12px; text-align: left; padding: 9px; border-radius: 14px; width: 100%; background: #0e0e15; font-weight: 500; }
.auc img, .auc .ph { grid-row: span 3; width: 56px; height: 56px; border-radius: 11px; object-fit: cover; background: #1d1d26; display: grid; place-items: center; font-size: 24px; }
.auc .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auc .m { font-size: 12px; color: var(--muted); }
.auc.air { border-color: rgba(239, 68, 68, .6); background: linear-gradient(90deg, rgba(239, 68, 68, .12), #0e0e15); }
.bar { height: 6px; border-radius: 99px; background: #23232d; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width .4s; }
.bar.tb > i { width: 100% !important; background: repeating-linear-gradient(45deg, rgba(255, 184, 0, .7) 0 8px, rgba(255, 106, 0, .7) 8px 16px); }
.err-box { color: #fca5a5; padding: 10px; border: 1px dashed rgba(239, 68, 68, .5); border-radius: 12px; }

/* ---------- on air ---------- */
.onair { border-color: rgba(239, 68, 68, .25); }
.oa-head { display: flex; gap: 14px; align-items: center; }
.oa-img { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; flex: none; }
.oa-main { min-width: 0; }
.tag-live { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.tag-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
.tag-live.off { background: #2a2a35; color: var(--muted); }
.tag-live.off::before { animation: none; background: var(--muted); }
.oa-title { font-size: 19px; font-weight: 800; margin-top: 4px; line-height: 1.2; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 10px; }
@media (max-width: 420px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { background: #0c0c12; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.tile b { display: block; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile span { font-size: 11px; color: var(--muted); }
.warn { margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(245, 158, 11, .1); color: #fde68a; font-size: 12px; }

/* ---------- log ---------- */
.log { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; font-size: 12px; }
.log li { padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, .04); display: flex; gap: 10px; }
.log time { color: #6b6b78; flex: none; font-variant-numeric: tabular-nums; }
.log .k-error { color: #fca5a5; }
.log .k-winner, .log .k-finalized, .log .k-welcome { color: #bbf7d0; }
.log .k-closed, .log .k-obs { color: #fde68a; }
.log .k-bid { color: #fdba74; }

/* ---------- script & presets ---------- */
.lines { display: flex; flex-direction: column; gap: 6px; }
.lines button { text-align: left; white-space: pre-line; font-size: 13px; font-weight: 500; background: #0e0e15; }
.chips-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chips-list button { white-space: pre-line; text-align: left; font-size: 12px; font-weight: 500; padding: 6px 10px; border-radius: 10px; background: #0e0e15; }

/* ---------- preview ---------- */
.pv { position: relative; width: 100%; max-width: 340px; aspect-ratio: 9 / 16; margin: 12px auto 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line2); background: repeating-conic-gradient(#1a1a22 0 25%, #14141b 0 50%) 0 0 / 22px 22px; }
.pv.landscape { max-width: 100%; aspect-ratio: 16 / 9; }
.pv iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; background: transparent; }

/* ---------- OBS ---------- */
.obs-status { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #0c0c12; border: 1px solid var(--line); font-weight: 600; }
.obs-status.live { border-color: rgba(239, 68, 68, .5); background: rgba(239, 68, 68, .08); }
.obs-status.err { color: #fca5a5; }
.scenes { display: flex; flex-wrap: wrap; gap: 6px; }
.scenes button { font-size: 12px; padding: 6px 10px; background: #0e0e15; }
.scenes button.on { border-color: var(--bad); background: rgba(239, 68, 68, .14); color: #fff; }
.url { display: flex; gap: 6px; }
.url input { font-size: 12px; color: var(--muted); }
details { margin-top: 10px; color: var(--muted); }
summary { cursor: pointer; font-weight: 600; color: #c8c8d2; }
details ol { padding-left: 20px; margin: 8px 0 0; }
details li { margin-bottom: 5px; }
code { background: #0c0c12; padding: 1px 5px; border-radius: 6px; font-size: 12px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.box .brand { margin-bottom: 14px; justify-content: space-between; }
