/* receipt.garden — base styles. No JS: theme via <html class="theme-*"> or the system setting. */

/* ---------- Theme tokens ---------- */
:root {
    --bg: #F5F1E6;
    --surface: #FFFDF7;
    --surface-2: #E9E3D1;
    --ink: #1B2620;
    --ink-2: #3E4A42;
    --muted: #4A564E;
    --muted-2: #58635B;
    --faint: #8A8F89;
    --line: #E2DBC8;
    --line-2: #D6CEB8;
    --hover: #ECE6D6;
    --brand: #2F6B45;
    --accent: #2F6B45;
    --on-accent: #FFFDF7;
    --blob: #DCE6CF;
    --ok-bg: #E3EEDD;
    --ok-fg: #24553A;
    --track: #EFEADC;
    --amber: #E0A33B;
    --danger: #A8402C;
    --danger-bg: #F6E0D8;
    --shadow: rgba(30, 45, 30, 0.16);

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Instrument Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    color-scheme: light;
}

html.theme-dark {
    --bg: #0F1612;
    --surface: #16201A;
    --surface-2: #1B2820;
    --ink: #EAEFE6;
    --ink-2: #C4CEC3;
    --muted: #A7B3A8;
    --muted-2: #95A297;
    --faint: #76837A;
    --line: #26342B;
    --line-2: #34453A;
    --hover: #1F2C24;
    --brand: #8FCB9B;
    --accent: #8FCB9B;
    --on-accent: #0F1A13;
    --blob: #22382A;
    --ok-bg: #1F3A2A;
    --ok-fg: #A6DDB0;
    --track: #26342B;
    --amber: #E8B25A;
    --danger: #F0907C;
    --danger-bg: #3A211B;
    --shadow: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
}

/* No saved choice: follow the system. Same values as html.theme-dark. */
@media (prefers-color-scheme: dark) {
    html:not(.theme-light):not(.theme-dark) {
        --bg: #0F1612;
        --surface: #16201A;
        --surface-2: #1B2820;
        --ink: #EAEFE6;
        --ink-2: #C4CEC3;
        --muted: #A7B3A8;
        --muted-2: #95A297;
        --faint: #76837A;
        --line: #26342B;
        --line-2: #34453A;
        --hover: #1F2C24;
        --brand: #8FCB9B;
        --accent: #8FCB9B;
        --on-accent: #0F1A13;
        --blob: #22382A;
        --ok-bg: #1F3A2A;
        --ok-fg: #A6DDB0;
        --track: #26342B;
        --amber: #E8B25A;
        --danger: #F0907C;
        --danger-bg: #3A211B;
        --shadow: rgba(0, 0, 0, 0.5);
        color-scheme: dark;
    }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { display: block; }
a { color: var(--brand); }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.ico {
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 80px;
}

/* ---------- Buttons & controls ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 44px;
    padding: 0 20px;
    border-radius: 12px;
    border: 1px solid transparent;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.btn--lg { height: 56px; padding: 0 28px; border-radius: 14px; font-size: 18px; }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { color: var(--on-accent); filter: brightness(1.08); }
.btn--ghost { color: var(--ink); }
.btn--ghost:hover { color: var(--ink); background: var(--hover); }
.btn--outline { color: var(--ink); border-color: var(--line-2); }
.btn--outline:hover { color: var(--ink); background: var(--hover); }

.control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid var(--line-2);
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.control:hover { background: var(--hover); }
.control--icon { width: 44px; padding: 0; justify-content: center; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); }
.site-header__inner {
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand__mark { border-radius: 9px; box-shadow: 0 0 0 1px var(--line-2); }
.brand__name { font-family: var(--font-display); font-size: 23px; font-weight: 600; letter-spacing: -0.01em; }
.brand__dot { color: var(--accent); }

.nav { display: flex; gap: 36px; font-weight: 500; }
.nav__link { color: var(--ink-2); text-decoration: none; }
.nav__link:hover { color: var(--ink); }

.header-actions { display: flex; align-items: center; gap: 10px; }

/* Language switcher (<details>) */
.lang { position: relative; }
.lang__toggle { list-style: none; }
.lang__toggle::-webkit-details-marker { display: none; }
.lang__chevron { display: flex; color: var(--faint); transition: transform 0.15s; }
.lang[open] .lang__chevron { transform: rotate(180deg); }
.lang__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 10;
    width: 210px;
    padding: 6px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 16px 32px var(--shadow);
}
.lang__item {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 44px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--ink);
    text-decoration: none;
}
.lang__item:hover, .lang__item.is-current { background: var(--hover); color: var(--ink); }
.lang__code { width: 22px; font-family: var(--font-mono); font-size: 12px; color: var(--faint); }
.lang__name { flex-grow: 1; }
.lang__check { display: flex; color: var(--brand); }

/* Theme toggle: show "to dark" in light mode and "to light" in dark mode */
.theme-form { display: flex; margin: 0; }
.theme-btn--to-light { display: none; }
html.theme-dark .theme-btn--to-dark { display: none; }
html.theme-dark .theme-btn--to-light { display: inline-flex; }
@media (prefers-color-scheme: dark) {
    html:not(.theme-light) .theme-btn--to-dark { display: none; }
    html:not(.theme-light) .theme-btn--to-light { display: inline-flex; }
}

/* ---------- Hero ---------- */
.hero { padding: 96px 0 112px; }
.hero__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 64px;
    align-items: center;
}
.hero__copy { display: flex; flex-direction: column; gap: 28px; }

.pill {
    align-self: flex-start;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    background: var(--surface);
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 500;
}

.hero__title {
    font-family: var(--font-display);
    font-size: clamp(44px, 5vw, 74px);
    line-height: 1.02;
    text-wrap: balance;
    font-weight: 600;
    letter-spacing: -0.025em;
}
/* Longer copy in pt / uk / ru: a slightly smaller headline keeps it to two lines. */
html:not(:lang(en)) .hero__title { font-size: clamp(40px, 4.7vw, 70px); }

.hero__lead { max-width: 520px; font-size: 20px; line-height: 1.55; color: var(--muted); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 8px; }

.checks {
    display: flex;
    flex-wrap: wrap;
    column-gap: 28px;
    row-gap: 10px;
    padding-top: 12px;
    font-size: 15px;
    color: var(--muted);
}
.checks li { display: flex; align-items: center; gap: 8px; }
.checks .ico { color: var(--brand); }

/* Illustration */
.demo {
    position: relative;
    height: 580px;
    border-radius: 32px;
    background: var(--surface-2);
    overflow: hidden;
}
.demo__blob {
    position: absolute;
    left: -60px;
    bottom: -80px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: var(--blob);
}

/* The receipt stays "paper" in both themes. */
.receipt {
    position: absolute;
    left: 64px;
    top: 48px;
    width: 290px;
    padding: 28px 26px 40px;
    background: #FFFEFA;
    color: #2A2F2B;
    transform: rotate(-4deg);
    box-shadow: 0 20px 40px var(--shadow);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.7;
    -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 14px 100%;
    mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 14px 100%;
}
.receipt__shop { text-align: center; font-size: 15px; font-weight: 600; letter-spacing: 0.08em; }
.receipt__center { text-align: center; }
.receipt__muted { color: #6B716C; }
.receipt__row { display: flex; justify-content: space-between; }
.receipt__row.receipt__muted { padding-top: 6px; }
.receipt__row--marked { margin: 0 -6px; padding: 0 6px; background: #F6E3B8; }
.receipt__rule { margin: 10px 0; border: 0; border-top: 1px dashed #B9B6AC; }
.receipt__total { font-size: 15px; font-weight: 600; }
.receipt__barcode { padding-top: 14px; text-align: center; letter-spacing: 0.2em; color: #8A8F89; }

.parsed {
    position: absolute;
    right: 48px;
    bottom: 56px;
    width: 330px;
    padding: 24px;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 24px 48px var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.parsed__top { display: flex; justify-content: space-between; align-items: center; }
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--ok-bg);
    color: var(--ok-fg);
    font-size: 13px;
    font-weight: 600;
}
.parsed__date { font-size: 13px; color: var(--muted-2); }
.parsed__shop { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.parsed__meta { font-size: 14px; color: var(--muted-2); }
.parsed__cats { display: flex; flex-direction: column; gap: 10px; }
.cat { display: flex; flex-direction: column; gap: 6px; }
.cat__row { display: flex; justify-content: space-between; font-size: 14px; }
.cat__track { height: 8px; border-radius: 4px; background: var(--track); }
.cat__bar { height: 8px; border-radius: 4px; background: var(--accent); }
.cat__bar--alt { background: var(--amber); }
.parsed__total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 14px;
    color: var(--muted-2);
}
.parsed__total strong { font-family: var(--font-display); font-size: 28px; font-weight: 600; color: var(--ink); }

/* ---------- Sections ---------- */
.section { padding: 112px 0; }
.section--alt {
    padding: 104px 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 48px;
    margin-bottom: 56px;
}
.section-head--stack { flex-direction: column; align-items: flex-start; gap: 16px; max-width: 760px; }

.section-title {
    max-width: 680px;
    font-family: var(--font-display);
    font-size: clamp(34px, 3.6vw, 52px);
    line-height: 1.08;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.section-lead { max-width: 420px; font-size: 18px; line-height: 1.55; color: var(--muted); }
.eyebrow { font-size: 14px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brand); }

/* How it works */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.step {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 32px;
    border-radius: 24px;
    background: var(--bg);
}
.step__top { display: flex; justify-content: space-between; align-items: center; }
.step__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--surface);
    color: var(--brand);
}
.step__num { font-family: var(--font-mono); font-size: 14px; color: var(--faint); }
.step__title { font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1.2; }
.step__text { font-size: 16px; line-height: 1.6; color: var(--muted); }

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 24px;
    overflow: hidden;
}
.feature { display: flex; flex-direction: column; gap: 14px; padding: 36px; background: var(--bg); }
.feature__icon { display: flex; color: var(--brand); }
.feature__title { font-size: 20px; font-weight: 600; }
.feature__text { font-size: 16px; line-height: 1.6; color: var(--muted); }

/* Call to action */
.cta { padding: 128px 0; }
.cta__inner { display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
.cta__mark { border-radius: 14px; box-shadow: 0 0 0 1px var(--line-2); }
.cta__title {
    font-family: var(--font-display);
    font-size: clamp(40px, 4.4vw, 64px);
    line-height: 1.05;
    font-weight: 600;
    letter-spacing: -0.025em;
}
.cta__lead { max-width: 520px; font-size: 19px; line-height: 1.55; color: var(--muted); }
.cta__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding-top: 12px; }

/* ---------- Auth (log in / sign up) ---------- */
.auth { padding: 64px 0 112px; }
.auth__grid {
    display: grid;
    grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
    gap: 48px;
    align-items: stretch;
}

.auth__panel {
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding: 48px;
    border-radius: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
}
.auth__head { display: flex; flex-direction: column; gap: 12px; }
.auth__title {
    font-family: var(--font-display);
    font-size: clamp(34px, 3vw, 44px);
    line-height: 1.08;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.auth__lead { font-size: 17px; line-height: 1.55; color: var(--muted); }
.auth__switch {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 15px;
    color: var(--muted);
}
.auth__switch a { font-weight: 600; text-underline-offset: 3px; }

/* Decorative side panel */
.auth__aside {
    position: relative;
    min-height: 640px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding: 56px;
    border-radius: 32px;
    background: var(--surface-2);
    overflow: hidden;
}
.auth__aside-copy { position: relative; display: flex; flex-direction: column; gap: 16px; max-width: 480px; }
.auth__aside-title {
    font-family: var(--font-display);
    font-size: clamp(32px, 3vw, 44px);
    line-height: 1.08;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.auth__aside-lead { font-size: 17px; line-height: 1.55; color: var(--muted); }
.auth__art { position: relative; flex-grow: 1; min-height: 380px; }
.auth__art .receipt { left: 8px; top: 12px; width: 260px; padding-bottom: 32px; }
.auth__art .parsed { right: 0; bottom: 0; width: 310px; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 22px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field__top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field__label { font-size: 15px; font-weight: 600; }
.field__link { font-size: 14px; font-weight: 500; text-underline-offset: 3px; }
.field__hint { font-size: 14px; color: var(--muted-2); }
.field__error { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--danger); }

.input {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--line-2);
    background: var(--bg);
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--faint); }
.input:hover { border-color: var(--faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.field--invalid .input { border-color: var(--danger); }
.field--invalid .input:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 20%, transparent); }

.checkbox { display: flex; align-items: flex-start; gap: 12px; font-size: 15px; line-height: 1.45; color: var(--ink-2); cursor: pointer; }
.checkbox input { flex-shrink: 0; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.checkbox a { text-underline-offset: 3px; }

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 15px;
    line-height: 1.45;
}

.btn--block { width: 100%; }

/* ---------- Signed-in header ---------- */
.nav__link.is-current { color: var(--ink); }
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 260px;
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink-2);
    font-size: 15px;
    font-weight: 500;
}
.user-chip .ico { color: var(--brand); }
a.user-chip { position: relative; text-decoration: none; }
a.user-chip:hover, a.user-chip.is-current { color: var(--ink); background: var(--hover); }
.user-chip__dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 25%, transparent);
}
.user-chip__email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-form { display: flex; margin: 0; }

/* ---------- Dashboard tiles ---------- */
.eyebrow--plain { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted-2); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.tile {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 24px;
    border-radius: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.tile:hover { color: var(--ink); border-color: var(--line-2); box-shadow: 0 12px 28px var(--shadow); transform: translateY(-2px); }
.tile__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: var(--ok-bg);
    color: var(--ok-fg);
}
.tile__body { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 0; }
.tile__title { font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1.2; }
.tile__meta { font-size: 15px; color: var(--muted); }
.tile__arrow { display: flex; color: var(--faint); transition: transform 0.15s, color 0.15s; }
.tile:hover .tile__arrow { color: var(--brand); transform: translateX(3px); }

/* ---------- Receipts ---------- */
.receipts { padding: 40px 0 112px; }
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    color: var(--muted);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
}
.back-link .ico { transform: rotate(180deg); }
.back-link:hover { color: var(--ink); }

.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 28px; }
.page-head__text { display: flex; flex-direction: column; gap: 6px; }
.page-head__title {
    font-family: var(--font-display);
    font-size: clamp(34px, 3.4vw, 48px);
    line-height: 1.08;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.page-head__meta { color: var(--muted); }

/* List: a table on wide screens, stacked cards on phones. Each row is one link. */
.rlist { border: 1px solid var(--line); border-radius: 24px; background: var(--surface); overflow: hidden; }
.rlist__head, .rlist__row {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr) 140px 160px;
    gap: 16px;
    align-items: center;
    padding: 0 24px;
}
.rlist__head { height: 48px; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); border-bottom: 1px solid var(--line); }
.rlist__row { min-height: 64px; color: var(--ink); text-decoration: none; }
.rlist__row + .rlist__row { border-top: 1px solid var(--line); }
.rlist__row:hover { background: var(--hover); color: var(--ink); }
.rlist__num { text-align: right; font-variant-numeric: tabular-nums; }
.rlist__date { color: var(--muted); font-variant-numeric: tabular-nums; }
.rlist__vendor { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rlist__lines { color: var(--muted); }
.rlist__total { font-weight: 600; }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 28px; }
.pager__status { color: var(--muted); font-size: 15px; }

/* One receipt */
.rcard { border: 1px solid var(--line); border-radius: 28px; background: var(--surface); overflow: hidden; }
.rcard__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px 32px;
    padding: 32px;
    border-bottom: 1px solid var(--line);
}
.rcard__who { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rcard__vendor {
    font-family: var(--font-display);
    font-size: clamp(30px, 3vw, 42px);
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}
.rcard__meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: 15px; }
.rcard__meta span + span::before { content: '·'; margin-right: 10px; color: var(--faint); }
.rcard__total { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.rcard__total-label { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); }
.rcard__total strong { font-family: var(--font-display); font-size: 40px; line-height: 1.1; font-weight: 600; font-variant-numeric: tabular-nums; }
.rcard__eur { font-size: 14px; color: var(--muted-2); }
.rcard__none { padding: 32px; color: var(--muted); }

.items { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.items th, .items td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.items th:first-child, .items td:first-child { padding-left: 32px; }
.items th:last-child, .items td:last-child { padding-right: 32px; }
.items thead th { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); }
.items tbody tr:hover { background: var(--hover); }
.items__name { font-weight: 500; overflow-wrap: anywhere; }
.items__num { text-align: right !important; white-space: nowrap; }
.items__qty { color: var(--muted); }
.items__price { font-weight: 600; }
.items tfoot th, .items tfoot td { border-bottom: 0; font-weight: 700; font-size: 17px; }
.chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

/* ---------- Receipt form ---------- */
.rform { display: flex; flex-direction: column; gap: 20px; max-width: 860px; }
.rform__alert { max-width: 860px; margin-bottom: 20px; }
.rform__section { margin: 0; padding: 26px 28px 28px; min-width: 0; }
.rform__legend {
    float: left;
    width: 100%;
    margin-bottom: 18px;
    padding: 0;
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
}
.rform__legend + * { clear: both; }
.rform__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.rform__grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rform__wide { grid-column: 1 / -1; }
.rform__section .field__hint { margin-top: 14px; }
.rform__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.field__optional { font-weight: 400; color: var(--muted-2); }

.input--num { font-variant-numeric: tabular-nums; }
select.input {
    appearance: none;
    padding-right: 44px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A8F89' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    cursor: pointer;
}
input[type="datetime-local"].input { font-variant-numeric: tabular-nums; }
.empty__cta { margin-top: 10px; }

/* ---------- Categories ---------- */
.cats { display: flex; flex-direction: column; gap: 28px; max-width: 860px; }
.cat-add { padding: 24px 28px; }
.cat-add__row { display: flex; gap: 12px; }
.cat-add__row .input { height: 56px; }

.cat-group { display: flex; flex-direction: column; gap: 14px; }
.cat-group__head { display: flex; align-items: baseline; gap: 10px; }
.cat-group__title { font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1.2; }
.cat-group__count { font-size: 15px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.cat-group__empty { padding: 22px 24px; border: 1px dashed var(--line-2); border-radius: 18px; color: var(--muted); }
.cat-group__note { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); }

.cat-list { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); overflow: hidden; }
.cat-list__item { display: flex; align-items: center; gap: 16px; padding: 12px 12px 12px 24px; min-height: 64px; }
.cat-list__item + .cat-list__item { border-top: 1px solid var(--line); }
.cat-list__name { flex-grow: 1; font-weight: 600; overflow-wrap: anywhere; }
.cat-list__usage { font-size: 14px; color: var(--muted-2); white-space: nowrap; }
.cat-list__delete { margin: 0; }

.cat-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip--lg { padding: 8px 14px; font-size: 15px; background: var(--surface); border: 1px solid var(--line); }

.btn--danger { height: 40px; padding: 0 14px; font-size: 15px; color: var(--danger); background: transparent; }
.btn--danger:hover { color: var(--danger); background: var(--danger-bg); }

/* ---------- Flash messages ---------- */
.flashes { display: flex; flex-direction: column; gap: 10px; padding-top: 24px; }
.flash {
    max-width: 800px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.45;
}
.flash--success { background: var(--ok-bg); color: var(--ok-fg); }
.flash--error { background: var(--danger-bg); color: var(--danger); }
.flash--info { background: var(--surface-2); color: var(--ink-2); }

/* ---------- Profile ---------- */
.profile { padding: 48px 0 112px; }
.profile__inner { display: flex; flex-direction: column; gap: 20px; max-width: 800px; }
.profile__head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.profile__title {
    font-family: var(--font-display);
    font-size: clamp(34px, 3.4vw, 48px);
    line-height: 1.08;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.profile__cta { align-self: flex-start; }

.card { padding: 28px 32px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); }

.facts { margin: 0; display: flex; flex-direction: column; }
.facts__row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; padding: 14px 0; }
.facts__row + .facts__row { border-top: 1px solid var(--line); }
.facts dt { color: var(--muted-2); font-size: 15px; }
.facts dd { margin: 0; font-weight: 500; }
.facts__email { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; overflow-wrap: anywhere; }
.settings { display: flex; flex-direction: column; gap: 16px; }
.settings__title { font-size: 20px; font-weight: 600; }
.settings__hint { display: block; margin-top: 4px; font-size: 14px; color: var(--muted-2); }
.settings__save { align-self: flex-start; }

.status--warn { background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--ink); }

.verify { display: flex; gap: 24px; align-items: flex-start; }
.verify__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: var(--ok-bg);
    color: var(--ok-fg);
}
.verify__body { display: flex; flex-direction: column; gap: 16px; min-width: 0; flex-grow: 1; }
.verify__title { font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1.2; }
.verify__text { font-size: 16px; line-height: 1.55; color: var(--muted); }
.verify__form { margin: 0; }
.verify__row { display: flex; gap: 12px; }
.input--code {
    max-width: 220px;
    height: 56px;
    font-family: var(--font-mono);
    font-size: 24px;
    letter-spacing: 0.3em;
    text-align: center;
}
.verify__resend { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 0; font-size: 15px; color: var(--muted); }
.verify__muted { font-size: 14px; color: var(--muted-2); }

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand);
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
.link-button:hover { color: var(--ink); }

/* ---------- Dashboard ---------- */
.dashboard { padding: 64px 0 112px; }
.dashboard__head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 40px; }
.dashboard__title {
    font-family: var(--font-display);
    font-size: clamp(34px, 3.4vw, 48px);
    line-height: 1.08;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 88px 24px;
    border: 1px dashed var(--line-2);
    border-radius: 28px;
    background: var(--surface);
    text-align: center;
}
.empty__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 6px;
    border-radius: 22px;
    background: var(--ok-bg);
    color: var(--ok-fg);
}
.empty__title { font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1.2; }
.empty__text { max-width: 440px; font-size: 17px; line-height: 1.55; color: var(--muted); }

/* ---------- Legal pages (terms / privacy) ---------- */
.legal { padding: 48px 0 112px; }
.legal__inner { display: flex; flex-direction: column; gap: 28px; }
.legal__tabs {
    display: inline-flex;
    align-self: flex-start;
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
    background: var(--surface-2);
}
.legal__tab {
    padding: 10px 16px;
    border-radius: 10px;
    color: var(--ink-2);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}
.legal__tab:hover { color: var(--ink); }
.legal__tab.is-current { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px var(--shadow); }

.legal__doc { max-width: 760px; }
.legal__head { display: flex; flex-direction: column; gap: 10px; padding-bottom: 28px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.legal__title {
    font-family: var(--font-display);
    font-size: clamp(34px, 3.6vw, 52px);
    line-height: 1.08;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.legal__updated { font-size: 15px; color: var(--muted-2); }

/* Long-form text: comfortable measure and rhythm. */
.prose { font-size: 17px; line-height: 1.7; color: var(--ink-2); overflow-wrap: break-word; }
.prose > * + * { margin-top: 16px; }
.prose h2 {
    margin-top: 44px;
    font-family: var(--font-display);
    font-size: 24px;
    line-height: 1.25;
    font-weight: 600;
    color: var(--ink);
}
.prose h2 + p, .prose h2 + ul { margin-top: 12px; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { text-underline-offset: 3px; }
.prose ul { display: flex; flex-direction: column; gap: 10px; padding-left: 4px; }
.prose li { position: relative; padding-left: 22px; }
.prose li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 0.72em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}
.prose__see-also { margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); color: var(--muted-2); font-size: 15px; }
.site-footer__inner {
    min-height: 96px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 28px;
    padding-top: 24px;
    padding-bottom: 24px;
}
.site-footer__links { display: flex; gap: 28px; }
.site-footer__links a { color: var(--muted-2); text-decoration: none; }
.site-footer__links a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Cookie notice ---------- */
.cookie-notice {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 50;
    width: min(560px, calc(100% - 48px));
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px 20px;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 16px 40px var(--shadow);
}
.cookie-notice__text { flex-grow: 1; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.cookie-notice__text a { color: var(--brand); white-space: nowrap; }
.cookie-notice__form { margin: 0; flex-shrink: 0; }

/* ---------- Statistics ---------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.stats__period::first-letter { text-transform: uppercase; }

.sfilter { display: flex; flex-direction: column; gap: 24px; margin-bottom: 36px; }
.sfilter__period { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 20px; }

.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.seg__tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 16px;
    border-radius: 10px;
    color: var(--ink-2);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}
.seg__tab:hover { color: var(--ink); }
.seg__tab.is-current { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px var(--shadow); }
.seg__tab.is-current .ico { color: var(--brand); }

.month-pick { display: flex; align-items: center; gap: 8px; }
.month-pick .control { height: 52px; width: 52px; border-radius: 12px; border: 1px solid var(--line-2); color: var(--ink); }
.month-pick__prev .ico { transform: rotate(180deg); }
.month-pick__select { width: auto; min-width: 230px; font-weight: 600; }
.month-pick__select option { font-weight: 400; }

.range-pick { display: grid; grid-template-columns: repeat(2, minmax(170px, 210px)); gap: 12px; }
input[type="date"].input { font-variant-numeric: tabular-nums; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 8px; }
.preset {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}
.preset:hover { color: var(--ink); background: var(--hover); }
.preset.is-current { border-color: var(--accent); color: var(--brand); background: color-mix(in srgb, var(--accent) 10%, transparent); }

.sfilter__cats { display: flex; flex-direction: column; gap: 14px; min-width: 0; margin: 0; padding: 22px 0 0; border: 0; border-top: 1px solid var(--line); }
.sfilter__legend { float: left; width: 100%; padding: 0; font-size: 15px; font-weight: 600; }
.sfilter__legend + * { clear: both; }
.sfilter__summary { margin-left: 8px; font-weight: 400; color: var(--muted-2); }
.sfilter__how { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.sfilter__hint { font-size: 14px; color: var(--muted-2); }

.radio-pill { position: relative; display: inline-flex; cursor: pointer; }
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill span {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--line-2);
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 600;
}
.radio-pill:hover span { background: var(--hover); }
.radio-pill input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.radio-pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }

.fchips { display: flex; flex-wrap: wrap; gap: 8px; }
.fchips__break { margin-left: 12px; padding-left: 20px; border-left: 1px solid var(--line-2); }
.fchip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 6px 14px 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    user-select: none;
}
.fchip:hover { border-color: var(--line-2); color: var(--ink); }
.fchip__box { position: absolute; opacity: 0; pointer-events: none; }
.fchip__check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 1.5px solid var(--line-2);
    color: transparent;
    transition: background 0.12s, border-color 0.12s;
}
.fchip__check .ico { stroke-width: 2.6; }
.fchip:has(.fchip__box:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--ink); }
.fchip:has(.fchip__box:checked) .fchip__check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.fchip:has(.fchip__box:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.fchip--none { font-style: italic; }
.fchip--own::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }

.sfilter__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.spend { display: flex; flex-direction: column; gap: 20px; }
.spend + .spend { margin-top: 48px; padding-top: 40px; border-top: 1px solid var(--line); }
.spend__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 40px; }
.spend__main { display: flex; flex-direction: column; gap: 4px; }
.spend__label { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); }
.spend__code { color: var(--brand); }
.spend__total { font-family: var(--font-display); font-size: clamp(44px, 5vw, 64px); line-height: 1.05; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.spend__eur { font-size: 15px; color: var(--muted-2); }
.spend__facts { display: flex; gap: 12px; margin: 0; }
.spend__facts > div { display: flex; flex-direction: column; gap: 2px; min-width: 110px; padding: 14px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.spend__facts dt { font-size: 13px; color: var(--muted-2); }
.spend__facts dd { margin: 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.spend__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; align-items: start; }
.spend__card { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.spend__title { font-family: var(--font-display); font-size: 24px; font-weight: 600; line-height: 1.2; }
.spend__note { margin-top: -10px; font-size: 14px; color: var(--muted-2); }
.spend__note strong { color: var(--ink); font-weight: 600; }

.shares { display: flex; flex-direction: column; gap: 14px; }
.share { display: flex; flex-direction: column; gap: 7px; }
.share__row { display: flex; align-items: baseline; gap: 10px; font-size: 15px; }
.share__name { flex-grow: 1; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.share__pct { font-size: 13px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.share__amount { min-width: 90px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.share__track { display: block; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.share__bar { display: block; height: 100%; min-width: 3px; border-radius: 4px; background: var(--accent); }
.share--none .share__name { font-style: italic; color: var(--muted); }
.share--none .share__bar { background: var(--faint); }

.tl {
    display: grid;
    grid-template-columns: repeat(var(--bars), minmax(0, 1fr));
    align-items: end;
    gap: clamp(1px, 0.4vw, 4px);
    height: 240px;
    padding-top: 8px;
    border-bottom: 1px solid var(--line-2);
}
.tl__col { position: relative; display: flex; align-items: flex-end; height: 100%; cursor: default; }
.tl__col:hover { background: var(--hover); border-radius: 4px 4px 0 0; }
.tl__bar { display: block; width: 100%; min-height: 3px; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--accent) 70%, var(--surface)); }
.tl__col:hover .tl__bar, .tl__col.is-peak .tl__bar { background: var(--accent); }
.tl__col.is-zero .tl__bar { min-height: 2px; background: var(--line-2); }
.tl__tick {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--muted-2);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.spend__card:has(.tl) { padding-bottom: 48px; }

.stats__note { display: flex; align-items: center; gap: 8px; margin-top: 28px; font-size: 14px; color: var(--muted-2); }

@media (max-width: 1100px) {
    .spend__grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
    .sfilter { gap: 20px; margin-bottom: 28px; }
    .sfilter__period { flex-direction: column; align-items: stretch; }
    .seg { display: flex; }
    .seg__tab { flex: 1; justify-content: center; }
    .month-pick__select { flex-grow: 1; min-width: 0; }
    .range-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fchips__break { margin-left: 0; padding-left: 0; border-left: 0; }
    .sfilter__actions .btn { width: 100%; }
    .spend__head { flex-direction: column; align-items: stretch; }
    .spend__facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .spend__facts > div { min-width: 0; padding: 10px 12px; }
    .spend__facts dd { font-size: 16px; }
    .tl { height: 180px; }
}

/* ---------- Receipt scans ---------- */
.page-head__actions { display: flex; flex-wrap: wrap; gap: 12px; }

.scan-card { display: flex; flex-direction: column; gap: 22px; }
.scan-drop { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "icon title" "icon hint"; gap: 2px 16px; align-items: center; cursor: pointer; }
.scan-drop__icon {
    grid-area: icon;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: var(--ok-bg);
    color: var(--ok-fg);
}
.scan-drop__title { grid-area: title; font-family: var(--font-display); font-size: 24px; font-weight: 600; line-height: 1.2; }
.scan-drop__hint { grid-area: hint; font-size: 15px; color: var(--muted); }
.input.scan-drop__input { height: auto; padding: 14px; border-style: dashed; border-width: 2px; cursor: pointer; font-size: 15px; color: var(--muted); }
.scan-drop__input::file-selector-button {
    height: 44px;
    margin-right: 16px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
/* "Take a photo" (phones): a button-looking label for a hidden capture input, then "or" before the picker. */
.scan-camera { display: flex; flex-direction: column; align-items: stretch; gap: 12px; margin: 18px 0 12px; }
.scan-camera__btn { width: 100%; }
.scan-camera__input:focus-visible + .scan-camera__btn { outline: 2px solid var(--brand); outline-offset: 3px; }
.scan-camera__done { display: none; align-items: center; justify-content: center; gap: 8px; font-weight: 600; color: var(--ok-fg); }
.scan-camera__done .ico { flex-shrink: 0; }
.scan-camera:has(.scan-camera__input:valid) .scan-camera__done { display: flex; }
.scan-camera__or { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); text-transform: lowercase; }
.scan-camera__or::before, .scan-camera__or::after { content: ""; flex: 1; border-top: 1px solid var(--line-2); }
@media (hover: hover) and (pointer: fine) {
    .scan-camera { display: none; }
}
.scan-tips { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; color: var(--ink-2); }
.scan-tips li { display: flex; align-items: center; gap: 10px; }
.scan-tips .ico { flex-shrink: 0; color: var(--brand); }
.scan-card__privacy { display: flex; align-items: flex-start; gap: 8px; margin: 0; }
.scan-card__privacy .ico { flex-shrink: 0; margin-top: 2px; }
.scan-card__privacy a { text-underline-offset: 3px; }

/* Receipts that are still a photo: greyed out in the list, with their own cancel / delete button. */
.rlist__row--processing, .rlist__row--failed { background: var(--bg); }
.rlist__row--processing .rlist__date, .rlist__row--failed .rlist__date { color: var(--faint); }
.rlist__row--processing:hover, .rlist__row--failed:hover { background: var(--bg); }
.rstatus { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; color: var(--muted); }
.rlist__row--failed .rstatus { color: var(--danger); }
.rlist__total form { display: flex; justify-content: flex-end; }
.btn--row { height: 36px; padding: 0 14px; font-size: 14px; color: var(--muted); background: transparent; border: 1px solid var(--line-2); }
.btn--row:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }
/* A row live.js just filled in. */
.rlist__row--fresh { animation: row-fresh 2.4s ease-out; }
@keyframes row-fresh { from { background: var(--ok-bg); } }

/* The page of a receipt that is still a photo. */
.rstate__meta { font-size: 14px; color: var(--muted-2); }
.rstate__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 10px; }
.rstate__actions form { display: contents; }
.rstate--failed .empty__icon { background: var(--danger-bg); color: var(--danger); }
.rcard__actions { display: flex; justify-content: flex-end; margin-top: 16px; }

.spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--line-2);
    border-top-color: var(--brand);
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner--lg { width: 28px; height: 28px; border-width: 3px; }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } .rlist__row--fresh { animation: none; } }

/* Live notifications (public/js/live.js). */
.toasts {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(380px, calc(100% - 32px));
    pointer-events: none;
}
.toast {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 4px 12px;
    padding: 16px 12px 16px 18px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 16px 36px var(--shadow);
    pointer-events: auto;
    animation: toast-in 0.2s ease-out;
}
.toast__icon { grid-row: span 2; display: flex; padding-top: 1px; color: var(--ok-fg); }
.toast--failed .toast__icon { color: var(--danger); }
.toast__title { font-weight: 600; }
.toast__text { grid-column: 2; font-size: 15px; line-height: 1.45; color: var(--muted); }
.toast__text a { font-weight: 600; text-underline-offset: 3px; }
.toast__close {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: -6px 0 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--faint);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.toast__close:hover { background: var(--hover); color: var(--ink); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Groups ---------- */
/* Receipt list filter: all / mine / a group. */
.rfilter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.rfilter__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    color: var(--ink-2);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
}
.rfilter__chip:hover { color: var(--ink); background: var(--hover); }
.rfilter__chip.is-current { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }

/* Under the shop name in the list: the group and, for other people's receipts, who added it. */
.rlist__vendor { display: flex; flex-direction: column; gap: 2px; }
.rlist__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rlist__meta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 13px; font-weight: 400; color: var(--muted); }
.rlist__group { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); }
.rlist__author { overflow: hidden; text-overflow: ellipsis; }

.rcard__share { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 14px; color: var(--muted); }
.chip--group { display: inline-flex; align-items: center; gap: 5px; background: var(--ok-bg); color: var(--ok-fg); text-decoration: none; }
.chip--group:hover { color: var(--ok-fg); filter: brightness(0.97); }
.rcard__actions { gap: 12px; }
.rcard__actions form { display: contents; }

/* Groups page */
.glist { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.glist__item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.glist__item:hover { color: var(--ink); border-color: var(--line-2); box-shadow: 0 10px 24px var(--shadow); }
.glist__item:hover .tile__arrow { color: var(--brand); transform: translateX(3px); }
.glist__icon { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 14px; background: var(--ok-bg); color: var(--ok-fg); flex-shrink: 0; }
.glist__body { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 0; }
.glist__name { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.glist__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.gdanger { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }

/* "Edit receipt": lines as a grid of inputs. */
.rform--wide { max-width: 1040px; }
.lines { display: flex; flex-direction: column; gap: 10px; }
.lines__head, .lines__row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 120px minmax(0, 220px) 44px; gap: 10px; align-items: center; }
.lines__head { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); }
.lines__num { text-align: right; }
.lines__row .input { height: 46px; }
.lines__row .input--num { text-align: right; }
.lines__row--invalid .input { border-color: var(--danger); }
.lines__remove { width: 44px; height: 44px; padding: 0; justify-content: center; }
.lines__error { grid-column: 1 / -1; }
.lines__add { align-self: flex-start; margin-top: 14px; }
.scan-card__group { max-width: 420px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .container { padding: 0 40px; }
    .nav { display: none; }
    .hero__grid { grid-template-columns: minmax(0, 1fr); }
    .demo { max-width: 640px; width: 100%; }
    .section-head { flex-direction: column; align-items: flex-start; gap: 16px; }
    .steps { grid-template-columns: minmax(0, 1fr); }
    .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .auth { padding: 48px 0 80px; }
    .auth__grid { grid-template-columns: minmax(0, 520px); justify-content: center; }
    .auth__aside { display: none; }
    .rform__grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rform__grid--3 > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
    .container { padding: 0 16px; }
    .site-header__inner { height: 72px; gap: 12px; }
    .brand__name { display: none; }
    .header-actions { gap: 6px; }
    .header-actions__login { display: none; }
    .hero { padding: 48px 0 64px; }
    .hero__lead { font-size: 18px; }
    .btn--lg { width: 100%; }
    .demo { height: 540px; border-radius: 24px; }
    .receipt { left: 16px; top: 24px; width: 250px; }
    .parsed { right: 12px; bottom: 20px; width: 260px; padding: 18px; }
    .section, .section--alt { padding: 72px 0; }
    .section-head { margin-bottom: 36px; }
    .step, .feature { padding: 24px; }
    .features { grid-template-columns: minmax(0, 1fr); }
    .cta { padding: 80px 0; }
    .cookie-notice { left: 12px; bottom: 12px; width: calc(100% - 24px); flex-direction: column; align-items: stretch; gap: 14px; }
    .cookie-notice .btn { width: 100%; }
    .auth { padding: 24px 0 56px; }
    .auth__panel { gap: 28px; padding: 28px 20px; border-radius: 22px; }
    .user-chip__email { display: none; }
    .user-chip { width: 44px; padding: 0; justify-content: center; }
    .dashboard { padding: 32px 0 64px; }
    .profile { padding: 24px 0 64px; }
    .card { padding: 22px 20px; border-radius: 20px; }
    .facts__row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
    .verify { flex-direction: column; gap: 16px; }
    .verify__row { flex-direction: column; }
    .input--code { max-width: none; }
    .empty { padding: 56px 20px; border-radius: 22px; }
    .legal { padding: 24px 0 64px; }
    .legal__tabs { align-self: stretch; }
    .legal__tab { flex: 1; text-align: center; padding: 10px 8px; }
    .prose { font-size: 16px; }
    .prose h2 { margin-top: 36px; font-size: 21px; }
    .receipts { padding: 24px 0 64px; }
    .rlist__head { display: none; }
    .rlist__row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "vendor total" "date lines"; gap: 2px 12px; padding: 14px 18px; }
    .rlist__vendor { grid-area: vendor; }
    .rlist__total { grid-area: total; }
    .rlist__date { grid-area: date; font-size: 14px; }
    .rlist__lines { grid-area: lines; font-size: 14px; }
    .rcard { border-radius: 22px; }
    .rcard__head { padding: 22px 18px; }
    .rcard__total { align-items: flex-start; }
    .items thead { display: none; }
    .items, .items tbody, .items tfoot { display: block; }
    .items tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
    .items th, .items td { padding: 0 !important; border: 0; }
    .items__name { grid-column: 1; }
    .items__price { grid-column: 2; grid-row: 1; }
    .items__qty { grid-column: 2; grid-row: 2; font-size: 14px; }
    .items__qty::before { content: '× '; }
    .cat-add { padding: 20px 18px; }
    .cat-add__row { flex-direction: column; }
    .cat-list__item { flex-wrap: wrap; padding: 14px 10px 14px 18px; gap: 4px 12px; }
    .cat-list__name { flex-basis: calc(100% - 60px); }
    .cat-list__usage { order: 3; flex-basis: 100%; }
    .cat-list__delete { order: 2; }
    .btn--danger span { display: none; }
    .btn--danger { width: 40px; padding: 0; }
    .rform__section { padding: 20px 18px 22px; }
    .rform__grid, .rform__grid--3 { grid-template-columns: minmax(0, 1fr); }
    .rform__actions .btn { width: 100%; }
    .page-head > .btn { width: 100%; }
    .items__cat { grid-column: 1; grid-row: 2; }
    .items tfoot tr { border-bottom: 0; }
    .items tfoot th { grid-column: 1; }
    .items tfoot td { grid-column: 2; }
}

@media (max-width: 640px) {
    .page-head__actions { width: 100%; flex-direction: column-reverse; }
    .page-head__actions .btn { width: 100%; }
    .toasts { right: 16px; bottom: 16px; }
}

@media (max-width: 760px) {
    .lines__head { display: none; }
    .lines__row { grid-template-columns: 1fr 1fr 44px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
    .lines__row > .input:first-child { grid-column: 1 / -1; }
    .lines__row > select.input { grid-column: 1 / 3; }
}

/* A receipt's tabs: the receipt itself / its files (the kept photo). */
.rtabs { display: flex; width: fit-content; margin-bottom: 20px; }
.seg__count {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
    line-height: 22px;
    text-align: center;
}
.seg__tab.is-current .seg__count { background: var(--ok-bg); color: var(--brand); }

.rfile { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); }
.rfile__preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    max-height: 560px;
    padding: 20px;
    background: var(--surface-2);
    border-right: 1px solid var(--line);
}
.rfile__preview img { display: block; max-width: 100%; max-height: 520px; object-fit: contain; border-radius: 8px; box-shadow: 0 8px 24px var(--shadow); }
.rfile__info { display: flex; flex-direction: column; gap: 10px; padding: 32px; min-width: 0; }
.rfile__title { font-family: var(--font-display); font-size: 28px; line-height: 1.15; font-weight: 600; }
.rfile__name { font-family: var(--font-mono); font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.rfile__meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: 15px; }
.rfile__meta span + span::before { content: '·'; margin-right: 10px; color: var(--faint); }
.rfile__note { display: flex; align-items: flex-start; gap: 8px; margin-top: 6px; color: var(--muted-2); font-size: 14px; }
.rfile__note .ico { flex: none; margin-top: 2px; }
.rfile__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 18px; }
.rfile__actions form { display: contents; }
.rfile__actions .btn--danger { height: 48px; }

@media (max-width: 760px) {
    .rfile { grid-template-columns: minmax(0, 1fr); }
    .rfile__preview { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
    .rfile__preview img { max-height: 420px; }
    .rfile__info { padding: 24px 20px; }
}
@media (max-width: 640px) {
    .rtabs { width: auto; }
    .rtabs .seg__tab { flex: 1; justify-content: center; }
    .rfile__actions .btn { flex: 1 1 auto; justify-content: center; }
    .rfile__actions .btn--danger span { display: inline; }
    .rfile__meta { flex-direction: column; }
    .rfile__meta span + span::before { content: none; }
}

/* "Add receipt": short / full switch, with a line on what each one is. */
.rtype { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 24px; }
.rtype__hint { color: var(--muted); font-size: 15px; }
.rform__span2 { grid-column: span 2; }
@media (max-width: 640px) {
    .rtype__switch { display: flex; width: 100%; }
    .rtype__switch .seg__tab { flex: 1; justify-content: center; }
    .rform__span2 { grid-column: auto; }
}
.rcard--short .rcard__head { border-bottom: 0; }

/* Full receipt form: lines total, tax on top, total. */
.rsum {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(100%, 380px);
    margin: 22px 0 0 auto;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
}
.rsum__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.rsum__label { color: var(--ink-2); font-size: 15px; }
.rsum__value { font-weight: 600; }
.rsum__input { width: 140px; height: 44px; text-align: right; }
.rsum__row--invalid .input { border-color: var(--danger); }
.rsum__error, .rsum__hint { margin-top: 6px; text-align: right; }
.rsum__tax { display: flex; flex-direction: column; }
.rsum__add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-end;
    margin-left: auto;
    width: fit-content;
    color: var(--brand);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.rsum__add::-webkit-details-marker { display: none; }
.rsum__add:hover { text-decoration: underline; }
.rsum__tax[open] > .rsum__add { display: none; }
.rsum__total { padding-top: 10px; border-top: 1px solid var(--line); }
.rsum__total .rsum__label { font-weight: 700; color: var(--ink); }
.rsum__total .rsum__value { font-family: var(--font-display); font-size: 26px; }
@media (max-width: 640px) {
    .rsum { width: 100%; }
}
/* A receipt with tax on top: "Items" and "Tax" above the total, lighter and tighter. */
.items tfoot .items__sub th, .items tfoot .items__sub td { font-weight: 500; font-size: 15px; color: var(--ink-2); padding-top: 8px; padding-bottom: 8px; }
.items tfoot .items__sub + tr:not(.items__sub) th, .items tfoot .items__sub + tr:not(.items__sub) td { border-top: 1px solid var(--line); }
.share--tax .share__bar { background: var(--muted-2); }
