:root {
  --brand: #1769e0; --brand-2: #0f56c0; --brand-soft: #e8f0fd;
  --bg: #f4f6f9; --surface: #fff; --text: #17202c; --muted: #66707e; --line: #e3e7ed; --line-2: #eef1f5;
  --green: #1f9d55; --green-soft: #e3f5ea; --orange: #e8822a; --orange-soft: #fdf0e3; --red: #d64545; --grey: #a3abb6;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
}
@media (prefers-color-scheme: dark) {
  :root { --brand: #4d8ff0; --brand-2: #6aa2f3; --brand-soft: #1a2a44; --bg: #0f1318; --surface: #171c23; --text: #e8ecf1; --muted: #98a2b0;
    --line: #262d37; --line-2: #1e242c; --green-soft: #15301f; --orange-soft: #352515; --shadow: none; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ---------- Topp ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; height: 60px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; color: #fff; }
.nav { display: flex; gap: 2px; height: 100%; overflow-x: auto; }
.nav button { border: 0; background: none; padding: 0 14px; height: 100%; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav button:hover { color: var(--text); }
.nav button.on { color: var(--brand); border-bottom-color: var(--brand); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tenant-pick { max-width: 220px; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 12px; }

/* ---------- Innhold ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 24px; }
.crumbs { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.crumb { display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; font-weight: 700; color: var(--muted); }
.crumb b { color: var(--text); }
.online-pill { display: inline-flex; align-items: center; border-radius: 6px; overflow: hidden; font-size: 12px; font-weight: 700; letter-spacing: .04em; cursor: pointer; border: 0; padding: 0; background: none; }
.online-pill span { padding: 5px 10px; }
.online-pill .l { background: var(--green); color: #fff; }
.online-pill .r { background: var(--green-soft); color: var(--green); }
.online-pill.warn .l { background: var(--orange); }
.online-pill.warn .r { background: var(--orange-soft); color: var(--orange); }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.search { position: relative; }
.search input[type=text] { padding-left: 36px; width: 240px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* ---------- Skjemaelementer ---------- */
input[type=text], input[type=password], input[type=email], input[type=url], input[type=number], input[type=datetime-local], input[type=time], select, textarea {
  height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; max-width: 100%;
}
textarea { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=color] { width: 46px; height: 38px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap; text-decoration: none; color: var(--text); }
.btn:hover { border-color: #c9d0da; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--red); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--line-2); color: var(--text); }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(16,24,40,.14); padding: 6px; z-index: 30; }
.menu-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; }
.menu-list button:hover { background: var(--line-2); }

/* ---------- Kort / liste ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; background: var(--line-2); border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.row { display: grid; grid-template-columns: 40px 84px 1fr auto 40px auto; align-items: center; gap: 14px; padding: 10px 14px 10px 10px; border-bottom: 1px solid var(--line-2); background: var(--surface); }
.row:last-child { border-bottom: 0; }
.row:hover { background: color-mix(in srgb, var(--brand-soft) 35%, var(--surface)); }
.row.dragging { opacity: .4; }
.row.drop-above { box-shadow: inset 0 2px 0 var(--brand); }
.row.drop-below { box-shadow: inset 0 -2px 0 var(--brand); }
.row.is-off .thumb, .row.is-off .row-title { opacity: .5; }
.grip { color: #b5bdc8; cursor: grab; display: grid; place-items: center; height: 40px; }
.thumb { width: 84px; height: 52px; border-radius: 6px; overflow: hidden; background: #1d232b; display: grid; place-items: center; color: #fff; border: 1px solid var(--line); }
.thumb.port { width: 52px; justify-self: center; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.text { font-weight: 800; font-size: 18px; }
.thumb.cal { background: var(--brand-soft); color: var(--brand); }
.row-main { min-width: 0; }
.row-title { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-title .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-top: 2px; flex-wrap: wrap; }
.row-meta svg { color: var(--brand); flex-shrink: 0; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 2px 7px; border-radius: 99px; background: var(--line-2); color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.badge.blue { background: var(--brand-soft); color: var(--brand); }
.dur { height: 32px; padding: 0 8px; border-color: transparent; background: transparent; color: var(--muted); cursor: pointer; }
.dur:hover { border-color: var(--line); }
.ring { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; border: 2px solid var(--grey); color: var(--grey); justify-self: center; cursor: default; }
.ring { background: none; padding: 0; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; transition: transform .1s; }
.ring:hover { transform: scale(1.12); }
.on-screens { color: var(--brand); font-weight: 600; }
.row-meta svg.inline { color: inherit; }
.screens-pop { position: absolute; right: auto; top: 0; width: 260px; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; }
.screens-pop .pop-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.screens-pop .check { padding: 6px 4px; border-radius: 6px; }
.screens-pop .check:hover { background: var(--line-2); }
.screens-pop .check.dim { opacity: .55; }
.ring.active { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.ring.scheduled { border-color: var(--orange); color: var(--orange); background: var(--orange-soft); }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); margin: 0 0 6px; }

/* ---------- Opplasting ---------- */
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; background: var(--surface); flex-wrap: wrap; }
.dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .dz-text { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.dropzone .dz-text b { color: var(--text); }
.dz-opts { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.progress { height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; margin: -8px 0 16px; }
.progress div { height: 100%; background: var(--brand); width: 0; transition: width .2s; }

/* ---------- Skjermer ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.screen-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.screen-top { display: flex; align-items: flex-start; gap: 12px; }
.screen-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--line-2); display: grid; place-items: center; color: var(--muted); flex-shrink: 0; }
.screen-name { font-weight: 700; font-size: 16px; }
.screen-sub { color: var(--muted); font-size: 13px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--grey); }
.status.on { color: var(--green); }
.status.on::before { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.status.off { color: var(--muted); }
.url-box { display: flex; align-items: center; gap: 6px; background: var(--line-2); border-radius: 8px; padding: 4px 4px 4px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.url-box span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.now-playing { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; background: var(--line-2); }
.now-playing .thumb { width: 64px; height: 40px; }
.now-playing .thumb.port { width: 32px; }
.np-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--green); white-space: nowrap; }
.np-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.thumb.is-video { position: relative; }
.thumb.is-video::after { content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-40%, -50%); border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent rgba(255,255,255,.9); filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.settings-card { padding: 22px; display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; max-width: 820px; }
.settings-card h3 { margin: 0; font-size: 16px; }
.settings-card p { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: var(--line-2); padding: 1px 5px; border-radius: 4px; }

/* ---------- Spillelister, godkjenning, tidsplan ---------- */
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.notice { background: var(--orange-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--orange) 35%, transparent); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.pl-section { margin-bottom: 16px; }
.pl-tools { display: inline-flex; align-items: center; gap: 4px; }
.pl-tools > span { margin-right: 6px; }
.icon-btn.sm { width: 26px; height: 26px; font-size: 14px; font-weight: 700; }
.icon-btn:disabled { opacity: .3; cursor: default; }
.empty-row { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.rows { min-height: 48px; }
.rows.drop-into { box-shadow: inset 0 0 0 2px var(--brand); background: var(--brand-soft); }
.row-actions { display: inline-flex; gap: 6px; }
.thumb { position: relative; }
.thumb.icon { background: var(--brand-soft); color: var(--brand); }
.thumb.t-youtube, .thumb.t-weather { background: var(--line-2); }
.thumb-tag { position: absolute; right: 3px; bottom: 3px; background: rgba(0,0,0,.65); color: #fff; font-size: 10px; padding: 1px 4px; border-radius: 4px; }
.plan-wrap { overflow-x: auto; }
table.plan { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 900px; }
.plan th, .plan td { padding: 6px; border-bottom: 1px solid var(--line-2); text-align: center; white-space: nowrap; }
.plan thead th { font-size: 11px; text-transform: none; letter-spacing: 0; }
.plan th.plan-name { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 230px; max-width: 280px; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--text); }
.plan thead th.plan-name { background: var(--line-2); color: var(--muted); }
.plan th.plan-name span { overflow: hidden; text-overflow: ellipsis; }
.plan .thumb { width: 44px; height: 28px; flex-shrink: 0; }
.plan .thumb.port { width: 22px; }
.plan .thumb svg { width: 16px; height: 16px; }
.plan td { min-width: 52px; }
.plan td.on { background: color-mix(in srgb, var(--green) 38%, transparent); box-shadow: inset 0 0 0 1px var(--surface); }
.plan td.on small { font-size: 10px; color: var(--text); opacity: .8; }
.plan .wknd { background-color: color-mix(in srgb, var(--line-2) 70%, transparent); }
.plan td.on.wknd { background: color-mix(in srgb, var(--green) 44%, transparent); }
.plan .today { box-shadow: inset 2px 0 0 var(--brand), inset -2px 0 0 var(--brand); }
.plan thead .today { color: var(--brand); font-weight: 800; }
.plan tr[data-id] { cursor: pointer; }
.plan tr[data-id]:hover th.plan-name { color: var(--brand); }
.plan-group td { text-align: left !important; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--line-2); position: sticky; left: 0; }

/* ---------- Nødmelding ---------- */
.alert-btn { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); color: var(--red); }
.alert-btn.on { background: var(--red); border-color: var(--red); color: #fff; animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .65; } }
.alert-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-radius: 10px; background: var(--red); color: #fff; margin-bottom: 16px; }
.alert-banner.warning { background: var(--orange); color: #1d1305; }
.alert-banner.info { background: var(--brand); }
.alert-banner .grow { flex: 1; }
.alert-banner .btn { background: rgba(255,255,255,.15); color: inherit; border-color: rgba(255,255,255,.35); }

/* ---------- Plakat-bilde og vær-sted ---------- */
.img-pick { display: flex; align-items: center; gap: 14px; }
.img-prev { width: 160px; height: 90px; border-radius: 8px; background: var(--line-2); display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: 12px; border: 1px solid var(--line); flex-shrink: 0; }
.img-prev img { width: 100%; height: 100%; object-fit: cover; }
.sub-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--line-2); }
.wx-pick { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.wx-search { display: flex; gap: 8px; }
.wx-search input { flex: 1; }
.wx-results { display: flex; flex-direction: column; gap: 4px; }
.wx-hit { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.wx-hit:hover { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- Fase 4: merke, grupper, 2FA, statistikk ---------- */
.brand-logo { height: 30px; max-width: 140px; object-fit: contain; }
.auth-card .brand-logo { height: 40px; max-width: 200px; }
.tag { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); border: 1px solid transparent; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag-filter { margin-bottom: 14px; }
.tag-filter .tag { cursor: pointer; font-size: 13px; padding: 5px 12px; background: var(--surface); color: var(--text); border-color: var(--line); }
.tag-filter .tag.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip.group span { border-style: dashed; }
.chip.group input:checked + span { border-style: solid; }
.pop-sub { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 8px 4px 2px; }
.code-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 22px !important; letter-spacing: .3em; text-align: center; height: 52px !important; }
.qr-wrap { display: flex; justify-content: center; }
.qr-svg { width: 200px; height: 200px; border-radius: 10px; }
.recovery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.recovery code { font-size: 15px; padding: 8px; text-align: center; }
.tenant-logo { height: 22px; max-width: 70px; object-fit: contain; vertical-align: middle; margin-right: 8px; }
.logo-prev { background: repeating-conic-gradient(var(--line-2) 0% 25%, var(--surface) 0% 50%) 50% / 14px 14px; }
.logo-prev img { object-fit: contain !important; padding: 8px; }
.chart-card { margin-bottom: 16px; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding: 16px 18px 12px; }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; border-radius: 3px 3px 0 0; }
.bar i { display: block; width: 100%; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 0; opacity: .85; }
.bar:hover i { opacity: 1; }
tr.total td { background: var(--line-2); }

/* ---------- Fase 5: sidepanel, strøm, enhet ---------- */
.w-order { display: flex; flex-direction: column; gap: 4px; }
.w-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.bg-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
input[type=range] { width: 100%; accent-color: var(--brand); }
.power-table { width: auto; }
.power-table td { padding: 4px 8px 4px 0; border: 0; }
.power-table td:first-child { min-width: 80px; font-weight: 600; }
.power-table input[type=time] { height: 32px; }
.power-table input:disabled { opacity: .4; }
.sso-btns { display: flex; flex-direction: column; gap: 8px; }
.sso-btns:empty { display: none; }
.sso-btn { justify-content: center; height: 42px; }
.sso-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin-top: 6px; }
.sso-or::before, .sso-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.ev-box { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 18px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--line-2); }
.ev-group { display: flex; flex-direction: column; gap: 4px; }
.ev-group code { font-size: 11px; color: var(--muted); }
.acc-link { padding: 8px 0; }
.full-row { grid-column: 1 / -1; }
.url-hero { display: flex; gap: 18px; align-items: center; padding: 16px; border-radius: 12px; background: var(--brand-soft); margin-bottom: 4px; }
.url-hero-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.url-hero .label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); }
.url-hero .url-box { background: var(--surface); font-size: 15px; }
.url-hero .hint { margin: 0; }
.url-qr .qr-svg { width: 120px; height: 120px; }
.inst { display: flex; flex-direction: column; gap: 10px; }
.inst p, .inst ol, .inst ul { margin: 0; }
.inst li { margin-bottom: 6px; }
.code-box span { white-space: normal; word-break: break-all; }
.shot-box img { width: 100%; border-radius: 10px; display: block; border: 1px solid var(--line); }
#power-pop { min-width: 240px; }

/* ---------- Plakatbygger ---------- */
.dz-thumb { background: #111; padding: 0 !important; }
.dz-modal-prev { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #111; }
.dz-modal-prev.port { width: 40%; margin: 0 auto; aspect-ratio: 9 / 16; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tpl { border: 2px solid var(--line); border-radius: 12px; background: var(--surface); padding: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; font-weight: 600; text-align: center; }
.tpl:hover { border-color: var(--brand); }
.tpl-prev { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #111; }
.tpl.port .tpl-prev { aspect-ratio: 9 / 16; width: 60%; margin: 0 auto; }
.overlay.dz-overlay { padding: 0; align-items: stretch; overflow: hidden; }
.dz-editor { background: var(--bg); width: 100%; height: 100vh; display: flex; flex-direction: column; }
.dz-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.dz-top .grow { flex: 1; }
.dz-title { width: 280px; }
.dz-main { flex: 1; display: grid; grid-template-columns: 92px 1fr 300px; min-height: 0; }
.dz-tools { background: var(--surface); border-right: 1px solid var(--line); padding: 10px 8px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.dz-tools button { border: 0; background: none; border-radius: 10px; padding: 10px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--text); }
.dz-tools button:hover { background: var(--brand-soft); color: var(--brand); }
.dz-tools .ic { font-size: 18px; line-height: 16px; height: 16px; }
.dz-stage { position: relative; margin: 28px; min-width: 0; min-height: 0; touch-action: none; user-select: none; }
#dz-host { position: absolute; inset: 0; background: transparent !important; }
#dz-host .dz-fill { display: none; }
#dz-host .dz-canvas { box-shadow: 0 10px 40px rgba(0,0,0,.35); }
#dz-host .dz-el { cursor: move; }
#dz-host [contenteditable="true"] { outline: none; cursor: text; user-select: text; }
.dz-sel-layer { position: absolute; pointer-events: none; }
.dz-selbox { position: absolute; outline: 2px solid var(--brand); outline-offset: 1px; pointer-events: auto; cursor: move; }
.dz-selbox.editing { pointer-events: none; outline-style: dashed; }
.dz-h { position: absolute; width: 12px; height: 12px; background: #fff; border: 2px solid var(--brand); border-radius: 3px; pointer-events: auto; }
.dz-h-nw { left: -7px; top: -7px; cursor: nwse-resize; } .dz-h-n { left: calc(50% - 6px); top: -7px; cursor: ns-resize; }
.dz-h-ne { right: -7px; top: -7px; cursor: nesw-resize; } .dz-h-e { right: -7px; top: calc(50% - 6px); cursor: ew-resize; }
.dz-h-se { right: -7px; bottom: -7px; cursor: nwse-resize; } .dz-h-s { left: calc(50% - 6px); bottom: -7px; cursor: ns-resize; }
.dz-h-sw { left: -7px; bottom: -7px; cursor: nesw-resize; } .dz-h-w { left: -7px; top: calc(50% - 6px); cursor: ew-resize; }
.dz-guide { position: absolute; background: #ff3b8d; pointer-events: none; }
.dz-guide.v { left: 50%; top: 0; bottom: 0; width: 1px; }
.dz-guide.h { top: 50%; left: 0; right: 0; height: 1px; }
.dz-props { background: var(--surface); border-left: 1px solid var(--line); padding: 14px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.dz-props h4 { margin: 6px 0 0; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.dz-props .field { gap: 4px; }
.dz-props .pv { color: var(--muted); font-weight: 500; }
.dz-props .cols { gap: 10px; }
.dz-fmtbar, .dz-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.seg.mini span { padding: 5px 10px; }

/* ---------- Tabell ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--line-2); }
tr:last-child td { border-bottom: 0; }
td .muted, .muted { color: var(--muted); }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; }
.trunc { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { padding: 16px 18px; }
.stat .n { font-size: 28px; font-weight: 750; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 13px; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15,20,28,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 24px 60px rgba(0,0,0,.25); animation: pop .18s; }
.modal.wide { max-width: 1100px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--line-2); border-radius: 0 0 14px 14px; }
.modal-foot .grow { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 600; font-size: 13px; }
.field .hint, .hint { color: var(--muted); font-size: 12.5px; }
.field input[type=text], .field input[type=password], .field input[type=email], .field input[type=url], .field select { width: 100%; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cols3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); cursor: pointer; font-weight: 600; font-size: 13px; user-select: none; }
.chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-soft); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 13px; border-right: 1px solid var(--line); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--brand-soft); color: var(--brand); }
.slug-input { display: flex; align-items: stretch; }
.slug-input .prefix { display: flex; align-items: center; padding: 0 10px; background: var(--line-2); border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; color: var(--muted); font-size: 13px; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.slug-input input { border-radius: 0 8px 8px 0 !important; flex: 1; }
.preview-img { max-height: 220px; border-radius: 8px; background: #111; display: block; margin: 0 auto; max-width: 100%; }

/* ---------- Forhåndsvisning ---------- */
.pv-wrap { display: flex; justify-content: center; align-items: center; background: repeating-conic-gradient(var(--line-2) 0% 25%, transparent 0% 50%) 50% / 20px 20px; border-radius: 10px; padding: 20px; min-height: 420px; }
.pv-frame { background: #000; border-radius: 10px; border: 8px solid #1b1f25; box-shadow: 0 16px 40px rgba(0,0,0,.3); overflow: hidden; }
.pv-frame iframe { border: 0; width: 100%; height: 100%; display: block; }
.pv-frame.land { width: min(100%, 960px); aspect-ratio: 16 / 9; }
.pv-frame.port { height: 70vh; aspect-ratio: 9 / 16; }

/* ---------- Innlogging ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.auth-card h1 { margin: 0; font-size: 22px; }
.auth-card .brand { margin-bottom: 8px; }
.err { color: var(--red); font-size: 13px; min-height: 1em; }

/* ---------- Toast ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; align-items: center; }
.toast { background: #1d232b; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-weight: 500; animation: pop .2s; }
.toast.error { background: var(--red); }

/* ---------- «Nytt oppslag»-meny ---------- */
.menu-grid { width: min(580px, calc(100vw - 32px)); display: grid; grid-template-columns: 1fr 1fr; gap: 2px; max-height: calc(100vh - 140px); overflow-y: auto; }
.menu-grid .menu-group { grid-column: 1 / -1; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 4px; }
.menu-grid .menu-group:first-child { padding-top: 4px; }
.menu-grid .menu-sep, .menu-grid button.wide { grid-column: 1 / -1; }
.menu-grid button { align-items: center; padding: 8px 10px; }
.menu-grid button b { display: block; font-weight: 650; }
.menu-grid button small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
.mi { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }

/* ---------- Oppslagsskjema: perioder, byer, holdeplasser, sosiale medier ---------- */
.stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.period-row { display: grid; grid-template-columns: 1fr 1fr 26px; gap: 10px; align-items: end; }
.period-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.period-row .icon-btn { margin-bottom: 6px; }
.wc-row { display: grid; grid-template-columns: 1fr 1fr 26px; gap: 8px; align-items: center; }
.chips.presets { margin-top: 8px; }
.chip-btn { border: 1px dashed var(--line); background: var(--surface); border-radius: 99px; padding: 4px 11px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--muted); }
.chip-btn:hover { border-color: var(--brand); color: var(--brand); }
.chip-on { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 11px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: 13px; }
.chip-on button { border: 0; background: none; color: inherit; cursor: pointer; display: grid; place-items: center; padding: 0; opacity: .7; }
.chip-on button svg { width: 14px; height: 14px; }
.chip-on button:hover { opacity: 1; }
#tr-chosen { margin-bottom: 8px; }
#tr-res { margin-top: 6px; }
.conn { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.conn.ok { flex-direction: row; align-items: center; gap: 12px; background: var(--green-soft); border-color: transparent; }
.conn .grow { flex: 1; min-width: 0; }
.conn .field { margin: 0; }
.err-text { color: var(--red); font-size: 12px; }
details.guide { font-size: 13px; color: var(--muted); }
details.guide summary { cursor: pointer; color: var(--brand); font-weight: 600; }
details.guide ol { padding-left: 20px; margin: 8px 0; }
details.guide li { margin-bottom: 4px; }
details.guide p { margin: 0; }

/* ---------- MSP-oversikt ---------- */
.ov-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
button.ov-stat { text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
button.ov-stat:hover { border-color: #c9d0da; }
button.ov-stat.sel { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.ov-stat.ov-on .n { color: var(--green); }
.ov-stat.ov-down.alarm .n { color: var(--red); }
.ov-stat.ov-sleep .n, .ov-stat.ov-new .n { color: var(--muted); }
.ov-attn { padding: 16px 20px; margin-bottom: 24px; }
.ov-attn-head { display: flex; align-items: center; gap: 8px; }
.ov-attn h3, .ov-h { margin: 0; font-size: 15px; }
#ov-q { width: 300px; }
.ov-issues { list-style: none; margin: 10px 0 0; padding: 0; }
.ov-issues li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.ov-issues .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--grey); }
.ov-issues .lvl-red .dot { background: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent); }
.ov-issues .lvl-orange .dot { background: var(--orange); }
.ov-issues .lvl-blue .dot { background: var(--brand); }
.ov-issues .txt { flex: 1; min-width: 0; }
.ov-issues .txt .muted { font-size: 12.5px; overflow-wrap: anywhere; }
.ov-ok { margin: 8px 0 0; color: var(--green); font-weight: 600; }
.ov-more { margin: 8px 0 0; font-size: 13px; }
.table-scroll { overflow-x: auto; }
.ov-table { min-width: 760px; }
.ov-table td .muted { font-size: 12.5px; }
.ov-table .status { white-space: nowrap; }
.ov-act { text-align: right; white-space: nowrap; }
.ov-act .icon-btn { vertical-align: middle; margin-right: 2px; }
.status.ov-down { color: var(--red); }
.status.ov-down::before { background: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent); }
.status.ov-on { color: var(--green); }
.status.ov-on::before { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.status.ov-sleep, .status.ov-new { color: var(--muted); }
.status.ov-new::before { background: transparent; box-shadow: inset 0 0 0 2px var(--grey); }
.screen-card.flash { animation: flash 2.2s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--brand); } }

/* ---------- Bunnlinje: versjon og leverandør ---------- */
.wlg-mark { display: inline-block; width: 26px; height: 26px; flex-shrink: 0; background: currentColor;
  -webkit-mask: url(/static/img/wlg-media.png) center / contain no-repeat; mask: url(/static/img/wlg-media.png) center / contain no-repeat; }
.wlg-mark.big { width: 48px; height: 48px; }
.app-foot { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 18px 24px 26px; color: var(--muted); font-size: 12.5px; }
.app-foot b { color: var(--text); font-weight: 650; }
.app-foot .sep { opacity: .5; }
.app-foot a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.app-foot a:hover { color: var(--brand); }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; color: var(--muted); font-size: 12.5px; }
.badge.green { background: var(--green-soft); color: var(--green); }
.release-head { display: flex; align-items: center; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.release h3 { font-size: 16px; margin: 18px 0 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.release h3 .muted { font-weight: 500; font-size: 13px; }
.release h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; }
.release p { margin: 0 0 6px; }
.release ul { margin: 0; padding-left: 20px; }
.release li { margin-bottom: 5px; line-height: 1.45; }
.release code { background: var(--line-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---------- Flervalg ---------- */
.row-lead { display: flex; align-items: center; gap: 4px; }
.row .pick { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); cursor: pointer; opacity: .3; transition: opacity .15s; }
.row:hover .pick, .row .pick:checked, .selecting .row .pick, .row .pick:focus-visible { opacity: 1; }
.bulk-bar { position: fixed; left: 0; right: 0; margin: 0 auto; width: max-content; bottom: 20px; z-index: 40; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,24,40,.22); padding: 10px 12px; animation: pop .15s; }
.bulk-bar .sep { width: 1px; height: 22px; background: var(--line); }
.bulk-bar select.sm { padding: 5px 8px; font-size: 13px; }
.row-actions .icon-btn { vertical-align: middle; }

/* ---------- Glemt passord ---------- */
.forgot-link { text-align: center; font-size: 13px; color: var(--muted); }
.forgot-link:hover { color: var(--brand); }

/* ---------- Soner i skjerminnstillingene ---------- */
.zone-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.zone-tpl { position: relative; cursor: pointer; }
.zone-tpl input { position: absolute; opacity: 0; pointer-events: none; }
.zone-tpl > span { display: flex; flex-direction: column; gap: 6px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; font-weight: 600; text-align: center; }
.zone-tpl input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.zone-tpl input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-soft); }
.zt-box, .zone-prev { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.zt-box i, .zone-prev i { position: absolute; box-sizing: border-box; border: 1px solid var(--surface); background: color-mix(in srgb, var(--brand) 35%, var(--surface)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; overflow: hidden; }
.zt-box i:first-child, .zone-prev i:first-child { background: var(--brand); }
.zt-box b { font-size: 10px; color: #fff; }
.zone-prev { max-width: 420px; margin: 4px 0 12px; border-radius: 8px; }
.zone-prev i { border-width: 2px; padding: 4px; }
.zone-prev b { font-size: 18px; color: #fff; line-height: 1; }
.zone-prev span { font-size: 11px; color: #fff; font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; max-width: 100%; white-space: nowrap; }
.zone-row { display: grid; grid-template-columns: 28px 170px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-2); }
.zone-no { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 13px; }
.zone-row:first-child .zone-no { background: var(--brand-2); }

/* ---------- Mediebibliotek ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.media-grid.compact { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); max-height: 60vh; overflow-y: auto; padding: 2px; margin-top: 12px; }
.m-card { display: flex; flex-direction: column; text-align: left; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; cursor: pointer; color: inherit; }
.m-card:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.m-thumb { aspect-ratio: 16 / 10; background: #1d232b; display: grid; place-items: center; overflow: hidden; }
.m-thumb img { width: 100%; height: 100%; object-fit: contain; }
.m-video { color: #fff; opacity: .8; }
.m-info { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px 10px; min-width: 0; }
.m-info b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-info > span:not(.badge) { font-size: 12px; color: var(--muted); }
.m-info .badge { align-self: flex-start; }
.m-detail { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.m-preview { background: #1d232b; border-radius: 10px; display: grid; place-items: center; min-height: 240px; overflow: hidden; }
.m-preview img, .m-preview video { max-width: 100%; max-height: 60vh; display: block; }
.m-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 14px; font-size: 13px; }
.m-facts dt { color: var(--muted); }
.m-facts dd { margin: 0; }
.m-uses { margin: 0; padding-left: 18px; font-size: 13px; }
.m-uses li { margin-bottom: 3px; }
.m-uses svg { vertical-align: -2px; }
.m-make { display: flex; gap: 8px; flex-wrap: wrap; }
.picker-overlay { z-index: 90; } /* over skjemaer og plakatbyggeren, under varslene */

/* Mellomstore skjermer: få plass til alle fanene på én linje */
@media (max-width: 1440px) {
  .top { gap: 16px; }
  .nav button { padding: 0 10px; }
  .tenant-pick { max-width: 170px; }
  .user-chip .uname { display: none; }
  .alert-btn .label { display: none; }
}
@media (max-width: 900px) {
  .top { flex-wrap: wrap; height: auto; padding-top: 8px; }
  .nav { order: 3; width: 100%; height: 44px; }
}
@media (max-width: 760px) {
  .top { padding: 0 12px; gap: 10px; height: auto; min-height: 56px; flex-wrap: wrap; padding-top: 8px; }
  .nav { order: 3; width: 100%; height: 44px; }
  .brand span.name { display: none; }
  main { padding: 16px; }
  .row { grid-template-columns: 36px 56px 1fr auto; gap: 10px; }
  .row .pick { opacity: 1; }
  .row .dur, .row .ring { display: none; }
  .thumb { width: 56px; height: 40px; }
  .thumb.port { width: 32px; }
  .cols, .cols3 { grid-template-columns: 1fr; }
  .search input[type=text] { width: 100%; }
  .search { flex: 1; }
  #ov-q { width: 100%; }
  .ov-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ov-stat { padding: 10px 14px; }
  .ov-stat .n { font-size: 22px; }
  .ov-attn { padding: 14px 16px; }
  .user-chip .uname { display: none; }
  .alert-btn .label { display: none; }
  .row .row-actions .btn:not([data-act="edit"]) { display: none; }
  .menu-grid { grid-template-columns: 1fr; position: fixed; left: 16px; right: 16px; top: 120px; width: auto; }
  .period-row, .wc-row { grid-template-columns: 1fr 26px; }
  .zone-row { grid-template-columns: 28px 1fr; }
  .m-detail { grid-template-columns: 1fr; }
  .zone-row .chips { grid-column: 1 / -1; }
  .period-row label:nth-child(2) { grid-row: 2; }
}
