:root {
    color-scheme: light;
    --bg: #f5f3ee;
    --paper: #fffdf8;
    --ink: #22201c;
    --muted: #706b62;
    --line: #ded7ca;
    --accent: #126c6a;
    --accent-strong: #0b4f4e;
    --gold: #b6812b;
    --red: #a0322d;
    --green: #1f7a4d;
    --shadow: 0 18px 45px rgba(42, 34, 20, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px clamp(16px, 4vw, 46px);
    background: #162b2b;
    color: #fffdf8;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 46px);
    line-height: 1;
    font-weight: 850;
}

.eyebrow {
    margin: 0 0 4px;
    color: #e4c783;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.logout-form {
    margin: 0;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ghost-button,
.sync-month-button,
.export-button,
.login-panel button,
.settings-actions button {
    display: inline-grid;
    place-items: center;
    min-height: 42px;
    border-radius: 8px;
    padding: 0 16px;
    background: var(--accent);
    color: white;
    font-weight: 800;
}

.export-button {
    background: var(--paper);
    border: 1px solid var(--line);
    color: var(--accent-strong);
    text-decoration: none;
}

.ghost-button {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: transparent;
    text-decoration: none;
}

.ghost-button.active {
    background: rgba(255, 255, 255, 0.16);
    border-color: #e4c783;
    color: #e4c783;
}

/* Sub-navigatie binnen een pagina (bv. Instellingen-secties) — zelfde patroon als de fooien-subnav:
   één horizontale tabbladenrij, op mobiel horizontaal scrollbaar i.p.v. gestapeld. */
.page-subnav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 2px 2px 14px;
    margin-bottom: 4px;
}

.page-subnav-tab {
    flex: none;
    display: inline-flex;
    align-items: center;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}

.page-subnav-tab:hover {
    border-color: var(--accent);
}

.page-shell {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 22px clamp(12px, 3vw, 34px) 42px;
}

.alert {
    margin: 0 0 12px;
    border-radius: 8px;
    padding: 12px 14px;
    font-weight: 700;
}

.warning {
    background: #fff3d1;
    color: #6a4507;
}

.error {
    background: #ffe2dd;
    color: #7f201b;
}

.location-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.location-tile {
    display: grid;
    gap: 4px;
    min-height: 92px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf8;
    color: var(--ink);
    padding: 14px 16px;
    text-decoration: none;
    box-shadow: 0 1px 0 rgba(22, 43, 43, 0.05);
}

.location-tile span,
.location-tile em {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.location-tile strong {
    min-height: 28px;
    font-size: 22px;
    line-height: 1.15;
}

.location-tile:hover,
.location-tile:focus-visible {
    border-color: var(--accent);
    outline: 2px solid rgba(23, 126, 119, 0.18);
    outline-offset: 2px;
}

.location-tile.active {
    border-color: #162b2b;
    background: #162b2b;
    color: #fffdf8;
}

.location-tile.active span,
.location-tile.active em {
    color: #e4c783;
}

.month-toolbar {
    display: grid;
    grid-template-columns: 46px minmax(180px, 260px) 46px auto auto;
    align-items: end;
    gap: 10px;
    margin-bottom: 16px;
}

.toolbar-dropdown {
    position: relative;
}

.toolbar-dropdown > summary {
    list-style: none;
    cursor: pointer;
}

.toolbar-dropdown > summary::-webkit-details-marker {
    display: none;
}

.toolbar-dropdown-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    right: 0;
    display: grid;
    gap: 4px;
    min-width: 220px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    box-shadow: 0 12px 30px rgba(22, 43, 43, 0.18);
}

.toolbar-dropdown-menu .dropdown-item {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font-weight: 700;
    text-align: left;
    text-decoration: none;
    line-height: 40px;
}

.toolbar-dropdown-menu .dropdown-item:hover:not(:disabled) {
    background: var(--bg);
}

.toolbar-dropdown-menu .dropdown-item:disabled {
    color: var(--muted);
    cursor: not-allowed;
}

.icon-button {
    display: grid;
    place-items: center;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink);
    text-decoration: none;
    font-size: 32px;
    line-height: 1;
}

.month-picker {
    display: grid;
    gap: 5px;
}

.month-picker label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.month-picker input,
.cashbook-table input,
.login-panel input,
.settings-card input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 8px 10px;
}

.cashbook-table input[readonly] {
    background: #eef5f3;
    color: var(--accent-strong);
    font-weight: 800;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.summary-grid div {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    padding: 14px;
    box-shadow: 0 8px 18px rgba(42, 34, 20, 0.05);
}

.summary-grid span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.summary-grid strong {
    font-size: clamp(18px, 2.4vw, 28px);
}

.cashbook-panel {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.cashbook-table {
    width: 100%;
    min-width: 1160px;
    border-collapse: collapse;
}

.cashbook-table th,
.cashbook-table td {
    border-bottom: 1px solid var(--line);
    padding: 9px 8px;
    vertical-align: middle;
}

.cashbook-table th {
    background: #e9e1d3;
    color: #3d372e;
    font-size: 12px;
    text-align: left;
    text-transform: uppercase;
}

.cashbook-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    box-shadow: 0 1px 0 var(--line), 0 8px 14px rgba(42, 34, 20, 0.08);
}

.sticky-location-row th {
    height: 42px;
    background: #162b2b;
    color: #fffdf8;
    text-transform: none;
}

.sticky-location-row span {
    margin-right: 8px;
    color: #e4c783;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sticky-location-row strong {
    font-size: 15px;
}

.cashbook-table thead tr:nth-child(2) th {
    top: 42px;
}

.cashbook-table tbody tr:nth-child(even) {
    background: #fbf7ee;
}

.cashbook-table tfoot th {
    position: sticky;
    bottom: 0;
    background: #162b2b;
    color: #fffdf8;
}

.cashbook-table tfoot tr:not(:last-child) th {
    bottom: 42px;
}

.corrections-total-row th {
    font-size: 12px;
}

.corrections-panel {
    margin-top: 20px;
}

@media (min-width: 821px) {
    .cashbook-panel {
        overflow: visible;
    }
}

.day-cell {
    width: 88px;
}

.closed-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    cursor: pointer;
    white-space: nowrap;
}

.closed-toggle input {
    margin: 0;
    cursor: pointer;
}

tr.row-closed {
    background: var(--bg);
    opacity: 0.6;
}

tr.row-closed .day-cell .closed-toggle {
    color: var(--ink);
    opacity: 1;
}

.day-number {
    display: block;
    font-size: 20px;
    font-weight: 850;
}

.day-name {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.vectron-warning-icon {
    display: inline-block;
    margin-left: 4px;
    font-size: 13px;
    cursor: help;
    vertical-align: middle;
}

.pay-cell {
    display: grid;
    grid-template-columns: 1fr 38px;
    gap: 6px;
}

.mini-button {
    width: 38px;
    min-width: 38px;
    min-height: 42px;
    border-radius: 8px;
    background: var(--gold);
    color: white;
    font-size: 20px;
    font-weight: 900;
}

.vectron-mini-button {
    margin-left: 6px;
    background: var(--accent);
    font-size: 13px;
}

.secondary-sync {
    background: var(--gold);
}

.tip-value {
    color: var(--muted);
    white-space: nowrap;
}

.tip-value.positive {
    color: var(--green);
}

.tip-value.negative {
    color: var(--red);
}

.status-cell {
    min-width: 100px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.status-cell [data-mode="saving"] {
    color: var(--gold);
}

.status-cell [data-mode="ok"] {
    color: var(--green);
}

.status-cell [data-mode="error"] {
    color: var(--red);
}

.login-body {
    display: grid;
    place-items: center;
    padding: 18px;
}

.login-panel {
    width: min(420px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    padding: 26px;
    box-shadow: var(--shadow);
}

.login-panel h1 {
    margin: 0 0 20px;
}

.login-panel form {
    display: grid;
    gap: 10px;
}

.login-panel label {
    color: var(--muted);
    font-weight: 800;
}

.settings-shell {
    max-width: 1240px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.settings-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    padding: 16px;
    box-shadow: 0 8px 18px rgba(42, 34, 20, 0.05);
}

.settings-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.settings-card-header h2 {
    margin: 0;
    font-size: 22px;
}

.settings-card-header span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.settings-card h3 {
    margin: 0 0 10px;
    font-size: 17px;
}

.access-card {
    margin-bottom: 16px;
}

.access-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 14px;
}

.settings-note {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.4;
}

.access-list {
    display: grid;
    gap: 8px;
}

.access-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fffdf8;
}

.access-row strong,
.access-row span {
    display: block;
}

.access-row span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.access-row button {
    min-height: 34px;
    background: transparent;
    color: var(--red);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-grid label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.check-row {
    grid-template-columns: 22px minmax(0, 1fr) !important;
    align-items: center;
    min-height: 42px;
    color: var(--ink) !important;
    text-transform: none !important;
}

.check-row input {
    min-height: 18px;
}

.settings-card textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 8px 10px;
    resize: vertical;
}

.settings-divider {
    height: 1px;
    margin: 14px 0;
    background: var(--line);
}

.settings-section-title {
    margin: 28px 0 12px;
    font-size: 20px;
}

.settings-collapsible {
    margin-bottom: 4px;
}

.settings-collapsible summary {
    cursor: pointer;
    padding: 4px 0;
    font-weight: 800;
    color: var(--accent-strong);
}

.settings-collapsible .form-grid {
    margin-top: 10px;
}

.settings-note-inline {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    text-transform: none;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.delete-form {
    display: flex;
    justify-content: flex-end;
    margin: 8px 0 0;
}

.delete-form button {
    min-height: 36px;
    border-radius: 8px;
    background: transparent;
    color: var(--red);
    font-weight: 800;
}

@media (max-width: 820px) {
    .topbar {
        padding: 18px 14px;
    }

    .topbar h1 {
        font-size: 26px;
    }

    .settings-card-header {
        flex-wrap: wrap;
    }

    .month-toolbar {
        grid-template-columns: 44px 1fr 44px;
    }

    .toolbar-dropdown {
        grid-column: 1 / -1;
    }

    .toolbar-dropdown > summary {
        width: 100%;
    }

    .toolbar-dropdown-menu {
        left: 0;
        right: 0;
        min-width: 0;
    }

    .page-subnav-tab {
        padding: 8px 13px;
        font-size: 13px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .access-columns {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cashbook-panel {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .cashbook-table,
    .cashbook-table tbody,
    .cashbook-table tr,
    .cashbook-table td {
        display: block;
        min-width: 0;
        width: 100%;
    }

    .cashbook-table thead,
    .cashbook-table tfoot {
        display: none;
    }

    .cashbook-table tr {
        margin-bottom: 12px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--paper);
        padding: 8px;
        box-shadow: 0 8px 18px rgba(42, 34, 20, 0.06);
    }

    .cashbook-table tbody tr:nth-child(even) {
        background: var(--paper);
    }

    .cashbook-table td {
        display: grid;
        grid-template-columns: 112px minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        border-bottom: 0;
        padding: 6px 2px;
    }

    .cashbook-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 850;
        text-transform: uppercase;
    }

    .day-cell {
        grid-template-columns: 1fr !important;
        padding-bottom: 8px !important;
    }

    .day-cell::before {
        display: none;
    }

    .day-number,
    .day-name {
        display: inline;
    }

    .day-name {
        margin-left: 8px;
    }
}

@media (max-width: 430px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .cashbook-table td {
        grid-template-columns: 96px minmax(0, 1fr);
    }
}
