:root {
    --font-brand: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
    --fs-page-title: 1.375rem;
    --fs-section: 1.0625rem;
    --fs-body: 0.9375rem;
    --fs-table: 0.875rem;
    --fs-label: 0.8125rem;
    --fs-small: 0.75rem;
    --fs-stat: 1.5rem;
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.5rem;
    --sp-6: 2rem;
    --sp-7: 3rem;
    --r-sm: 8px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-full: 999px;
    --content-max: 96rem;
}
:root {
    color-scheme: light;
    --bg: #f3f5f9;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --field-bg: #ffffff;
    --backdrop: rgba(11, 18, 32, 0.5);
    --text: #16202e;
    --muted: #5b6b80;
    --on-primary: #ffffff;
    --on-danger: #ffffff;
    --border: #dbe1eb;
    --border-strong: #c2cbda;
    --primary: #1a56db;
    --primary-hover: #164ac0;
    --primary-soft: #e9effc;
    --primary-soft-text: #164ac0;
    --focus: #1a56db;
    --ok: #187a41;
    --ok-soft: #e3f4ea;
    --ok-border: #b5dfc5;
    --warn: #8a5b00;
    --warn-soft: #faf0da;
    --warn-border: #e3c98a;
    --danger: #b3261e;
    --danger-hover: #9a1f18;
    --danger-soft: #fbeae8;
    --danger-border: #edb6b2;
    --shadow-sm: 0 1px 2px rgba(22, 32, 46, 0.06);
    --shadow-md: 0 4px 16px rgba(22, 32, 46, 0.10);
    --shadow-lg: 0 12px 40px rgba(22, 32, 46, 0.18);
}
[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1220;
    --surface: #121d33;
    --surface-2: #172440;
    --field-bg: #0d1730;
    --backdrop: rgba(3, 7, 15, 0.65);
    --text: #f2f5f9;
    --muted: #93a0b4;
    --on-primary: #071228;
    --on-danger: #240a08;
    --border: #243250;
    --border-strong: #35476b;
    --primary: #4c7df0;
    --primary-hover: #6b93f4;
    --primary-soft: #1b2c52;
    --primary-soft-text: #a6c0f8;
    --focus: #6b93f4;
    --ok: #5bc98d;
    --ok-soft: #123324;
    --ok-border: #1f5a3b;
    --warn: #e3b457;
    --warn-soft: #33290f;
    --warn-border: #61501d;
    --danger: #f19c94;
    --danger-hover: #f4b1aa;
    --danger-soft: #3a201e;
    --danger-border: #7a3b35;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0b1220;
        --surface: #121d33;
        --surface-2: #172440;
        --field-bg: #0d1730;
        --backdrop: rgba(3, 7, 15, 0.65);
        --text: #f2f5f9;
        --muted: #93a0b4;
        --on-primary: #071228;
        --on-danger: #240a08;
        --border: #243250;
        --border-strong: #35476b;
        --primary: #4c7df0;
        --primary-hover: #6b93f4;
        --primary-soft: #1b2c52;
        --primary-soft-text: #a6c0f8;
        --focus: #6b93f4;
        --ok: #5bc98d;
        --ok-soft: #123324;
        --ok-border: #1f5a3b;
        --warn: #e3b457;
        --warn-soft: #33290f;
        --warn-border: #61501d;
        --danger: #f19c94;
        --danger-hover: #f4b1aa;
        --danger-soft: #3a201e;
        --danger-border: #7a3b35;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
        --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
    }
}
@font-face {
    font-family: "Space Grotesk";
    src: local("Space Grotesk"), url("fonts/SpaceGrotesk-Regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Space Grotesk";
    src: local("Space Grotesk Medium"), local("Space Grotesk"), url("fonts/SpaceGrotesk-Medium.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: "Space Grotesk";
    src: local("Space Grotesk SemiBold"), local("Space Grotesk"), url("fonts/SpaceGrotesk-SemiBold.woff2") format("woff2");
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: "Space Grotesk";
    src: local("Space Grotesk Bold"), local("Space Grotesk"), url("fonts/SpaceGrotesk-Bold.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}
:root {
    --accent: var(--primary);
    --accent-hover: var(--primary-hover);
    --on-accent: var(--on-primary);
    --error: var(--danger);
    --error-bg: var(--danger-soft);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--fs-body);
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
h1, .page-title {
    font-family: var(--font-brand);
    font-size: var(--fs-page-title);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 var(--sp-4);
}
h2, .section-title {
    font-family: var(--font-brand);
    font-size: var(--fs-section);
    font-weight: 600;
    letter-spacing: -0.005em;
    margin: 0 0 var(--sp-3);
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.mono { font-family: var(--font-mono); font-size: 0.9em; }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-5);
    box-shadow: var(--shadow-sm);
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    flex-wrap: wrap;
    margin-bottom: var(--sp-4);
}
.card-head h2, .card-head h1 { margin: 0; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 0.5rem 0.95rem;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: 500;
    line-height: 1.3;
    color: var(--text);
    background: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: default; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary-soft-text); }
.btn-icon { padding: 0.5rem; width: 2.4rem; }
.btn-icon.btn-sm { padding: 0.25rem; width: 1.9rem; }
.btn-sm { padding: 0.2rem 0.6rem; font-size: var(--fs-label); border-radius: 6px; }
.btn.is-loading { position: relative; color: transparent; pointer-events: none; }
.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    color: var(--on-primary);
    animation: btn-spin 0.7s linear infinite;
}
.btn-secondary.is-loading::after, .btn-ghost.is-loading::after { color: var(--muted); }
.btn-danger.is-loading::after { color: var(--on-danger); }
@keyframes btn-spin { to { transform: rotate(360deg); } }
.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--sp-3) var(--sp-4);
}
.form-grid .field-wide { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.field-label {
    font-size: var(--fs-label);
    font-weight: 500;
    color: var(--muted);
}
.field-help { font-size: var(--fs-label); color: var(--muted); }
.field-error-msg { font-size: var(--fs-label); color: var(--danger); }
.input, .select, .textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--field-bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--fs-body);
    transition: border-color 0.12s;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 0;
    border-color: transparent;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 0.75; }
.input-mono { font-family: var(--font-mono); font-size: var(--fs-table); }
.textarea { resize: vertical; min-height: 4.5rem; }
.select {
    appearance: none;
    padding-right: 2rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                      linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 0.95rem) 50%, calc(100% - 0.65rem) 50%;
    background-size: 0.3rem 0.3rem;
    background-repeat: no-repeat;
}
.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea { border-color: var(--danger); }
.field.has-error .input:focus-visible { outline-color: var(--danger); }
.field.has-error .field-label { color: var(--danger); }
.checkbox {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-body);
    cursor: pointer;
}
.checkbox input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--primary);
    margin: 0;
}
.switch { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; }
.switch input {
    appearance: none;
    width: 2.3rem;
    height: 1.3rem;
    margin: 0;
    border-radius: var(--r-full);
    background: var(--border-strong);
    position: relative;
    transition: background 0.15s;
    flex-shrink: 0;
}
.switch input::after {
    content: "";
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s;
}
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(1rem); }
.switch input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.search-field { position: relative; }
.autocomplete {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: var(--sp-1);
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-md);
    max-height: 16rem;
    overflow-y: auto;
}
.autocomplete button {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-3);
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text);
    font-size: var(--fs-body);
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
}
.autocomplete button:hover, .autocomplete button.is-active {
    background: var(--primary-soft);
    color: var(--primary-soft-text);
}
.autocomplete .ac-meta { color: var(--muted); font-size: var(--fs-label); }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.1rem 0.6rem;
    border-radius: var(--r-full);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    font-size: var(--fs-label);
    font-weight: 500;
    white-space: nowrap;
}
.chip-short { font-size: var(--fs-small); padding: 0.05rem 0.45rem; }
.chip-uploaded {  }
.chip-processing { border-color: var(--border); }
.chip-processing::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--primary);
    animation: chip-pulse 1.2s ease-in-out infinite;
}
@keyframes chip-pulse { 50% { opacity: 0.3; } }
.chip-extracted {
    background: var(--primary-soft);
    border-color: transparent;
    color: var(--primary-soft-text);
}
.chip-reviewed {
    background: var(--ok-soft);
    border-color: transparent;
    color: var(--ok);
}
.chip-error {
    background: var(--danger-soft);
    border-color: transparent;
    color: var(--danger);
}
.chip-paid {
    background: none;
    border-color: var(--ok-border);
    color: var(--ok);
}
.chip-archived { opacity: 0.7; }
.flag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.1rem 0.6rem 0.1rem 0.5rem;
    border-radius: var(--r-full);
    border: 1px solid var(--warn-border);
    background: var(--warn-soft);
    color: var(--warn);
    font-size: var(--fs-label);
    font-weight: 500;
    white-space: nowrap;
}
.flag::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
}
.banner {
    border-radius: var(--r-sm);
    padding: 0.6rem 0.85rem;
    font-size: var(--fs-body);
    border: 1px solid;
}
.banner ul { margin: 0; padding-left: 1.1rem; }
.banner-warn { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.banner-error { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.banner-info { background: var(--primary-soft); border-color: transparent; color: var(--primary-soft-text); }
.banner-ok { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.toast {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 0.6rem 0.9rem;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-md);
    font-size: var(--fs-body);
    max-width: 28rem;
}
.toast::before {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.toast-success::before { background: var(--ok); }
.toast-error::before { background: var(--danger); }
.toast-info::before { background: var(--primary); }
.toast-text { flex: 1; }
.toast-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.1rem;
}
.toast-close:hover { color: var(--text); }
.toast-container {
    position: fixed;
    top: var(--sp-4);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    max-width: min(28rem, 90vw);
}
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2) var(--sp-3);
    align-items: flex-end;
}
.filter {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: var(--fs-label);
    color: var(--muted);
    font-weight: 500;
}
.filter .input, .filter .select {
    min-width: 7.5rem;
    padding: 0.4rem 0.55rem;
    font-size: var(--fs-table);
}
.filter .input[type="search"], .filter .input[type="text"] { min-width: 11rem; }
.filter-actions { display: flex; gap: var(--sp-2); }
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    flex-wrap: wrap;
}
.page-head h1 { margin: 0; }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.summary-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    align-items: stretch;
}
.summary-card {
    flex: 1 1 14rem;
    max-width: 24rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: var(--sp-4) var(--sp-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
}
.summary-count { font-size: var(--fs-label); font-weight: 500; color: var(--muted); }
.summary-total {
    font-family: var(--font-brand);
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.summary-sub { font-size: var(--fs-label); color: var(--muted); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-table);
}
.data-table th {
    text-align: left;
    color: var(--muted);
    font-weight: 500;
    font-size: var(--fs-label);
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
}
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--primary); }
.data-table th .sort-arrow { font-size: 1.2em; }
.data-table td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.data-table td.num, .data-table th.num { text-align: right; }
.data-table td.trunc { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
.data-table td.trunc-wide { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; }
.data-table tbody tr.row-link { cursor: pointer; }
.data-table tbody tr.row-link:hover td { background: var(--primary-soft); }
.overdue { color: var(--danger); font-weight: 600; }
.table-actions { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.table-empty {
    text-align: center;
    color: var(--muted);
    padding: var(--sp-6) var(--sp-4);
}
.table-empty .table-empty-actions {
    display: flex;
    justify-content: center;
    gap: var(--sp-2);
    margin-top: var(--sp-3);
}
.table-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-3);
    color: var(--muted);
    font-size: var(--fs-label);
}
.table-loader::before {
    content: "";
    width: 1em;
    height: 1em;
    border: 2px solid var(--muted);
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
}
.bulk-bar {
    display: none;
    gap: var(--sp-2) var(--sp-3);
    align-items: center;
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--primary);
    border-radius: var(--r-sm);
    background: var(--primary-soft);
    flex-wrap: wrap;
}
.bulk-bar.is-visible { display: flex; }
.bulk-bar .bulk-count { font-weight: 600; color: var(--primary-soft-text); }
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--backdrop);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 900;
    padding: var(--sp-4);
}
.modal-backdrop.is-open { display: flex; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 28rem;
}
.modal--wide { max-width: 46rem; }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; }
.modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.2rem;
    border-radius: 6px;
}
.modal-close:hover { color: var(--text); }
.modal-close:focus-visible { outline: 2px solid var(--focus); }
.modal-body {
    padding: var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}
.modal-scroll { max-height: 60vh; overflow-y: auto; }
.modal-actions {
    display: flex;
    gap: var(--sp-2);
    justify-content: flex-end;
    padding: 0 var(--sp-5) var(--sp-5);
}
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
    gap: var(--sp-3);
}
.stat-tile {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    align-items: flex-start;
    padding: var(--sp-4);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font-size: inherit;
    font-family: inherit;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.12s;
}
.stat-tile:disabled { cursor: default; }
.stat-tile:not(:disabled):hover { border-color: var(--primary); }
.stat-tile:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.stat-label { font-size: var(--fs-label); font-weight: 500; color: var(--muted); }
.stat-value {
    font-family: var(--font-brand);
    font-size: var(--fs-stat);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    line-height: 1.15;
}
.stat-sub { font-size: var(--fs-label); color: var(--muted); font-variant-numeric: tabular-nums; }
.stat-alert { border-color: var(--danger-border); background: var(--danger-soft); }
.stat-alert .stat-value, .stat-alert .stat-sub { color: var(--danger); }
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--sp-4);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    height: 3.5rem;
}
.topbar .spacer { flex: 1; }
.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-brand);
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
    margin-right: var(--sp-2);
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand-logo {
    width: 1.7rem;
    height: 1.7rem;
    display: inline-flex;
    flex-shrink: 0;
}
.brand-logo svg { width: 100%; height: 100%; display: block; }
.brand-word { text-transform: lowercase; letter-spacing: -0.04em; font-weight: 500; }
.nav { display: flex; align-items: center; gap: 0.15rem; }
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--r-sm);
    border: none;
    background: none;
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-link:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.nav-link.active { background: var(--primary-soft); color: var(--primary-soft-text); }
.nav-link .caret { font-size: 0.65em; }
.menu-wrap { position: relative; }
.menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 13rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-md);
    padding: var(--sp-1);
    z-index: 800;
}
.menu--right { left: auto; right: 0; }
.menu-wrap.is-open > .menu { display: block; }
.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--fs-body);
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
}
.menu-item:hover { background: var(--primary-soft); color: var(--primary-soft-text); text-decoration: none; }
.menu-item.is-checked::after { content: "✓"; color: var(--primary); font-weight: 600; }
.menu-sep { border-top: 1px solid var(--border); margin: var(--sp-1) 0; }
.menu-header { padding: 0.45rem 0.6rem 0.55rem; display: flex; flex-direction: column; gap: 0.1rem; }
.menu-header .muted { font-size: var(--fs-label); }
.menu-label {
    padding: 0.4rem 0.6rem 0.15rem;
    font-size: var(--fs-small);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.tenant-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 15rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--fs-table);
    font-weight: 500;
    cursor: pointer;
}
.tenant-switcher:hover { border-color: var(--border-strong); }
.tenant-switcher:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tenant-switcher .tenant-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-switcher .caret { font-size: 0.6rem; color: var(--muted); flex-shrink: 0; }
.tenant-switcher .tenant-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}
.user-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: none;
    border: none;
    border-radius: var(--r-sm);
    color: var(--text);
    padding: 0.35rem 0.55rem;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: var(--fs-table);
    font-weight: 500;
}
.user-menu-toggle:hover { background: var(--surface-2); }
.user-menu-toggle:focus-visible { outline: 2px solid var(--focus); }
.avatar {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-soft-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 600;
    flex-shrink: 0;
}
.user-menu-name { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-row { display: flex; align-items: center; gap: var(--sp-2); padding: 0.45rem 0.6rem; }
.theme-row .theme-row-label { flex: 1; font-size: var(--fs-body); }
.theme-seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.theme-seg button {
    background: none;
    border: none;
    padding: 0.25rem 0.55rem;
    font-size: var(--fs-label);
    color: var(--muted);
    cursor: pointer;
}
.theme-seg button + button { border-left: 1px solid var(--border); }
.theme-seg button.is-active { background: var(--primary-soft); color: var(--primary-soft-text); font-weight: 600; }
.burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0 0.55rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
}
.burger span { display: block; height: 2px; border-radius: 2px; background: var(--text); }
.burger:focus-visible { outline: 2px solid var(--focus); }
.mobile-nav {
    display: none;
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: var(--sp-2) var(--sp-4) var(--sp-3);
    flex-direction: column;
    gap: 0.1rem;
}
.mobile-nav.is-open { display: flex; }
.mobile-nav .nav-link { width: 100%; justify-content: flex-start; padding: 0.55rem 0.75rem; }
.mobile-nav .menu-label { padding-left: 0.75rem; }
@media (max-width: 960px) {
    .nav { display: none; }
    .burger { display: flex; }
    .user-menu-name, .user-menu-toggle .caret { display: none; }
    .tenant-switcher { max-width: 10rem; }
    .topbar-upload-label { display: none; }
}
.app-main {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--sp-5) var(--sp-4) var(--sp-7);
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    flex: 1;
    overflow-x: clip;
}
.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--sp-4);
    position: relative;
}
.auth-card {
    width: 100%;
    max-width: 23rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    padding: var(--sp-6) var(--sp-5) var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}
.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-2);
}
.auth-brand .brand-logo { width: 2.6rem; height: 2.6rem; }
.auth-brand .auth-title {
    font-family: var(--font-brand);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.auth-title.brand-word { font-weight: 500; letter-spacing: -0.04em; }
.auth-sub { text-align: center; color: var(--muted); font-size: var(--fs-table); margin: -0.5rem 0 0; }
.auth-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--fs-table);
    margin-top: var(--sp-1);
}
.auth-meta {
    position: absolute;
    bottom: var(--sp-4);
    left: 0;
    right: 0;
    text-align: center;
    color: var(--muted);
    font-size: var(--fs-label);
}
.corner-theme {
    position: absolute;
    top: var(--sp-4);
    right: var(--sp-4);
    z-index: 2;
}
.auth-wrap--photo {
    background-image: url("img/snow-bg.jpg");
    background-size: cover;
    background-position: center;
}
.auth-wrap--photo::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(11, 18, 32, 0.55), rgba(11, 18, 32, 0.12) 35%, rgba(11, 18, 32, 0) 60%);
    pointer-events: none;
}
.auth-wrap--photo .auth-card { position: relative; box-shadow: var(--shadow-lg); border-color: transparent; }
.auth-wrap--photo .corner-theme .btn { color: #f2f5f9; }
.auth-wrap--photo .corner-theme .btn:hover { background: rgba(11, 18, 32, 0.35); color: #ffffff; }
.auth-wrap--photo .auth-meta, .auth-wrap--photo .auth-meta a { color: #e6ecf5; }
.auth-wrap--photo .auth-meta a:hover { color: #ffffff; }
.auth-wrap--photo .auth-meta { text-shadow: 0 1px 6px rgba(11, 18, 32, 0.5); position: relative; }
.app-footer {
    width: 100%;
    margin-top: auto;
    padding: var(--sp-4);
    text-align: center;
    font-size: var(--fs-label);
}
.app-footer a, .auth-meta a {
    color: var(--muted);
    text-decoration: none;
}
.app-footer a:hover, .auth-meta a:hover {
    color: var(--primary);
    text-decoration: none;
}
.error-code {
    font-family: var(--font-brand);
    font-size: 4.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--primary);
    text-align: center;
}
.error-title { text-align: center; margin: var(--sp-2) 0 0; }
.error-text { text-align: center; color: var(--muted); margin: var(--sp-2) 0 0; }
.error-actions { display: flex; justify-content: center; gap: var(--sp-2); margin-top: var(--sp-4); }
.chart { display: flex; align-items: stretch; gap: 0.5rem; height: 11rem; }
.chart-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chart-value {
    text-align: center;
    font-size: var(--fs-small);
    color: var(--muted);
    white-space: nowrap;
    min-height: 1.2em;
    font-variant-numeric: tabular-nums;
}
.chart-bar-wrap { flex: 1; display: flex; align-items: flex-end; }
.chart-bar { width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart-label { text-align: center; font-size: var(--fs-small); color: var(--muted); margin-top: 0.3rem; }
@media (max-width: 760px) {
    .chart { gap: 0.25rem; }
    .chart-value { display: none; }
}
.review-head {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-wrap: wrap;
    position: sticky;
    top: 3.5rem;
    z-index: 50;
    background: var(--bg);
    padding: var(--sp-2) 0;
    border-bottom: 1px solid var(--border);
}
.review-head h1 { margin: 0; }
.review-head .spacer { flex: 1; }
.review-actions-cluster {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
}
.vdiv { width: 1px; height: 1.6rem; background: var(--border-strong); flex-shrink: 0; }
.log-menu { min-width: 19rem; max-height: 22rem; overflow-y: auto; }
.log-row {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.45rem 0.6rem;
    font-size: var(--fs-table);
    border-radius: 6px;
}
.log-row + .log-row { border-top: 1px solid var(--border); border-radius: 0; }
.log-when { color: var(--muted); font-size: var(--fs-label); font-variant-numeric: tabular-nums; }
.log-what strong { font-weight: 600; }
.form-section {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-4);
    margin-top: var(--sp-4);
}
.form-section > h2 { margin-bottom: var(--sp-3); }
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
    gap: var(--sp-4);
    align-items: start;
}
.review-split {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(360px, 1fr);
    gap: var(--sp-4);
    align-items: start;
}
.pages-pane {
    background: #dde1e8;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-3);
    max-height: 82vh;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}
.doc-page {
    background: #ffffff;
    color: #232323;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    border-radius: 2px;
    padding: 2rem 2.2rem;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 0.72rem;
    line-height: 1.5;
    cursor: zoom-in;
}
.vat-table { border-collapse: collapse; width: 100%; }
.vat-table th {
    text-align: left;
    color: var(--muted);
    font-size: var(--fs-label);
    font-weight: 500;
    padding: 0 0.4rem 0.25rem 0;
}
.vat-table td { padding: 0 0.4rem 0.4rem 0; }
.vat-table td:last-child, .vat-table th:last-child { padding-right: 0; }
.review-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); flex-wrap: wrap; }
.meta-line { font-size: var(--fs-label); color: var(--muted); margin-top: var(--sp-3); }
.review-tabs {
    display: none;
    gap: 0.25rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 0.25rem;
}
.review-tabs button {
    flex: 1;
    padding: 0.45rem;
    border: none;
    background: none;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
}
.review-tabs button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
@media (max-width: 900px) {
    .review-split { grid-template-columns: 1fr; }
    .review-tabs { display: flex; }
    .review-split.show-doc .review-form-pane { display: none; }
    .review-split.show-form .pages-pane { display: none; }
}
.invoice-cards { display: none; flex-direction: column; gap: var(--sp-2); }
.icard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-3) var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    cursor: pointer;
}
.icard:hover { border-color: var(--primary); }
.icard-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); }
.icard-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icard-amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.icard-meta {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    color: var(--muted);
    font-size: var(--fs-label);
    flex-wrap: wrap;
}
@media (max-width: 760px) {
    .table-desktop { display: none; }
    .invoice-cards { display: flex; }
}
.spacer { flex: 1; }
h3 { font-size: 0.95rem; margin: 1rem 0 0.25rem; color: var(--muted); }
button.ghost {
    background: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text);
    padding: 0.35rem 0.7rem;
    font-size: var(--fs-table);
    font-family: var(--font-body);
    cursor: pointer;
}
button.ghost:hover { border-color: var(--primary); color: var(--primary); }
.error {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid var(--danger-border);
    border-radius: var(--r-sm);
    padding: 0.5rem 0.7rem;
    margin: 0.5rem 0 0;
    font-size: var(--fs-table);
}
.notice {
    border-radius: var(--r-sm);
    padding: 0.5rem 0.8rem;
    margin-bottom: 0.75rem;
    font-size: var(--fs-table);
    background: var(--primary-soft);
    color: var(--primary-soft-text);
}
.notice-error { background: var(--danger-soft); color: var(--danger); }
.inline-error { font-size: var(--fs-label); }
.banner { margin-bottom: 0.75rem; }
.filter-bar { margin-bottom: 0.75rem; }
.dropzone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--r-sm);
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted);
    cursor: pointer;
    margin-bottom: 0.75rem;
}
.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover { border-color: var(--primary); color: var(--primary); outline: none; }
.upload-list,
.entry-list { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.upload-list li,
.entry-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    font-size: var(--fs-table);
    flex-wrap: wrap;
}
.file-name { flex: 1; min-width: 12rem; overflow-wrap: anywhere; }
.file-status { color: var(--muted); }
.file-status[data-state="upload.status.done"] { color: var(--ok); }
.file-status[data-state="error"],
.file-status[data-state="duplicate"] { color: var(--danger); }
.dup-actions { display: flex; gap: 0.4rem; }
.dup-actions button {
    border: none;
    border-radius: var(--r-sm);
    background: var(--primary);
    color: var(--on-primary);
    padding: 0.25rem 0.6rem;
    font-size: var(--fs-label);
    cursor: pointer;
}
.dup-actions button.ghost { background: none; border: 1px solid var(--border-strong); color: var(--text); }
.upload-actions { margin-top: 0.75rem; display: flex; gap: 0.5rem; }
.upload-actions button {
    border: none;
    border-radius: var(--r-sm);
    background: var(--primary);
    color: var(--on-primary);
    padding: 0.5rem 1rem;
    font-size: var(--fs-body);
    font-weight: 500;
    cursor: pointer;
}
.upload-actions button.ghost { background: none; border: 1px solid var(--border-strong); color: var(--text); }
.upload-actions button:disabled { opacity: 0.6; cursor: default; }
.modal-body .dropzone { margin-bottom: 0; }
.invoice-list { list-style: none; margin: 0; padding: 0; }
.invoice-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: var(--fs-table);
}
.invoice-row:hover { background: var(--primary-soft); text-decoration: none; }
.invoice-row .cell.date { width: 6.5rem; color: var(--muted); flex-shrink: 0; }
.invoice-row .cell.name { flex: 1; min-width: 8rem; overflow-wrap: anywhere; }
.invoice-row .cell.number { width: 10rem; color: var(--muted); overflow-wrap: anywhere; }
.invoice-row .cell.amount { width: 8.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.review-head h2 { margin: 0; flex: 1; }
.page-img {
    width: 100%;
    height: auto;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    cursor: zoom-in;
    background: #fff;
}
.page-img.zoomed { width: 180%; max-width: none; cursor: zoom-out; }
.downloads { display: flex; flex-direction: column; gap: 0.25rem; }
.download-link { font-size: var(--fs-table); }
.review-form { min-width: 0; }
.field > span { color: var(--muted); }
.field input, .field select, .field textarea,
.creditor-picker input, .creditor-new input {
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--field-bg);
    color: var(--text);
    font-size: var(--fs-body);
    font-family: var(--font-body);
}
.field textarea { resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible,
.creditor-picker input:focus-visible, .creditor-new input:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 0;
    border-color: transparent;
}
.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.creditor-field { margin-bottom: 1rem; }
.creditor-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; position: relative; }
.creditor-current { font-weight: 600; }
.creditor-new { display: flex; gap: 0.5rem; flex-wrap: wrap; width: 100%; }
.creditor-filter { position: relative; }
.vat-table { margin-bottom: 0.5rem; }
.vat-table input { width: 100%; }
.review-actions button, .creditor-new button, .banner button {
    border: none;
    border-radius: var(--r-sm);
    background: var(--primary);
    color: var(--on-primary);
    padding: 0.5rem 1rem;
    font-size: var(--fs-body);
    font-weight: 500;
    cursor: pointer;
}
.review-actions button.ghost, .creditor-picker button.ghost {
    background: none;
    border: 1px solid var(--border-strong);
    color: var(--text);
}
.summary { font-size: var(--fs-table); margin-top: 1rem; }
.list-search {
    width: 100%;
    max-width: 24rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--field-bg);
    color: var(--text);
    font-size: var(--fs-body);
    margin-bottom: 0.75rem;
}
.iban-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.5rem; }
.iban-row { display: flex; gap: 0.5rem; }
.iban-row input {
    flex: 1;
    max-width: 22rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--field-bg);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: var(--fs-table);
}
.merge-confirm {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--primary);
    border-radius: var(--r-sm);
    background: var(--primary-soft);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}
.merge-confirm input[type="text"] {
    flex: 1;
    min-width: 14rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--field-bg);
    color: var(--text);
}
.filter input, .filter select {
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--field-bg);
    color: var(--text);
    font-size: var(--fs-table);
    font-family: var(--font-body);
    min-width: 7rem;
}
.filter input[type="text"] { min-width: 10rem; }
.summary-note { align-self: center; color: var(--muted); }
.data-table td a { color: var(--text); text-decoration: none; }
.data-table td a:hover { color: var(--primary); }
.modal-body input[type="text"],
.modal-body input[type="date"],
.modal-body input[type="email"],
.modal-body input[type="password"],
.modal-body input[type="number"],
.modal-body textarea,
.modal-body select {
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--field-bg);
    color: var(--text);
    font-size: var(--fs-body);
    font-family: var(--font-body);
    width: 100%;
}
.modal-actions button {
    border: none;
    border-radius: var(--r-sm);
    background: var(--primary);
    color: var(--on-primary);
    padding: 0.5rem 1rem;
    font-size: var(--fs-body);
    font-weight: 500;
    cursor: pointer;
}
.modal-actions button.ghost { background: none; border: 1px solid var(--border-strong); color: var(--text); }
.table-actions button { font-size: var(--fs-label); padding: 0.15rem 0.5rem; }
.usage-controls { display: flex; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.usage-custom { display: flex; align-items: flex-end; gap: 0.5rem; }
tr.usage-partner { cursor: pointer; font-weight: 600; }
tr.usage-partner:hover td { background: var(--primary-soft); }
tr.usage-tenant td:first-child { padding-left: 1.9rem; }
tr.usage-total td { font-weight: 600; border-top: 2px solid var(--border-strong); }
.usage-caret { display: inline-block; width: 1em; }
.chart-toolbar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.chart-toolbar input[type="search"] {
    flex: 1 1 14rem;
    max-width: 20rem;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--field-bg);
    color: var(--text);
}
.chart-empty { text-align: center; padding: 2rem 0; }
.chart-empty-actions { display: flex; justify-content: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }
.chart-table { border-collapse: collapse; width: 100%; margin-bottom: 0.5rem; }
.chart-table th { text-align: left; color: var(--muted); font-size: var(--fs-label); font-weight: 500; padding: 0.25rem; }
.chart-table td { padding: 0.25rem; }
.chart-table input[type="text"], .chart-table input[type="number"],
.chart-table input[type="search"], .chart-table select { width: 100%; }
.chart-table td.chart-active, .chart-table td.vatc-active { text-align: center; }
.chart-table .chart-number { max-width: 7rem; }
.chart-diff-wrap { max-height: 55vh; overflow-y: auto; }
.chart-diff-wrap table { border-collapse: collapse; width: 100%; }
.chart-diff-wrap th, .chart-diff-wrap td { padding: 0.3rem 0.5rem; text-align: left; }
.chart-diff-wrap th {
    color: var(--muted);
    font-size: var(--fs-label);
    font-weight: 500;
    position: sticky;
    top: 0;
    background: var(--surface);
}
tr.chart-diff-unchanged td { color: var(--muted); }
tr.chart-diff-invalid td { color: var(--danger); }
tr.chart-diff-new td:last-child { color: var(--primary); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.attachment-block { margin-top: 1rem; padding-top: 0.75rem; border-top: 2px solid var(--border-strong); }
.attachment-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.attachment-label { font-weight: 600; font-size: var(--fs-table); }
.menu--scroll { max-height: 20rem; overflow-y: auto; }
.chip-approved { background: none; border-color: var(--ok-border); color: var(--ok); }
.chip-unapproved { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.bulk-bar { margin-bottom: 0.75rem; }
.bulk-bar .input { width: 8rem; padding: 0.35rem 0.5rem; }
.review { display: flex; flex-direction: column; gap: 0.75rem; }
.review .banner, .review .notice { margin-bottom: 0; }
[hidden] { display: none !important; }
@media (max-width: 640px) {
    .topbar-inner { padding: 0 var(--sp-2); gap: 0.35rem; }
    .brand { margin-right: 0; }
    .brand-word { display: none; }
    .tenant-switcher { max-width: 7.5rem; padding-left: 0.5rem; padding-right: 0.5rem; }
}
