@font-face {
    font-family: "Source Sans 3";
    src: url("../fonts/SourceSans3-Upright.woff2") format("woff2");
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Source Sans 3";
    src: url("../fonts/SourceSans3-Italic.woff2") format("woff2");
    font-weight: 200 900;
    font-style: italic;
    font-display: swap;
}

:root {
    --ink: #2b2523;
    --ink-soft: #4a3f3b;
    --muted: #635551;
    --accent: #d9480f;
    --accent-ink: #b83a0e;
    --accent-dark: #7c2a0b;
    --accent-soft: #fff1ea;
    --accent-tint: #ffe9e0;
    --line: #ede6e2;
    --line-soft: #f3edea;
    --field: #d9ccc6;
    --bg: #fbf8f6;
    --surface: #ffffff;
    --hero: #2b2523;
    --hero-inner: #3a322f;
    --hero-muted: #e8dcd6;
    --ok: #166534;
    --ok-bg: #e9f7ee;
    --error: #9f1239;
    --error-bg: #fdecef;
    --radius: 16px;
    --radius-small: 10px;
    --sidebar: 16rem;
    --topbar: 3.2rem;
    --bottombar: 3.9rem;
    font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    color: var(--ink);
    background: var(--bg);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "locl" 0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

a {
    color: var(--accent-ink);
}

a:hover {
    color: var(--accent-dark);
}

h1 {
    margin: 0 0 1.25rem;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-small);
    background: var(--ink);
    color: #fff;
    z-index: 10;
}

.skip-link:focus {
    top: 1rem;
}

/* Layout */

.app {
    min-height: 100vh;
}

.app-body {
    display: flex;
    min-height: calc(100vh - var(--topbar));
}

.sidebar {
    position: sticky;
    top: var(--topbar);
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: var(--sidebar);
    height: calc(100vh - var(--topbar));
    overflow-y: auto;
    padding: 1.4rem 1rem;
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.brand {
    display: inline-block;
    padding: 0 0.6rem;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--accent);
    text-decoration: none;
}

.content {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 80rem;
    padding: 2rem 2.25rem 3rem;
}

.content-narrow {
    max-width: 30rem;
    margin: 0 auto;
    padding-top: 3rem;
}

.content-narrow .brand {
    padding: 0;
    margin-bottom: 1.5rem;
}

/* Side menu */

.company-switch {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
    color: var(--ink);
    text-decoration: none;
}

.company-switch:hover {
    color: var(--ink);
    border-color: var(--field);
}

.company-mark {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-small);
    background: var(--accent-tint);
    color: var(--accent-ink);
    font-weight: 700;
}

.company-text {
    min-width: 0;
}

.company-name {
    display: block;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.company-hint {
    font-size: 0.8rem;
    color: var(--muted);
}

.quick-links {
    display: grid;
    gap: 0.5rem;
}

.quick-links .button {
    text-align: center;
}

.quick-links .button + .button {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
}

.side-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 2px;
}

.side-nav-title {
    margin: 0.8rem 0 0.3rem;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.side-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.42rem 0.75rem;
    border-radius: var(--radius-small);
    color: var(--ink-soft);
    font-weight: 600;
    text-decoration: none;
}

.side-nav a:hover {
    background: var(--bg);
    color: var(--ink);
}

.side-nav a[aria-current="page"] {
    background: var(--accent-soft);
    color: var(--ink);
}

.side-nav a > .side-text {
    flex: 1 1 auto;
}

.side-nav-badge {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-ink);
}

.side-balance {
    display: grid;
    gap: 0.1rem;
    margin-top: auto;
    padding: 0.85rem 0.9rem;
    border-radius: 12px;
    background: var(--hero);
    color: #fff;
    text-decoration: none;
}

.side-balance:hover {
    color: #fff;
}

.side-balance-label {
    font-size: 0.8rem;
    color: var(--hero-muted);
}

.side-balance-amount {
    font-size: 1.15rem;
    font-weight: 700;
}

.side-user {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    align-items: baseline;
    padding: 0 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.side-user-name {
    overflow-wrap: anywhere;
}

.side-balance + .side-user {
    margin-top: 0;
}

.side-nav + .side-user {
    margin-top: auto;
}

/* Buttons */

button,
a.button {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.6rem 1.15rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

a.button {
    margin-top: 0;
}

button:hover,
a.button:hover {
    background: var(--accent-ink);
    color: #fff;
}

button.secondary,
a.button.secondary {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--field);
}

button.secondary:hover,
a.button.secondary:hover {
    background: var(--bg);
    color: var(--ink);
}

button.danger {
    background: var(--error);
}

button.danger:hover {
    background: #7f0e2d;
}

.link-button,
.link-button:hover {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--accent-ink);
    font-weight: 600;
    text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* Forms */

input,
select,
textarea {
    min-height: 2.6rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--field);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
}

input[type="checkbox"],
input[type="radio"] {
    padding: 0;
    min-height: 0;
    accent-color: var(--accent);
}

input[type="file"] {
    padding: 0.45rem;
    background: var(--bg);
}

.form {
    display: grid;
    gap: 0.35rem;
    max-width: 30rem;
}

.form label {
    margin-top: 0.6rem;
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 0.95rem;
}

.form .check {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-weight: normal;
    color: var(--ink);
}

.form button {
    justify-self: start;
}

.document-form {
    max-width: none;
}

.hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.confirm {
    display: grid;
    gap: 0.35rem;
    margin-top: 1rem;
    padding: 1rem 1.2rem;
    border: 1px solid #fbd9c8;
    border-radius: var(--radius);
    background: #fff4ee;
}

.confirm legend {
    padding: 0 0.3rem;
    font-weight: 700;
}

.inline-field {
    display: flex;
    gap: 0.5rem;
}

.inline-field input {
    flex: 1;
}

.inline-field button {
    margin-top: 0;
}

.inline-form {
    display: inline;
}

.inline-form button {
    margin-top: 0;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 2rem;
}

.grid-2 > div {
    display: grid;
    gap: 0.35rem;
    align-content: start;
}

details {
    padding: 0.9rem 1.2rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

summary {
    font-weight: 700;
    cursor: pointer;
}

details[open] summary {
    margin-bottom: 0.5rem;
}

/* Page parts */

.page-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-head h1 {
    margin: 0;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: center;
    margin: 1.25rem 0 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.filters label {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.filters input,
.filters select {
    padding: 0.4rem 0.6rem;
}

.filters button {
    margin-top: 0;
}

.columns {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 2rem;
}

.side h2 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.actions,
.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.actions button,
.row-actions button {
    margin-top: 0;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

.tabs a {
    padding: 0.5rem 0;
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 3px solid transparent;
}

.tabs a[aria-current="page"] {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

.pager {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
    color: var(--muted);
}

.steps li {
    margin-bottom: 0.75rem;
}

.mail-section {
    margin-top: 2rem;
}

/* Messages */

.message {
    margin: 0 0 1.25rem;
    padding: 0.8rem 1.1rem;
    border: 1px solid;
    border-radius: 12px;
}

.message-ok {
    border-color: #bfe3cb;
    background: var(--ok-bg);
    color: var(--ok);
}

.message-error {
    border-color: #f5c2cd;
    background: var(--error-bg);
    color: var(--error);
}

.message-error ul {
    margin: 0;
    padding-left: 1.25rem;
}

/* Tables */

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.table caption {
    padding-bottom: 0.5rem;
    text-align: left;
    color: var(--muted);
    font-weight: 600;
}

.table thead th:first-child {
    border-top-left-radius: var(--radius);
}

.table thead th:last-child {
    border-top-right-radius: var(--radius);
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: middle;
}

.table thead th {
    background: var(--bg);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tbody tr:last-child td,
.table tbody tr:last-child th {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: #fdfaf8;
}

.table a {
    font-weight: 600;
    text-decoration: none;
}

.number,
td.number,
th.number,
.table th.number,
.table td.number {
    text-align: right;
    white-space: nowrap;
}

tr.removed td {
    color: var(--muted);
    text-decoration: line-through;
}

.lines input,
.lines select {
    width: 100%;
    padding: 0.4rem 0.5rem;
}

.lines input.short {
    max-width: 7rem;
}

.totals {
    margin-left: auto;
    border-collapse: collapse;
}

.totals th {
    text-align: right;
    font-weight: normal;
    padding: 0.2rem 1rem;
    color: var(--muted);
}

.totals td {
    text-align: right;
    padding: 0.2rem 0;
}

.totals .grand th,
.totals .grand td {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
}

/* Bank */

.balances {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.balance {
    display: grid;
    gap: 0.2rem;
    padding: 1.1rem 1.25rem;
    border-radius: var(--radius);
    background: var(--hero);
    color: #fff;
    text-decoration: none;
}

.balance:hover {
    color: #fff;
    background: var(--hero-inner);
}

.balance-bank {
    font-weight: 600;
}

.balance-iban {
    color: var(--hero-muted);
    font-size: 0.85rem;
}

.balance-amount {
    margin-top: 0.4rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.import {
    margin-bottom: 1rem;
}

.totals-line {
    color: var(--muted);
}

.totals-line .in,
td.in {
    color: var(--ok);
    font-weight: 600;
}

.totals-line .out,
td.out {
    color: var(--error);
    font-weight: 600;
}

/* Two-factor and codes */

.qr {
    display: block;
    width: 12rem;
    height: 12rem;
    background: #fff;
}

.key,
.codes code {
    font-size: 1.1rem;
    letter-spacing: 0.05em;
}

.codes {
    columns: 2;
    list-style: none;
    padding: 0;
}

code.link {
    word-break: break-all;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Small screens: the menu goes above the page */

@media (max-width: 60rem) {
    .content {
        padding: 1.25rem 1rem 2rem;
    }
}

@media (max-width: 48rem) {
    .columns,
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

@media print {
    .no-print {
        display: none;
    }

    .app {
        display: block;
    }
}

/* Cards, filters, badges and empty states */

.form:not(.document-form),
.columns > section > .form {
    padding: 1.25rem 1.5rem 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

details .form:not(.document-form) {
    padding: 0;
    border: 0;
}

.form-horizontal {
    grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr);
    gap: 0.6rem 1.25rem;
    align-items: center;
    max-width: 44rem;
}

.form-horizontal label {
    margin-top: 0;
}

.form-horizontal .hint,
.form-horizontal .check,
.form-horizontal button,
.form-horizontal .inline-field,
.form-horizontal .actions {
    grid-column: 2;
}

.form-horizontal fieldset,
.form-horizontal .message {
    grid-column: 1 / -1;
}

.form-horizontal textarea {
    align-self: stretch;
}

.filter {
    display: grid;
    gap: 0.25rem;
    flex: 1 1 9rem;
    min-width: 8.5rem;
    max-width: 13rem;
}

.filter-wide {
    flex: 3 1 14rem;
    max-width: none;
}

.filter input,
.filter select {
    width: 100%;
}

.filters {
    align-items: end;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.7rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-issued {
    background: #eaf0fd;
    color: #1e40af;
}

.badge-draft {
    background: #f7f3f1;
    color: var(--muted);
}

.badge-cancelled {
    background: var(--error-bg);
    color: var(--error);
}

.badge-ok {
    background: var(--ok-bg);
    color: var(--ok);
}

.content > p[role="status"]:not(.message):not(.totals-line) {
    padding: 1.5rem;
    border: 1px dashed var(--field);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--muted);
    text-align: center;
}

.table .inline-field {
    max-width: 20rem;
}

.balance-empty {
    font-size: 1rem;
    font-weight: 600;
    color: var(--hero-muted);
}

@media (max-width: 40rem) {
    .form-horizontal {
        grid-template-columns: 1fr;
    }

    .form-horizontal .hint,
    .form-horizontal .check,
    .form-horizontal button,
    .form-horizontal .inline-field,
    .form-horizontal .actions {
        grid-column: 1;
    }
}

.form-horizontal .confirm {
    grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr);
    column-gap: 1.25rem;
    align-items: center;
}

.form-horizontal .confirm .hint {
    grid-column: 1 / -1;
}

.filters .check {
    display: flex;
    align-items: center;
    align-self: end;
    min-height: 2.6rem;
    padding: 0;
}

@media (max-width: 40rem) {
    .sidebar {
        gap: 0.9rem;
        padding: 1rem;
    }

    .quick-links {
        grid-template-columns: 1fr 1fr;
    }

    .quick-links .button {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .side-nav ul {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .side-nav a {
        white-space: nowrap;
    }

    .side-nav-title {
        margin-top: 0.5rem;
    }

    .company-hint {
        display: none;
    }

    .page-head .actions {
        flex: 1 1 100%;
    }

    .filter,
    .filter-wide {
        flex: 1 1 100%;
        max-width: none;
    }

    .table {
        display: block;
        overflow-x: auto;
    }

    h1 {
        font-size: 1.5rem;
    }
}

/* Matching */

.movement {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.movement > div {
    display: grid;
    gap: 0.2rem;
}

.movement-amount {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.movement-amount.in {
    color: var(--ok);
}

.movement-amount.out {
    color: var(--error);
}

.facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 0.35rem 1.25rem;
    flex: 1 1 24rem;
    margin: 0;
}

.facts dt {
    color: var(--muted);
    font-weight: 600;
}

.facts dd {
    margin: 0;
}

.amount-field {
    width: 8rem;
    text-align: right;
}

.explain {
    margin-top: 1rem;
}

.content h2 {
    margin: 2rem 0 0.75rem;
}

/* Dashboard */

.dashboard-top,
.dashboard-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: stretch;
    margin-bottom: 1.5rem;
}

.hero {
    flex: 2 1 26rem;
    min-width: 0;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding: 1.75rem;
    border-radius: 20px;
    background: var(--hero);
    color: #fff;
}

.hero-label {
    font-size: 0.9rem;
    color: var(--hero-muted);
}

.hero-amount {
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.hero-accounts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.hero-account {
    flex: 1 1 12rem;
    display: grid;
    gap: 0.1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    background: var(--hero-inner);
    color: #fff;
    text-decoration: none;
}

.hero-account:hover {
    color: #fff;
    outline: 1px solid #6b5e59;
}

.hero-account-amount {
    font-weight: 600;
}

.hero .actions .button.light {
    background: #fff;
    color: var(--ink);
}

.hero .actions .button.ghost {
    background: transparent;
    border-color: #6b5e59;
    color: #fff;
}

.kpis {
    flex: 1 1 18rem;
    min-width: 0;
    display: grid;
    gap: 0.75rem;
}

.kpi {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.2rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
}

.kpi:hover {
    color: var(--ink);
    border-color: var(--field);
}

.kpi-label {
    display: block;
    font-weight: 600;
}

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

.kpi-value {
    font-size: 1.3rem;
    font-weight: 700;
    text-align: right;
}

.kpi-alert {
    border-color: #fbd9c8;
    background: #fff4ee;
}

.kpi-alert .kpi-value {
    color: var(--accent-ink);
}

.card {
    flex: 1 1 22rem;
    min-width: 0;
    padding: 0.5rem 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.card > .hint {
    padding: 0 1.5rem 1rem;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.75rem 1.5rem;
}

.card-head h2,
.content .card-head h2 {
    margin: 0;
}

.card-head a {
    font-weight: 600;
    text-decoration: none;
}

.doc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.doc-list a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 1rem;
    padding: 0.8rem 1.5rem;
    border-top: 1px solid var(--line-soft);
    color: var(--ink);
    text-decoration: none;
}

.doc-list a:hover {
    background: #fdfaf8;
    color: var(--ink);
}

.doc-list-name {
    font-weight: 600;
}

.doc-list .hint {
    grid-column: 1;
}

.doc-list-amount {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    font-weight: 700;
}

.flow {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 0.5rem 1.5rem;
    margin: 0;
    padding: 0.5rem 1.5rem 1rem;
    border-top: 1px solid var(--line-soft);
}

.flow dt {
    color: var(--muted);
}

.flow dd {
    margin: 0;
    font-weight: 600;
    text-align: right;
}

.flow dd.in {
    color: var(--ok);
}

.flow dd.out {
    color: var(--error);
}

.vat-summary {
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    margin-bottom: 1.25rem;
}

.missing-numbers {
    padding: 0.2rem 0.5rem;
}

.missing-numbers p {
    margin: 0.4rem 0 0;
    max-width: 40rem;
    font-variant-numeric: tabular-nums;
}

/* Top bar, side menu icons, folding groups and the phone panel */

.icon {
    flex: none;
    width: 1.2rem;
    height: 1.2rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    padding: 0.45rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--ink-soft);
    cursor: pointer;
}

.icon-button:hover {
    background: var(--bg);
    color: var(--ink);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: var(--topbar);
    padding: 0 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.topbar .brand {
    padding: 0;
    font-size: 1.2rem;
}

.top-actions {
    display: flex;
    gap: 0.35rem;
    margin-left: 0.5rem;
}

.top-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    font-size: 0.88rem;
    white-space: nowrap;
}

.top-action .icon {
    width: 1rem;
    height: 1rem;
}

.top-action + .top-action {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line);
}

.top-action + .top-action:hover {
    background: var(--bg);
    color: var(--ink);
}

.top-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    margin-left: auto;
}

.topbar .company-switch {
    max-width: 15rem;
    padding: 0.2rem 0.6rem 0.2rem 0.2rem;
    border-radius: 999px;
}

.topbar .company-mark {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    font-size: 0.85rem;
}

.topbar .company-name {
    font-size: 0.88rem;
}

.topbar .company-hint {
    display: none;
}

.topbar .icon-button {
    padding: 0.35rem;
}

.topbar .icon-button .icon {
    width: 1.05rem;
    height: 1.05rem;
}

.top-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.top-user-name {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-check,
.menu-open-button {
    display: none;
}

.side-group {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
}

.side-group summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0.7rem 0 0.25rem;
    padding: 0.2rem 0.75rem;
    border-radius: var(--radius-small);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    cursor: pointer;
    list-style: none;
}

.side-group summary::-webkit-details-marker {
    display: none;
}

.side-group summary:hover {
    color: var(--ink);
}

.side-group summary .icon {
    width: 1rem;
    height: 1rem;
    transition: transform 0.15s ease;
}

.side-group:not([open]) summary .icon {
    transform: rotate(-90deg);
}

.side-nav a .icon {
    color: var(--muted);
}

.side-nav a:hover .icon,
.side-nav a[aria-current="page"] .icon {
    color: var(--accent);
}

.side-balance {
    grid-template-columns: auto 1fr;
    align-items: start;
    column-gap: 0.6rem;
}

.side-balance > .icon {
    margin-top: 0.15rem;
    color: var(--hero-muted);
}

.side-balance > .side-text {
    display: grid;
    gap: 0.1rem;
}

/* Icons only: chosen with the button, or on a smaller laptop screen */

.menu-compact {
    --sidebar: 4.6rem;
}

.menu-compact .sidebar {
    padding: 1rem 0.6rem;
}

.menu-compact .side-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.menu-compact .side-nav a,
.menu-compact .side-balance {
    position: relative;
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.menu-compact .side-balance {
    grid-template-columns: auto;
    justify-items: center;
}

.menu-compact .side-group summary {
    justify-content: center;
    margin: 0.5rem 0 0.15rem;
    padding: 0.25rem 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
}

.menu-compact .side-group summary .icon {
    display: none;
}

.menu-compact .side-nav-badge {
    position: absolute;
    top: 0.1rem;
    right: 0.35rem;
    font-size: 0.7rem;
}

@media (min-width: 60.01rem) and (max-width: 75rem) {
    .menu-wide {
        --sidebar: 4.6rem;
    }

    .menu-wide .sidebar {
        padding: 1rem 0.6rem;
    }

    .menu-wide .side-toggle {
        display: none;
    }

    .menu-wide .side-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .menu-wide .side-nav a,
    .menu-wide .side-balance {
        position: relative;
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    .menu-wide .side-balance {
        grid-template-columns: auto;
        justify-items: center;
    }

    .menu-wide .side-group summary {
        justify-content: center;
        margin: 0.5rem 0 0.15rem;
        padding: 0.25rem 0;
        border-top: 1px solid var(--line);
        border-radius: 0;
    }

    .menu-wide .side-group summary .icon {
        display: none;
    }

    .menu-wide .side-nav-badge {
        position: absolute;
        top: 0.1rem;
        right: 0.35rem;
        font-size: 0.7rem;
    }

    .top-user-name {
        display: none;
    }
}

@media (max-width: 75rem) {
    .topbar .company-text {
        display: none;
    }

    .topbar .company-switch {
        padding: 0.25rem;
    }
}

/* Phone: the menu opens as a panel over the page with the button on the left */

@media (max-width: 60rem) {
    .side-toggle,
    .top-user-name,
    .top-text {
        display: none;
    }

    .menu-check {
        display: block;
    }

    .top-actions {
        margin-left: auto;
        gap: 0.35rem;
    }

    .top-right {
        margin-left: 0;
        gap: 0.35rem;
    }

    .top-action {
        justify-content: center;
        width: 2.4rem;
        height: 2.4rem;
        padding: 0;
    }

    .topbar .company-switch {
        border: 0;
        background: none;
    }

    .topbar {
        gap: 0.5rem;
        padding: 0 0.6rem;
    }

    .app-body {
        display: block;
    }

    .sidebar,
    .menu-compact .sidebar {
        position: fixed;
        top: var(--topbar);
        bottom: 0;
        left: 0;
        z-index: 25;
        display: none;
        width: min(18rem, 85vw);
        height: auto;
        padding: 1rem;
        box-shadow: 0 12px 32px rgba(40, 24, 16, 0.18);
    }

    .menu-check:checked ~ .app-body .sidebar {
        display: flex;
    }

    .menu-compact .side-text {
        position: static;
        width: auto;
        height: auto;
        clip: auto;
    }

    .menu-compact .side-nav a {
        justify-content: flex-start;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .menu-compact .side-group summary {
        justify-content: space-between;
        border-top: 0;
        padding: 0.2rem 0.75rem;
    }

    .menu-check:focus-visible ~ .topbar .menu-open-button {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }
}

@media (max-width: 26rem) {
    .topbar .brand {
        font-size: 1.1rem;
    }
}

/* Phone: tabs at the bottom, like an app */

.bottom-tabs {
    display: none;
}

@media (max-width: 60rem) {
    .bottom-tabs {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 30;
        display: flex;
        height: var(--bottombar);
        padding-bottom: env(safe-area-inset-bottom);
        background: var(--surface);
        border-top: 1px solid var(--line);
        box-shadow: 0 -6px 18px rgba(40, 24, 16, 0.06);
    }

    .bottom-tabs a,
    .bottom-tabs label {
        position: relative;
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        min-width: 0;
        font-size: 0.72rem;
        font-weight: 600;
        color: var(--muted);
        text-decoration: none;
        cursor: pointer;
    }

    .bottom-tabs .icon {
        width: 1.45rem;
        height: 1.45rem;
    }

    .bottom-tabs span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .bottom-tabs a[aria-current="page"] {
        color: var(--ink);
    }

    .bottom-tabs a[aria-current="page"] .icon {
        color: var(--accent);
    }

    .bottom-tabs a[aria-current="page"]::before {
        content: "";
        position: absolute;
        top: 0;
        left: 30%;
        right: 30%;
        height: 3px;
        border-radius: 0 0 3px 3px;
        background: var(--accent);
    }

    .bottom-tabs .bottom-badge {
        position: absolute;
        top: 0.3rem;
        left: 55%;
        padding: 0 0.3rem;
        border-radius: 999px;
        background: var(--accent);
        color: #fff;
        font-size: 0.65rem;
    }

    .menu-check:checked ~ .bottom-tabs label {
        color: var(--accent);
    }

    .content {
        padding-bottom: calc(var(--bottombar) + 1.5rem);
    }

    .sidebar,
    .menu-compact .sidebar {
        bottom: var(--bottombar);
    }
}
