:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --ink: #161614;
  --ink-2: #45453f;
  --muted: #75746c;
  --line: #e3e0d7;
  --line-strong: #cbc7ba;
  --green: #1e6b45;
  --green-bg: #e3f0e8;
  --amber: #875800;
  --amber-bg: #f7ecd0;
  --red: #a5281e;
  --red-bg: #f8e2df;
  --blue: #1f4f8f;
  --blue-bg: #e2ebf7;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: inherit; }
h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1 { font: 600 30px/1.15 var(--serif); letter-spacing: -0.015em; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.wrap { overflow-wrap: anywhere; }
.bad-text { color: var(--red); }

/* Ram */
.layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: #151513; color: #c9c6bb; padding: 22px 14px; display: flex; flex-direction: column; gap: 26px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; text-decoration: none; color: #fff; }
.brand .mark { width: 36px; height: 36px; flex: none; }
.brand strong { display: block; font-size: 16px; letter-spacing: -0.01em; }
.brand small { display: block; font-size: 12px; color: #98958a; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; text-decoration: none; font-size: 14px; }
.nav a:hover { background: #22221f; color: #fff; }
.nav a.active { background: #2c2c28; color: #fff; }
.nav .count { margin-left: auto; background: #e9e6dc; color: #151513; border-radius: 999px; font-size: 11px; font-weight: 650; padding: 1px 7px; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.menu { display: flex; flex-direction: column; gap: 26px; flex: 1; min-height: 0; }
.sidebar .menu-toggle, .sidebar .menu-logout { display: none; }
.sidebar .btn { background: transparent; color: #fff; border-color: #55534c; }
.sidebar .btn .count { margin-left: 6px; background: #e9e6dc; color: #151513; border-radius: 999px; font-size: 11px; font-weight: 650; padding: 1px 7px; }
.whoami { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid #2c2c28; }
.whoami strong { display: block; color: #fff; font-size: 13.5px; font-weight: 600; }
.whoami small { display: block; font-size: 12px; color: #98958a; }
.avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #e9e6dc; color: #151513; font-size: 12px; font-weight: 650; }
.avatar.light { background: var(--bg); border: 1px solid var(--line); }

.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 9px 40px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 13px; color: var(--ink-2); }
.topbar .spacer { flex: 1; }
.cap::first-letter { text-transform: uppercase; }
.loading { padding: 48px; color: var(--muted); }
.content { padding: 30px 40px 96px; max-width: 1180px; }

/* Rubriker och kort */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.eyebrow { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.lead { color: var(--ink-2); margin-top: 6px; max-width: 68ch; }
.back { display: inline-block; margin-bottom: 10px; font-size: 13.5px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; }
.card > h2 { margin-bottom: 12px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 + p { margin-top: 2px; font-size: 13.5px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; }
.empty { color: var(--muted); padding: 6px 0; }
.empty-state { text-align: center; padding: 48px 22px; }
.empty-state p { margin: 6px auto 18px; max-width: 46ch; color: var(--ink-2); }
.note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 14px; }

/* Knappar och fält */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 14px; font-weight: 550; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #33332e; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; margin-bottom: 8px; }
.btn.selected { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--ink); font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); cursor: pointer; }
.link:hover { text-decoration-color: var(--ink); }
.link.danger { color: var(--red); }
.icon { width: 26px; height: 26px; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; line-height: 1; }
.icon:hover:not(:disabled) { border-color: var(--line-strong); color: var(--ink); }
.icon:disabled { opacity: 0.3; cursor: default; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

input[type="text"], input[type="search"], input[type="date"], input[type="time"], input[type="month"], input[type="file"], input[type="number"], input:not([type]), select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
}
select { -webkit-appearance: none; appearance: none; padding-right: 32px; background-repeat: no-repeat; background-position: right 11px center; background-size: 10px 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2375746c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
textarea { resize: vertical; line-height: 1.45; }
label { display: block; font-size: 13px; font-weight: 550; color: var(--ink-2); }
label > input, label > select, label > textarea { margin-top: 5px; font-weight: 400; color: var(--ink); }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.field { margin-top: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 550; color: var(--ink-2); margin-bottom: 6px; }
.search { margin-bottom: 8px; max-width: 360px; }

/* Etiketter */
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #eceae3; color: var(--ink-2); }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.amber { background: var(--amber-bg); color: var(--amber); }
.chip.red { background: var(--red-bg); color: var(--red); }
.chip.blue { background: var(--blue-bg); color: var(--blue); }
.chip.type-beslut { background: var(--ink); color: #fff; }
.chip.type-information, .chip.type-diskussion { background: none; border: 1px solid var(--line-strong); }

/* Rader */
.rows > li + li { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 14px; padding: 12px 4px; text-decoration: none; }
a.row:hover .row-main strong { text-decoration: underline; text-underline-offset: 3px; }
.row-main { flex: 1; min-width: 0; }
.row-main strong { display: block; font-weight: 600; }
.row-main small { display: block; font-size: 13px; color: var(--muted); }
.chev { color: var(--line-strong); font-size: 20px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); flex: none; }
.row.urgent .dot { background: var(--red); }
.datebox { width: 46px; flex: none; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 4px 0; background: var(--surface-2); }
.datebox b { display: block; font: 600 18px/1.1 var(--serif); }
.datebox i { display: block; font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.next-date { font: 600 20px/1.25 var(--serif); }
.next-date::first-letter { text-transform: uppercase; }
.next-title { font-weight: 600; margin-top: 6px; }
.next-meta { display: flex; align-items: center; gap: 10px; margin: 14px 0 16px; }

.people > li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.people > li + li { border-top: 1px solid var(--line); }
.people .chip + .chip { margin-left: -4px; }
.people .link { white-space: nowrap; }
.people + p { margin-top: 10px; }

.files { display: grid; gap: 6px; margin: 8px 0; }
.files li { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.files li small { margin-left: auto; font-size: 12.5px; }
.files li .icon { margin-left: 2px; }
.file { font: 600 10px/1 var(--mono); padding: 4px 5px; border-radius: 4px; background: #eceae3; color: var(--ink-2); }
.group { margin: 16px 0 4px; }
.group:first-of-type { margin-top: 0; }

/* Tabeller */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 6px 10px 8px 0; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .narrow { width: 28px; }
.table tr.done td { color: var(--muted); }
.table tr.done td:nth-child(2) { text-decoration: line-through; }
.table input[type="checkbox"] { width: 16px; height: 16px; margin-top: 3px; accent-color: var(--ink); }

.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 8px 0; text-decoration: none; font-weight: 550; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--ink); }
.tabs a .muted { font-weight: 400; font-size: 13px; }

.decision { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; padding: 14px 0; }
.decision + .decision { border-top: 1px solid var(--line); }
.decision-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 13.5px; }
.decision h3 { margin-bottom: 2px; }

/* Uppföljning: kryssrutor för beslut, uppdrag och föregående protokoll */
.follows > li { border-top: 1px solid var(--line); }
.follow { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; padding: 14px 0; }
.follow > input, .follow-sub input { width: 17px; height: 17px; margin: 3px 0 0; accent-color: var(--ink); cursor: pointer; }
.follow > input:disabled, .follow-sub input:disabled { cursor: default; }
.follow-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.follow-src { margin-left: auto; font-size: 13px; color: var(--muted); }
.follow.done .follow-head strong, .follow-sub li.done label span { color: var(--muted); text-decoration: line-through; }
.follow.done .pre { color: var(--muted); }
.follow-sub { display: grid; gap: 6px; margin-top: 8px; padding-left: 14px; border-left: 2px solid var(--line); }
.follow-sub.flat { margin-top: 0; padding-left: 0; border-left: 0; }
.follow-sub li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.follow-sub label { font-size: 14px; color: var(--ink); cursor: pointer; }
.follow-sub label input { margin: 0; }
.card-head .search { margin-bottom: 0; flex: none; width: 300px; }
.card-head .search + p { max-width: 46ch; text-align: right; }

/* Stegen i mötesflödet */
.stepper { display: grid; grid-template-columns: repeat(6, 1fr); margin-bottom: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stepper li + li { border-left: 1px solid var(--line); }
.step { display: flex; align-items: center; gap: 9px; padding: 12px 14px; text-decoration: none; font-size: 14px; font-weight: 550; color: var(--ink-2); height: 100%; }
a.step:hover { background: var(--surface-2); }
.num { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 650; border: 1.5px solid var(--line-strong); color: var(--muted); }
.stepper .done .num { background: var(--green); border-color: var(--green); color: #fff; }
.stepper .current .num { border-color: var(--ink); color: var(--ink); }
.stepper .locked .step { color: #a9a79e; }
.stepper .locked .num { border-style: dashed; }
.stepper .active { box-shadow: inset 0 -3px 0 var(--ink); }
.stepper .active .step { color: var(--ink); }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: var(--blue-bg); border: 1px solid #c9d8ee; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; }
.banner strong { display: block; }
.banner .muted { font-size: 13px; color: #3c5b86; }
.banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.agenda-item { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.nr { font: 600 15px/1.5 var(--serif); color: var(--muted); }
.ai-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ai-meta { font-size: 13px; color: var(--muted); margin-top: 1px; }
.ai-tools { display: flex; align-items: center; gap: 10px; align-self: start; }
.proposal { margin-top: 8px; padding: 8px 12px; border-left: 3px solid var(--ink); background: var(--surface-2); font-size: 14px; }
.proposal span { display: block; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.proposal.missing { border-left-color: var(--amber); background: var(--amber-bg); color: var(--amber); font-size: 13px; font-weight: 550; }

.next-step { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 4px; }
.next-step.sticky { position: sticky; bottom: 0; background: var(--bg); padding: 14px 0; border-top: 1px solid var(--line); justify-content: space-between; flex-wrap: wrap; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
.side { position: sticky; top: 16px; }
.checks li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 9px 0; }
.checks li + li { border-top: 1px solid var(--line); }
.checks p { font-size: 13px; color: var(--ink-2); }
.checks strong { font-size: 14px; }
.mark-ico { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 2px; }
.checks .ok .mark-ico { background: var(--green-bg); color: var(--green); }
.checks .warn .mark-ico { background: var(--amber-bg); color: var(--amber); }
.checks + .note, .checks + .btn { margin-top: 14px; }

.toggle { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 550; color: var(--muted); cursor: pointer; }
.toggle.on { background: var(--green-bg); border-color: #b9d8c6; color: var(--green); }
.toggle.on.warn { background: var(--amber-bg); border-color: #e3cf9a; color: var(--amber); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.quorum { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 10px 14px; border-radius: 8px; margin: 14px 0; font-size: 14px; }
.quorum.ok { background: var(--green-bg); color: var(--green); }
.quorum.bad { background: var(--red-bg); color: var(--red); }
.item-card label + label, .item-card .ai-title + label { margin-top: 12px; }
.action-add { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) 150px auto; gap: 8px; }
.facts { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 14px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts.stacked { grid-template-columns: 1fr; gap: 2px; margin-bottom: 12px; }
.facts.stacked dt { font-size: 12.5px; margin-top: 8px; }

/* Dokument: kallelse och protokoll */
.paper { background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 1px 2px rgba(22, 22, 20, 0.04), 0 12px 32px -18px rgba(22, 22, 20, 0.25); padding: 56px 64px 44px; font: 15.5px/1.6 var(--serif); color: #1b1b19; }
.paper p + p { margin-top: 12px; }
.doc-kind { text-align: center; font-size: 13px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; }
.doc-sub { text-align: center; font-style: italic; color: #55544e; margin-top: 4px !important; }
.doc-company { text-align: center; font-size: 26px; line-height: 1.2; margin-top: 2px !important; }
.doc-org { text-align: center; font-size: 13px; color: #55544e; margin: 4px 0 30px !important; padding-bottom: 22px; border-bottom: 1px solid #d9d6cc; }
.doc-facts { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 4px 16px; margin: 18px 0 24px; }
.doc-facts dt { font-style: italic; color: #55544e; }
.paper h4 { font: 700 15.5px/1.4 var(--serif); margin: 22px 0 4px; }
.doc-agenda { list-style: decimal; padding-left: 22px; margin-bottom: 18px; }
.doc-agenda li { padding: 2px 0; }
.doc-agenda small { display: block; font-size: 13px; color: #55544e; }
.doc-par textarea { font: inherit; margin-top: 4px; }
.doc-place { margin-top: 32px !important; }
.doc-sign { margin-top: 36px !important; }
.doc-sign span { font-style: italic; color: #55544e; }
.doc-signers { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 24px; margin-top: 34px; }
.doc-signers > div { display: flex; flex-direction: column; }
.sig-role { font-style: italic; color: #55544e; font-size: 14px; }
.sig-line { height: 40px; border-bottom: 1px solid #1b1b19; display: flex; align-items: flex-end; padding-bottom: 4px; }
.sig-line em { font: 600 11.5px/1.2 var(--sans); font-style: normal; color: var(--green); }
.sig-name { font-size: 14px; margin-top: 4px; }
.doc-foot { margin-top: 44px !important; padding-top: 12px; border-top: 1px solid #d9d6cc; text-align: center; font-size: 12px; color: #77766e; }

/* Årshjul */
.year { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.month { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-height: 132px; }
.month h3 { font: 600 16px/1.2 var(--serif); text-transform: capitalize; margin-bottom: 8px; }
.month.passed { background: var(--surface-2); }
.month.passed h3 { color: var(--muted); }
.month.now { border-color: var(--ink); box-shadow: inset 0 3px 0 var(--ink); }
.month li { position: relative; padding: 3px 0 3px 14px; font-size: 13.5px; line-height: 1.4; }
.month li::before, .legend span::before { content: ""; position: absolute; left: 0; top: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.month li.none { padding-left: 0; color: var(--muted); }
.month li.none::before { display: none; }
.k-mote::before { background: var(--ink) !important; }
.k-stamma::before { background: var(--blue) !important; }
.legend { display: flex; gap: 22px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.legend span { position: relative; padding-left: 14px; }
.legend span::before { top: 6px; }

.table .tools { text-align: right; }
.table .tools .link + .link { margin-left: 12px; }
input[type="email"], input[type="password"], input[readonly] { width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
input[readonly] { background: var(--surface-2); font-family: var(--mono); font-size: 13px; }

/* Ekonomi */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--surface-2); }
.kpi span { display: block; font-size: 12.5px; color: var(--muted); }
.kpi strong { display: block; font: 600 22px/1.3 var(--serif); font-variant-numeric: tabular-nums; }
.kpi small { display: block; font-size: 12.5px; color: var(--ink-2); }
.kpi.warn { background: var(--amber-bg); border-color: #e3cf9a; }
.kpi.bad { background: var(--red-bg); border-color: #e9bdb8; }
.quorum.warn { background: var(--amber-bg); color: var(--amber); }
.amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table.fin th.amount { text-align: right; }
.table.fin td:first-child { width: 34%; }
.fin-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(2, 130px); gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.fin-row.head { border-top: 0; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding-top: 10px; }
.fin-row.total { font-weight: 650; border-top-color: var(--line-strong); }
.fin-row.account { border-top: 0; padding: 3px 0; color: var(--ink-2); font-size: 13px; }
.fin-row.account > span:first-child { padding-left: 32px; }
/* Rader med en enda beloppskolumn, som i balansräkningen. */
.fin-row:has(> .amount:nth-child(2):last-child) { grid-template-columns: minmax(0, 1fr) 130px; }
.fin-line > summary { cursor: pointer; list-style: none; }
.fin-line > summary::-webkit-details-marker { display: none; }
.fin-row > span:first-child { position: relative; padding-left: 16px; }
.fin-row.head > span:first-child, .fin-row.total > span:first-child { padding-left: 0; }
.fin-line > summary > span:first-child::before { content: "›"; position: absolute; left: 2px; top: 0; color: var(--muted); transition: transform 0.15s; }
.fin-line[open] > summary > span:first-child::before { transform: rotate(90deg); }
.fin-line[open] { padding-bottom: 6px; }
.rule { border: 0; border-top: 1px solid var(--line-strong); margin: 26px 0; }
.section { font: 600 18px/1.3 var(--serif); margin-bottom: 12px; }
.field .check + .check { margin-top: 6px; }

.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Rapporter */
.report { padding: 14px 0; }
.report .follow-head a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.report .follow-head a:hover { text-decoration-color: var(--ink); }
.report.old .follow-head a, .report.old .pre { color: var(--muted); }
.report p { margin-top: 4px; }
.report-tools { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
textarea.code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); white-space: pre; }
code { font-family: var(--mono); font-size: 0.92em; }

/* Inloggning och aktivering */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { min-width: 0; width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 32px; display: grid; gap: 16px; }
.auth-card.wide-card { width: min(520px, 100%); }
.auth-card form { display: grid; gap: 14px; }
.auth-card h2 { margin-top: 10px; }
.auth-card .lead { margin-top: 0; }
.auth-card .btn.wide { margin-bottom: 0; }

/* Dialog och meddelande */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 24px 64px -16px rgba(22, 22, 20, 0.45); color: var(--ink); }
dialog::backdrop { background: rgba(22, 22, 20, 0.45); }
.dialog-form { padding: 24px; display: grid; gap: 14px; }
.dialog-form h2 { font: 600 20px/1.2 var(--serif); }
.dialog-form .note { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.waiting { justify-items: center; text-align: center; padding: 40px 24px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--ink); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); max-width: min(560px, calc(100vw - 32px)); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 20; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Smalare fönster */
@media (max-width: 1080px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  .year { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  /* Menyn ligger bakom en knapp i en rad som följer med överst på skärmen. */
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 10; height: auto; gap: 0; padding: 10px 16px; }
  .brand { padding: 0; }
  .brand .mark { width: 30px; height: 30px; }
  .sidebar .menu-toggle, .sidebar .menu-logout { display: inline-flex; }
  .sidebar .menu-toggle { padding: 8px 14px; font-size: 14px; }
  .menu { display: none; }
  .menu-open .menu { display: flex; gap: 10px; padding-top: 10px; max-height: calc(100vh - 64px); overflow-y: auto; }
  .nav a { padding: 12px 10px; font-size: 16px; }
  .whoami { margin-top: 4px; padding: 12px 6px 6px; }
  .menu-logout { margin-left: auto; }
  .topbar { display: none; }
  .content { padding: 22px 16px 80px; }

  /* Skrivfält under 16 px får Safari på iPhone att zooma in sidan. */
  input, select, textarea, input[readonly] { font-size: 16px; }
  h1 { font-size: 26px; }
  .page-head { flex-wrap: wrap; }
  .card { padding: 16px; }
  .card-head { flex-direction: column; align-items: stretch; }
  .card-head .search { width: 100%; }
  .card-head .search + p { text-align: left; max-width: none; }
  .people > li { flex-wrap: wrap; }
  .people .row-main { flex-basis: calc(100% - 46px); }
  .icon { width: 38px; height: 38px; font-size: 18px; }
  .link { padding: 6px 0; }
  .report-tools, .ai-tools { flex-wrap: wrap; }
  .follow-src { margin-left: 0; flex-basis: 100%; }
  .next-step { justify-content: stretch; }
  .next-step .btn { width: 100%; white-space: normal; }
  .banner-actions .btn { flex: 1; }
  .tabs { gap: 16px; overflow-x: auto; }
  .fin-row { grid-template-columns: minmax(0, 1fr) repeat(2, 92px); gap: 8px; }
  .fin-row:has(> .amount:nth-child(2):last-child) { grid-template-columns: minmax(0, 1fr) 100px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi strong { font-size: 18px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .stepper { grid-template-columns: repeat(3, 1fr); }
  .stepper li:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .stepper li:nth-child(4) { border-left: 0; }
  .paper { padding: 32px 22px; }
  .doc-facts, .decision { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .agenda-item { grid-template-columns: 24px minmax(0, 1fr); }
  .ai-tools { grid-column: 2; }
  .action-add { grid-template-columns: minmax(0, 1fr); }
  .year { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table { display: block; overflow-x: auto; }
}
@media (max-width: 480px) {
  .year { grid-template-columns: minmax(0, 1fr); }
  .month { min-height: 0; }
  .stepper { grid-template-columns: repeat(2, 1fr); }
  .stepper li:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .stepper li:nth-child(odd) { border-left: 0; }
  .stepper li:nth-child(4) { border-left: 1px solid var(--line); }
  .dialog-form { padding: 18px; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .btn { flex: 1; }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .page-head, .back, .stepper, .side, .banner, #toast { display: none !important; }
  .layout, .split { display: block; }
  .content { padding: 0; max-width: none; }
  .paper { border: 0; box-shadow: none; padding: 0; }
}
