[hidden] { display: none !important; }
:root {
  --bg: #f4f6f9; --card: #fff; --text: #1d2433; --muted: #5f6b7d; --line: #e2e7ee;
  --accent: #1f6feb; --accent-ink: #fff; --ok: #1a7f37; --ok-bg: #e6f4ea; --bad: #c62828; --bad-bg: #fdecea;
  --warn: #9a6700; --warn-bg: #fff4d6; --side: #14213d; --side-ink: #dfe6f3;
  --radius: 14px; --shadow: 0 1px 2px rgba(20,33,61,.06), 0 4px 16px rgba(20,33,61,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
h1 { font-size: 1.7rem; margin: 0 0 .3rem; }
h2 { font-size: 1.2rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.side { width: 250px; background: var(--side); color: var(--side-ink); padding: 22px 14px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; }
.side .logo { font-weight: 700; font-size: 1.1rem; padding: 0 10px 18px; color: #fff; }
.side .logo small { display: block; font-weight: 400; font-size: .8rem; opacity: .7; }
.side a, .side button.link { display: flex; align-items: center; gap: 10px; color: var(--side-ink); text-decoration: none; padding: 11px 12px; border-radius: 10px; font-size: 1rem; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; font-family: inherit; }
.side a:hover, .side button.link:hover { background: rgba(255,255,255,.08); }
.side a.active { background: rgba(255,255,255,.15); color: #fff; font-weight: 600; }
.side .ico { width: 22px; text-align: center; font-size: 1.1rem; }
.side .spacer { flex: 1; }
.side .who { font-size: .85rem; opacity: .75; padding: 8px 12px; }
.main { flex: 1; padding: 28px 32px 60px; max-width: 1200px; min-width: 0; }
.topbar { display: none; }

.banner { background: var(--warn-bg); color: var(--warn); padding: 10px 16px; border-radius: 10px; margin-bottom: 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--bad-bg); color: var(--bad); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }

/* Kort */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px; }
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.stat .label { color: var(--muted); font-size: .9rem; }
.stat .value { font-size: 2rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: .85rem; }
.stat.big .value { font-size: 3rem; color: var(--accent); }
.help { color: var(--muted); font-size: .9rem; margin-top: -4px; margin-bottom: 14px; }

/* Status */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.pill.on { background: var(--ok-bg); color: var(--ok); }
.pill.off { background: var(--bad-bg); color: var(--bad); }
.pill.grey { background: #eef1f5; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.on .dot { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* Spilles nå */
.np { display: flex; gap: 18px; align-items: center; }
.np img, .np .noart { width: 96px; height: 96px; border-radius: 10px; object-fit: cover; background: #e9edf3; flex-shrink: 0; }
.np .noart { display: flex; align-items: center; justify-content: center; font-size: 2.2rem; color: #9aa6b8; }
.np .artist { font-size: 1.15rem; font-weight: 700; }
.np .title { font-size: 1.05rem; }

/* Tabeller */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.songs td { padding: 7px 10px; }
.songs img { width: 36px; height: 36px; border-radius: 5px; object-fit: cover; vertical-align: middle; background: #e9edf3; }

.bar { height: 8px; background: #edf1f6; border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* Skjema */
label { display: block; font-weight: 600; margin-bottom: 5px; }
label .opt { font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=url], textarea, select {
  width: 100%; padding: 11px 13px; font: inherit; border: 1.5px solid #cfd6e0; border-radius: 10px; background: #fff; color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,111,235,.15); }
input[type=color] { width: 70px; height: 44px; border: 1.5px solid #cfd6e0; border-radius: 10px; padding: 3px; background: #fff; }
.field { margin-bottom: 18px; }
.field .hint { color: var(--muted); font-size: .88rem; margin-top: 5px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-bottom: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1; min-width: 180px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: #e8eef8; color: var(--accent); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.ghost { background: none; color: var(--accent); padding: 8px 10px; }
.btn.small { padding: 7px 13px; font-size: .9rem; }
.btn.big { padding: 15px 28px; font-size: 1.1rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Kopierbare felt */
.copy { display: flex; gap: 8px; align-items: center; }
.copy code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #f1f4f8; padding: 8px 12px; border-radius: 8px; font-size: .95rem; flex: 1; overflow-x: auto; white-space: nowrap; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; align-items: center; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; min-width: 0; }

.secret-box { background: var(--ok-bg); border: 2px dashed var(--ok); border-radius: 12px; padding: 18px; margin-bottom: 20px; }
.secret-box.warn { background: var(--warn-bg); border-color: var(--warn); }

.tabs { display: inline-flex; background: #e9eef5; border-radius: 10px; padding: 4px; gap: 2px; }
.tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font: inherit; cursor: pointer; color: var(--muted); font-weight: 600; }
.tabs button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.station-list .card { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 18px 22px; margin-bottom: 12px; }
.station-list .name { font-weight: 700; font-size: 1.1rem; }
.station-list .grow { flex: 1; min-width: 200px; }
.station-list .count { font-size: 1.6rem; font-weight: 700; min-width: 80px; text-align: right; font-variant-numeric: tabular-nums; }

details.more summary { cursor: pointer; color: var(--accent); font-weight: 600; margin: 6px 0; }

/* Innlogging */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg, #14213d, #1f3a6e); }
.login { width: 100%; max-width: 400px; }
.login .card { padding: 32px; }
.login h1 { text-align: center; }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .side { width: 100%; flex-direction: row; flex-wrap: wrap; padding: 10px; gap: 2px; }
  .side .logo { width: 100%; padding: 6px 10px; }
  .side a, .side button.link { width: auto; padding: 8px 10px; font-size: .92rem; }
  .side .spacer, .side .who { display: none; }
  .main { padding: 18px 16px 50px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }
  .stat.big .value { font-size: 2.4rem; }
}

/* Strømtabell i adminpanelet: to linjer per strøm */
table.streams tbody tr:first-child td { border-bottom: 0; padding-bottom: 4px; }
table.streams tbody tr.sub td { padding-top: 4px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
table.streams tbody:last-of-type tr.sub td { border-bottom: 0; }

.flag { width: 1.33em; height: 1em; border-radius: 2px; vertical-align: -0.12em; margin-right: 8px; object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
/* Valg av mating (ordinær eller masterstrøm) */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 400; }
.choice input { width: 18px; height: 18px; margin-top: 3px; flex-shrink: 0; }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,111,235,.12); }
