:root {
    --wood: #8f3f25;
    --wood-dark: #5e2919;
    --brass: #d9a947;
    --paper: #fff4d8;
    --cream: #f8e8bb;
    --ink: #2a1810;
    --muted: #745f4b;
    --green: #27734f;
    --red: #b33327;
    --blue: #28618d;
    --shadow: rgba(66, 31, 15, .28);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

.lock-body,
.app-body {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(255,255,255,.22), rgba(0,0,0,.08)),
        repeating-linear-gradient(90deg, #8b4a2f 0 22px, #7b3b25 22px 44px, #9c5737 44px 66px);
}

.lock-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 22px;
}

.mobile-shell {
    min-height: 100vh;
    max-width: 520px;
    margin: 0 auto;
    padding: 18px 14px 92px;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    color: #fff6df;
    margin-bottom: 14px;
}

.app-header h1,
.lock-card h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 34px;
    font-weight: 800;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0 0 3px;
    color: #f9d98d;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 800;
}

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

.wood-card {
    border: 1px solid rgba(86, 39, 20, .45);
    border-radius: 8px;
    background:
        linear-gradient(145deg, rgba(255,255,255,.52), rgba(255,255,255,.04)),
        var(--paper);
    box-shadow:
        inset 2px 2px 5px rgba(255,255,255,.78),
        inset -3px -3px 8px rgba(92,47,22,.18),
        0 12px 28px var(--shadow);
    padding: 16px;
    margin-bottom: 14px;
}

.lock-card {
    width: min(420px, 100%);
    padding: 28px;
}

.brass-badge {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    color: var(--wood-dark);
    font-family: Georgia, serif;
    font-size: 48px;
    font-weight: 900;
    background: radial-gradient(circle at 28% 22%, #fff1b8, var(--brass) 52%, #9d6c1d 100%);
    box-shadow: inset 2px 2px 6px rgba(255,255,255,.8), inset -4px -5px 8px rgba(64,35,8,.35), 0 8px 20px var(--shadow);
}

.hero-ledger {
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 14px;
    color: #fff7dd;
    background:
        linear-gradient(145deg, rgba(255,255,255,.16), rgba(0,0,0,.2)),
        #4b2619;
    box-shadow: inset 2px 2px 5px rgba(255,255,255,.16), inset -5px -5px 12px rgba(0,0,0,.38), 0 14px 30px var(--shadow);
}

.hero-ledger span,
.hero-ledger small {
    display: block;
    color: #f3d89c;
    font-weight: 700;
}

.hero-ledger strong {
    display: block;
    font-size: 36px;
    line-height: 1.1;
    margin: 6px 0;
}

.metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.pressed-tile {
    min-height: 92px;
    padding: 14px;
    border-radius: 8px;
    background: var(--cream);
    box-shadow: inset 4px 4px 8px rgba(92,47,22,.24), inset -3px -3px 8px rgba(255,255,255,.72);
}

.pressed-tile span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.pressed-tile strong {
    display: block;
    margin-top: 6px;
    font-size: 20px;
    overflow-wrap: anywhere;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.section-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
}

.entry-form {
    display: grid;
    gap: 11px;
}

.entry-form.compact {
    gap: 9px;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

input,
select,
textarea,
.form-control,
.form-select {
    width: 100%;
    min-height: 42px;
    border: 1px solid rgba(95, 52, 25, .35);
    border-radius: 8px;
    background: #fff8e8;
    color: var(--ink);
    padding: 9px 11px;
     -webkit-appearance: none;
    outline: none;
    box-shadow: inset 2px 2px 5px rgba(92,47,22,.18), inset -2px -2px 5px rgba(255,255,255,.76);
}

textarea { resize: vertical; }

.inset-input .input-group-text {
    background: #fff8e8;
    border-color: rgba(95,52,25,.35);
    border-radius: 8px 0 0 8px;
}

.leather-btn {
    min-height: 46px;
    border: 1px solid #37180e;
    border-radius: 8px;
    color: #fff8de;
    font-weight: 900;
    background:
        linear-gradient(145deg, rgba(255,255,255,.16), rgba(0,0,0,.22)),
        var(--wood);
    box-shadow: inset 2px 2px 4px rgba(255,255,255,.24), inset -3px -3px 7px rgba(0,0,0,.28), 0 8px 16px var(--shadow);
}

.leather-btn:hover,
.leather-btn:focus {
    color: #fff8de;
    background-color: var(--wood-dark);
}

.round-btn {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(50, 22, 10, .55);
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    color: #fff7df;
    text-decoration: none;
    background: radial-gradient(circle at 30% 22%, #d79862, #78341f 70%);
    box-shadow: inset 2px 2px 4px rgba(255,255,255,.26), inset -3px -4px 7px rgba(0,0,0,.3), 0 6px 14px var(--shadow);
}

.round-btn.mini {
    width: 34px;
    height: 34px;
    font-size: 13px;
}

.list-stack {
    display: grid;
    gap: 10px;
}

.book-row {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid rgba(95, 52, 25, .25);
    border-radius: 8px;
    background: rgba(255,248,232,.82);
    box-shadow: inset 1px 1px 3px rgba(255,255,255,.82), 0 4px 10px rgba(87,42,20,.12);
}

.row-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.row-top strong {
    display: block;
    font-size: 16px;
}

.row-top small,
.book-row small {
    color: var(--muted);
    font-weight: 700;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.account-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.history-row {
    grid-template-columns: 1fr auto;
}

.history-credit {
    border-left: 4px solid var(--red);
}

.history-payment {
    border-left: 4px solid var(--green);
}

.chip-btn,
.pill {
    min-height: 32px;
    border: 1px solid rgba(95, 52, 25, .35);
    border-radius: 999px;
    padding: 6px 10px;
    color: var(--ink);
    background: #f8e8bb;
    font-size: 12px;
    font-weight: 900;
    box-shadow: inset 1px 1px 3px rgba(255,255,255,.78), inset -1px -1px 3px rgba(92,47,22,.16);
}

.danger { color: var(--red); }
.green { color: var(--green); }
.blue { color: var(--blue); }

.switch-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.switch-line input {
    width: 18px;
    min-height: 18px;
}

.report-filters {
    display: grid;
    grid-template-columns: 1fr 1fr 44px;
    gap: 8px;
    margin-bottom: 12px;
}

.report-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.report-table td,
.report-table th {
    padding: 8px;
    background: rgba(255,248,232,.85);
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    width: min(492px, calc(100% - 24px));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(61, 29, 18, .94);
    box-shadow: inset 2px 2px 5px rgba(255,255,255,.12), inset -3px -3px 8px rgba(0,0,0,.28), 0 14px 28px var(--shadow);
    z-index: 20;
}

.bottom-nav button {
    border: 0;
    border-radius: 8px;
    min-height: 54px;
    color: #ecd2a0;
    background: transparent;
    display: grid;
    place-items: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 800;
}

@media (max-width: 390px) {
    .bottom-nav {
        gap: 4px;
        padding: 6px;
    }
    .bottom-nav button {
        font-size: 11px;
        min-height: 52px;
    }
}

.bottom-nav button i {
    font-size: 18px;
}

.bottom-nav button.active {
    color: #3c1a0f;
    background: radial-gradient(circle at 30% 20%, #fff0b6, var(--brass));
    box-shadow: inset 1px 1px 4px rgba(255,255,255,.75), inset -2px -2px 5px rgba(91,54,10,.22);
}

.app-view { display: none; }
.app-view.active { display: block; }

.pay-dialog {
    width: min(420px, calc(100% - 28px));
    border: 0;
    padding: 0;
    background: transparent;
}

.pay-dialog::backdrop {
    background: rgba(38, 18, 9, .62);
}

@media (max-width: 370px) {
    .two-col,
    .metric-grid,
    .report-filters {
        grid-template-columns: 1fr;
    }
    .report-filters .round-btn {
        width: 100%;
        border-radius: 8px;
    }
}

@media print {
    .app-header,
    .bottom-nav,
    form,
    .round-btn,
    .row-actions {
        display: none !important;
    }
    .mobile-shell {
        max-width: none;
        padding: 0;
    }
    body {
        background: #fff !important;
    }
    .wood-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
