:root {
  --bg: #f6f7f9; --fg: #15181d; --muted: #5b6470; --card: #ffffff; --line: #d9dee5;
  --accent: #0b5cad; --accent-fg: #ffffff; --rec: #c62828; --ok: #1b7f3b; --warn: #b26a00;
  --strip: #10151c; --strip-fg: #ffffff; --chip: #e8eef6;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --fg: #e9edf2; --muted: #9aa4b1; --card: #181d23; --line: #2b323b;
    --accent: #5aa2f0; --accent-fg: #06121f; --rec: #ff5c5c; --ok: #4cc275; --warn: #f0a742;
    --strip: #000000; --strip-fg: #ffffff; --chip: #23303f;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.45 var(--font);
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); }
h1 { font-size: 1.35rem; margin: .2rem 0 .6rem; }
h2 { font-size: 1.1rem; margin: 1.2rem 0 .5rem; }
h3 { font-size: 1rem; margin: .8rem 0 .3rem; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
[hidden] { display: none !important; }

/* Status strip: readable at arm's length. */
.strip {
  position: sticky; top: 0; z-index: 50; background: var(--strip); color: var(--strip-fg);
  padding: calc(6px + env(safe-area-inset-top)) 10px 6px; display: grid; gap: 4px;
  font-variant-numeric: tabular-nums;
}
.strip .row1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.strip .rec { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 1.35rem; }
.strip .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--rec); animation: blink 1.2s infinite; }
.strip .idle .dot { background: #888; animation: none; }
@keyframes blink { 50% { opacity: .35; } }
.strip .level { flex: 1 1 80px; min-width: 80px; max-width: 480px; height: 14px; background: #333a44; border-radius: 7px; overflow: hidden; }
.strip .level > i { display: block; height: 100%; width: 0; background: #3ccf6e; transition: width .15s linear; }
.strip .nums { display: flex; gap: 6px; flex-wrap: wrap; font-size: 1rem; }
.strip .num { background: #232b36; border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.strip .num b { font-size: 1.15rem; }
.strip .net-ok { color: #7fe39f; }
.strip .net-bad { color: #ffb4a8; }
.strip .alarm { background: var(--rec); color: #fff; font-weight: 700; border-radius: 6px; padding: 6px 10px; font-size: 1.05rem; }
.strip .warn { background: #8a5a00; color: #fff; border-radius: 6px; padding: 4px 10px; }
.strip a { color: #fff; }

.update { background: var(--accent); color: var(--accent-fg); padding: 8px 12px; display: flex; gap: 10px; align-items: center; }
.update button { min-height: 36px; }

.top { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; color: var(--fg); margin-right: 6px; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1 1 auto; }
@media (max-width: 640px) {
  .brand { display: none; }
  .top { padding: 4px 4px; }
  .nav a { padding: 8px 9px; }
}
.nav a { padding: 10px 10px; min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; color: var(--fg); border-radius: 8px; white-space: nowrap; }
.nav a.on { background: var(--chip); font-weight: 700; }
.nav a.nav-rec { color: var(--rec); font-weight: 700; }

main { padding: 12px; max-width: 1100px; margin: 0 auto; }
.notices { max-width: 1100px; margin: 0 auto; padding: 0 12px; }
.notice { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #fff4d6; color: #4a3500; border: 1px solid #e8c766; display: flex; gap: 10px; align-items: flex-start; }
.notice.bad { background: #ffe2e0; color: #5c0c06; border-color: #f0a39b; }
.notice.good { background: #dff5e6; color: #0b3d1b; border-color: #8fd3a5; }
.notice p { margin: 0; flex: 1; }
.notice button { min-height: 36px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0; }
.card.now { border-left: 5px solid var(--accent); }
.grid { display: grid; gap: 10px; }
@media (min-width: 800px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: 1fr 1fr 1fr; } }

button, .btn {
  font: inherit; min-height: 44px; min-width: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--fg); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
button.primary, .btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 700; }
button.rec, .btn.rec { background: var(--rec); color: #fff; border-color: var(--rec); font-weight: 700; }
button.big, .btn.big { width: 100%; min-height: 72px; font-size: 1.3rem; border-radius: 16px; }
button:disabled { opacity: .5; cursor: default; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
@media (min-width: 800px) { .actions { grid-template-columns: repeat(4, 1fr); } }
.actions button, .actions label.btn { min-height: 64px; font-size: 1.05rem; text-align: center; }
label.btn input[type=file] { display: none; }

input[type=text], input[type=url], input[type=search], input[type=datetime-local], select, textarea {
  font: inherit; width: 100%; min-height: 44px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--fg);
}
textarea { min-height: 110px; }
label.field { display: block; margin: 8px 0; }
label.field span { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 3px; }
.switch { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.switch input { width: 24px; height: 24px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--chip); border-radius: 999px; padding: 2px 10px; font-size: .85rem; white-space: nowrap; }
.chip.going, .chip.covering { background: #d6f0de; color: #0b3d1b; }
.chip.maybe { background: #fff0c8; color: #4a3500; }
.chip.skip { background: #eee; color: #777; text-decoration: line-through; }
.chip.gap { background: #ffe2e0; color: #5c0c06; font-weight: 700; }
@media (prefers-color-scheme: dark) {
  .chip.going, .chip.covering { background: #173d24; color: #bff0cf; }
  .chip.maybe { background: #3d3214; color: #ffe4a0; }
  .chip.skip { background: #2a2a2a; color: #999; }
  .chip.gap { background: #4a1612; color: #ffc9c2; }
  .notice { background: #3a2e0c; color: #ffe6a8; border-color: #6e5719; }
  .notice.bad { background: #431511; color: #ffd3cd; border-color: #7a2a22; }
  .notice.good { background: #12341f; color: #c6f1d4; border-color: #2f6b45; }
}
.plan { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.plan button { min-height: 44px; padding: 6px 12px; font-size: .95rem; }
.plan button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

.item { display: block; text-decoration: none; color: inherit; }
.item .when { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.item .title { font-weight: 600; }
.list .card { margin: 8px 0; }

.recpanel { text-align: center; }
.recpanel .clock { font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.recpanel video { width: 100%; max-height: 50vh; background: #000; border-radius: 12px; }
.biglevel { height: 26px; background: var(--chip); border-radius: 13px; overflow: hidden; margin: 10px 0; }
.biglevel > i { display: block; height: 100%; width: 0; background: #2fbf5f; transition: width .15s linear; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: zoom-in; background: var(--chip); }
.transcript { max-height: 60vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.transcript .line { margin: 4px 0; }
.transcript .t { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; margin-right: 6px; }
.transcript img { max-width: 220px; max-height: 160px; border-radius: 8px; display: block; margin: 6px 0; cursor: zoom-in; }
audio, video { width: 100%; }

.viewer { padding: 0; border: none; background: #000; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.viewer img { width: 100%; height: 100%; object-fit: contain; }
.viewer .close { position: fixed; top: 10px; right: 10px; z-index: 2; }
.viewer::backdrop { background: rgba(0,0,0,.9); }

table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ok { color: var(--ok); font-weight: 700; }
.bad { color: var(--rec); font-weight: 700; }
.signin { text-align: center; padding: 40px 12px; }
.signin .btn { max-width: 360px; width: 100%; }
.tzswitch { float: right; }
.tzswitch button { min-height: 36px; padding: 4px 10px; font-size: .85rem; }
pre { white-space: pre-wrap; word-break: break-word; font-size: .8rem; }
.slot { border-top: 2px solid var(--line); padding-top: 6px; margin-top: 14px; }
.slot h3 { margin-top: 0; }
.progress { height: 8px; background: var(--chip); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); }
/* footer with the version on every view, and the Versions view (views/pages.js) */
.foot { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; padding: 18px 12px calc(18px + env(safe-area-inset-bottom)); font-size: .8rem; color: var(--muted); }
.foot a { color: var(--muted); }
/* the test site next.conf.ai-academy.se (views/pages.js, isTestSite) */
.test-site { padding: calc(8px + env(safe-area-inset-top)) 12px 8px; text-align: center; font-weight: 700; background: repeating-linear-gradient(135deg, #ffd34d 0 14px, #ffe07a 14px 28px); color: #111; border-bottom: 2px solid #111; }
.ver-diff { color: var(--warn); font-weight: 700; }
.card.current { border-color: var(--ok); }
