:root {
  --bg: #16140f;
  --bg-2: #211e17;
  --panel: #2a261d;
  --panel-2: #332e23;
  --line: #4a4233;
  --text: #ece4d0;
  --muted: #a89d85;
  --paper: #f3ead3;
  --paper-2: #e9dec2;
  --ink: #2a241a;
  --ink-muted: #6b5f48;
  --accent: #b8412f;
  --accent-2: #d9674f;
  --brass: #c9a45c;
  --ok: #6fa36b;
  --warn: #d6a23c;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --font-body: 'Inter', system-ui, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, serif;
  --font-type: 'Special Elite', 'Courier New', monospace;
  --font-hand: 'Caveat', cursive;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 20% -10%, #2b2519 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--brass); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-serif); line-height: 1.2; margin: 0 0 .5em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- knappar & fält ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .45em;
  padding: .6em 1.05em; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); cursor: pointer; text-decoration: none;
  font-weight: 500; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #3d3629; border-color: #62573f; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.small { padding: .35em .7em; font-size: .88em; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.input, textarea.input, select.input {
  width: 100%; padding: .65em .8em; border-radius: 8px; border: 1px solid var(--line);
  background: #1d1a14; color: var(--text); outline: none;
}
.input:focus { border-color: var(--brass); }
label.field { display: block; margin-bottom: 1rem; }
label.field > span { display: block; font-size: .85em; color: var(--muted); margin-bottom: .3em; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- startsida ---------- */
.start { max-width: 1060px; margin: 0 auto; padding: 48px 16px 80px; }
.hero { text-align: center; margin-bottom: 42px; }
.hero .kicker { font-family: var(--font-type); color: var(--brass); letter-spacing: .25em; font-size: .85rem; }
.hero h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); margin: .15em 0 .05em; letter-spacing: -.01em; }
.hero h2 { font-weight: 400; font-style: italic; color: var(--muted); font-size: 1.3rem; }
.hero p.tagline { max-width: 620px; margin: 1.2em auto 0; font-family: var(--font-serif); font-size: 1.15rem; }
.start-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
@media (max-width: 860px) { .start-grid { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card h3 { font-size: 1.25rem; }
.diffs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 560px) { .diffs { grid-template-columns: 1fr; } }
.diff { border: 1px solid var(--line); border-radius: 8px; padding: 12px; cursor: pointer; background: #1f1c15; }
.diff input { display: none; }
.diff strong { display: block; font-family: var(--font-serif); font-size: 1.05rem; }
.diff small { color: var(--muted); font-size: .8rem; line-height: 1.35; display: block; margin-top: 4px; }
.diff.selected { border-color: var(--brass); background: #2c2518; box-shadow: inset 0 0 0 1px var(--brass); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { background: #3a3325; border: 1px solid var(--line); border-radius: 999px; padding: .2em .7em; font-size: .9em; display: inline-flex; gap: .4em; align-items: center; }
.chip button { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 0; }
.game-list { list-style: none; margin: 0; padding: 0; }
.game-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.game-list li:last-child { border-bottom: 0; }
.game-list .code { font-family: var(--font-type); color: var(--brass); letter-spacing: .12em; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .input { flex: 1; min-width: 120px; }

/* ---------- spellayout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(22,20,15,.92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { font-family: var(--font-serif); font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); white-space: nowrap; }
.brand span { color: var(--accent-2); }
.game-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
.code-badge { font-family: var(--font-type); background: #2f291e; border: 1px dashed var(--brass); color: var(--brass); padding: .15em .6em; border-radius: 6px; letter-spacing: .15em; cursor: pointer; }
.timer { font-family: var(--font-type); font-size: 1.05rem; color: var(--text); display: inline-flex; gap: 6px; align-items: center; }
.spacer { flex: 1; }
.nav { max-width: 1280px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-size: .95rem; }
.nav a.active { color: var(--text); border-bottom-color: var(--accent); }
.nav a:hover { color: var(--text); }
.main { max-width: 1280px; margin: 0 auto; padding: 24px 16px 80px; }

/* ---------- ärendeakt / hub ---------- */
.hub-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; }
@media (max-width: 960px) { .hub-grid { grid-template-columns: 1fr; } }
.envelopes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
@media (max-width: 640px) { .envelopes { grid-template-columns: 1fr; } }
.envelope {
  position: relative; background: linear-gradient(160deg, #c9b187, #b39a6d); color: var(--ink);
  border-radius: 6px; padding: 16px 16px 14px; min-height: 130px; box-shadow: var(--shadow);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}
.envelope::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 38px; background: linear-gradient(to bottom right, transparent 49.5%, rgba(0,0,0,.12) 50%) left/50% 100% no-repeat, linear-gradient(to bottom left, transparent 49.5%, rgba(0,0,0,.12) 50%) right/50% 100% no-repeat; }
.envelope h4 { font-family: var(--font-type); margin: 22px 0 4px; font-size: 1rem; }
.envelope p { margin: 0; font-size: .85rem; font-family: var(--font-serif); }
.envelope.locked { background: linear-gradient(160deg, #544c3c, #3f3829); color: #b8ab8e; }
.envelope .status { position: absolute; top: 10px; right: 12px; font-size: .75rem; font-family: var(--font-type); }
.env-btn { margin-top: 10px; background: #fff8 !important; border-color: #0002 !important; color: #2a241a !important; }
.envelope .seal { position: absolute; bottom: 10px; right: 12px; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #d45a47, #8a2418); display: grid; place-items: center; color: #f7d9cf; font-size: .8rem; box-shadow: 0 2px 4px rgba(0,0,0,.4); }
.categories { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.cat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; display: block; }
.cat-card:hover { border-color: var(--brass); transform: translateY(-2px); }
.cat-card .icon { font-size: 1.6rem; }
.cat-card h4 { margin: .3em 0 .2em; font-family: var(--font-serif); font-size: 1.1rem; }
.cat-card p { margin: 0; color: var(--muted); font-size: .85rem; }
.cat-card .count { margin-top: 10px; font-size: .8rem; color: var(--brass); }
.badge { display: inline-block; background: var(--accent); color: #fff; border-radius: 999px; padding: 0 .55em; font-size: .75rem; margin-left: .35em; vertical-align: middle; }
.section-title { font-family: var(--font-type); color: var(--brass); letter-spacing: .15em; font-size: .85rem; text-transform: uppercase; margin: 26px 0 12px; }
.section-title:first-child { margin-top: 0; }
.question-card { background: var(--paper); color: var(--ink); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); border-left: 6px solid var(--accent); }
.question-card h3 { font-family: var(--font-type); font-weight: 400; color: var(--accent); font-size: 1rem; letter-spacing: .1em; }
.question-card .prompt { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 600; margin-bottom: 14px; }
.options { display: grid; gap: 8px; margin-bottom: 14px; }
.option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid #cdbf9d; border-radius: 8px; background: #fbf6e8; cursor: pointer; font-family: var(--font-serif); }
.option:hover { border-color: var(--accent); }
.option input { margin-top: .3em; accent-color: var(--accent); }
.question-card .input { background: #fffaf0; color: var(--ink); border-color: #cdbf9d; }
.feedback { margin-top: 12px; padding: 10px 12px; border-radius: 8px; font-family: var(--font-serif); }
.feedback.bad { background: #f5d8cf; color: #6d1c10; }
.feedback.good { background: #d9ead3; color: #1f4a1a; }
.solved-stamp { display: inline-block; font-family: var(--font-type); color: #2f6b2a; border: 2px solid #2f6b2a; padding: 2px 10px; transform: rotate(-4deg); border-radius: 4px; }
.log-list { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.log-list li { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.log-list time { color: var(--muted); font-family: var(--font-type); font-size: .8rem; margin-right: 6px; }
.players { display: flex; flex-wrap: wrap; gap: 6px; }
.hint-box { background: #2f2a1f; border: 1px dashed var(--brass); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-family: var(--font-serif); }
.hint-box strong { color: var(--brass); font-family: var(--font-type); font-weight: 400; }
.progress { height: 6px; background: #3a3325; border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.progress > div { height: 100%; background: var(--brass); }

/* ---------- dokument ---------- */
.docs-layout { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .docs-layout { grid-template-columns: 1fr; } .docs-layout > nav { order: 2; } }
.docs-layout > *, .hub-grid > *, .start-grid > * { min-width: 0; }
body { overflow-x: hidden; }
.doc-list { position: sticky; top: 110px; max-height: calc(100vh - 130px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
@media (max-width: 900px) { .doc-list { position: static; max-height: none; } }
.doc-list h5 { font-family: var(--font-type); color: var(--brass); font-weight: 400; letter-spacing: .1em; margin: 12px 8px 6px; font-size: .78rem; text-transform: uppercase; }
.doc-list a { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--text); font-size: .9rem; }
.doc-list a:hover { background: var(--panel-2); }
.doc-list a.active { background: #3d3629; box-shadow: inset 3px 0 0 var(--accent); }
.doc-list a .env { font-family: var(--font-type); color: var(--muted); font-size: .72rem; white-space: nowrap; }
.doc-list a.unread { font-weight: 600; }
.doc-list a.unread::after { content: '●'; color: var(--accent-2); font-size: .6rem; margin-left: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.filters a { text-decoration: none; padding: .3em .8em; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.filters a.active { background: var(--brass); color: #1a160f; border-color: var(--brass); }

.paper {
  background: var(--paper); color: var(--ink); border-radius: 4px; padding: 44px 48px; box-shadow: var(--shadow), inset 0 0 80px rgba(160,130,70,.15);
  font-family: var(--font-serif); font-size: 1.04rem; position: relative; max-width: 880px;
}
@media (max-width: 640px) { .paper { padding: 26px 18px; } }
.paper::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, transparent 0 31px, rgba(120,100,60,.05) 31px 32px); border-radius: 4px; }
.paper .doc-title { font-family: var(--font-type); font-size: 1.35rem; color: var(--ink); margin-bottom: 18px; }
.paper .env-tag { position: absolute; top: 16px; right: 18px; font-family: var(--font-type); font-size: .75rem; color: var(--ink-muted); }
.paper h4 { font-family: var(--font-type); font-weight: 400; font-size: 1.02rem; text-transform: uppercase; letter-spacing: .06em; margin: 1.5em 0 .5em; border-bottom: 1px solid #cdbf9d; padding-bottom: 3px; }
.paper h3 { font-family: var(--font-type); font-weight: 400; text-align: center; letter-spacing: .15em; }
.paper p { margin: .6em 0; }
.paper .muted { color: var(--ink-muted); font-size: .92em; }
.paper .right { text-align: right; }
.paper blockquote { border-left: 4px solid var(--accent); margin: 1em 0; padding: .4em 1em; background: #efe3c5; font-style: italic; }
.form-head { display: flex; justify-content: space-between; gap: 10px; font-family: var(--font-type); font-size: .85rem; border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.letterhead { font-family: var(--font-type); border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 18px; }
.paper table { border-collapse: collapse; width: 100%; margin: 10px 0 14px; font-size: .92rem; }
.paper table.meta th, .paper table.meta td, .paper table.log th, .paper table.log td { border: 1px solid #bfae88; padding: 6px 8px; text-align: left; vertical-align: top; }
.paper table.meta th, .paper table.log th { background: #e6d9b8; font-family: var(--font-type); font-weight: 400; font-size: .8rem; white-space: nowrap; }
.paper .table-wrap { overflow-x: auto; }
.transcript p { margin: .55em 0; }
.transcript .who { font-family: var(--font-type); font-weight: 400; margin-right: .4em; color: #5a2a1c; }
.transcript .sfx { color: var(--ink-muted); font-style: italic; }
.signature { font-family: var(--font-hand); font-size: 1.9rem; margin: 10px 0 -8px; color: #20305c; }
.sig { font-family: var(--font-hand); font-size: 1.8rem; color: #20305c; display: inline-block; border-bottom: 1px solid #555; min-width: 180px; padding: 0 6px; }
.sig.small { font-size: 1.4rem; min-width: 0; border: 0; }
.sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 18px; font-size: .9rem; }
.contract { border: 1px solid #bfae88; padding: 24px; background: #fbf6e8; }
.receipt { font-family: 'Courier New', monospace; background: #fff; border: 1px dashed #999; padding: 18px; max-width: 420px; margin: 0 auto 20px; font-size: .9rem; }
.handwritten { font-family: var(--font-hand); font-size: 1.45rem; line-height: 1.45; color: #1f2d57; }
.handwritten p { margin: .35em 0; }
.notebook { font-family: var(--font-hand); font-size: 1.4rem; color: #1f2d57; background: repeating-linear-gradient(#f7f0da 0 31px, #b9c9dd 31px 32px); padding: 14px 22px; border-left: 3px double #d88; }
.notebook ul { margin: 0; padding-left: 1.1em; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.person { border: 1px solid #bfae88; background: #fbf6e8; padding: 12px; border-radius: 4px; }
.person h4 { margin: 0 0 4px; border: 0; font-size: .95rem; text-transform: none; letter-spacing: 0; }
.person p { margin: 0; font-size: .92rem; }
.person.victim { border-color: var(--accent); background: #f6e3da; }
.person .tag { font-size: .7rem; background: var(--accent); color: #fff; padding: 1px 6px; border-radius: 3px; vertical-align: middle; }
.photos { display: grid; gap: 10px; }
.photo { display: grid; grid-template-columns: 110px 1fr; gap: 12px; background: #fff; padding: 10px; border: 1px solid #d8cba9; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
@media (max-width: 560px) { .photo { grid-template-columns: 1fr; } }
.ph-time { font-family: var(--font-type); background: #222; color: #ffcf6b; display: grid; place-items: center; border-radius: 3px; font-size: 1.05rem; min-height: 56px; }
.ph-body { font-size: .95rem; }
.map { width: 100%; height: auto; border: 1px solid #bfae88; margin: 8px 0; }
.caption { font-size: .88rem; color: var(--ink-muted); font-style: italic; }
.doc-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; max-width: 880px; flex-wrap: wrap; }
.stamp { position: absolute; right: 32px; bottom: 26px; font-family: var(--font-type); color: rgba(184,65,47,.55); border: 3px solid rgba(184,65,47,.55); padding: 4px 12px; transform: rotate(-8deg); font-size: 1.1rem; letter-spacing: .15em; pointer-events: none; }

/* ---------- misstänkta ---------- */
.suspects { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.suspect { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; transition: border-color .2s; }
.suspect.suspect-status-suspect { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.suspect.suspect-status-cleared { opacity: .65; }
.suspect h4 { margin: 0; font-family: var(--font-serif); font-size: 1.1rem; }
.suspect .role { color: var(--muted); font-size: .85rem; margin-bottom: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.seg button { background: transparent; border: 0; padding: .35em .7em; cursor: pointer; font-size: .82rem; color: var(--muted); }
.seg button.on { background: var(--panel-2); color: var(--text); }
.seg button.on.s-suspect { background: var(--accent); color: #fff; }
.seg button.on.s-cleared { background: #3b5a38; color: #fff; }
.suspect textarea { min-height: 80px; resize: vertical; font-size: .9rem; }

/* ---------- anteckningar ---------- */
.notes-area { min-height: 60vh; font-family: var(--font-hand); font-size: 1.45rem; line-height: 32px; background: repeating-linear-gradient(#f7f0da 0 31px, #b9c9dd 31px 32px); color: #1f2d57; border: 0; border-left: 3px double #d88; padding: 4px 18px; border-radius: 4px; width: 100%; resize: vertical; }
.notes-meta { color: var(--muted); font-size: .85rem; margin-top: 6px; }

/* ---------- anklagelse & facit ---------- */
.accuse { max-width: 860px; }
.check-item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.check-item h4 { margin: 0 0 4px; font-family: var(--font-serif); font-size: 1.12rem; }
.check-item .help { color: var(--muted); font-size: .88rem; margin-bottom: 10px; }
.check-item .seg button.on.s-ja { background: var(--ok); color: #10200e; }
.check-item .seg button.on.s-nej { background: var(--accent); color: #fff; }
.check-item .seg button.on.s-osaker { background: var(--warn); color: #241a05; }
.warning { background: #3a2a14; border: 1px solid var(--warn); color: #f3d9a3; padding: 12px 14px; border-radius: 8px; margin: 14px 0; }
.step-label { font-family: var(--font-type); color: var(--brass); letter-spacing: .12em; font-size: .8rem; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 10px 0 18px; }
.picker label { display: block; padding: 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: var(--panel); }
.picker label.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.picker input { display: none; }
.picker.list { grid-template-columns: 1fr; }
.facit { max-width: 900px; }
.facit .verdict { font-size: clamp(1.6rem, 4vw, 2.3rem); font-family: var(--font-serif); margin-bottom: .3em; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--brass); }
.timeline li { padding: 6px 0 10px 18px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 13px; width: 12px; height: 12px; border-radius: 50%; background: var(--brass); }
.timeline time { font-family: var(--font-type); color: var(--brass); display: block; font-size: .85rem; }
.mmo-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.mmo-table th, .mmo-table td { border: 1px solid var(--line); padding: 8px 10px; vertical-align: top; text-align: left; }
.mmo-table th { background: var(--panel-2); font-weight: 600; }
.mark-yes { color: var(--ok); font-weight: 700; }
.mark-no { color: var(--accent-2); font-weight: 700; }
.score { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0; }
.score > div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 18px; }
.score strong { display: block; font-size: 1.6rem; font-family: var(--font-serif); }
.score span { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.facit-block { margin-bottom: 28px; }
.table-scroll { overflow-x: auto; }

/* ---------- modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; max-width: 540px; width: 100%; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal h3 { margin-top: 0; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #f3ead3; color: var(--ink); padding: 10px 18px; border-radius: 8px; box-shadow: var(--shadow); opacity: 0; transition: all .25s; z-index: 200; pointer-events: none; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.loading { text-align: center; padding: 80px 16px; color: var(--muted); font-family: var(--font-type); }
.empty { color: var(--muted); font-style: italic; }

@media (max-width: 640px) {
  .paper svg.map { min-width: 680px; }
  .paper .env-tag { position: static; margin-bottom: 8px; }
}

/* ---------- fallväljare ---------- */
.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
@media (max-width: 400px) { .case-grid { grid-template-columns: 1fr; } }
.case-card { display: grid; grid-template-columns: 110px 1fr; background: var(--paper); color: var(--ink); border-radius: var(--radius); overflow: hidden; text-decoration: none; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.case-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(0,0,0,.45); }
.case-cover { background: linear-gradient(160deg, #8a2418, #3b1410); display: grid; place-items: center; font-size: 3.2rem; }
.case-body { padding: 16px 18px; }
.case-body h3 { font-size: 1.5rem; margin: 2px 0 0; color: var(--ink); }
.case-no { font-family: var(--font-type); font-size: .72rem; color: var(--accent); letter-spacing: .12em; }
.case-sub { font-family: var(--font-serif); font-style: italic; color: var(--ink-muted); margin-bottom: 8px; }
.case-body p { font-family: var(--font-serif); margin: 0 0 12px; font-size: .98rem; }
.case-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.case-tags span { font-size: .78rem; background: #e6d9b8; border-radius: 99px; padding: .15em .65em; }
.case-card.soon { opacity: .5; cursor: default; filter: grayscale(.6); }
.case-card.soon:hover { transform: none; }
.case-card.soon .case-cover { background: linear-gradient(160deg, #4a4233, #2a261d); }
.back-link { display: inline-block; margin-bottom: 12px; text-decoration: none; color: var(--muted); font-size: .9rem; }
.back-link:hover { color: var(--text); }
.crumb { color: var(--line); }
.case-title { color: var(--text); text-decoration: none; font-family: var(--font-serif); font-weight: 600; white-space: nowrap; }
.brand { font-size: 1rem; color: var(--accent-2); }
.killer-row { background: #3a2119; }
.nav-notes { margin-left: auto; }

/* ---------- anteckningspanel ---------- */
.notes-fab { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: inline-flex; gap: 8px; align-items: center; background: var(--brass); color: #1b160d; border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 600; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.notes-fab:hover { background: #d8b56c; }
.notes-fab .badge { background: #1b160d; color: var(--brass); }
.notes-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 100%; z-index: 70; background: #221f18; border-left: 1px solid var(--line); box-shadow: -12px 0 30px rgba(0,0,0,.4); display: flex; flex-direction: column; transform: translateX(105%); transition: transform .22s ease; }
.notes-drawer.open { transform: none; }
.nd-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.nd-tabs { display: flex; border-bottom: 1px solid var(--line); }
.nd-tabs button { flex: 1; background: none; border: 0; padding: 10px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.nd-tabs button.on { color: var(--text); border-bottom-color: var(--brass); }
.nd-body { flex: 1; display: flex; flex-direction: column; padding: 12px 14px; min-height: 0; gap: 8px; }
.nd-help { margin: 0; font-size: .8rem; color: var(--muted); }
.nd-text { flex: 1; min-height: 200px; width: 100%; resize: none; font-family: var(--font-hand); font-size: 1.35rem; line-height: 30px; background: repeating-linear-gradient(#f7f0da 0 29px, #b9c9dd 29px 30px); color: #1f2d57; border: 0; border-left: 3px double #d88; padding: 2px 12px; border-radius: 4px; outline: none; }
.nd-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .8rem; }
.board-list { flex: 1; overflow: auto; display: grid; gap: 10px; align-content: start; min-height: 0; }
.lapp { background: #f6e7a8; color: #2d2610; padding: 10px 12px; border-radius: 3px; box-shadow: 0 3px 8px rgba(0,0,0,.3); transform: rotate(-.4deg); }
.lapp:nth-child(even) { transform: rotate(.5deg); background: #f3dfa0; }
.lapp-meta { font-size: .75rem; color: #6b5a24; display: flex; gap: 6px; align-items: center; }
.lapp-del { margin-left: auto; background: none; border: 0; cursor: pointer; color: #8a7433; }
.lapp-text { font-family: var(--font-hand); font-size: 1.3rem; line-height: 1.25; white-space: pre-wrap; word-break: break-word; }
.lapp-doc { font-size: .78rem; color: #7a3a22; }
.board-add textarea { resize: vertical; }
@media (min-width: 1200px) { body.notes-open #app { padding-right: 400px; } }
@media (max-width: 640px) {
  .notes-drawer { top: auto; height: 78vh; width: 100%; border-left: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; transform: translateY(105%); }
  .notes-fab span:first-of-type { display: none; }
  .case-card { grid-template-columns: 80px 1fr; }
}

/* ---------- läsframsteg ---------- */
.env-progress { margin-top: 8px; max-width: 75%; }
.env-progress .progress { background: rgba(0,0,0,.15); margin: 0 0 2px; }
.env-progress .progress > div { background: #6b2a1c; }
.env-progress small { font-size: .75rem; font-family: var(--font-type); }
.envelope.locked .env-progress { display: none; }
.doc-list a.is-read span:first-child::before { content: '✔ '; color: var(--ok); font-size: .8em; }
.doc-list .locked-doc { display: flex; justify-content: space-between; padding: 8px 10px; color: var(--muted); font-size: .88rem; opacity: .7; }
.read-sentinel { height: 1px; }
.read-mark { margin-top: 28px; padding-top: 12px; border-top: 1px dashed #bfae88; font-family: var(--font-type); font-size: .85rem; color: var(--ink-muted); text-align: center; }
.read-mark.done { color: #2f6b2a; }

/* ---------- vem gjorde vad ---------- */
.who-tag { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--pc); }
.who-tag i { font-style: normal; width: 18px; height: 18px; border-radius: 50%; background: var(--pc); color: #15120c; display: inline-grid; place-items: center; font-size: .68rem; font-weight: 700; }
.paper .who-tag, .lapp .who-tag { filter: brightness(.6) saturate(1.4); }
.log-list li { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.log-list .log-icon { width: 1.2em; text-align: center; }
.log-list.big li { padding: 9px 0; font-size: .95rem; }
.byline { font-size: .78rem; color: var(--muted); margin: 4px 0 8px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 14px 0 18px; }
.stat-card { padding: 14px 16px; }
.stat-nums { display: flex; gap: 14px; margin-top: 8px; font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.stat-nums strong { color: var(--text); font-size: 1.05rem; }

/* =========================================================
   Kortbaserad layout (ersätter menyraden)
   ========================================================= */
.topbar-inner { max-width: 1100px; min-height: 56px; }
.back { color: var(--text); text-decoration: none; font-weight: 500; padding: 6px 2px; }
.back:hover { color: var(--brass); }
.notes-btn span { margin-left: 2px; }
@media (max-width: 520px) { .notes-btn span { display: none; } }
.main { max-width: 1100px; }
.main-page { max-width: 900px; }
.page { max-width: 860px; margin: 0 auto; }
.kicker { font-family: var(--font-type); color: var(--brass); letter-spacing: .18em; font-size: .78rem; }
.hub-head { text-align: center; margin: 10px 0 30px; }
.hub-head h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); margin: .15em 0 .1em; }
.page-head { margin: 6px 0 24px; }
.page-head h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: .2em 0 .25em; }
.page-head p { font-family: var(--font-serif); font-size: 1.1rem; margin: 0 0 14px; }
.page-head .progress { max-width: 320px; }

/* delkort */
.section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
@media (max-width: 420px) { .section-grid { grid-template-columns: 1fr; } }
.section-card { display: flex; flex-direction: column; gap: 6px; min-height: 200px; padding: 20px 22px; border-radius: 14px; text-decoration: none; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; position: relative; }
.section-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(0,0,0,.45); }
.section-card h2 { font-size: 1.55rem; margin: 2px 0 0; color: var(--ink); }
.section-card p { margin: 0; font-family: var(--font-serif); color: #4a4030; flex: 1; }
.sc-top { display: flex; justify-content: space-between; align-items: center; }
.sc-icon { font-size: 2rem; }
.sc-no { font-family: var(--font-type); font-size: .75rem; letter-spacing: .15em; color: var(--ink-muted); }
.sc-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .85rem; color: var(--ink-muted); margin-top: 8px; }
.sc-foot .progress { flex: 1 1 100%; background: #dccfae; margin: 0; }
.sc-foot .progress > div { background: var(--accent); }
.sc-cta { margin-left: auto; color: var(--accent); font-weight: 600; }
.section-card.current { box-shadow: 0 0 0 3px var(--brass), var(--shadow); }
.section-card.done { background: #e6ecd8; }
.section-card.done .sc-foot { color: #2f6b2a; font-weight: 600; }
.section-card.locked { background: #2a261d; color: var(--muted); box-shadow: none; border: 1px dashed var(--line); cursor: not-allowed; }
.section-card.locked h2, .section-card.locked p { color: var(--muted); }
.section-card.locked .sc-icon { filter: grayscale(1); opacity: .5; }
.section-card.locked:hover { transform: none; }

/* stora anklaga-knappen */
.accuse-cta { display: flex; align-items: center; gap: 18px; margin: 28px 0; padding: 22px 26px; border-radius: 14px; background: linear-gradient(135deg, #b8412f, #8a2418); color: #fff; text-decoration: none; box-shadow: 0 12px 30px rgba(138,36,24,.45); transition: transform .15s, box-shadow .15s; }
.accuse-cta:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(138,36,24,.6); }
.accuse-cta .ac-icon { font-size: 2.4rem; }
.accuse-cta strong { display: block; font-family: var(--font-serif); font-size: clamp(1.4rem, 4vw, 1.9rem); line-height: 1.1; }
.accuse-cta small { display: block; opacity: .85; font-size: .95rem; margin-top: 4px; }
.accuse-cta .ac-arrow { margin-left: auto; font-size: 2rem; }
.accuse-cta.locked { background: #2a261d; color: var(--muted); box-shadow: none; border: 1px dashed var(--line); cursor: not-allowed; }
.accuse-cta.locked:hover { transform: none; }
.accuse-cta.solved { background: linear-gradient(135deg, #3f6b3a, #2a4a27); box-shadow: 0 12px 30px rgba(40,80,35,.4); }
.accuse-submit { display: block; width: 100%; margin: 26px 0 10px; padding: 20px; border: 0; border-radius: 12px; background: linear-gradient(135deg, #b8412f, #8a2418); color: #fff; font-family: var(--font-serif); font-size: clamp(1.3rem, 4vw, 1.7rem); font-weight: 700; cursor: pointer; box-shadow: 0 12px 30px rgba(138,36,24,.45); }
.accuse-submit:hover { filter: brightness(1.08); }

/* verktygskort */
.tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
.tool-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px 18px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: var(--text); transition: border-color .15s; }
.tool-card:hover { border-color: var(--brass); }
.tool-card span { font-size: 1.5rem; }
.tool-card strong { font-family: var(--font-serif); font-size: 1.1rem; }
.tool-card small { color: var(--muted); }

/* dokumentlista i en del */
.doc-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.doc-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 12px; background: var(--paper); color: var(--ink); text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.25); transition: transform .12s; }
.doc-card:hover { transform: translateX(4px); }
.dc-no { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--font-type); flex: none; }
.dc-title { flex: 1; font-family: var(--font-serif); font-size: 1.12rem; font-weight: 600; }
.dc-state { font-size: .82rem; color: var(--ink-muted); white-space: nowrap; }
.doc-card.read { background: #e6ecd8; }
.doc-card.read .dc-no { background: #3f6b3a; }
.doc-card.read .dc-state { color: #2f6b2a; font-weight: 600; }

/* dokumentvy */
.doc-page { max-width: 880px; margin: 0 auto; }
.doc-pos { font-family: var(--font-type); color: var(--muted); font-size: .8rem; letter-spacing: .08em; margin-bottom: 10px; }
.doc-page .paper { max-width: none; }
.doc-actions { max-width: none; }

/* övriga sidor */
.hint-section { margin-bottom: 22px; }
.hint-section h3 { font-size: 1.2rem; }
.info-block { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 14px; }
.info-block h3 { margin-bottom: .3em; }
.code-big { font-family: var(--font-type); font-size: 2rem; letter-spacing: .3em; padding: 10px 22px; background: #2f291e; border: 2px dashed var(--brass); color: var(--brass); border-radius: 10px; cursor: pointer; }
.nav, .notes-fab { display: none !important; }
.notes-drawer { transition: transform .22s ease, visibility 0s linear .22s; visibility: hidden; }
.notes-drawer.open { visibility: visible; transition: transform .22s ease; }

/* konto */
.account-bar { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.start-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.start.narrow { max-width: 860px; }
/* läsläge: bara dokumentet */
.main-reading { max-width: 880px; padding-top: 18px; }
.doc-next { display: flex; justify-content: flex-end; margin-top: 18px; }
.doc-next .btn { font-size: 1.05rem; padding: .75em 1.4em; }
.account-bar { margin-bottom: 14px; }

.section-card { min-height: 150px; justify-content: space-between; }
.dc-state { color: #2f6b2a; font-weight: 700; font-size: 1.1rem; }
.stat-row { display: none; }
/* sammanfattade förhör */
.summary p { margin: .8em 0; line-height: 1.65; }
.observed { margin-top: 1.4em; padding: 10px 14px; border-left: 3px solid #bfae88; background: #efe3c5; font-size: .92rem; color: var(--ink-muted); }
.nd-head { gap: 8px; padding: 6px 10px 6px 6px; }
.nd-head .nd-tabs { flex: 1; border-bottom: 0; }
.nd-body { padding-top: 10px; }
.nd-text { min-height: 0; }

/* Kartor & bevis */
.material-cta { display: flex; align-items: center; gap: 18px; margin: 22px 0 0; padding: 18px 24px; border-radius: 14px; background: var(--paper); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); border-left: 6px solid var(--brass); transition: transform .15s; }
.material-cta:hover { transform: translateY(-2px); }
.material-cta .mc-icon { font-size: 2.2rem; }
.material-cta strong { display: block; font-family: var(--font-serif); font-size: clamp(1.25rem, 3.5vw, 1.6rem); }
.material-cta small { display: block; color: var(--ink-muted); font-size: .9rem; margin-top: 2px; }
.material-cta .mc-count { margin-left: auto; min-width: 38px; height: 38px; padding: 0 10px; border-radius: 99px; background: var(--brass); color: #1b160d; display: grid; place-items: center; font-weight: 700; }
.ref-group { margin-bottom: 26px; }
.ref-group h3 { font-size: 1.15rem; margin-bottom: 10px; }
.dc-where { font-size: .82rem; color: var(--ink-muted); white-space: nowrap; }
@media (max-width: 520px) { .dc-where { display: none; } }

/* Fetstil i förhören hjälper bara på Lätt */
[data-diff="normal"] .summary strong, [data-diff="hard"] .summary strong { font-weight: inherit; }
