@font-face {
    font-family: 'Switzer';
    src: url('/fonts/Switzer/Switzer-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Switzer';
    src: url('/fonts/Switzer/Switzer-Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'Switzer';
    src: url('/fonts/Switzer/Switzer-Semibold.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: 'Switzer';
    src: url('/fonts/Switzer/Switzer-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'Switzer';
    src: url('/fonts/Switzer/Switzer-Black.woff2') format('woff2');
    font-weight: 900;
    font-display: swap;
}
@font-face {
    font-family: 'Author';
    src: url('/fonts/Author/Author-Regular.ttf');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Author';
    src: url('/fonts/Author/Author-Medium.ttf');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'Author';
    src: url('/fonts/Author/Author-Semibold.ttf');
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('/fonts/JetBrainsMono/JetBrainsMono-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('/fonts/JetBrainsMono/JetBrainsMono-Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}

:root {
    --font-sans: 'Author', ui-sans-serif, system-ui, sans-serif;
    --font-display: 'Switzer', ui-sans-serif, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    --ink: #0a0a0a;
    --paper: #fbfbfa;
    --surface: #ffffff;
    --signal: #fc3c02;
    --signal-dark: #d63300;
    --hairline: #e5e3df;
    --muted: #6b6963;

    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;

    --nav-h: 64px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    color: var(--ink);
    background-color: var(--paper);
    background-image: radial-gradient(circle, rgba(10, 10, 10, 0.08) 1px, transparent 1px);
    background-size: 18px 18px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 560px;
    margin-inline: auto;
    position: relative;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    margin: 0;
    letter-spacing: -0.02em;
}

p {
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font-family: inherit;
    color: inherit;
}

/* ---------- Layout shell ---------- */

.screen {
    padding: 20px 20px calc(var(--nav-h) + 32px);
    min-height: 100dvh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.topbar__title {
    font-size: 13px;
    font-family: var(--font-mono);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.topbar__mark {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15px;
}

.topbar__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--signal);
    flex-shrink: 0;
}

/* ---------- Cards ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.card + .card {
    margin-top: 12px;
}

/* ---------- Bottom nav ---------- */

.nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 560px;
    margin-inline: auto;
    height: var(--nav-h);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--hairline);
    display: flex;
    align-items: stretch;
    z-index: 50;
}

.nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: var(--muted);
}

.nav__item svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
}

.nav__label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav__item.is-active {
    color: var(--ink);
}

.nav__item.is-active svg {
    stroke: var(--signal);
}

.nav__item.is-active .nav__dot {
    opacity: 1;
}

.nav__dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--signal);
    opacity: 0;
    position: absolute;
    margin-top: -30px;
}

/* ---------- Buttons ---------- */

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}

.btn-primary {
    background: var(--signal);
    color: var(--paper);
}

.btn-primary:active {
    background: var(--signal-dark);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--hairline);
    color: var(--ink);
}

/* ---------- Form elements ---------- */

.field-label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    display: block;
    margin-bottom: 8px;
}

.input {
    width: 100%;
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 15px;
    font-family: var(--font-sans);
}

.input:focus {
    outline: none;
    border-color: var(--ink);
}

/* ---------- Chips ---------- */

.chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar {
    display: none;
}

.chip {
    flex-shrink: 0;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid var(--hairline);
    background: var(--paper);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.chip.is-selected {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chip:has(input:checked) {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

/* ---------- PIN lock ---------- */

.pin-screen {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 20px;
    text-align: center;
}

.pin-screen svg {
    width: 26px;
    height: 26px;
    stroke: var(--muted);
    fill: none;
    stroke-width: 1.6;
}

.pin-screen h1 {
    font-size: 18px;
    margin-top: 4px;
}

.pin-screen__hint {
    font-size: 13px;
    color: var(--muted);
    margin-top: -14px;
}

.pin-screen__error {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--signal-dark);
    height: 14px;
    margin-top: -14px;
}

.pin-dots {
    display: flex;
    gap: 16px;
}

.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--hairline);
    background: transparent;
}

.pin-dot.is-filled {
    background: var(--ink);
    border-color: var(--ink);
}

.pin-dots.is-error .pin-dot {
    border-color: var(--signal);
}

.pin-dots.is-error .pin-dot.is-filled {
    background: var(--signal);
}

@keyframes pin-shake {
    0%, 100% { translate: 0 0; }
    20% { translate: -8px 0; }
    40% { translate: 8px 0; }
    60% { translate: -6px 0; }
    80% { translate: 6px 0; }
}

.pin-dots.is-shake {
    animation: pin-shake 0.4s ease;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    width: 100%;
    max-width: 260px;
}

.keypad-btn {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid var(--hairline);
    background: var(--surface);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keypad-btn:active {
    background: var(--paper);
}

.keypad-btn.is-empty {
    border: none;
    background: transparent;
}

.keypad-btn svg {
    width: 20px;
    height: 20px;
    stroke: var(--ink);
    fill: none;
    stroke-width: 1.6;
}

/* ---------- Amount entry ---------- */

.amount-card {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    text-align: center;
    margin-bottom: 12px;
}

.amount-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    margin-top: 6px;
}

.amount-row .currency {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 28px;
    color: var(--muted);
}

.amount-input {
    border: none;
    background: transparent;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 52px;
    letter-spacing: -0.02em;
    width: 220px;
    text-align: center;
}

.amount-input:focus {
    outline: none;
}

.amount-input::placeholder {
    color: var(--hairline);
}

/* ---------- Recent list ---------- */

.recent-list {
    display: flex;
    flex-direction: column;
}

.recent-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 2px;
    border-bottom: 1px solid var(--hairline);
}

.recent-row:last-child {
    border-bottom: none;
}

.recent-row__main {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.recent-row__cat {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--signal);
}

.recent-row__note {
    font-size: 14px;
}

.recent-row__side {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.recent-row__day {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
}

.recent-row__amount {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15px;
}

.del {
    background: none;
    border: none;
    color: var(--muted);
    width: 22px;
    height: 22px;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

.del:active {
    color: var(--signal-dark);
}

.section-title {
    font-size: 13px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 28px 0 12px;
}

/* ---------- Report ---------- */

.summary-card {
    text-align: center;
    padding: 28px 20px;
}

.summary-card .field-label {
    margin-bottom: 4px;
}

.summary-total {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 44px;
    letter-spacing: -0.02em;
}

.summary-sub {
    margin-top: 4px;
    font-size: 13px;
    color: var(--muted);
}

.summary-sub strong {
    color: var(--ink);
    font-weight: 600;
}

.progress-track {
    height: 6px;
    border-radius: 999px;
    background: var(--paper);
    border: 1px solid var(--hairline);
    overflow: hidden;
    margin-top: 18px;
}

.progress-fill {
    height: 100%;
    background: var(--signal);
}

.cat-row {
    padding: 12px 0;
}

.cat-row__top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.cat-row__name {
    font-size: 14px;
    font-weight: 600;
}

.cat-row__value {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
}

.cat-row__track {
    height: 8px;
    border-radius: 999px;
    background: var(--paper);
    border: 1px solid var(--hairline);
    overflow: hidden;
}

.cat-row__fill {
    height: 100%;
    background: var(--ink);
    border-radius: 999px;
}

/* ---------- Settings ---------- */

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--hairline);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row__label {
    font-size: 14px;
    font-weight: 600;
}

.settings-row__hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.settings-row input,
.settings-row select {
    border: none;
    background: transparent;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--ink);
    width: 130px;
}

.settings-row input:focus,
.settings-row select:focus {
    outline: none;
}

.btn-danger {
    background: transparent;
    border: 1px solid var(--hairline);
    color: var(--signal-dark);
}

/* ---------- Utility ---------- */

.mono {
    font-family: var(--font-mono);
}

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

.hairline {
    border: none;
    border-top: 1px solid var(--hairline);
    margin: 16px 0;
}
