/* le & le · vino: weisser Grund mit dunkler Schrift, damit Produktfotos (weisser
   Hintergrund) nahtlos in der Seite stehen. Flächen ein warmes, helles Grau.
   Farbe trägt Bedeutung: im Regal nur als kleiner Punkt für bald trinken und
   überfällig (oder im Stil-Modus die Farbe im Glas). */

:root {
    --fg-rgb: 38, 35, 31;
    --bg: #ffffff;
    --surface: #f1efeb;
    --surface-2: #e4e1da;
    --text: #26231f;
    --muted: #6e675e;
    --faint: #a49c91;
    --line: rgba(var(--fg-rgb), .16);
    --line-soft: rgba(var(--fg-rgb), .08);
    --on-color: #f4f2ee;
    --danger: #a4513e;

    /* Status: ruhende Zustände haben keine Farbe (hohle Kreise).
       Farbe gibt es nur, wo man handeln sollte. Die übrigen Werte brauchen
       nur der Zeitstrahl und die Legende. */
    --st-unbekannt: #d8d3ca;
    --st-liegen_lassen: #c9c2b7;
    --st-offen: #a79e92;
    --st-hoehepunkt: #3b3631;
    --st-bald_trinken: #b88a4f;
    --st-ueberfaellig: #a45d49;

    /* Stil: die Farbe im Glas, in die Erdtöne der App gezogen */
    --sty-rot: #7c4842;
    --sty-weiss: #cdbf8e;
    --sty-orange: #b07e52;
    --sty-rose: #c08e86;
    --sty-schaumwein: #d9cfb0;
    --sty-suess: #a68a54;

    --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --ease: cubic-bezier(.23, 1, .32, 1);
    --r: 10px;
    color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}
::selection { background: var(--text); color: var(--on-color); }
a { color: inherit; }
button, .btn, .tab, .slot, .seg-btn, .legend-item, .row {
    font: inherit; color: inherit; background: none; border: 0; cursor: pointer;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
h1, h2, h3 { text-wrap: balance; font-weight: 600; }
p { text-wrap: pretty; }

/* ── Felder ─────────────────────────────────────────────────────────── */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
input, textarea, select {
    font: inherit; color: var(--text);
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 12px;
    outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--muted); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--text); }
textarea { resize: vertical; }
fieldset { border: 0; margin: 0 0 20px; }
legend { font-family: var(--serif); font-size: 1.1rem; margin-bottom: 10px; }
.hint { color: var(--muted); font-size: .88rem; margin-bottom: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.check-field { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }

/* ── Buttons ────────────────────────────────────────────────────────── */
/* Ruhig: Haarlinie statt Fläche, Pille; nur die Hauptaktion ist gefüllt */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px; border-radius: 999px;
    background: none; color: var(--text); box-shadow: inset 0 0 0 1px var(--line);
    font-size: .94rem; font-weight: 450; text-decoration: none; text-align: center;
    transition: transform .12s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
}
@media (hover: hover) { .btn:hover { box-shadow: inset 0 0 0 1px rgba(var(--fg-rgb), .4); } }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--text); color: var(--on-color); box-shadow: none; }
.btn-danger { background: var(--danger); color: var(--on-color); box-shadow: none; }
@media (hover: hover) { .btn-primary:hover, .btn-danger:hover { box-shadow: none; opacity: .9; } }
.btn-quiet { box-shadow: none; color: var(--muted); }
@media (hover: hover) { .btn-quiet:hover { box-shadow: none; color: var(--text); } }
.btn-small { padding: 6px 12px; font-size: .86rem; }
.btn-block { width: 100%; }
.icon-btn, .avatar-btn {
    width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    transition: transform .12s var(--ease);
}
.icon-btn:active, .avatar-btn:active { transform: scale(.94); }
.icon-btn { background: var(--text); color: var(--on-color); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.avatar-btn { background: var(--surface-2); font-weight: 600; }

/* ── Segmente ───────────────────────────────────────────────────────── */
.seg {
    display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px;
    background: var(--surface); border-radius: var(--r);
}
.seg-btn {
    padding: 7px 12px; border-radius: 7px; color: var(--muted); font-size: .9rem;
    transition: background-color .15s var(--ease), color .15s var(--ease);
}
.seg-btn.on { background: var(--surface-2); color: var(--text); }

/* ── Kopf, Tabs ─────────────────────────────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 12px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: var(--bg);
}
.wordmark { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; text-decoration: none; letter-spacing: -.01em; white-space: nowrap; }
.wm-dot { color: var(--faint); margin: 0 .35em; font-weight: 400; }
.offline-tag { display: none; font-size: .78rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }
.is-offline .offline-tag { display: inline-block; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }

#view { padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    display: flex; justify-content: center; gap: 4px;
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
    background: var(--bg);
    border-top: 1px solid var(--line-soft);
}
.tab {
    flex: 1; max-width: 160px; padding: 9px 6px; border-radius: var(--r);
    text-align: center; text-decoration: none; color: var(--muted); font-size: .92rem;
}
.tab.on { color: var(--text); background: var(--surface); }

/* ── Seiten ─────────────────────────────────────────────────────────── */
.page-head { margin: 10px 0 18px; }
.page-head h1 { font-family: var(--serif); font-size: 2rem; line-height: 1.1; letter-spacing: -.015em; }
.page-head .meta { color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.back { display: inline-block; color: var(--muted); text-decoration: none; padding: 6px 0; margin-top: 4px; }
section { margin-top: 32px; }
section > h2 {
    font-family: var(--serif); font-size: 1.25rem; margin-bottom: 10px;
    display: flex; align-items: baseline; gap: 10px;
}
.count { color: var(--muted); font-family: var(--sans); font-size: .85rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 40px 8px; text-align: center; }
.intro { background: var(--surface); border-radius: var(--r); padding: 18px; margin-bottom: 20px; }
.intro p { margin-bottom: 14px; }

/* ── Regal ──────────────────────────────────────────────────────────── */
/* Legende: schlichte Liste, rechts neben dem Regal (oder darunter, wenn es eng ist) */
.rack-layout { display: flex; flex-direction: column; gap: 28px; }
.rack-layout.side { flex-direction: row; align-items: flex-start; gap: 32px; }
.legend { flex: 0 0 150px; font-size: .88rem; }
.legend ul { list-style: none; }
.legend-mode { display: flex; gap: 14px; margin-bottom: 12px; }
.legend-mode button { color: var(--faint); padding: 2px 0; }
.legend-mode button.on { color: var(--text); }
.legend-item {
    display: flex; align-items: center; gap: 9px; width: 100%;
    padding: 5px 0; text-align: left; color: var(--muted);
    transition: color .15s var(--ease), opacity .15s var(--ease);
}
.legend-item span:first-of-type { flex: 1; }
.legend-item .count { font-size: .82rem; color: var(--faint); }
.legend-item.on { color: var(--text); }
.legend-item.off { opacity: .45; }
.legend-item.static { cursor: default; }
.rack-layout:not(.side) .legend ul { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
.rack-layout:not(.side) .legend { flex-basis: auto; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; background: var(--st-unbekannt); box-shadow: inset 0 0 0 1px rgba(var(--fg-rgb), .12); }
.dot.st-liegen_lassen { background: var(--st-liegen_lassen); }
.dot.st-offen { background: var(--st-offen); }
.dot.st-hoehepunkt { background: var(--st-hoehepunkt); }
.dot.st-bald_trinken { background: var(--st-bald_trinken); }
.dot.st-ueberfaellig { background: var(--st-ueberfaellig); }
.dot.sty-rot { background: var(--sty-rot); }
.dot.sty-weiss { background: var(--sty-weiss); }
.dot.sty-orange { background: var(--sty-orange); }
.dot.sty-rose { background: var(--sty-rose); }
.dot.sty-schaumwein { background: var(--sty-schaumwein); }
.dot.sty-suess { background: var(--sty-suess); }

.rack-wrap { overflow-x: auto; scrollbar-width: thin; }
.rack { display: flex; gap: 20px; width: max-content; }
.rack-module {
    display: grid; grid-template-columns: repeat(var(--cols), var(--cell));
    grid-auto-rows: var(--cell); gap: 4px;
}
.slot {
    position: relative; display: flex; align-items: center; justify-content: center;
    width: var(--cell); height: var(--cell); padding: 0;
    border-radius: 3px;
}
/* Augenhöhe nur beim Bearbeiten sichtbar */
.rack-edit .slot.eye { background: rgba(var(--fg-rgb), .05); }
.slot.void { pointer-events: none; }
.disc {
    position: relative;
    width: 78%; height: 78%; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: calc(var(--cell) * .27); font-variant-numeric: tabular-nums;
    transition: opacity .2s var(--ease), transform .12s var(--ease);
}
/* Nur Linien: belegt = klare Kreislinie, frei = kaum sichtbar.
   Status zeigt ein kleiner Punkt oben rechts, und nur, wo man handeln sollte. */
.slot.empty .disc { color: var(--faint); box-shadow: inset 0 0 0 1px var(--line-soft); }
.slot.full .disc { color: var(--text); box-shadow: inset 0 0 0 1.5px rgba(var(--fg-rgb), .8); font-weight: 500; }
.slot.magnum .disc { width: 92%; height: 92%; }
/* Fokus nur für Tastatur, als feiner Ring um den Kreis statt Kästchen */
.slot:focus-visible { outline: none; }
.slot:focus-visible .disc { outline: 1.5px solid rgba(var(--fg-rgb), .45); outline-offset: 3px; }
.slot.empty.magnum .disc { box-shadow: inset 0 0 0 1px var(--line-soft), inset 0 0 0 4px var(--bg), inset 0 0 0 5px var(--line-soft); }
.slot.full.magnum .disc { box-shadow: inset 0 0 0 1.5px rgba(var(--fg-rgb), .8), inset 0 0 0 4px var(--bg), inset 0 0 0 5.5px rgba(var(--fg-rgb), .8); }
.slot:active .disc { transform: scale(.92); }
.slot.full.st-bald_trinken .disc::after,
.slot.full.st-ueberfaellig .disc::after,
.slot.full[class*="sty-"] .disc::after {
    content: ''; position: absolute; top: -1px; right: -1px;
    width: 28%; height: 28%; min-width: 8px; min-height: 8px; border-radius: 50%;
    background: var(--c); box-shadow: 0 0 0 2px var(--bg), inset 0 0 0 1px rgba(var(--fg-rgb), .12);
}
.st-bald_trinken { --c: var(--st-bald_trinken); }
.st-ueberfaellig { --c: var(--st-ueberfaellig); }
.sty-rot { --c: var(--sty-rot); }
.sty-weiss { --c: var(--sty-weiss); }
.sty-orange { --c: var(--sty-orange); }
.sty-rose { --c: var(--sty-rose); }
.sty-schaumwein { --c: var(--sty-schaumwein); }
.sty-suess { --c: var(--sty-suess); }
.dot.st-unbekannt, .dot.st-liegen_lassen, .dot.st-offen, .dot.st-hoehepunkt { background: none; box-shadow: inset 0 0 0 1.5px var(--muted); }
.slot.dim .disc { opacity: .15; }
.slot.moving .disc { outline: 1.5px dashed var(--text); outline-offset: 3px; }

/* Auswahl beim Einbuchen */
.rack-pick .slot.sel .disc { background: var(--text); color: var(--on-color); box-shadow: none; }
.rack-pick .slot.sel .disc::after { display: none; }
.rack-pick .slot.blocked .disc { opacity: .25; }

.banner {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--surface); border-radius: var(--r); padding: 12px 14px; margin-bottom: 14px;
}
.banner p { flex: 1 1 220px; }
.banner-actions { display: flex; gap: 8px; }

/* ── Listen ─────────────────────────────────────────────────────────── */
.list { list-style: none; }
.row {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
    padding: 12px 2px; border-bottom: 1px solid var(--line-soft); text-decoration: none;
}
.row:last-child { border-bottom: 0; }
.row:active { background: var(--line-soft); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { color: var(--muted); font-size: .9rem; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-act { color: var(--muted); font-size: .88rem; }

/* ── Sheet ──────────────────────────────────────────────────────────── */
.sheet-backdrop {
    position: fixed; inset: 0; z-index: 40; background: rgba(var(--fg-rgb), .3);
    opacity: 0; transition: opacity .2s var(--ease);
}
.sheet-backdrop.open { opacity: 1; }
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
    max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain;
    background: var(--surface); border-radius: 16px 16px 0 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(100%); transition: transform .24s var(--ease);
}
.sheet.open { transform: translateY(0); }
.sheet h2 { font-family: var(--serif); font-size: 1.35rem; margin-bottom: 12px; line-height: 1.2; }
.sheet input, .sheet textarea, .sheet .seg { background: var(--bg); }
.sheet .seg-btn.on { background: var(--surface-2); }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }
.confirm-text { font-size: 1.05rem; }
@media (min-width: 700px) {
    .sheet {
        left: 50%; right: auto; bottom: auto; top: 50%; width: 520px;
        border-radius: 16px; transform: translate(-50%, -46%); opacity: 0;
        transition: transform .22s var(--ease), opacity .22s var(--ease);
    }
    .sheet.open { transform: translate(-50%, -50%); opacity: 1; }
}
.menu { display: flex; flex-direction: column; }
.menu-item { padding: 14px 2px; text-align: left; text-decoration: none; border-bottom: 1px solid var(--line-soft); }
.menu-item:last-child { border-bottom: 0; }

/* Flasche */
.wine-title { font-family: var(--serif); font-size: 1.5rem; line-height: 1.15; }
.wine-sub { color: var(--muted); margin-top: 2px; font-size: 1.05rem; }
.bottle-head { margin-bottom: 12px; }
.bottle-status { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-bottom: 14px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin-bottom: 18px; }
.facts dt { color: var(--muted); }
.facts dd { font-variant-numeric: tabular-nums; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions .btn-primary { grid-column: 1 / -1; }

/* Sterne */
.stars { display: inline-flex; gap: 2px; vertical-align: -2px; }
.star {
    display: inline-block; width: 16px; height: 16px;
    clip-path: polygon(50% 3%, 61.8% 36%, 97% 36%, 68.5% 57%, 79.4% 91%, 50% 70%, 20.6% 91%, 31.5% 57%, 3% 36%, 38.2% 36%);
    background: linear-gradient(90deg, var(--text) calc(var(--f, 0) * 100%), var(--line) 0);
}
.star-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.star-input { display: inline-flex; gap: 4px; cursor: pointer; touch-action: manipulation; }
.star-input .star { width: 34px; height: 34px; background: linear-gradient(90deg, var(--text) calc(var(--f, 0) * 100%), rgba(var(--fg-rgb), .15) 0); }
.star-val { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 2ch; }
.tasters { display: grid; gap: 8px; }
@media (min-width: 700px) { .tasters { grid-template-columns: 1fr 1fr; gap: 20px; } }
.taster .seg { margin-bottom: 14px; }

/* ── Anmeldung ──────────────────────────────────────────────────────── */
.screen { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .wordmark { display: block; font-size: 2.2rem; margin-bottom: 8px; }
.auth-card .lead { color: var(--muted); margin-bottom: 24px; }
.who-seg { display: flex; margin: 18px 0 16px; }
.who-seg .seg-btn { flex: 1; }

/* ── Toast ──────────────────────────────────────────────────────────── */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 60; display: flex; justify-content: center; pointer-events: none; padding: 0 16px; }
.toast {
    background: var(--text); color: var(--on-color); padding: 10px 16px; border-radius: var(--r);
    opacity: 0; transform: translateY(6px); transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}

/* ── Formulare und Detail ───────────────────────────────────────────── */
.field-label { font-size: .82rem; color: var(--muted); margin: 4px 0 6px; }
.field-label + .seg, .field-label + .hint + .seg { margin-bottom: 16px; }
.seg + .field, .seg + .row2 { margin-top: 16px; }
.align-end { align-items: end; }
.align-end .check-field { margin-bottom: 28px; }
.field-btn { margin-bottom: 16px; height: 45px; }
section.first { margin-top: 0; }
.form-actions { margin: 28px 0 8px; }
.list-tools { margin-bottom: 8px; }
.list-tools .seg { margin-bottom: 12px; }
.small { font-size: .88rem; }
.link { color: var(--text); text-decoration: underline; text-underline-offset: 3px; font-size: .9rem; padding: 4px 0; }
.link.muted { color: var(--muted); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.wine-status { display: flex; align-items: center; gap: 12px; }
.window-text { margin-top: 10px; }
.tip { margin: 12px 0; padding: 10px 12px; border-radius: 8px; background: var(--surface); }
section .btn-small { margin-top: 12px; }
.notes { white-space: pre-wrap; margin-top: 12px; }

details.more { margin-top: 24px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
details.more summary { cursor: pointer; font-family: var(--serif); font-size: 1.1rem; list-style: none; padding: 4px 0 12px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: '+'; color: var(--muted); margin-left: 10px; }
details.more[open] summary::after { content: '–'; }
.range-row { display: grid; grid-template-columns: 5.5rem 1fr 3rem auto; align-items: center; gap: 10px; margin-bottom: 8px; }
.range-row input[type=range] { padding: 0; background: none; border: 0; accent-color: var(--text); }
.range-row output { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; }
.range-label { font-size: .92rem; }

.attrs { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; align-items: center; }
.attrs dt { color: var(--muted); }
.attrs dd { display: flex; align-items: center; gap: 10px; }
.bar { flex: 1; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--text) calc(var(--v) * 100%), var(--line) 0); }
.bar-num { font-variant-numeric: tabular-nums; color: var(--muted); width: 1ch; }

.timeline { position: relative; height: 34px; margin: 6px 0 4px; }
.timeline::before { content: ''; position: absolute; left: 0; right: 0; top: 9px; height: 2px; background: var(--line); }
.tl-win { position: absolute; top: 5px; height: 10px; border-radius: 5px; background: var(--st-offen); opacity: .55; }
.tl-peak { position: absolute; top: 5px; height: 10px; border-radius: 5px; background: var(--st-hoehepunkt); }
.tl-now { position: absolute; top: 0; width: 2px; height: 20px; margin-left: -1px; background: var(--st-bald_trinken); }
.tl-lab { position: absolute; top: 20px; font-size: .78rem; color: var(--muted); transform: translateX(-50%); font-variant-numeric: tabular-nums; }

.opening { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.opening:last-child { border-bottom: 0; }
.opening-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 8px; }
.opening-actions { display: flex; gap: 14px; }
.notes2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.note p { margin-bottom: 3px; }
.note-who { font-weight: 600; }
.note-text { color: var(--muted); white-space: pre-wrap; }
.rating-num { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 4px; }
.diverge { margin-top: 8px; color: var(--st-bald_trinken); font-size: .9rem; }

.stars.small .star { width: 12px; height: 12px; }
.rates { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; margin-top: 3px; }
.rate { display: inline-flex; align-items: center; gap: 5px; }
.rate-who { font-size: .78rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row.static { cursor: default; }
.row.static:active { background: none; }

.module-row { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.module-row .btn-row { margin-top: 8px; }
.module-add { margin-top: 20px; }
.rack-edit .slot.full .disc::after { display: none; }

/* ── Etikett-Scan ───────────────────────────────────────────────────── */
.scan-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.file-btn { cursor: pointer; }
.scan-thumbs { display: flex; gap: 10px; margin-bottom: 10px; }
.scan-thumbs:empty { display: none; }
.scan-thumbs figure { width: 96px; }
.scan-thumbs img { width: 96px; height: 128px; object-fit: cover; border-radius: 6px; display: block; }
.scan-thumbs figcaption { font-size: .78rem; color: var(--muted); margin-top: 4px; }
#scan-hint.working { color: var(--text); animation: pulse-text 1.6s ease-in-out infinite; }
@keyframes pulse-text { 50% { opacity: .55; } }
#scan-go { margin-bottom: 8px; }
#scan-result .tip a { color: var(--text); }
.window-take { align-items: flex-start; margin-top: 12px; }
.window-take span { display: flex; flex-direction: column; gap: 3px; }
.window-take small { font-size: .84rem; }
/* Sicherheit der Erkennung: tief = Rand in Amber, mittel = nur Hinweis */
.field.unsure input, .field.unsure textarea { border-color: var(--st-bald_trinken); }
.seg.unsure { box-shadow: inset 0 0 0 1px var(--st-bald_trinken); }
.conf-note { display: block; font-size: .78rem; color: var(--muted); margin-top: 4px; }
.unsure > .conf-note, .unsure + .conf-note { color: var(--st-bald_trinken); }
.check-field .conf-note { margin: 0 0 0 6px; display: inline; }

.label-photos { display: flex; gap: 10px; margin-top: 16px; }
.label-photos img { width: 112px; height: 150px; object-fit: cover; border-radius: 6px; display: block; }

/* Wunschliste */
.wish-list { margin-top: 16px; }
.row.done .row-title { color: var(--muted); }
.tab { padding: 9px 2px; font-size: .88rem; }
.seg.unsure { margin-bottom: 0; }
.seg + .conf-note { margin: 6px 0 16px; }
.attr-src { font-size: .78rem; color: var(--faint); min-width: 4.5em; }
.xw-cand { align-items: flex-start; gap: 14px; }
.xw-cand .row-main span:first-child { white-space: normal; }
.xw-cand .row-sub { white-space: normal; margin-top: 4px; }
.row-count { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 500; }
details.orig { margin-top: 10px; }
details.orig summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
details.orig .notes { color: var(--muted); margin-top: 6px; }

/* ── Wein als Popup ─────────────────────────────────────────────────── */
html.modal-open { overflow: hidden; }
.modal-backdrop {
    position: fixed; inset: 0; z-index: 30; background: rgba(var(--fg-rgb), .28);
    opacity: 0; transition: opacity .22s var(--ease);
}
.modal-backdrop.open { opacity: 1; }
.modal {
    position: fixed; z-index: 31; background: var(--bg);
    left: 0; right: 0; bottom: 0; top: max(24px, env(safe-area-inset-top));
    border-radius: 16px 16px 0 0; overflow: hidden; display: flex;
    transform: translateY(100%); transition: transform .28s var(--ease);
}
.modal.open { transform: none; }
.modal-body {
    flex: 1; overflow-y: auto; overscroll-behavior: contain;
    padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
}
.modal-close {
    position: absolute; top: 12px; right: 12px; z-index: 2;
    width: 36px; height: 36px; border-radius: 50%; background: var(--surface);
    display: grid; place-items: center;
}
.modal-close svg { width: 18px; height: 18px; fill: none; stroke: var(--text); stroke-width: 1.6; stroke-linecap: round; }
.modal .page-head { margin-top: 0; padding-right: 44px; }

/* Flasche gross, Text daneben; auf dem Handy darunter */
.wine-visual { display: flex; justify-content: center; }
.bottle-shot { position: relative; display: flex; justify-content: center; padding-bottom: 12px; margin: 4px 0 18px; }
.bottle-shot img { position: relative; z-index: 1; display: block; height: min(56dvh, 520px); max-width: 100%; object-fit: contain; }
.bottle-shot::after {
    content: ''; position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%);
    width: 42%; max-width: 150px; height: 16px; border-radius: 50%;
    background: radial-gradient(closest-side, rgba(var(--fg-rgb), .24), rgba(var(--fg-rgb), .07) 60%, rgba(var(--fg-rgb), 0));
}
.label-shot { margin: 4px 0 18px; display: flex; justify-content: center; }
.label-shot img { display: block; max-width: min(260px, 70%); border-radius: 4px; }

@media (min-width: 760px) {
    .modal {
        left: 50%; top: 50%; right: auto; bottom: auto;
        width: min(1080px, calc(100vw - 64px)); height: min(88dvh, 900px);
        border-radius: 16px; transform: translate(-50%, -48%); opacity: 0;
        transition: transform .28s var(--ease), opacity .22s var(--ease);
        box-shadow: 0 24px 80px rgba(var(--fg-rgb), .18);
    }
    .modal.open { transform: translate(-50%, -50%); opacity: 1; }
    .modal-body { padding: 36px 40px 40px; }
    .modal-close { top: 16px; right: 16px; }
    .wine-layout.has-shot { display: grid; grid-template-columns: minmax(240px, 38%) 1fr; gap: 48px; align-items: start; }
    .wine-layout.has-shot .wine-visual { position: sticky; top: 0; height: calc(min(88dvh, 900px) - 76px); align-items: center; }
    .wine-layout.has-shot .bottle-shot { margin: 0; }
    .wine-layout.has-shot .bottle-shot img { height: min(74dvh, 760px); }
    .wine-layout.has-shot .label-shot img { max-width: 100%; }
}

/* Produktbild im Bearbeiten */
.product-row { display: flex; gap: 16px; align-items: center; margin-top: 8px; }
.product-thumb { width: 64px; height: 120px; flex: none; display: flex; align-items: flex-end; justify-content: center; }
.product-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.product-act { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

/* Regal: Vorschau beim Überfahren, fest unter dem Regal */
.rack-col { min-width: 0; }
.rack-peek {
    display: flex; align-items: center; gap: 16px; height: 132px; margin-top: 20px;
    opacity: 0; transition: opacity .18s var(--ease);
}
.rack-peek.show { opacity: 1; }
@media not ((hover: hover) and (pointer: fine)) { .rack-peek { display: none; } }
.rack-peek img { height: 132px; width: auto; flex: none; }
.peek-prod { font-family: var(--serif); font-size: 1.15rem; line-height: 1.2; }
.peek-rest { color: var(--muted); font-size: .92rem; margin-top: 2px; }
.peek-meta { display: flex; align-items: center; gap: 6px; font-size: .85rem; margin-top: 10px; }
.peek-meta .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.peek-meta span { color: var(--faint); margin-left: 6px; }

/* Flaschen im Weindetail: Aktionen direkt in der Zeile */
.bottle-row { gap: 12px; }
.bottle-acts { display: flex; gap: 6px; flex: none; }
