/* SITHS-granskning. Based on Konsultresan's stylesheet. Bonliva profile: Open Sans, straight corners, no
   shadows or gradients, peach only for the primary action and key marks.
   Tokens from the Bonliva design system (tokens.css), light and dark. */
/* Open Sans served from this app (M2): no request to Google, no visitor IPs leave Bonliva.
   SIL Open Font License 1.1 – see /fonts/LICENSE.txt. */
@font-face { font-family: "Open Sans"; src: url("/fonts/OpenSans-Variable.ttf") format("truetype"); font-weight: 300 800; font-style: normal; font-display: swap; }

:root, [data-theme="light"] {
  --peach: #ff867b; --peach-ink: #9e4f47; --peach-tint: #ffe8e5; --on-peach: #ffffff;
  --gra: #495358; --morkbla: #003a5b; --neutral: #f6f3f0; --puder: #fcebe0; --ljusbla: #e0e8e8;
  --duvbla: #8c9ab2; --guld: #b29987;
  --surface: #f6f3f0; --surface-raised: #ffffff; --surface-tint: #fcebe0;
  --line: #e0e8e8; --line-strong: #7a8489; --ink: #495358; --ink-muted: #5f6a70;
  --on-dark: #ffffff; --focus: #003a5b; --nav: #003a5b;
  --chart-1: #003a5b; --chart-2: #ff867b; --chart-3: #8c9ab2;
  --morkbla-tint: #ccd8de; --gra-tint: #dbddde; --duvbla-tint: #e8ebf0;
  --status-lag: #2e6449; --status-lag-bg: #dcece2;
  --status-begransad: #7a5a00; --status-begransad-bg: #fbefc9;
  --status-hog: #8f4a12; --status-hog-bg: #fbe1cc;
  --status-kritisk: #9b2c25; --status-kritisk-bg: #f8dcd9;
  --font: "Open Sans", Arial, Helvetica, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --peach-ink: #ff867b; --peach-tint: #3d2c2a; --surface: #1f2528; --surface-raised: #2a3135; --surface-tint: #33292a;
    --line: #3a4247; --line-strong: #7d888d; --ink: #f6f3f0; --ink-muted: #b8c2c6; --focus: #e0e8e8; --nav: #161b1d;
    --chart-1: #e0e8e8; --morkbla-tint: #2c3e48; --duvbla-tint: #2f353b;
    --status-lag: #8fd1ab; --status-lag-bg: #1f3a2c; --status-begransad: #f0c860; --status-begransad-bg: #3a3014;
    --status-hog: #f5a66b; --status-hog-bg: #40291a; --status-kritisk: #ff9d93; --status-kritisk-bg: #43221f;
    color-scheme: dark;
  }
}
[data-theme="dark"] {
  --peach-ink: #ff867b; --peach-tint: #3d2c2a; --surface: #1f2528; --surface-raised: #2a3135; --surface-tint: #33292a;
  --line: #3a4247; --line-strong: #7d888d; --ink: #f6f3f0; --ink-muted: #b8c2c6; --focus: #e0e8e8; --nav: #161b1d;
  --chart-1: #e0e8e8; --morkbla-tint: #2c3e48; --duvbla-tint: #2f353b;
  --status-lag: #8fd1ab; --status-lag-bg: #1f3a2c; --status-begransad: #f0c860; --status-begransad-bg: #3a3014;
  --status-hog: #f5a66b; --status-hog-bg: #40291a; --status-kritisk: #ff9d93; --status-kritisk-bg: #43221f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--surface); color: var(--ink); font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--peach-ink); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--ink); }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 20px; line-height: 1.2; }
h3 { font-size: 16px; line-height: 1.3; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--ink-muted); }
.small { font-size: 12px; }
.lead { font-size: 16px; font-weight: 300; line-height: 1.55; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Shell ─────────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--nav); color: var(--on-dark); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; flex-direction: column; gap: 6px; padding: 24px 20px 20px; text-decoration: none; color: var(--on-dark); }
.brand img { width: 112px; display: block; filter: brightness(0) invert(1); }
.brand span { font-size: 13px; font-weight: 600; letter-spacing: .04em; opacity: .85; }
.nav { display: flex; flex-direction: column; padding: 8px 0; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 20px; color: var(--on-dark); text-decoration: none; font-weight: 400; border-left: 3px solid transparent; opacity: .82; }
.nav a:hover { opacity: 1; background: rgba(255,255,255,.06); }
.nav a[aria-current="page"] { opacity: 1; border-left-color: var(--peach); background: rgba(255,255,255,.08); font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav-count { margin-left: auto; background: var(--peach); color: var(--on-peach); font-size: 11px; font-weight: 700; min-width: 20px; padding: 1px 6px; text-align: center; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; min-height: 360px; white-space: pre; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); }
.seg label { padding: 6px 12px; cursor: pointer; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.seg label:has(input:checked) { background: var(--morkbla); color: var(--on-dark); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.nav .sep { height: 1px; background: rgba(255,255,255,.14); margin: 8px 20px; }
.side-foot { margin-top: auto; padding: 16px 20px 20px; font-size: 12px; opacity: .8; }

.top { display: flex; align-items: center; gap: 16px; padding: 14px 32px; background: var(--surface-raised); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.mode { background: var(--peach); color: var(--on-peach); font-weight: 600; font-size: 12px; letter-spacing: .06em; padding: 5px 10px; text-transform: uppercase; white-space: nowrap; }
.top .grow { flex: 1; }
.search { display: flex; align-items: center; border: 1px solid var(--line-strong); background: var(--surface-raised); }
.search input { border: 0; background: transparent; padding: 6px 10px; width: 220px; }
.search button { border: 0; background: transparent; padding: 6px 10px; cursor: pointer; color: var(--ink-muted); }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.who select { border: 1px solid var(--line-strong); background: var(--surface-raised); padding: 5px 8px; }
.demo-note { background: var(--surface-tint); border-bottom: 1px solid var(--line); padding: 10px 32px; font-size: 13px; }
main { padding: 28px 32px 64px; max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .sub { margin-top: 6px; max-width: 760px; }
.crumb { font-size: 13px; margin-bottom: 6px; }
.crumb a { color: var(--ink-muted); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

/* ── Building blocks ───────────────────────────────────────────────────── */
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.panel { background: var(--surface-raised); border: 1px solid var(--line); }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-b { padding: 16px 20px; }
.panel-b.flush { padding: 0; }
.panel-f { padding: 12px 20px; border-top: 1px solid var(--line); font-size: 13px; }
.card-link { text-decoration: none; color: inherit; display: block; }
.card-link:hover .panel, .panel.click:hover { border-color: var(--line-strong); }

.stat { padding: 18px 20px; background: var(--surface-raised); border: 1px solid var(--line); }
.stat .v { font-size: 32px; font-weight: 600; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat .l { margin-top: 6px; font-size: 13px; color: var(--ink-muted); }
.stat.accent { border-top: 3px solid var(--peach); }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--morkbla); background: var(--surface-raised); color: var(--morkbla); padding: 8px 14px; font-weight: 600; cursor: pointer; text-decoration: none; font-size: 14px; white-space: nowrap; }
.btn:hover { background: var(--morkbla-tint); }
.btn.primary { background: var(--peach); border-color: var(--peach); color: var(--on-peach); }
.btn.primary:hover { background: #f2766b; }
.btn.quiet { border-color: var(--line-strong); color: var(--ink); font-weight: 400; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--peach-ink); text-decoration: underline; cursor: pointer; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; background: var(--duvbla-tint); color: var(--ink); white-space: nowrap; }
.chip.navy { background: var(--morkbla); color: var(--on-dark); }
.chip.peach { background: var(--peach-tint); color: var(--peach-ink); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; background: currentColor; flex: none; }
.lv-lag { color: var(--status-lag); background: var(--status-lag-bg); }
.lv-begransad { color: var(--status-begransad); background: var(--status-begransad-bg); }
.lv-hog { color: var(--status-hog); background: var(--status-hog-bg); }
.lv-kritisk { color: var(--status-kritisk); background: var(--status-kritisk-bg); }

table { width: 100%; border-collapse: collapse; }
th { background: var(--morkbla); color: var(--on-dark); font-weight: 600; text-align: left; padding: 9px 12px; font-size: 13px; white-space: nowrap; }
[data-theme="dark"] th { background: #12313f; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface); }
tfoot td { font-weight: 600; }
.table-wrap { overflow-x: auto; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 20px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }

.empty { padding: 28px 20px; text-align: center; color: var(--ink-muted); }
.note { padding: 12px 16px; background: var(--surface-tint); border-left: 3px solid var(--peach); font-size: 13px; }
.note.info { background: var(--duvbla-tint); border-left-color: var(--duvbla); }

/* Tabs inside a page */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-muted); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--peach); }
.tabs a:hover { color: var(--ink); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label { font-weight: 600; font-size: 13px; }
.field .hint { font-size: 12px; color: var(--ink-muted); }
input[type=text], input[type=number], input[type=time], input[type=date], input[type=search], select, textarea {
  border: 1px solid var(--line-strong); background: var(--surface-raised); padding: 8px 10px; width: 100%; border-radius: 0;
}
textarea { min-height: 160px; resize: vertical; line-height: 1.55; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); padding: 5px 10px; cursor: pointer; background: var(--surface-raised); font-size: 13px; }
.checks label:has(input:checked) { border-color: var(--morkbla); background: var(--morkbla-tint); }
.choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.choice label { border: 1px solid var(--line); padding: 10px 12px; cursor: pointer; background: var(--surface-raised); display: flex; gap: 8px; align-items: flex-start; }
.choice label:has(input:checked) { border-color: var(--morkbla); box-shadow: inset 0 0 0 1px var(--morkbla); }
.choice small { display: block; color: var(--ink-muted); font-size: 12px; margin-top: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.step { display: grid; grid-template-columns: 32px 1fr; gap: 16px; padding: 20px; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step-n { width: 28px; height: 28px; background: var(--morkbla); color: var(--on-dark); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.sentence { font-size: 16px; font-weight: 300; line-height: 1.6; }
.sentence b { font-weight: 600; }

/* Checklist (readiness) */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: start; }
.checklist li:last-child { border-bottom: 0; }
.checklist .mark { width: 18px; height: 18px; display: grid; place-items: center; margin-top: 1px; }
.checklist .ok .mark { color: var(--peach); }
.checklist .no .mark { color: var(--line-strong); }
#html-checks .no { color: var(--status-kritisk); }
#html-checks .no .mark { color: var(--status-kritisk); font-weight: 700; }
#html-checks .ok .mark { color: var(--status-lag); }
.progress { height: 8px; background: var(--line); }
.progress > span { display: block; height: 100%; background: var(--morkbla); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--morkbla); color: var(--on-dark); padding: 10px 18px; z-index: 50; font-weight: 600; max-width: 90vw; }
.toast.err { background: var(--status-kritisk); }
.loading { padding: 40px; color: var(--ink-muted); }
dialog { border: 1px solid var(--line-strong); padding: 0; max-width: 520px; width: calc(100% - 32px); background: var(--surface-raised); color: var(--ink); }
dialog::backdrop { background: rgba(0, 20, 30, .45); }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .editor { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .brand { flex-direction: row; align-items: center; padding: 14px 16px; }
  .nav { flex-direction: row; overflow-x: auto; padding: 0; }
  .nav a { border-left: 0; border-bottom: 3px solid transparent; padding: 10px 14px; white-space: nowrap; }
  .nav a[aria-current="page"] { border-bottom-color: var(--peach); }
  .nav .sep, .side-foot { display: none; }
  .top { padding: 10px 16px; flex-wrap: wrap; position: static; }
  .search input { width: 140px; }
  main { padding: 20px 16px 48px; }
  .demo-note { padding: 10px 16px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat .v { font-size: 26px; }
  h1 { font-size: 24px; }
  .eff { grid-template-columns: 100px 1fr 56px; }
}


/* ── SITHS-granskning additions ───────────────────────────────────────── */
.answers { display: flex; flex-wrap: wrap; gap: 6px; }
.answers button { border: 1px solid var(--line-strong); background: var(--surface-raised); padding: 6px 12px; cursor: pointer; font-weight: 600; font-size: 13px; }
.answers button:hover { border-color: var(--morkbla); }
.answers button[aria-pressed="true"] { background: var(--morkbla); border-color: var(--morkbla); color: var(--on-dark); }
.answers button.danger[aria-pressed="true"] { background: var(--status-kritisk); border-color: var(--status-kritisk); }
.cardrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); align-items: start; }
.cardrow:last-child { border-bottom: 0; }
.cardrow .meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-muted); margin-top: 4px; }
.cardrow.done { background: var(--surface); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.filebox { border: 1px dashed var(--line-strong); background: var(--surface-raised); padding: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.filebox input[type=file] { max-width: 100%; }
.filebox.ok { border-style: solid; border-color: var(--status-lag); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 13px; }
.kv dt { color: var(--ink-muted); }
.kv dd { margin: 0; }
.warnlist { margin: 4px 0 0; padding-left: 18px; font-size: 12px; color: var(--status-hog); }
td .chip + .chip { margin-left: 4px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input[type=search] { width: 240px; }
tr.unmatched td { background: var(--status-kritisk-bg); }
tr.warn td:first-child { box-shadow: inset 3px 0 0 var(--status-hog); }
.pick { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pick input { width: 220px; }
@media (max-width: 860px) {
  .cardrow { grid-template-columns: 1fr; }
  .filters input[type=search] { width: 100%; }
}
.mt { margin-top: 28px; margin-bottom: 12px; }
#result > * + * { margin-top: 20px; }
main > .panel + .panel, main > .grid + .panel, main > .panel + .grid { margin-top: 20px; }
.mt-s { margin-top: 8px; }
.panel .table-wrap, .panel-b.flush { overflow-x: auto; }
.login { max-width: 520px; margin: 40px auto; }
.who a { color: var(--ink-muted); }
.inline { display: inline; margin: 0; }
