/* AriBooks. Fjord blue for structure, spruce for income, cloudberry for "waiting", lingonberry for "late" and costs. */
:root {
    --fjord: #16324f; --fjord-2: #24507c; --fjord-soft: #e6eef6;
    --spruce: #1f7a6b; --spruce-soft: #e1f2ee;
    --cloudberry: #b9781a; --cloudberry-soft: #fdf1dc;
    --lingon: #b4373f; --lingon-soft: #fbe8e9;
    --ink: #172433; --muted: #5a6878; --line: #dce3ea; --bg: #f3f6f9; --card: #fff;
    --radius: 10px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
a { color: var(--fjord-2); }
h1 { font-size: 1.65rem; line-height: 1.2; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
.icon { flex: none; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 6px; z-index: 10; }
.skip:focus { left: 8px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #7aa7e0; outline-offset: 2px; }

/* Signed-out pages: fjord panel with what AriBooks is, form on the right; stacked on phones */
.guest { min-height: 100vh; background: var(--card); }
.guest__wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 5fr) 7fr; }
.guest__intro { position: relative; overflow: hidden; background: var(--fjord); color: #e9f0f7; padding: 48px 56px; display: flex; flex-direction: column; gap: 28px; }
.guest__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: #fff; margin: 0; }
.guest__mark { color: #9cc4e8; }
.guest__headline { font-size: clamp(1.7rem, 2.6vw, 2.35rem); line-height: 1.15; font-weight: 650; letter-spacing: -0.02em; color: #fff; max-width: 15ch; margin: auto 0 0; }
.guest__points { list-style: none; padding: 0; margin: 0 0 auto; display: grid; gap: 12px; max-width: 34ch; }
.guest__points li { position: relative; padding-left: 22px; color: #c9d8e6; }
.guest__points li::before { content: ""; position: absolute; left: 0; top: .55em; width: 8px; height: 8px; border-radius: 50%; background: #5fbfab; }
.guest__fjord { position: absolute; left: 0; right: 0; bottom: 56px; width: 100%; height: 120px; }
.guest__fjord path { fill: none; stroke: #2f5f8f; stroke-width: 1.5; }
.guest__fjord path:first-child { stroke: #3f7fae; }
.guest__foot { position: relative; margin: 0; font-size: .9rem; color: #9fb4c8; }
.guest__main { display: grid; place-items: center; padding: 48px 24px; }
.guest__form { width: 100%; max-width: 380px; }
.guest__form h1 { font-size: 1.9rem; margin-bottom: 1.25rem; }
.guest__form .form input:not([type=checkbox]) { padding: 11px 12px; }
.guest__form .form button[type=submit] { width: 100%; justify-content: center; padding: 12px 16px; margin-top: 18px; }
.guest .links { color: var(--muted); }
.guest__form .check input { width: 18px; height: 18px; flex: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: 100%; box-shadow: 0 10px 30px rgba(22, 50, 79, .08); }
.card--narrow { max-width: 420px; }
.brand { font-weight: 700; color: var(--fjord); text-decoration: none; margin: 0 0 1rem; }
.card h1 { margin-bottom: .5rem; }
@media (max-width: 860px) {
    .guest__wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .guest__intro { padding: 22px 20px 26px; gap: 10px; }
    .guest__headline { font-size: 1.3rem; max-width: none; margin: 0; }
    .guest__points, .guest__fjord, .guest__foot { display: none; }
    .guest__main { place-items: start center; padding: 28px 20px 40px; }
    .guest__form h1 { font-size: 1.6rem; }
}

/* App shell: side menu on wide screens, tab bar on phones */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--fjord) 232px, transparent 232px); }
.side { background: var(--fjord); color: #dbe6f2; display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.side__brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none; padding: 4px 10px 22px; }
.mark { flex: none; display: block; }
.side__nav { display: grid; gap: 2px; }
.side__nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: #c9d7e6; text-decoration: none; font-weight: 500; }
.side__nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side__nav a[aria-current="page"] { background: #fff; color: var(--fjord); font-weight: 650; }
.side__foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .14); padding: 14px 12px 0; }
.side__biz { margin: 0 0 8px; color: #fff; font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; }
.side__out { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: #c9d7e6; font: inherit; padding: 6px 0; cursor: pointer; margin: 0; }
.side__out:hover { color: #fff; }
.tabbar { display: none; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 32px 32px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

/* Panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin: 0 0 20px; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: .75rem; }
.panel__head h2 { margin: 0; }
.grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; }
.empty, .hint { color: var(--muted); }
.hint { font-weight: 400; font-size: .9rem; }

/* Key figures: tinted, each colour means one thing */
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.figure { display: grid; gap: 2px; padding: 18px 20px; border-radius: var(--radius); text-decoration: none; color: var(--ink); border: 1px solid transparent; }
.figure__label { font-size: .9rem; font-weight: 600; color: var(--muted); }
.figure__value { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.figure__note { font-size: .88rem; color: var(--muted); }
.figure--amber { background: var(--cloudberry-soft); border-color: #f3dcb1; }
.figure--amber:hover { border-color: var(--cloudberry); }
.figure--blue { background: var(--fjord-soft); border-color: #cddcec; }
.figure--green { background: var(--spruce-soft); border-color: #bfe2d9; }
.t-bad { color: var(--lingon); }

/* Chart */
.years { display: flex; gap: 4px; }
.years a { padding: 4px 10px; border-radius: 6px; text-decoration: none; color: var(--muted); font-size: .9rem; }
.years a[aria-current="page"] { background: var(--fjord-soft); color: var(--fjord); font-weight: 650; }
.chart { margin: 0; }
.chart svg { width: 100%; height: 200px; display: block; }
.chart__base { stroke: var(--line); stroke-width: 1; }
.chart__in { fill: var(--spruce); }
.chart__out { fill: var(--lingon); opacity: .8; }
.chart__months { display: grid; grid-template-columns: repeat(12, 1fr); font-size: .78rem; color: var(--muted); text-align: center; margin-top: 4px; }
.legend { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); margin-top: 10px; }
.key { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-left: 8px; }
.key:first-child { margin-left: 0; }
.key--in { background: var(--spruce); }
.key--out { background: var(--lingon); }

/* To do */
.todo { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.todo__item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; border-left: 4px solid; }
.todo__item a { font-weight: 600; white-space: nowrap; }
.todo__item--bad { background: var(--lingon-soft); border-color: var(--lingon); }
.todo__item--warn { background: var(--cloudberry-soft); border-color: var(--cloudberry); }
.todo__item--info { background: var(--fjord-soft); border-color: var(--fjord-2); }
.done { display: flex; align-items: center; gap: 8px; color: var(--spruce); font-weight: 600; }

/* Forms and buttons */
.form { display: grid; gap: 6px; margin: 12px 0; }
.form label { font-weight: 600; font-size: .95rem; margin-top: 8px; }
.form .check { font-weight: 400; display: flex; gap: 8px; align-items: center; }
input:not([type=checkbox]):not([type=radio]), select, textarea { font: inherit; padding: 10px 12px; border: 1px solid #b9c5d2; border-radius: 8px; width: 100%; background: #fff; color: var(--ink); }
button, .button { font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 8px; border: 0; background: var(--fjord); color: #fff; cursor: pointer; margin-top: 10px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.page-head .button { margin-top: 0; }
button:hover, .button:hover { background: var(--fjord-2); }
button.secondary, .button.secondary { background: var(--fjord-soft); color: var(--fjord); }
button.danger { background: var(--lingon-soft); color: var(--lingon); }
button.link { background: none; color: var(--muted); padding: 0; margin: 0; font-weight: 400; text-decoration: underline; }
form.inline { display: inline-block; margin-right: 8px; }
.notice { background: var(--spruce-soft); border-radius: 8px; padding: 10px 12px; margin: 0 0 16px; }
.guest .notice { background: var(--fjord-soft); }
.errors { background: var(--lingon-soft); color: var(--lingon); border-radius: 8px; padding: 10px 12px; margin: 0 0 16px; }
.errors ul { margin: 0; padding-left: 18px; }
.ok { color: var(--spruce); font-weight: 600; }
.links { margin-top: 16px; font-size: .95rem; }
.qr { background: #fff; display: inline-block; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.codes { columns: 2; list-style: none; padding: 0; }
code { background: #eef1f6; padding: 2px 6px; border-radius: 4px; overflow-wrap: anywhere; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > div { display: grid; gap: 6px; }
.row > .grow { flex: 1 1 200px; }
.row .end button { margin-top: 0; }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 8px 0; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--fjord); }
details { margin-top: 16px; }
details.panel summary { cursor: pointer; font-weight: 600; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
thead th { font-size: .85rem; color: var(--muted); font-weight: 600; }
tfoot th { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.wrap-any { overflow-wrap: anywhere; }
.list { padding-left: 18px; }

/* Invoice lines */
fieldset.lines { border: 0; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; min-width: 0; }
fieldset.lines legend { font-weight: 600; margin-bottom: 6px; }
.lines__head, .lines__row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 150px; gap: 8px; }
.lines__head { font-size: .85rem; color: var(--muted); }
.show-sm { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Status */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 650; background: #eef1f6; }
.badge--paid { background: var(--spruce-soft); color: var(--spruce); }
.badge--overdue { background: var(--lingon-soft); color: var(--lingon); }
.badge--unpaid { background: var(--cloudberry-soft); color: #8a560c; }
.badge--draft { background: #eef1f6; color: var(--muted); }
.badge--credited, .badge--credit_note { background: #ece8f6; color: #4b3a86; }
.sub { color: var(--muted); margin: -8px 0 16px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 0 0 12px; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; font-weight: 600; }
.note { color: var(--muted); }
.actions { display: flex; gap: 16px; align-items: center; }
.actions form.inline { margin: 0; }
.actions button.link { margin: 0; }

@media (max-width: 960px) {
    .grid { grid-template-columns: 1fr; }
    .figures { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
    .shell { display: block; }
    .side { display: none; }
    .wrap { padding: 20px 16px 96px; }
    .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
    .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; font-size: .75rem; color: var(--muted); text-decoration: none; border-radius: 8px; }
    .tabbar a[aria-current="page"] { color: var(--fjord); font-weight: 650; background: var(--fjord-soft); }
    .figures { grid-template-columns: 1fr; }
    .figure__value { font-size: 1.45rem; }
    h1 { font-size: 1.4rem; }
}
@media (max-width: 560px) {
    .lines__head { display: none; }
    .lines__row { grid-template-columns: 1fr 1fr; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
    .lines__row input:first-of-type { grid-column: 1 / -1; }
    .codes { columns: 1; }
    .card { padding: 20px; }
    .hide-sm { display: none; }
    .show-sm { display: inline; }
    .journal { table-layout: fixed; width: 100%; }
    .journal th:first-child { width: 2.6rem; }
    .journal th.num { width: 5.6rem; }
    .journal td { overflow-wrap: break-word; font-size: .9rem; padding: 6px 4px; }
    th, td { padding: 8px 4px; }
    .panel { padding: 16px; }
    .chart__months span:nth-child(even) { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (max-width: 760px) {
    .shell { background: none; }
    .figure { padding: 14px 16px; }
}
fieldset.choices { border: 0; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
fieldset.choices legend { font-weight: 600; margin-bottom: 4px; }
.choice { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-weight: 400 !important; margin: 0 !important; cursor: pointer; }
.choice input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--fjord); }
.choice:has(input:checked) { border-color: var(--fjord-2); background: var(--fjord-soft); }
input[type=file] { padding: 8px; background: var(--bg); }
.facts--stack { display: grid; gap: 10px; }
.receipt { margin: 0 0 12px; }
.receipt img { display: block; max-width: 100%; max-height: 320px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: #fff; }
.head-actions { display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: center; }
.advice { border: 1px solid var(--cloudberry); background: var(--cloudberry-soft); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.advice p { margin: 0 0 8px; }
.advice .check { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-top: 4px; }
.advice .check input { width: 18px; height: 18px; flex: none; }
.sub-panel { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.sub-panel summary { cursor: pointer; font-weight: 600; }
.steps-list { padding-left: 20px; margin: 0 0 16px; display: grid; gap: 6px; }
.mapping { display: grid; gap: 10px; }
.mapping__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; align-items: center; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.panel-head p { margin: 0; }
.table-scroll { overflow-x: auto; }
.import-rows select { padding: 6px 8px; min-width: 9rem; font-size: .9rem; }
.import-rows td .hint { display: block; }
.import-rows tr.flagged td { background: var(--lingon-soft); }
.import-rows tr.skipped td { color: var(--muted); }
table.compact td, table.compact th { padding-top: 6px; padding-bottom: 6px; }
.sticky-actions { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 40%); z-index: 2; }
@media (max-width: 760px) { .mapping__row { grid-template-columns: 1fr; gap: 4px; } .sticky-actions { bottom: 64px; } }
.year-pick { display: flex; align-items: center; gap: 8px; }
.year-pick label { margin: 0; font-weight: 600; }
.year-pick select { width: auto; padding: 8px 10px; }
.report td, .report th { padding: 7px 8px; }
.report__section th { text-align: left; padding-top: 16px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
.report__total td { font-weight: 600; border-top: 1px solid var(--line); }
.report__result td { font-weight: 700; font-size: 1.05rem; border-top: 2px solid var(--ink); }
.journal__head td { font-weight: 600; background: var(--bg); }
.link-list { padding-left: 20px; display: grid; gap: 6px; margin: 0 0 12px; }
@media print {
    .side, .tabbar, .skip, .page-head .button, .year-pick, button, .no-print { display: none !important; }
    body { background: #fff; }
    .shell { display: block; background: none; }
    .wrap { padding: 0; max-width: none; }
    .panel { box-shadow: none; border: 0; break-inside: avoid; }
    .grid { display: block; }
    a { color: inherit; text-decoration: none; }
}
.history { list-style: none; padding: 0; margin: 12px 0 0; color: var(--muted); font-size: .92rem; display: grid; gap: 4px; }
.inbox { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.inbox__item { margin: 0; display: grid; gap: 10px; align-content: start; }
.inbox__thumb { display: block; height: 180px; border-radius: 8px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.inbox__thumb img { width: 100%; height: 100%; object-fit: cover; }
.inbox__thumb--file { display: grid; place-items: center; font-weight: 700; color: var(--muted); text-decoration: none; }
.inbox__name { margin: 0; overflow-wrap: anywhere; }
.receipt-from-inbox { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); margin-bottom: 12px; }
.receipt-from-inbox img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }
.deadlines__title { font-size: 1rem; margin: 18px 0 8px; }
.deadlines { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.deadlines li { display: grid; grid-template-columns: 6.2rem 1fr; gap: 10px; align-items: start; }
.deadlines time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--fjord); }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.checklist__item { display: grid; grid-template-columns: 1.8rem 1fr; gap: 10px; align-items: start; }
.checklist__mark { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.checklist__item--ok .checklist__mark { background: var(--spruce-soft); color: var(--spruce); }
.checklist__item--warn .checklist__mark { background: var(--cloudberry-soft); color: #8a560c; }
.checklist__item--block .checklist__mark { background: var(--lingon-soft); color: var(--lingon); }
.label-like { display: block; font-weight: 600; margin-bottom: 6px; }
.book-balance { margin: 0; padding: 10px 0; font-variant-numeric: tabular-nums; }
.side__search { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 14px; padding: 9px 12px; border-radius: 10px; background: rgba(255,255,255,.08); color: #d7e2ee; font-weight: 500; text-align: left; border: 1px solid rgba(255,255,255,.12); }
.side__search:hover { background: rgba(255,255,255,.14); }
.side__search kbd { margin-left: auto; font: inherit; font-size: .75rem; opacity: .75; }
.palette { width: min(640px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 14px; margin: 12vh auto auto; box-shadow: 0 24px 60px rgba(22, 50, 79, .25); }
.palette::backdrop { background: rgba(23, 36, 51, .35); }
.palette__form { display: block; }
.palette__form input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; font-size: 1.05rem; }
.palette__form input:focus-visible { outline: none; }
.palette__list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette__list a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.palette__list [aria-selected="true"] a, .palette__list a:hover { background: var(--fjord-soft); }
.palette__empty { padding: 12px; color: var(--muted); }
.palette__foot { margin: 0; padding: 8px 18px 12px; border-top: 1px solid var(--line); }

/* Lists: filter bar, rows, footer with totals and paging */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.filters label { margin: 0; }
.filters__search { position: relative; flex: 1 1 260px; }
.filters__search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.filters__search input { padding-left: 36px !important; }
.filters select { width: auto; min-width: 9rem; padding-right: 28px; }
.filters button { margin: 0; }
.filters__clear { color: var(--muted); font-size: .92rem; padding: 0 4px; }
.panel--flush { padding: 0; overflow: hidden; }
.rows th, .rows td { padding: 12px 14px; }
.rows thead th { background: #f8fafc; border-bottom: 1px solid var(--line); font-size: .8rem; letter-spacing: .01em; }
.rows tbody tr { position: relative; transition: background-color .12s; }
.rows tbody tr:hover { background: #f6f9fc; }
.rows tbody tr:last-child td { border-bottom: 0; }
.rows__key a { font-weight: 600; color: var(--ink); text-decoration: none; font-variant-numeric: tabular-nums; }
.rows__key a::after { content: ""; position: absolute; inset: 0; }
.rows__key a:focus-visible { outline: none; }
.rows tbody tr:has(.rows__key a:focus-visible) { outline: 3px solid #7aa7e0; outline-offset: -3px; }
.rows__main { font-weight: 500; }
.rows__muted { color: var(--muted); }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.list-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 12px 14px; border-top: 1px solid var(--line); background: #fbfcfd; font-size: .92rem; color: var(--muted); }
.list-foot__count { margin: 0; }
.list-foot__count strong { color: var(--ink); }
.pager { display: flex; align-items: center; gap: 6px; }
.pager__step { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-decoration: none; color: var(--ink); font-weight: 600; }
.pager__step:hover { border-color: var(--fjord-2); }
.pager__step.is-off { color: #a8b3bf; background: transparent; }
.pager__where { padding: 0 6px; }
.empty-state { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 48px 24px; color: var(--muted); }
.empty-state > .icon { width: 32px; height: 32px; color: var(--fjord-2); margin-bottom: 6px; }
.empty-state__title { margin: 0; font-weight: 650; font-size: 1.05rem; color: var(--ink); }
.empty-state p { margin: 0; max-width: 46ch; }
.empty-state .button { margin-top: 14px; }

/* Forms read better at a comfortable width; invoice and offer lines keep the full width */
.form { max-width: 680px; }
.form:has(fieldset.lines), .form:has(.mapping), .form:has(.import-rows) { max-width: none; }

@media (max-width: 640px) {
    .rows thead { display: none; }
    .rows tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
    .rows tbody tr:last-child { border-bottom: 0; }
    .rows td { padding: 0; border: 0; }
    .rows td.num { grid-column: 2; grid-row: 1; align-self: start; }
    .rows td.rows__status { grid-column: 2; justify-self: end; }
    .rows td.rows__main { grid-column: 1; }
    .rows td.rows__key { font-size: .9rem; }
    .filters select { flex: 1 1 8rem; }
    .list-foot { padding: 12px 14px; }
}

/* Overview: chart with a scale, compact deadlines */
.grid { align-items: start; }
.chart__plot { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.chart__scale { display: flex; flex-direction: column; justify-content: space-between; height: 200px; margin: -.5em 0; font-size: .75rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.chart svg { height: 200px; }
.chart__grid { stroke: #e7ecf1; stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart__grid:first-child { stroke: #c9d3dd; }
.chart__in { fill: var(--spruce); }
.chart__out { fill: var(--lingon); opacity: .85; }
.chart__months { margin-left: 2.6rem; }
.legend { flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.deadlines li { grid-template-columns: 2.8rem 1fr; gap: 12px; }
.deadlines__date { display: grid; place-items: center; align-content: center; height: 2.8rem; border-radius: 10px; background: var(--fjord-soft); color: var(--fjord); font-size: .72rem; font-weight: 650; line-height: 1.05; text-transform: lowercase; }
.deadlines__date span { font-size: 1.05rem; font-weight: 750; }
.deadlines__text { display: grid; gap: 1px; }
.deadlines__text strong { font-size: .95rem; }
.deadlines__detail { font-size: .85rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rows--inner th, .rows--inner td { padding: 10px 6px; }
.rows--inner thead th { background: none; }
.panel__head a { font-size: .92rem; font-weight: 600; }
.stack { display: grid; gap: 20px; align-content: start; min-width: 0; }
.stack > .panel { margin: 0; }
.chart__scale { position: relative; display: block; width: 2.4rem; margin: 0; }
.chart__scale span { position: absolute; right: 0; transform: translateY(-50%); }
.rows__clip { max-width: 0; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 960px) { .grid { display: flex; flex-direction: column; } .todo-panel { order: -1; } }
@media (max-width: 760px) {
    .page-head .head-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 8px; }
    .page-head .head-actions .button { justify-content: center; }
    .page-head .head-actions .button:not(.secondary) { grid-column: 1 / -1; order: -1; }
}
@media (max-width: 640px) {
    .rows td.rows__clip { grid-column: 1 / -1; max-width: none; width: auto; white-space: normal; }
}
.panel:has(> form.form):not(:has(fieldset.lines, .mapping, .import-rows)) { max-width: 760px; }
.form > button[type=submit], .form > .form-actions { justify-self: start; margin-top: 16px; padding-left: 22px; padding-right: 22px; }
.guest__form .form > button[type=submit] { justify-self: stretch; }
.form label .hint, .form label span.hint { font-weight: 400; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-right: 12px; padding: 6px 12px; border: 0; border-radius: 6px; background: var(--fjord-soft); color: var(--fjord); cursor: pointer; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--fjord); flex: none; }

/* Uploads: drop area, camera button on phones, previews */
.drop { display: grid; gap: 8px; margin-top: 8px; }
.drop .label-like { margin-bottom: 0; }
.drop__input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop:not(.drop--ready) .drop__input { position: static; width: auto; height: auto; opacity: 1; pointer-events: auto; }
.drop:not(.drop--ready) .drop__zone, .drop:not(.drop--ready) .drop__js { display: none; }
.drop__zone { display: grid; justify-items: center; gap: 4px; padding: 26px 20px; border: 1.5px dashed #b6c4d3; border-radius: 12px; background: #f8fafc; text-align: center; cursor: pointer; font-weight: 400 !important; margin: 0 !important; transition: border-color .15s, background-color .15s; }
.drop__zone:hover, .drop--over .drop__zone { border-color: var(--fjord-2); background: var(--fjord-soft); }
.drop__input:focus-visible + .drop__zone { outline: 3px solid #7aa7e0; outline-offset: 2px; }
.drop__icon { width: 28px; height: 28px; color: var(--fjord-2); }
.drop__title { font-weight: 600; color: var(--ink); }
.drop__title u { color: var(--fjord-2); text-underline-offset: 3px; }
.drop__meta { font-size: .88rem; color: var(--muted); }
.drop--filled .drop__zone { padding: 14px 20px; }
.drop--filled .drop__icon { display: none; }
.drop__camera { justify-self: start; margin: 0; }
@media (pointer: fine) { .drop__camera { display: none !important; } }
.drop__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.drop__list:empty { display: none; }
.drop__file { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.drop__thumb { width: 48px; height: 48px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: var(--fjord-soft); color: var(--fjord); font-size: .72rem; font-weight: 750; }
.drop__thumb img { width: 100%; height: 100%; object-fit: cover; }
.drop__name { display: grid; overflow-wrap: anywhere; font-weight: 500; }
.drop__size { font-size: .82rem; color: var(--muted); font-weight: 400; }
.drop__remove { margin: 0; width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 8px; background: transparent; color: var(--muted); font-size: 1.35rem; line-height: 1; }
.drop__remove:hover { background: var(--lingon-soft); color: var(--lingon); }
.drop__problem { padding: 8px 12px; border-radius: 8px; background: var(--lingon-soft); color: var(--lingon); font-size: .92rem; }
.drop { position: relative; }
.drop__input { left: 0; top: 0; }
.drop__camera { position: relative; overflow: hidden; }
.logo-preview { display: inline-grid; place-items: center; padding: 14px 18px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin: 4px 0 8px; }
.logo-preview img { display: block; max-height: 72px; max-width: 260px; }
.logo-panel form + form { margin-top: 4px; }

/* Invoice preview before issuing and sending */
.panel__head .button { margin: 0; }
.mail-preview { margin: 4px 0 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfd; }
.mail-preview summary { padding: 10px 14px; font-weight: 600; cursor: pointer; }
.mail-preview__head { display: grid; gap: 4px; margin: 0; padding: 0 14px 10px; }
.mail-preview__head div { display: grid; grid-template-columns: 5.5rem 1fr; gap: 8px; }
.mail-preview__head dt { color: var(--muted); }
.mail-preview__head dd { margin: 0; overflow-wrap: anywhere; }
.mail-preview__body { margin: 0; padding: 12px 14px 14px; border-top: 1px solid var(--line); white-space: pre-wrap; font: inherit; font-size: .95rem; line-height: 1.55; }
/* Draft preview: the printable invoice styles, scoped to .paper */
.paper .sheet { position: relative; background: #fff; max-width: 210mm; margin: 0 auto; padding: 18mm 16mm; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.paper .top { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.paper .seller { font-size: 1.25rem; font-weight: 700; margin: 0 0 4px; }
.paper .logo { display: block; max-height: 68px; max-width: 230px; margin: 0 0 10px; }
.paper .top p { margin: 0; }
.paper h1 { margin: 0 0 8px; font-size: 1.6rem; text-align: right; }
.paper .meta th { text-align: left; font-weight: 500; color: #5b6475; padding: 1px 12px 1px 0; }
.paper .meta td { text-align: right; padding: 1px 0; }
.paper .buyer { margin: 28px 0 20px; }
.paper .label { color: #5b6475; font-size: .85rem; margin: 0 0 2px; text-transform: uppercase; letter-spacing: .04em; }
.paper .buyer p { margin: 0; }
.paper .items { width: 100%; border-collapse: collapse; margin-top: 8px; }
.paper .items th, .paper .items td { padding: 8px 6px; border-bottom: 1px solid #dde2ea; text-align: left; vertical-align: top; }
.paper .items thead th { font-size: .85rem; color: #5b6475; border-bottom: 2px solid #14213d; }
.paper .items tfoot th, .paper .items tfoot td { border-bottom: 0; border-top: 2px solid #14213d; font-weight: 700; font-size: 1.05rem; }
.paper .num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.paper .vat, .paper .note { color: #5b6475; font-size: .9rem; }
.paper .pay { margin-top: 24px; padding: 12px 14px; background: #f5f7fa; border-radius: 6px; }
.paper .pay p { margin: 0; }
@media (max-width: 600px) { .paper .sheet { padding: 20px 16px; } .paper h1 { text-align: left; } .paper .meta td { text-align: left; } }
.paper .sheet__draft { position: absolute; top: 40%; left: 0; right: 0; margin: 0; text-align: center; font-size: 6rem; font-weight: 800; color: rgba(22, 50, 79, .07); transform: rotate(-24deg); pointer-events: none; }
.paper { background: #e9edf2; border-radius: 10px; padding: 18px; color: #14213d; font-size: .95rem; line-height: 1.45; }
.paper .sheet { box-shadow: 0 2px 10px rgba(22, 50, 79, .1); padding: 12mm 11mm; }
@media (max-width: 640px) { .paper { padding: 8px; margin: 0 -8px; } }
.guest__lang { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }
.guest__lang button { background: none; border: 0; padding: 2px 0; margin: 0; color: var(--muted); font-weight: 500; font-size: .9rem; cursor: pointer; }
.guest__lang button:hover { color: var(--fjord-2); background: none; text-decoration: underline; }
.guest__lang button[aria-current] { color: var(--ink); font-weight: 650; }
