/* ==========================================================================
   LPG Tracker — Designsystem

   Übernommen vom Wine Tracker: eine Akzentfarbe, warme Neutraltöne, Karten
   mit Rahmen statt Schlagschatten. Flächen sind ruhig, Farbe bedeutet etwas:
   gefüllt = die Hauptaktion einer Seite, alles andere tritt zurück.
   Der Akzent ist hier ein dunkles Ocker statt Weinrot.

   Aufbau: 1 Tokens · 2 Grundlagen · 3 Layout · 4 Bausteine · 5 Seiten
   · 6 Hilfsklassen · 7 Schmale Bildschirme
   ========================================================================== */

/* ---------------------------------------------------------------- 1 Tokens */
:root {
    /* Ocker als einziger Akzent. Ein helles Gelb trägt keine weiße Schrift —
       #8f6100 auf Weiß kommt auf 5,4:1 und funktioniert als Knopf. */
    --lpg: #8f6100;
    --lpg-dark: #744e00;
    --lpg-ink: #5c3d05;           /* Überschriften */
    --lpg-tint: #fdf8ea;          /* getönte Flächen */
    --lpg-tint-strong: #f6ebcf;

    --ink: #2c261a;               /* Fließtext */
    --ink-muted: #6d6455;         /* Zweitrangiges */
    --ink-faint: #968d7c;         /* Beschriftungen, Hinweise */

    --surface: #ffffff;
    --surface-sunken: #faf8f3;    /* Seitenhintergrund */
    --surface-raised: #f3efe4;    /* Chips, Tabellenköpfe */

    --border: #e8e1d2;
    --border-strong: #d6ccb7;

    /* Bedeutungsfarben: teurer = rot, gespart/günstiger = grün. Beide nur in
       Zahlenspalten und Chips, nie als Fläche. */
    --danger: #b3261e;
    --danger-tint: #fdf3f2;
    --good: #1e6b45;
    --good-bg: #eaf5ee;
    --good-border: #c8e3d3;
    --warn-bg: #fdf6e8;
    --warn-ink: #6b4b12;
    --warn-border: #efdcb4;
    --error-bg: #fdf0ef;
    --error-ink: #8c221c;
    --error-border: #f0cdc9;
    --info-bg: #eef3fa;
    --info-ink: #23508a;
    --info-border: #cddcef;

    /* Abstände: 4er-Raster, überall dieselben Stufen */
    --s-1: 0.25rem;
    --s-2: 0.5rem;
    --s-3: 0.75rem;
    --s-4: 1rem;
    --s-5: 1.5rem;
    --s-6: 2rem;
    --s-7: 3rem;

    --r-sm: 6px;
    --r: 10px;
    --r-lg: 14px;
    --r-pill: 999px;

    /* Schatten sparsam: nur was über der Seite schwebt */
    --shadow-pop: 0 6px 24px rgba(44, 38, 26, 0.12);
    --shadow-nav: 0 1px 0 var(--border);

    --focus: 0 0 0 3px rgba(143, 97, 0, 0.26);

    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
            'Helvetica Neue', Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    --content-width: 1140px;
}

/* ----------------------------------------------------------- 2 Grundlagen */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--ink);
    background: var(--surface-sunken);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    color: var(--lpg-ink);
    line-height: 1.25;
    font-weight: 600;
}

h1 { font-size: 1.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

a {
    color: var(--lpg);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

img {
    max-width: 100%;
}

code {
    font-family: var(--mono);
    font-size: 0.88em;
    background: var(--surface-raised);
    border-radius: var(--r-sm);
    padding: 0.1rem 0.35rem;
}

/* ein einheitlicher Fokusring */
:focus-visible {
    outline: 2px solid var(--lpg);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

/* ------------------------------------------------------------- 3 Layout */
.navbar {
    background: var(--surface);
    box-shadow: var(--shadow-nav);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: var(--s-3) var(--s-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-4);
}

.nav-brand {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--lpg-ink);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--s-2);
    white-space: nowrap;
}

.nav-logo {
    height: 1.75rem;
    width: 1.75rem;
    border-radius: var(--r-sm);
    display: block;
}

.nav-menu {
    display: flex;
    gap: var(--s-1);
    align-items: center;
}

.nav-link {
    color: var(--ink-muted);
    text-decoration: none;
    font-size: 0.94rem;
    padding: var(--s-2) var(--s-3);
    border-radius: var(--r-sm);
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: var(--lpg-tint);
    color: var(--lpg-ink);
}

/* aktuelle Seite: erkennbar, ohne zu schreien */
.nav-link[aria-current="page"] {
    color: var(--lpg);
    background: var(--lpg-tint);
    font-weight: 500;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--s-2);
}

.nav-toggle span {
    width: 22px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
}

.main-content {
    flex: 1;
    padding: var(--s-6) var(--s-4);
    width: 100%;
}

.container {
    max-width: var(--content-width);
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-4);
    margin-bottom: var(--s-5);
}

.page-header.is-tight {
    margin-bottom: var(--s-2);
}

/* Überschrift mit etwas direkt daneben (Bio-Marke) statt am rechten Rand */
.page-header.is-inline {
    justify-content: flex-start;
    gap: var(--s-3);
}

/* Einleitungssatz unter der Überschrift */
.lead {
    color: var(--ink-muted);
    margin-bottom: var(--s-5);
}

.page-header .btn-row {
    display: flex;
    gap: var(--s-2);
    flex-wrap: wrap;
}

/* Zurück-Zeile über der Überschrift */
.back-link {
    display: inline-block;
    margin-bottom: var(--s-3);
    color: var(--ink-muted);
    font-size: 0.9rem;
    text-decoration: none;
}

.back-link:hover {
    color: var(--lpg-ink);
}

/* Fußzeile: nur der Weg zur Rückmeldung, bewusst leise. */
.app-footer {
    text-align: center;
    padding: var(--s-5) var(--s-4) max(var(--s-5), env(safe-area-inset-bottom));
    font-size: 0.85rem;
}

.app-footer a { color: var(--ink-muted); text-decoration-color: var(--border-strong); }
.app-footer a:hover { color: var(--accent-ink); }

/* ---------------------------------------------------------- 4 Bausteine */

/* --- Knöpfe -------------------------------------------------------------
   Vier Rollen, eine Form: primary = die eine Hauptaktion, secondary =
   gleichrangige Nebenaktion, ghost = beiläufig, danger = erst beim
   Darüberfahren rot. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    padding: 0 var(--s-4);
    min-height: 40px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

.btn-primary {
    background: var(--lpg);
    color: #fff;
}

.btn-primary:hover {
    background: var(--lpg-dark);
}

.btn-secondary {
    background: var(--surface);
    color: var(--lpg-ink);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: var(--lpg-tint);
    border-color: var(--lpg);
}

.btn-ghost {
    background: transparent;
    color: var(--ink-muted);
    border-color: transparent;
    padding: 0 var(--s-3);
}

.btn-ghost:hover {
    background: var(--surface-raised);
    color: var(--lpg-ink);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: #e8c9c6;
}

.btn-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn-sm {
    min-height: 32px;
    padding: 0 var(--s-3);
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    cursor: default;
}

/* als Text getarnter Knopf */
.link-button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--lpg);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

/* Winziger Knopf direkt an einem Text (Umbenennen, Speichern in der Zeile).
   Erscheint erst, wenn die Zeile berührt oder fokussiert wird. */
.icon-btn {
    background: none;
    border: none;
    padding: 0 var(--s-1);
    font: inherit;
    font-size: 0.85rem;
    line-height: 1;
    color: var(--ink-faint);
    cursor: pointer;
}

.icon-btn:hover {
    color: var(--lpg);
}

.icon-btn.on-hover {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.hover-row:hover .icon-btn.on-hover,
.hover-row:focus-within .icon-btn.on-hover {
    opacity: 1;
}

/* --- Flächen ----------------------------------------------------------- */
.card,
.empty-state,
.prose {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
}

.card {
    padding: var(--s-5);
}

.card-tight {
    padding: var(--s-4);
}

/* Karte, die eine Tabelle randlos umschließt */
.card-flush {
    padding: 0;
    overflow: hidden;
}

.card > h2,
.card > h3 {
    margin-bottom: var(--s-3);
}

.card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-3);
    margin-bottom: var(--s-3);
}

.card-header h2 {
    margin: 0;
}

.card-link {
    font-size: 0.85rem;
    text-decoration: none;
}

.card-link:hover {
    text-decoration: underline;
}

.empty-state {
    text-align: center;
    padding: var(--s-7) var(--s-4);
}

.empty-state h2 {
    color: var(--ink-muted);
    margin-bottom: var(--s-2);
}

.empty-state p {
    color: var(--ink-faint);
    margin-bottom: var(--s-4);
}

.prose {
    padding: var(--s-5);
}

.prose h2 {
    margin-bottom: var(--s-3);
}

.prose ol,
.prose ul {
    margin: 0 0 0 var(--s-5);
    color: var(--ink);
    font-size: 0.94rem;
}

.prose li {
    margin-bottom: var(--s-2);
}

.prose p {
    margin-bottom: var(--s-3);
}

.prose p:last-child {
    margin-bottom: 0;
}

/* Kasten mit getöntem Grund — Hinweise, die dazugehören statt zu warnen */
.note-box {
    background: var(--lpg-tint);
    border: 1px solid var(--lpg-tint-strong);
    border-radius: var(--r);
    padding: var(--s-4);
    font-size: 0.9rem;
    color: var(--lpg-ink);
}

.note-box p {
    margin-bottom: var(--s-1);
}

.note-box p:last-child {
    margin-bottom: 0;
}

.note-box code {
    background: var(--lpg-tint-strong);
}

/* --- Raster ------------------------------------------------------------- */
.stack {
    display: flex;
    flex-direction: column;
    gap: var(--s-5);
}

.stack-sm {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--s-5);
}

/* Inhalt links, Werkzeugspalte rechts (Bon- und Produktseite) */
.split {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    gap: var(--s-5);
    align-items: start;
}

.split-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s-5);
}

.split-side {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
}

/* --- Kennzahlen --------------------------------------------------------- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--s-4);
    margin-bottom: var(--s-5);
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: var(--s-4);
}

.stat-label {
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: var(--s-1);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--lpg-ink);
    line-height: 1.2;
}

.stat-value.is-plain {
    color: var(--ink);
}

.stat-value.is-small {
    font-size: 1.05rem;
}

.stat-note {
    margin-top: var(--s-1);
    font-size: 0.8rem;
    color: var(--ink-faint);
}

.stat-note.is-good {
    color: var(--good);
}

/* Veränderung gegenüber dem Vormonat, direkt hinter der Zahl */
.delta {
    font-size: 0.78rem;
    font-weight: 500;
    margin-left: var(--s-1);
    vertical-align: middle;
}

.delta.is-up,
.trend.is-up {
    color: var(--danger);
}

.delta.is-down,
.trend.is-down {
    color: var(--good);
}

.trend {
    font-size: 0.78rem;
    margin-left: 0.15rem;
}

/* --- Chips und Statusmarken --------------------------------------------- */
.chip {
    display: inline-block;
    background: var(--surface-raised);
    color: var(--ink-muted);
    border-radius: var(--r-pill);
    padding: 0.1rem 0.55rem;
    font-size: 0.78rem;
    white-space: nowrap;
}

.chip-accent {
    background: var(--lpg-tint);
    color: var(--lpg-ink);
}

.status {
    display: inline-block;
    border-radius: var(--r-pill);
    padding: 0.1rem 0.6rem;
    font-size: 0.78rem;
    white-space: nowrap;
    border: 1px solid transparent;
}

.status-ok      { background: var(--good-bg);  color: var(--good);      border-color: var(--good-border); }
.status-review  { background: var(--warn-bg);  color: var(--warn-ink);  border-color: var(--warn-border); }
.status-error   { background: var(--error-bg); color: var(--error-ink); border-color: var(--error-border); }
.status-pending { background: var(--info-bg);  color: var(--info-ink);  border-color: var(--info-border); }

/* Bio-Vermerk hinter einem Produktnamen — kleiner als der Name, aber
   erkennbar; Farbe allein trägt die Aussage nicht, das Wort steht da. */
.bio-mark {
    font-size: 0.78rem;
    color: var(--good);
    margin-left: var(--s-1);
}

/* Querverweis ins Weinbuch */
.wine-link {
    font-size: 0.78rem;
    margin-left: var(--s-1);
    color: #8a3247;
    text-decoration: none;
}

.wine-link:hover {
    text-decoration: underline;
}

/* --- Werkzeug- und Filterleiste ---------------------------------------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    align-items: center;
    margin-bottom: var(--s-4);
    padding: var(--s-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
}

.search-row {
    display: flex;
    gap: var(--s-2);
    flex: 1;
    min-width: 0;
    position: relative;
}

.search-input,
.form-control,
.form-select {
    font-family: inherit;
    font-size: 1rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input {
    flex: 1;
    min-width: 0;
    padding: 0 var(--s-3);
    min-height: 40px;
}

.search-input:focus,
.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--lpg);
    box-shadow: var(--focus);
}

.suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow-pop);
    max-height: 300px;
    overflow-y: auto;
    z-index: 20;
    padding: var(--s-1);
}

.suggestions[hidden] {
    display: none;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-2) var(--s-3);
    border-radius: var(--r-sm);
    font-size: 0.94rem;
    text-decoration: none;
    color: var(--ink);
}

.suggestion-item:hover {
    background: var(--lpg-tint);
}

.suggestion-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-count {
    font-size: 0.85rem;
    color: var(--ink-faint);
    margin-bottom: var(--s-3);
}

/* --- Formulare ---------------------------------------------------------- */
.form-group {
    margin-bottom: var(--s-4);
}

.form-label {
    display: block;
    margin-bottom: var(--s-1);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--ink);
}

.form-control,
.form-select {
    width: 100%;
    padding: 0 var(--s-3);
    min-height: 40px;
}

.form-control.error {
    border-color: var(--danger);
}

.form-help {
    display: block;
    margin-top: var(--s-1);
    font-size: 0.85rem;
    color: var(--ink-faint);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-4);
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    font-size: 0.9rem;
    color: var(--ink-muted);
}

.form-actions {
    display: flex;
    gap: var(--s-2);
    margin-top: var(--s-5);
}

.form-actions > * {
    flex: 1;
}

/* Dateiauswahl: die eigentliche <input type=file> bleibt sichtbar, bekommt
   aber denselben Rahmen wie die übrigen Felder. */
.file-input {
    width: 100%;
    font-size: 0.9rem;
    color: var(--ink-muted);
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-sm);
    padding: var(--s-3);
}

.file-input::file-selector-button {
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--lpg-ink);
    background: var(--lpg-tint);
    border: 1px solid var(--lpg-tint-strong);
    border-radius: var(--r-sm);
    padding: 0.35rem 0.8rem;
    margin-right: var(--s-3);
    cursor: pointer;
}

.file-input::file-selector-button:hover {
    background: var(--lpg-tint-strong);
}

/* Feld, das erst beim Berühren als Feld erkennbar wird (Filialname auf der
   Bonseite) — sonst sähe die Kopfzeile aus wie ein Formular. */
.inline-edit {
    display: inline-flex;
    align-items: center;
    gap: var(--s-1);
    vertical-align: middle;
    max-width: 100%;
}

/* über die volle Breite, wenn das Feld allein in seiner Zeile steht */
.inline-edit.is-wide {
    display: flex;
}

.inline-input {
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--ink-muted);
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    padding: 0.1rem 0;
    min-width: 0;
    flex: 1;
}

.inline-input:hover {
    border-bottom-color: var(--border);
}

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

/* --- Tabellen ----------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: var(--surface);
}

.table th,
.table td {
    text-align: left;
    padding: var(--s-2) var(--s-3);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-faint);
    font-weight: 600;
    background: var(--surface-sunken);
    white-space: nowrap;
}

.table .num {
    text-align: right;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.table .num-plain {
    text-align: right;
    white-space: nowrap;
}

.table .mid {
    text-align: center;
}

.table .muted-cell {
    color: var(--ink-muted);
}

.table .name-cell {
    font-weight: 500;
}

/* ganze Zeile ist ein Link (per data-href in main.js) */
.table tbody tr.is-clickable {
    cursor: pointer;
}

.table tbody tr.is-clickable:hover {
    background: var(--lpg-tint);
}

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

.table a:hover {
    color: var(--lpg);
}

/* günstigster / teuerster Laden im Preisvergleich: Streifen links plus Chip,
   damit die Aussage nicht allein an der Farbe hängt */
.table tr.is-cheapest td:first-child { border-left: 3px solid var(--good); }
.table tr.is-priciest td:first-child { border-left: 3px solid var(--danger); }
.table tr.is-cheapest { background: var(--good-bg); }
.table tr.is-priciest { background: var(--danger-tint); }

.chip-good  { background: var(--good-bg);  color: var(--good);      border-radius: var(--r-pill); padding: 0.05rem 0.5rem; font-size: 0.75rem; margin-left: var(--s-1); }
.chip-bad   { background: var(--error-bg); color: var(--error-ink); border-radius: var(--r-pill); padding: 0.05rem 0.5rem; font-size: 0.75rem; margin-left: var(--s-1); }

.table-note {
    padding: var(--s-2) var(--s-3) 0;
    font-size: 0.8rem;
    color: var(--ink-faint);
}

/* Artikelliste auf der Bonseite: keine Kopf-Tönung, nur Trennlinien */
.table-plain th {
    background: transparent;
}

/* --- Meldungen ---------------------------------------------------------- */
.alert {
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r);
    margin-bottom: var(--s-4);
    font-size: 0.94rem;
    border: 1px solid transparent;
}

.alert-success { background: var(--good-bg);  color: var(--good);      border-color: var(--good-border); }
.alert-warning { background: var(--warn-bg);  color: var(--warn-ink);  border-color: var(--warn-border); }
.alert-error   { background: var(--error-bg); color: var(--error-ink); border-color: var(--error-border); }
.alert-info    { background: var(--lpg-tint); color: var(--lpg-ink);   border-color: var(--lpg-tint-strong); }

.alert a {
    color: inherit;
    font-weight: 500;
}

/* ------------------------------------------------------------- 5 Seiten */

/* --- Anmeldeseite (eigenes Layout, ohne Navigation) --------------------- */
.login-wrap {
    max-width: 360px;
    margin: 10vh auto;
    padding: var(--s-6);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--s-3);
}

.login-logo img {
    height: 72px;
    width: 72px;
    border-radius: var(--r-lg);
}

.login-wrap h1 {
    text-align: center;
    font-size: 1.35rem;
    margin-bottom: var(--s-5);
}

.login-oder {
    text-align: center;
    color: var(--ink-muted);
    margin: var(--s-4) 0;
}

/* --- Diagrammkarten ----------------------------------------------------- */
.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: var(--s-5);
}

.chart-card h2 {
    margin-bottom: var(--s-3);
}

.chart-sub {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--ink-faint);
}

/* --- Break-even der Mitgliedschaft -------------------------------------- */
.breakeven {
    display: flex;
    align-items: center;
    gap: var(--s-6);
    flex-wrap: wrap;
}

.breakeven-gauge {
    width: 11rem;
    flex: 0 0 auto;
}

.breakeven-figure {
    font-size: 2.4rem;
    font-weight: 600;
    color: var(--lpg-ink);
    line-height: 1.1;
}

.breakeven-figure .unit {
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--ink-faint);
}

.breakeven-missing {
    margin-top: var(--s-1);
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--lpg);
}

.breakeven-done {
    margin-top: var(--s-1);
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--good);
}

/* --- Listen mit Betrag rechts (Dashboard) ------------------------------- */
.mini-list {
    list-style: none;
}

.mini-list li + li {
    border-top: 1px solid var(--border);
}

.mini-list a {
    display: flex;
    align-items: baseline;
    gap: var(--s-2);
    padding: var(--s-2) 0;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--ink);
}

.mini-list a:hover {
    color: var(--lpg-ink);
}

.mini-date {
    color: var(--ink-faint);
    flex: 0 0 auto;
    font-size: 0.85rem;
}

.mini-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink-muted);
}

.mini-amount {
    margin-left: auto;
    flex: 0 0 auto;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    color: var(--lpg-ink);
}

/* --- Kategorisier-Assistent --------------------------------------------- */
.wizard {
    max-width: 520px;
    margin: 0 auto;
}

.progress {
    height: 6px;
    background: var(--surface-raised);
    border-radius: var(--r-pill);
    overflow: hidden;
    margin-bottom: var(--s-5);
}

.progress-bar {
    height: 100%;
    background: var(--lpg);
    border-radius: var(--r-pill);
}

.wizard-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-6) var(--s-5);
    text-align: center;
    margin-bottom: var(--s-4);
}

.wizard-kicker {
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: var(--s-2);
}

.wizard-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--lpg-ink);
    line-height: 1.25;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--s-2);
    margin-bottom: var(--s-4);
}

.choice {
    min-height: 48px;
    padding: var(--s-2) var(--s-3);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.choice:hover {
    background: var(--lpg-tint);
    border-color: var(--lpg);
    color: var(--lpg-ink);
}

/* --- Bonseite ----------------------------------------------------------- */
.receipt-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--s-4);
    margin-bottom: var(--s-4);
    flex-wrap: wrap;
}

.receipt-total {
    text-align: right;
    flex: 0 0 auto;
}

.receipt-total .amount {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--lpg-ink);
    font-variant-numeric: tabular-nums;
}

.receipt-total .saved {
    font-size: 0.8rem;
    color: var(--good);
    font-weight: 500;
}

.receipt-total .member {
    font-size: 0.8rem;
    color: var(--ink-faint);
}

.receipt-thumb {
    display: block;
    margin-top: var(--s-2);
}

.receipt-thumb img {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--r);
    object-fit: contain;
}

/* --- Bon bearbeiten ----------------------------------------------------- */
.edit-table input {
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--ink);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 0.2rem 0;
    min-width: 0;
}

.edit-table input:focus {
    outline: none;
    border-bottom-color: var(--lpg);
}

.edit-table .num input {
    text-align: right;
    font-family: var(--mono);
}

.edit-table .w-name  { min-width: 150px; width: 100%; }
.edit-table .w-qty   { width: 3.5rem; }
.edit-table .w-unit  { width: 4rem; }
.edit-table .w-money { width: 5rem; }

.edit-table tr.is-deleted {
    opacity: 0.35;
    text-decoration: line-through;
}

/* --- Produktseite: Trennen und Zusammenführen --------------------------- */
.split-list {
    list-style: none;
}

.split-list > li + li {
    border-top: 1px solid var(--border);
}

.split-list summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2);
    padding: var(--s-2) 0;
    cursor: pointer;
    list-style: none;
    font-size: 0.9rem;
    color: var(--ink-muted);
}

.split-list summary::-webkit-details-marker {
    display: none;
}

.split-list summary:hover {
    color: var(--lpg-ink);
}

.split-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.split-count {
    flex: 0 0 auto;
    font-size: 0.8rem;
    color: var(--ink-faint);
}

.split-form {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    padding-bottom: var(--s-3);
}

.merge-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.merge-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2);
    font-size: 0.9rem;
}

.merge-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink-muted);
}

/* --- Dublettenliste ----------------------------------------------------- */
.dubletten-filter .form-label {
    margin: 0;
}

.dublette-meta {
    display: block;
    font-size: 0.85rem;
}

.dublette-aktionen {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    align-items: center;
}

.dublette-aktionen form {
    margin: 0;
}

/* -------------------------------------------------------- 6 Hilfsklassen */
.muted {
    color: var(--ink-muted);
}

.faint {
    color: var(--ink-faint);
    font-size: 0.85rem;
}

.mono {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stack-top {
    margin-top: var(--s-5);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

[hidden] {
    display: none !important;
}

/* ------------------------------------------- 7 Schmale Bildschirme */
@media (max-width: 900px) {
    .split {
        grid-template-columns: 1fr;
    }
}

/* Acht Menüpunkte passen nicht bis 768 px nebeneinander — das Klappmenü
   übernimmt hier deutlich früher als beim Weintracker. */
@media (max-width: 960px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--surface);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: var(--s-2);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-pop);
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-link {
        padding: var(--s-3);
    }

    .nav-toggle {
        display: flex;
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-wrap: wrap;
    }

    .breakeven {
        gap: var(--s-4);
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: var(--s-4) var(--s-3);
    }

    h1 { font-size: 1.4rem; }

    .card,
    .chart-card,
    .prose {
        padding: var(--s-4);
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .stats {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}
