:root {
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #0f172a;
    --color-muted: #64748b;
    --color-border: #e2e8f0;
    --color-primary: #1d4ed8;
    --color-reported: #64748b;
    --color-wrong: #dc2626;
    --color-wrong-bg: #fef2f2;
    --color-refund: #15803d;
    --color-refund-bg: #f0fdf4;
    --color-accent: #0ea5e9;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --max-width: 980px;
}

* { box-sizing: border-box; }
/* 14px ≈ 80 % av tidigare 18px-bas — mer kompakt utan att användaren behöver zooma */
html { font-size: 14px; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.45;
}

a { color: var(--color-primary); text-decoration-thickness: 2px; }
a:hover { text-decoration: underline; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 1rem 1.25rem; }

.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header .inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.5rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    justify-content: space-between;
}
.brand { font-weight: 700; font-size: 1rem; color: var(--color-text); text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; font-size: 0.875rem; }
.nav a { color: var(--color-muted); text-decoration: none; padding: 0.25rem 0; }
.nav a:hover, .nav a.active { color: var(--color-primary); }

.hero-box {
    background: linear-gradient(135deg, #eff6ff, #f0fdf4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}
.hero-box h1 { margin-top: 0; font-size: 1.45rem; line-height: 1.25; margin-bottom: 0.5rem; }
.lead { font-size: 1rem; color: var(--color-muted); margin: 0.35rem 0 0; }

.summary-strip {
    background: var(--color-refund-bg);
    border: 2px solid #86efac;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    text-align: center;
}
.summary-strip .amount { font-size: 1.85rem; font-weight: 800; color: var(--color-refund); display: block; line-height: 1.2; }
.summary-strip .label { font-size: 0.9rem; color: var(--color-muted); }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}
.card h2, .card h3 { margin-top: 0; margin-bottom: 0.6rem; font-size: 1.15rem; }
.card h2 { font-size: 1.25rem; }

.important-first {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0 var(--radius) var(--radius) 0;
}
.important-first strong { display: block; margin-bottom: 0.25rem; }

.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li {
    counter-increment: step;
    padding: 0.75rem 0.75rem 0.75rem 3rem;
    position: relative;
    margin-bottom: 0.5rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}
.steps li::before {
    content: counter(step);
    position: absolute;
    left: 1rem;
    top: 1rem;
    width: 2rem;
    height: 2rem;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.amount-reported { color: var(--color-reported); font-weight: 600; }
.amount-wrong { color: var(--color-wrong); font-weight: 700; }
.amount-refund { color: var(--color-refund); font-weight: 700; }

.year-grid { display: grid; gap: 0.75rem; }
@media (min-width: 640px) { .year-grid { grid-template-columns: repeat(2, 1fr); } }
.year-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.year-card:hover { border-color: var(--color-primary); box-shadow: 0 4px 12px rgba(29,78,216,0.12); }
.year-card .year-label { font-size: 1.5rem; font-weight: 800; color: var(--color-primary); line-height: 1.2; }
.year-card .wrong { font-size: 1.2rem; font-weight: 700; color: var(--color-wrong); }

.btn {
    display: inline-block;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-primary { background: var(--color-primary); color: white; }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); }
.btn:hover { opacity: 0.92; }

.simpler-toggle {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--color-primary);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}
.simpler-panel {
    display: none;
    margin-top: 0.75rem;
    padding: 1rem;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 0.95rem;
}
.simpler-panel.open { display: block; }

.term {
    border-bottom: 1px dotted var(--color-muted);
    cursor: help;
    position: relative;
    color: var(--color-primary);
}
.term:focus { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 2px; }
.term:hover::after, .term:focus::after {
    content: attr(data-tip);
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 0.4rem;
    z-index: 200;
    width: max-content;
    max-width: 300px;
    background: var(--color-text);
    color: #fff;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.45;
    font-weight: 400;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.25);
}
.tooltip-wrap { position: relative; display: inline; }

.amount-link { text-decoration: none; border-bottom: 2px solid transparent; }
.amount-link:hover, .amount-link:focus { border-bottom-color: currentColor; }
.summary-strip .amount-link .amount { text-decoration: underline; text-decoration-thickness: 3px; }

.threemin { border-left: 4px solid var(--color-primary); }
.threemin-list { padding-left: 1.25rem; }
.threemin-list li { margin-bottom: 0.6rem; }

.rule-figure {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin: 1.25rem 0;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius);
}
.rule-col { flex: 1; text-align: center; }
.rule-bar {
    height: 96px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    background: #fff;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}
.rule-fill { width: 100%; }
.rule-fill-ok { background: var(--color-refund); }
.rule-fill-bad { background: var(--color-wrong); }
.rule-cap { font-size: 0.9rem; margin-top: 0.5rem; font-weight: 600; }
.rule-verdict { font-size: 0.85rem; margin-top: 0.25rem; font-weight: 700; }
.rule-verdict-ok { color: var(--color-refund); }
.rule-verdict-bad { color: var(--color-wrong); }
.rule-line {
    align-self: stretch;
    border-left: 2px dashed var(--color-wrong);
    display: flex;
    align-items: center;
}
.rule-line span {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 0.75rem;
    color: var(--color-wrong);
    padding: 0 0.25rem;
    font-weight: 600;
}

table.data { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.data th, table.data td { padding: 0.45rem 0.55rem; text-align: left; border-bottom: 1px solid var(--color-border); }
table.data th { background: #f1f5f9; font-weight: 600; }
table.data tr:hover td { background: #f8fafc; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge-ok { background: #dcfce7; color: #166534; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-wrong { background: #fee2e2; color: #991b1b; }

table.data tr.row-wrong td { background: #fef2f2; }
table.data tr.row-wrong:hover td { background: #fee2e2; }
table.data tr.row-ok td { background: #f0fdf4; }
table.data tr.row-ok:hover td { background: #dcfce7; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 0.25rem; }
table.data-ownership { min-width: 720px; }
table.data-ownership th.num,
table.data-ownership td.num {
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
table.data-ownership td.col-year { white-space: nowrap; }
table.data-ownership .num-main { display: block; }
table.data-ownership .innehav-split { white-space: nowrap; margin-top: 0.15rem; }
table.data-ownership td.kallor { font-size: 0.8rem; line-height: 1.4; vertical-align: top; min-width: 10rem; }
a.source-link { white-space: nowrap; }

.muted-small { color: var(--color-muted); font-size: 0.85rem; }

.pill { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.pill-bad { background: #fee2e2; color: #991b1b; }
.pill-ok { background: #dcfce7; color: #166534; }
.pill-warn { background: #fef3c7; color: #92400e; }
.vp-box { background: #f8fafc; border: 1px solid var(--color-border); border-radius: 8px; padding: 0.75rem 1rem; margin: 0.75rem 0; font-size: 0.92rem; }
.source-row { margin-top: 0.75rem; padding-top: 0.6rem; border-top: 1px solid var(--color-border); font-size: 0.9rem; }
.source-row a { white-space: nowrap; }

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.filters input, .filters select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.9rem;
}

.pdf-viewer { width: 100%; height: 75vh; border: 1px solid var(--color-border); border-radius: var(--radius); }

.timeline { list-style: none; padding: 0; border-left: 3px solid var(--color-border); margin-left: 1rem; }
.timeline li { padding: 0 0 1rem 1.25rem; position: relative; }
.timeline li::before {
    content: '';
    position: absolute;
    left: -0.55rem;
    top: 0.35rem;
    width: 0.9rem;
    height: 0.9rem;
    background: var(--color-primary);
    border-radius: 50%;
    border: 2px solid white;
}

.login-box { max-width: 380px; margin: 2.5rem auto; }
.login-box input { width: 100%; padding: 0.55rem 0.65rem; margin-bottom: 0.75rem; border: 1px solid var(--color-border); border-radius: 6px; font-size: 0.9rem; }

.alert-error { background: var(--color-wrong-bg); color: var(--color-wrong); padding: 0.55rem 0.65rem; border-radius: 6px; margin-bottom: 0.75rem; font-size: 0.9rem; }
.alert-success { background: var(--color-refund-bg); color: var(--color-refund); padding: 0.55rem 0.65rem; border-radius: 6px; margin-bottom: 0.75rem; font-size: 0.9rem; }

.form-field { margin-bottom: 0.75rem; }
.form-field label { display: block; font-weight: 600; margin-bottom: 0.25rem; font-size: 0.9rem; }
.form-input { width: 100%; padding: 0.55rem 0.65rem; border: 1px solid var(--color-border); border-radius: 6px; font-size: 0.9rem; }
.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check label { margin: 0; font-weight: 500; }
.form-check input { width: auto; }
.form-field ul { color: var(--color-wrong); margin: 0.25rem 0 0; padding-left: 1.25rem; font-size: 0.9rem; }

.btn-danger { background: var(--color-wrong); color: white; }

.tour-banner {
    background: #eff6ff;
    border: 1px dashed var(--color-primary);
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.site-footer {
    margin-top: 2rem;
    padding-bottom: 1.25rem;
    color: var(--color-muted);
    font-size: 0.8rem;
}

@media print {
    .site-header, .nav, .btn, .simpler-toggle, .no-print { display: none !important; }
    body { background: white; font-size: 12pt; }
    .card { break-inside: avoid; box-shadow: none; }
}

@media (max-width: 600px) {
    html { font-size: 13px; }
    .summary-strip .amount { font-size: 1.6rem; }
}

.md-preview .md-raw {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.45;
    margin: 0;
    max-height: 70vh;
    overflow: auto;
}

/* ========== Skin: beloppsspärr / hub / auth ========== */
body.skin-belopp,
body.skin-hub,
body.skin-auth {
    --bp-ink: #14201c;
    --bp-ink-soft: #3d4f48;
    --bp-muted: #6b7c74;
    --bp-accent: #c45c26;
    --bp-accent-soft: #f3e0d4;
    --bp-line: #e6ebe8;
    --bp-paper: #ffffff;
    --bp-side: #1a2e28;
    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-body: "Source Sans 3", "Segoe UI", sans-serif;
    font-family: var(--font-body);
    color: var(--bp-ink);
    background-color: var(--bp-side);
    background-image:
        radial-gradient(ellipse 90% 60% at 10% -10%, rgba(196, 92, 38, 0.28), transparent 55%),
        radial-gradient(ellipse 70% 50% at 100% 20%, rgba(120, 160, 140, 0.18), transparent 50%),
        radial-gradient(ellipse 50% 40% at 50% 100%, rgba(0, 0, 0, 0.35), transparent 60%),
        linear-gradient(165deg, #243d35 0%, #152822 42%, #0f1a16 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

body.skin-belopp .site-header,
body.skin-hub .site-header,
body.skin-auth .site-header {
    background: rgba(15, 26, 22, 0.72);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
body.skin-belopp .site-header .inner,
body.skin-hub .site-header .inner,
body.skin-auth .site-header .inner {
    max-width: 880px;
}
body.skin-belopp .brand,
body.skin-hub .brand,
body.skin-auth .brand {
    font-family: var(--font-display);
    font-weight: 650;
    font-size: 1.15rem;
    color: #f4f7f5;
    letter-spacing: -0.02em;
}
body.skin-belopp .nav a,
body.skin-hub .nav a,
body.skin-auth .nav a {
    color: rgba(244, 247, 245, 0.62);
    font-weight: 500;
}
body.skin-belopp .nav a:hover,
body.skin-belopp .nav a.active,
body.skin-hub .nav a:hover,
body.skin-hub .nav a.active {
    color: #fff;
}
body.skin-belopp .nav-switch,
body.skin-hub .nav-switch {
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    padding-left: 0.75rem !important;
    margin-left: 0.15rem;
    color: #f0c9b0 !important;
    font-weight: 600;
}
body.skin-belopp .nav-zip { font-weight: 600; }

body.skin-belopp .container-paper {
    max-width: 1280px;
    padding: 1.25rem 1rem 2.5rem;
}
body.skin-belopp .card {
    background: #fff;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
body.skin-belopp .pdf-viewer {
    background: #fff;
    border-radius: 12px;
    border-color: var(--bp-line);
}
body.skin-belopp .site-footer,
body.skin-hub .site-footer,
body.skin-auth .site-footer {
    color: rgba(244, 247, 245, 0.45);
    max-width: 820px;
    text-align: center;
}

body.skin-belopp a { color: #9a4a1c; }
body.skin-belopp .btn-primary {
    background: var(--bp-ink);
    color: #fff;
    border-radius: 999px;
    padding: 0.55rem 1.15rem;
}
body.skin-belopp .btn-secondary {
    background: transparent;
    color: var(--bp-ink);
    border: 1px solid var(--bp-line);
    border-radius: 999px;
    padding: 0.55rem 1.15rem;
}
body.skin-belopp .btn-primary:hover,
body.skin-belopp .btn-secondary:hover { opacity: 0.9; text-decoration: none; }

/* Vitt papper i mitten */
body.skin-belopp .letter {
    background: var(--bp-paper);
    color: var(--bp-ink);
    border-radius: 18px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.06) inset,
        0 24px 60px rgba(0, 0, 0, 0.35),
        0 2px 8px rgba(0, 0, 0, 0.2);
    padding: 2.25rem 2.4rem 2.75rem;
    max-width: none;
    margin: 0;
    animation: letter-in 0.45s ease-out;
}
@keyframes letter-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 640px) {
    body.skin-belopp .letter { padding: 1.4rem 1.15rem 2rem; border-radius: 14px; }
}

.letter-kicker {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bp-accent);
    margin: 0 0 0.5rem;
}
.letter-kicker a { color: inherit; text-decoration: none; }
.letter-kicker a:hover { text-decoration: underline; }
.letter-header h1 {
    font-family: var(--font-display);
    font-weight: 650;
    font-size: clamp(1.65rem, 3.5vw, 2.15rem);
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin: 0 0 0.45rem;
    color: var(--bp-ink);
}
.letter-sub {
    margin: 0 0 1.25rem;
    color: var(--bp-muted);
    font-size: 1.02rem;
    max-width: 36em;
}
.letter-meta {
    display: grid;
    gap: 0.55rem 1.25rem;
    margin: 0 0 1.25rem;
    padding: 0.9rem 0;
    border-top: 1px solid var(--bp-line);
    border-bottom: 1px solid var(--bp-line);
    font-size: 0.92rem;
}
@media (min-width: 560px) {
    .letter-meta { grid-template-columns: 1fr 1fr; }
}
.letter-meta div { display: grid; grid-template-columns: 3.5rem 1fr; gap: 0.4rem; }
.letter-meta dt { color: var(--bp-muted); font-weight: 600; margin: 0; }
.letter-meta dd { margin: 0; font-weight: 500; }
.letter-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin: 0 0 1rem;
}
.letter-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0;
}
.letter-jump a {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: #f3f6f4;
    color: var(--bp-ink-soft) !important;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.15s, color 0.15s;
}
.letter-jump a:hover {
    background: var(--bp-accent-soft);
    color: var(--bp-accent) !important;
}

.letter-body {
    font-size: 1.05rem;
    line-height: 1.62;
    color: var(--bp-ink-soft);
}
.letter-body > p { margin: 0 0 1rem; }
.letter-body strong { color: var(--bp-ink); font-weight: 650; }
.letter-callout {
    margin: 1.25rem 0 1.5rem;
    padding: 0.95rem 1.1rem;
    background: #faf6f2;
    border-left: 3px solid var(--bp-accent);
    border-radius: 0 10px 10px 0;
    color: var(--bp-ink);
    font-size: 0.98rem;
}
.letter-section {
    margin: 2.25rem 0 0;
    scroll-margin-top: 5rem;
}
.letter-section h2 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    margin: 0 0 0.35rem;
    padding: 0;
    border: 0;
    color: var(--bp-ink);
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
}
.sec-num {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--bp-accent);
}
.sec-lead {
    margin: 0 0 1rem;
    color: var(--bp-muted);
    font-size: 0.95rem;
}
.letter-section h3 {
    font-family: var(--font-display);
    font-size: 1.08rem;
    font-weight: 600;
    margin: 1.35rem 0 0.4rem;
    color: var(--bp-ink);
}

/* Inramade steg i §00 — känns “betade av” */
.letter-step {
    margin: 1.15rem 0 1.35rem;
    padding: 1.1rem 1.2rem 1.15rem;
    background: #fff;
    border: 1px solid var(--bp-line);
    border-left: 4px solid var(--bp-accent);
    border-radius: 0 12px 12px 0;
    box-shadow: 0 1px 0 rgba(20, 32, 28, 0.04);
}
.letter-step + .letter-step { margin-top: 1.5rem; }
.letter-step-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.55rem 0.85rem;
    margin-bottom: 0.55rem;
}
.letter-step-num {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--bp-accent);
}
.letter-step h3 {
    margin: 0;
    font-size: 1.12rem;
}
.letter-step > p:last-child,
.letter-step > .att-row:last-child { margin-bottom: 0; }

.letter-glossary {
    margin: 0 0 0.9rem;
    padding: 0.85rem 1rem;
    background: #f7faf8;
    border: 1px solid var(--bp-line);
    border-radius: 10px;
    font-size: 0.94rem;
}
.letter-glossary strong {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--bp-ink);
}
.letter-glossary p { margin: 0 0 0.5rem; }
.letter-glossary ul {
    margin: 0;
    padding-left: 1.15rem;
}
.letter-glossary li { margin: 0.2rem 0; }

.letter-consequence-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin: 0.85rem 0 1rem;
}
@media (max-width: 720px) {
    .letter-consequence-grid { grid-template-columns: 1fr; }
}
.letter-consequence {
    padding: 0.9rem 1rem;
    background: #fafbfa;
    border: 1px solid var(--bp-line);
    border-radius: 12px;
}
.letter-consequence-main {
    background: #fff;
    border-color: #d8c0b0;
    box-shadow: 0 0 0 3px var(--bp-accent-soft);
}
.letter-consequence h4 {
    margin: 0.4rem 0 0.35rem;
    font-family: var(--font-display);
    font-size: 1.02rem;
    font-weight: 650;
}
.letter-consequence p { margin: 0; font-size: 0.92rem; }

.letter-bridge {
    margin: 1.5rem 0 0;
    padding-top: 1rem;
    border-top: 1px dashed var(--bp-line);
    color: var(--bp-ink-soft);
    font-size: 0.95rem;
}

/* As-of tipp-räknare */
.asof-desk {
    margin: 1.35rem 0 0.5rem;
    padding: 1.1rem 1.15rem 1.2rem;
    background: #faf8f6;
    border: 1px solid var(--bp-line);
    border-radius: 12px;
}
.asof-desk h3 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}
.asof-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.75rem 0 0.85rem;
}
.asof-chip {
    appearance: none;
    border: 1px solid var(--bp-line);
    background: #fff;
    color: var(--bp-ink);
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}
.asof-chip:hover { border-color: #c9b0a0; }
.asof-chip.is-active {
    background: var(--bp-accent-soft);
    border-color: #d8c0b0;
    color: #7a3d18;
}
.asof-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bp-muted);
    margin-bottom: 0.3rem;
}
.asof-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}
.asof-input {
    flex: 1 1 12rem;
    min-width: 10rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--bp-line);
    border-radius: 8px;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}
.asof-status {
    margin: 0.65rem 0 0.4rem;
    font-size: 0.9rem;
    color: var(--bp-muted);
}
.asof-status.is-error { color: #a33; }
.asof-totals { margin: 0.55rem 0 0.15rem; font-size: 0.95rem; }
.asof-delta { margin: 0; }
.asof-table tr.asof-emission-row td { background: #f7f0ea; }
.asof-table tr.asof-owner-sum td {
    border-top: 1px solid #d8cfc6;
    background: #faf8f6;
    font-size: 0.92em;
}
body.skin-belopp table.data {
    font-size: 0.92rem;
    border: 1px solid var(--bp-line);
    border-radius: 10px;
    overflow: hidden;
}
body.skin-belopp table.data th {
    background: #f5f8f6;
    color: var(--bp-muted);
    font-weight: 600;
}
body.skin-belopp table.data td.col-main { color: var(--bp-ink); }
body.skin-belopp .muted-small { color: var(--bp-muted); }

.letter-claim {
    background: #fafbfa;
    border: 1px solid var(--bp-line);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    margin-bottom: 0.7rem;
}
.letter-claim-main {
    background: #fff;
    border: 1px solid #d8c0b0;
    box-shadow: 0 0 0 3px var(--bp-accent-soft);
}
.letter-claim-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.4rem;
}
.tipp-date {
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--bp-ink);
    letter-spacing: -0.02em;
}
body.skin-belopp .badge {
    border-radius: 6px;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
body.skin-belopp .badge-ok { background: #e5f2ea; color: #1d5c3a; }
body.skin-belopp .badge-pending { background: #f3eee8; color: #7a4a28; }

.letter-aside {
    background: #f7f9f8;
    border: 1px solid var(--bp-line);
    border-radius: 12px;
    padding: 0.95rem 1.1rem;
    margin: 0.9rem 0;
    font-size: 0.95rem;
}
.letter-aside strong { display: block; margin-bottom: 0.35rem; color: var(--bp-ink); }
.letter-aside ul { margin: 0.35rem 0 0.6rem; padding-left: 1.15rem; }
.letter-aside p:last-child { margin-bottom: 0; }

.letter-timeline {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    border-left: 2px solid var(--bp-line);
}
.letter-timeline li {
    padding: 0 0 1.1rem 1.2rem;
    position: relative;
}
.letter-timeline li::before {
    content: '';
    position: absolute;
    left: -0.4rem;
    top: 0.4rem;
    width: 0.65rem;
    height: 0.65rem;
    background: var(--bp-accent);
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--bp-accent-soft);
}
.letter-timeline .tl-title {
    display: block;
    font-weight: 650;
    color: var(--bp-ink);
    margin-top: 0.1rem;
}
.letter-timeline .muted-small { display: block; margin-top: 0.2rem; }

.letter-att-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
}
.letter-att-list li {
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--bp-line);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    align-items: baseline;
}
.letter-att-list a { font-weight: 600; text-decoration: none; }
.letter-att-list a:hover { text-decoration: underline; }
.att-actions { font-size: 0.85rem; color: var(--bp-muted); margin-left: auto; }
.att-actions a { font-weight: 500; color: var(--bp-muted); }

.letter-signoff {
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--bp-line);
    font-size: 1.05rem;
    color: var(--bp-ink);
}

.att-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    margin: 0.55rem 0 0;
}
.att-chip {
    display: inline-block;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    background: #f3f6f4;
    border: 1px solid var(--bp-line);
    color: var(--bp-ink-soft) !important;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.att-chip:hover {
    background: var(--bp-accent-soft);
    border-color: #e0b89a;
    color: var(--bp-accent) !important;
}
.att-chip-missing {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b !important;
}

/* Hub */
body.skin-hub .container {
    max-width: 880px;
    padding: 2.5rem 1.25rem 3rem;
}
.hub-shell { color: #f4f7f5; }
.hub-intro h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 2.6rem);
    font-weight: 650;
    letter-spacing: -0.03em;
    margin: 0.2rem 0 0.5rem;
    color: #fff;
}
.hub-lead {
    color: rgba(244, 247, 245, 0.7);
    font-size: 1.1rem;
    max-width: 32em;
    margin: 0 0 1.75rem;
}
body.skin-hub .letter-kicker { color: #e8a57a; }
.workspace-grid {
    display: grid;
    gap: 1rem;
}
@media (min-width: 720px) {
    .workspace-grid { grid-template-columns: 1fr 1fr; }
}
.workspace-card {
    display: block;
    text-decoration: none !important;
    color: var(--bp-ink);
    background: #fff;
    border: 0;
    border-radius: 16px;
    padding: 1.5rem 1.5rem 1.35rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.workspace-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.34);
}
.workspace-card .track-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--bp-accent);
    margin: 0 0 0.45rem;
}
.workspace-card h2 {
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    margin: 0 0 0.45rem;
    color: var(--bp-ink);
}
.workspace-card p {
    margin: 0;
    color: var(--bp-muted);
    font-size: 0.98rem;
    line-height: 1.45;
}
.workspace-cta {
    display: inline-block;
    margin-top: 1.15rem;
    font-weight: 700;
    color: var(--bp-accent);
}
.workspace-card-isk .track-label { color: #2f6b8a; }
.workspace-card-isk .workspace-cta { color: #2f6b8a; }

body.skin-auth .container { max-width: 420px; padding-top: 3rem; }
body.skin-auth .login-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    padding: 1.75rem;
}
body.skin-auth .login-box h1 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}

/* Desk: brev + smal bilagelista; preview i stor modal */
.desk {
    display: grid;
    gap: 1rem;
    align-items: start;
}
@media (min-width: 1000px) {
    .desk {
        /* Tidigare rail ~360–420px → nu smalare lista */
        grid-template-columns: minmax(0, 1fr) minmax(200px, 240px);
        gap: 1rem;
    }
}
.desk-letter { min-width: 0; }
.desk-rail {
    position: sticky;
    top: 4.25rem;
    max-height: calc(100vh - 5rem);
}
.desk-att-panel {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 5rem);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
.desk-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--bp-line);
}
.desk-panel-head h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 650;
    color: var(--bp-ink);
}
.desk-zip {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--bp-accent) !important;
    text-decoration: none !important;
}
.desk-hint {
    margin: 0;
    padding: 0.4rem 0.75rem 0;
    font-size: 0.74rem;
    color: var(--bp-muted);
    line-height: 1.35;
}
.desk-att-list {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0 0.45rem;
    overflow: auto;
}
.desk-att-list li { border-bottom: 1px solid var(--bp-line); }
.desk-att-list a {
    display: block;
    padding: 0.5rem 0.75rem;
    text-decoration: none !important;
    color: var(--bp-ink);
}
.desk-att-list a:hover,
.desk-att-list a.is-active {
    background: #faf6f2;
}
.desk-att-list a.is-active { box-shadow: inset 3px 0 0 var(--bp-accent); }
.desk-att-title {
    display: block;
    font-size: 0.8rem;
    font-weight: 650;
    line-height: 1.3;
}
.desk-att-group {
    display: block;
    font-size: 0.68rem;
    color: var(--bp-muted);
    margin-top: 0.12rem;
}
.desk-att-missing {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: #991b1b;
}
.desk-preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    justify-content: flex-end;
}
.btn-sm {
    padding: 0.28rem 0.65rem !important;
    font-size: 0.78rem !important;
}
.desk-zoom {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin-right: 0.25rem;
}
.desk-zoom-label {
    min-width: 3.4rem;
    border: 0;
    background: transparent;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--bp-ink-soft);
    cursor: pointer;
    padding: 0.2rem;
}
.desk-zoom-hint {
    margin: 0;
    padding: 0.4rem 0.85rem 0.55rem;
    font-size: 0.72rem;
    color: var(--bp-muted);
    text-align: center;
    border-top: 1px solid var(--bp-line);
    background: #fafbfa;
}

/* Modal: ~50 % bredare än tidigare ~420px-panel → ~630px, plus höjd för läsbarhet */
.desk-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8, 14, 12, 0.62);
    z-index: 200;
    backdrop-filter: blur(3px);
}
.desk.is-previewing .desk-backdrop {
    display: block;
}
.desk-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 210;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    pointer-events: none;
}
.desk.is-previewing .desk-modal {
    display: flex;
}
.desk-modal-dialog {
    pointer-events: auto;
    width: min(94vw, 630px); /* 420 × 1.5 */
    max-height: min(92vh, 920px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: desk-modal-in 0.22s ease-out;
}
@keyframes desk-modal-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.desk-modal-head {
    flex: 0 0 auto;
    gap: 0.75rem;
}
.desk-modal-head h2 {
    font-size: 1rem;
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.desk-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background: #eef1ef;
    overscroll-behavior: contain;
}
.desk-preview-empty {
    padding: 2rem 1.25rem;
    color: var(--bp-muted);
    font-size: 0.95rem;
    text-align: center;
}
.desk-preview-loading {
    padding: 2rem;
    text-align: center;
    color: var(--bp-muted);
    margin: 0;
}
.desk-preview-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
}
.desk-pdf-page {
    display: block;
    max-width: 100%;
    height: auto;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}
.desk-preview-md {
    margin: 0;
    padding: 1.15rem 1.35rem 1.5rem;
    min-height: 100%;
    max-width: 100%;
    background: #fff;
    color: var(--bp-ink);
    line-height: 1.5;
    overflow-x: hidden;
    box-sizing: border-box;
}
.desk-preview-pre {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
}
.md-doc {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}
.md-doc h1,
.md-doc h2,
.md-doc h3 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    color: var(--bp-ink);
    line-height: 1.25;
    margin: 1.25rem 0 0.5rem;
    overflow-wrap: anywhere;
}
.md-doc h1 { font-size: 1.35rem; margin-top: 0; }
.md-doc h2 { font-size: 1.15rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--bp-line); }
.md-doc h3 { font-size: 1.02rem; }
.md-doc p,
.md-doc li { font-size: 0.92rem; color: var(--bp-ink-soft); }
.md-doc p { margin: 0 0 0.75rem; }
.md-doc ul,
.md-doc ol { margin: 0 0 0.85rem; padding-left: 1.25rem; }
.md-doc li { margin-bottom: 0.3rem; }
.md-doc strong { color: var(--bp-ink); }
.md-doc code {
    font-size: 0.84em;
    background: #f3f6f4;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.md-doc pre {
    max-width: 100%;
    overflow-x: hidden;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    background: #f3f6f4;
    padding: 0.75rem 0.85rem;
    border-radius: 8px;
    font-size: 0.8rem;
}
.md-doc table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.74rem;
    margin: 0.75rem 0 1.1rem;
    border: 1px solid var(--bp-line);
    border-radius: 8px;
}
.md-doc th,
.md-doc td {
    padding: 0.4rem 0.4rem;
    border-bottom: 1px solid var(--bp-line);
    text-align: left;
    vertical-align: top;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
}
.md-doc th {
    background: #f5f8f6;
    font-weight: 650;
    color: var(--bp-muted);
}
.md-doc tr:last-child td { border-bottom: 0; }
/* Numeriska kolumner: högerställda men får bryta rad i smal modal */
.md-doc td:nth-child(n+2),
.md-doc th:nth-child(n+2) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
body.desk-modal-open { overflow: hidden; }

@media (max-width: 999px) {
    .desk-rail {
        position: static;
        max-height: none;
    }
    .desk-att-panel {
        max-height: none;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    }
    .desk-modal-dialog {
        width: min(96vw, 630px);
        max-height: 90vh;
    }
}

.att-chip.is-active {
    background: var(--bp-accent-soft) !important;
    border-color: #e0b89a !important;
    color: var(--bp-accent) !important;
}

@media print {
    body.skin-belopp {
        background: #fff !important;
    }
    body.skin-belopp .letter {
        box-shadow: none;
        padding: 0;
    }
    .desk-rail,
    .desk-backdrop,
    .desk-modal { display: none !important; }
}
