:root { --bg: #0b1220; --card: #141d2e; --card2: #1c2840; --line: #2a3853; --text: #f4f7fb; --muted: #a9b6ca; --accent: #38bdf8; --danger: #f87171; --ok: #4ade80; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
html { background: #0b1220; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 4px; }
p { margin: 0 0 12px; }
a { color: var(--accent); }

.top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: #0f1727; border-bottom: 1px solid var(--line); }
.top-title b { font-size: 17px; }
.top-title span { margin-left: 10px; color: var(--muted); }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.status { color: var(--muted); font-size: 14px; }
.status.warn { color: #fbbf24; }
.status.bad { color: var(--danger); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card2); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: #4a5e84; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06121f; }
.btn.danger { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: 14px; }
.btn:disabled { opacity: 0.45; cursor: default; }

.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 16px 0; border-bottom: 1px solid var(--line); }
.tabs button { flex: none; padding: 10px 14px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

.work { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; padding: 20px 16px 60px; max-width: 1280px; margin: 0 auto; }
.panel { flex: 999 1 460px; min-width: 0; }
.preview { flex: 1 1 300px; max-width: 420px; position: sticky; top: 84px; }
.section { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.section > p { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.field { display: block; margin-bottom: 12px; }
.label { display: block; margin-bottom: 5px; font-size: 14px; font-weight: 600; color: var(--muted); }
.hint { display: block; margin-top: 5px; font-size: 13px; color: var(--muted); }
input, select, textarea { width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: #0b1220; color: var(--text); font: inherit; }
input[type="color"] { padding: 3px; }
textarea { resize: vertical; }
.item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; background: var(--card2); }
.item-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.item-bar b { font-size: 14px; color: var(--muted); }
.item-tools { display: flex; gap: 6px; }
.img-row { display: flex; gap: 10px; align-items: center; }
.img-row img { flex: none; width: 72px; height: 48px; object-fit: cover; border-radius: 6px; background: #0b1220; border: 1px solid var(--line); }
.img-row input[type="text"] { flex: 1; min-width: 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: #64748b; }
.dot.on { background: var(--ok); }
.url { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; color: var(--muted); }
.error { color: var(--danger); min-height: 1.4em; }
.alert-box { border-color: #7f1d1d; }
.alert-on { color: #fca5a5; font-weight: 700; }

.login { max-width: 340px; margin: 12vh auto 0; padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.login .btn { width: 100%; }

/* TV frames, shared with the wall preview */
.bezel { position: relative; width: 100%; background: #000; border: 8px solid #18181b; border-radius: 10px; box-shadow: 0 0 0 2px #27272a, 0 16px 30px -10px rgba(0, 0, 0, 0.8); overflow: hidden; aspect-ratio: 16 / 9; }
.bezel.portrait, .tv.portrait .bezel { aspect-ratio: 9 / 16; }
.bezel iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; pointer-events: none; }
.bezel-link { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.bezel-link:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

.wall { background: radial-gradient(circle at 50% 20%, #1e293b 0%, #0f172a 70%, #020617 100%) fixed; }
.wall-grid { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 28px; padding: 28px 16px 60px; max-width: 1280px; margin: 0 auto; }
.tv { width: 100%; }
.tv.portrait { max-width: 340px; }
.tv.landscape { max-width: 1100px; }
.tv-label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 14px; }
.tv-label span { color: var(--muted); }
.wall-empty { color: var(--muted); }
