:root {
    /* Semantic action colors (shared) */
    --bom-add: #2fa84f;
    --bom-add-deep: #248a40;
    --bom-sub: #d64541;
    --bom-sub-deep: #b8352f;

    /* Entry "bar scoreboard" dark theme */
    --bom-night: #17120f;
    --bom-surface: #221b16;
    --bom-surface-2: #2c241d;
    --bom-line: #3c3026;
    --bom-brass: #e0a83c;
    --bom-brass-deep: #c8902a;
    --bom-cream: #f4ecd8;
    --bom-muted: #a99c87;
    --bom-notice: #f0c66b;

    /* Light theme for the placeholder home/chart pages */
    --bom-ink: #1c1c1c;
    --bom-bg: #fafafa;
}

* { box-sizing: border-box; }

html { background: var(--bom-night); }
body {
    margin: 0;
    min-height: 100%;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--bom-ink);
    background: var(--bom-night);
}

/* ---------- Placeholder pages (home / chart), refined in later slices ---------- */
.bom-main { max-width: 720px; margin: 0 auto; padding: 1rem; }
.bom-note { color: #777; font-size: 0.85rem; }
.bom-error { color: var(--bom-sub); font-weight: 600; }
.bom-totals { border-collapse: collapse; width: 100%; max-width: 420px; }
.bom-totals th, .bom-totals td { border: 1px solid #ddd; padding: 0.4rem 0.6rem; text-align: left; }

/* ===================== ENTRY PAGE ===================== */
.bom-app {
    --sb: 1;
    --cm: 1;
    --uz: 1;
    --s: calc(var(--sb) * var(--cm) * var(--uz));
    min-height: 100dvh;
    background: var(--bom-night);
    color: var(--bom-cream);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(14px * var(--s));
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
/* Calculator mode is a touch denser so 5 drinks + totals fit without scrolling on most phones. */
.bom-app.is-calc { --cm: 0.76; gap: calc(7px * var(--s)); }
.bom-app > * { width: 100%; max-width: calc(480px * var(--s)); }
/* The header is independent of the per-device zoom: its width follows the base scale only, so
   zooming the content below never narrows the title bar (which would clip the wordmark / oval the O). */
.bom-app > .bom-header { max-width: calc(480px * var(--sb)); }
/* The modal scrim must cover the whole viewport, not the centered content column. */
.bom-app > .bom-modal-scrim { max-width: none; }

/* Scale up only when BOTH width and height allow it, so the panel never exceeds the
   viewport (a wide-but-short window settles at the largest size that still fits the height). */
@media (min-width: 420px)  and (min-height: 700px)  { .bom-app { --sb: 1.05; } }
@media (min-width: 540px)  and (min-height: 730px)  { .bom-app { --sb: 1.12; } }
@media (min-width: 680px)  and (min-height: 770px)  { .bom-app { --sb: 1.20; } }
@media (min-width: 820px)  and (min-height: 810px)  { .bom-app { --sb: 1.28; } }
@media (min-width: 1000px) and (min-height: 850px)  { .bom-app { --sb: 1.36; } }
@media (min-width: 1200px) and (min-height: 890px)  { .bom-app { --sb: 1.45; } }
@media (min-width: 1500px) and (min-height: 940px)  { .bom-app { --sb: 1.55; } }
@media (min-width: 1800px) and (min-height: 980px)  { .bom-app { --sb: 1.65; } }

/* Hint bar — fixed overlay toast so page content doesn't shift when it appears */
.bom-hint {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 448px;
    z-index: 110;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    color: #fff;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    animation: bom-toast-in 0.18s ease-out;
}
.bom-hint-success { background: var(--bom-add); }
.bom-hint-error { background: var(--bom-sub); }

@keyframes bom-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Header / wordmark */
.bom-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--bom-night);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    flex-wrap: nowrap; min-width: 0;
    padding: calc(6px + env(safe-area-inset-top)) 0 8px;
    box-shadow: 0 8px 14px -10px rgba(0, 0, 0, 0.8);
}

/* Language toggle */
.bom-lang { display: inline-flex; border: 1px solid var(--bom-line); border-radius: 999px; overflow: hidden; flex: 0 0 auto; }
.bom-lang-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--bom-muted);
    background: transparent;
    border: none;
    cursor: pointer;
}
.bom-lang-btn.is-active { background: var(--bom-brass); color: var(--bom-night); }
.bom-wordmark {
    font-size: clamp(0.7rem, 4vw, calc(1.5rem * var(--sb)));
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bom-cream);
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    flex: 0 1 auto;
    min-width: 0;
}
.bom-o {
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15em;
    height: 1.15em;
    margin: 0 0.04em;
    border-radius: 50%;
    background: var(--bom-brass);
    color: var(--bom-night);
    font-size: 0.82em;
    box-shadow: inset 0 0 0 2px rgba(23, 18, 15, 0.18);
    transform: translateY(1px);
}

/* Generic message panels */
.bom-panel {
    background: var(--bom-surface);
    border: 1px solid var(--bom-line);
    border-radius: 14px;
    padding: 1rem;
    text-align: center;
    color: var(--bom-muted);
}
.bom-panel-error { color: #ffd9d7; border-color: var(--bom-sub-deep); }

/* Town selection card */
.bom-card {
    background: var(--bom-surface);
    border: 1px solid var(--bom-line);
    border-radius: 14px;
    padding: 14px;
}
.bom-label {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bom-muted);
    margin-bottom: 8px;
}
.bom-town-input {
    width: 100%;
    height: 54px;
    padding: 0 14px;
    font-size: 1.1rem;
    color: var(--bom-cream);
    background: var(--bom-surface-2);
    border: 1px solid var(--bom-line);
    border-radius: 10px;
}
.bom-town-input::placeholder { color: #7d7264; }

.bom-town-actions { display: flex; gap: 8px; margin-top: 8px; }
.bom-town-btn {
    flex: 1 1 0;
    height: calc(46px * var(--s));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: calc(0.95rem * var(--s));
    font-weight: 600;
    color: var(--bom-cream);
    background: var(--bom-surface-2);
    border: 1px solid var(--bom-line);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.05s ease, background 0.15s ease;
}
.bom-town-btn:active { transform: translateY(1px); background: var(--bom-line); }

/* Tappable town field that opens the full-screen picker */
.bom-town-trigger {
    width: 100%;
    height: calc(54px * var(--s));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 14px;
    font-size: calc(1.1rem * var(--s));
    text-align: left;
    color: var(--bom-brass);
    background: var(--bom-surface-2);
    border: 1px solid var(--bom-line);
    border-radius: 10px;
    cursor: pointer;
}

/* Unselected town placeholder ("Choose a town") in red, matching the minus buttons */
.bom-town-trigger.is-empty {
    color: var(--bom-sub);
}

.bom-town-trigger svg { flex: 0 0 auto; color: var(--bom-muted); }

/* Counter */
.bom-counter {
    background: var(--bom-surface);
    border: 1px solid var(--bom-line);
    border-radius: 14px;
    padding: 14px;
}
.bom-eyebrow {
    display: block;
    text-align: center;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--bom-muted);
    margin-bottom: 12px;
}
.bom-counter-grid {
    display: grid;
    grid-template-columns: minmax(68px, 1fr) minmax(110px, 1.5fr) minmax(68px, 1fr);
    gap: 12px;
    align-items: center;
}
.bom-col { display: flex; flex-direction: column; gap: 10px; }

.bom-q {
    height: calc(58px * var(--s));
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: calc(1.4rem * var(--s));
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.05s ease, filter 0.15s ease;
}
.bom-q:active { transform: translateY(2px); filter: brightness(0.92); }
.bom-add { background: var(--bom-add); box-shadow: 0 4px 0 var(--bom-add-deep); }
.bom-sub { background: var(--bom-sub); box-shadow: 0 4px 0 var(--bom-sub-deep); }
.bom-add:active { box-shadow: 0 1px 0 var(--bom-add-deep); }
.bom-sub:active { box-shadow: 0 1px 0 var(--bom-sub-deep); }

/* Readout (the hero number) */
.bom-readout { display: flex; flex-direction: column; align-items: center; }
.bom-amount-input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--bom-brass);
    font-size: calc(3.4rem * var(--s));
    font-weight: 800;
    line-height: 1;
    text-align: center;
    font-variant-numeric: tabular-nums;
    padding: 2px 0;
}
.bom-amount-input:focus { outline: none; }
.bom-amount-input::-webkit-outer-spin-button,
.bom-amount-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bom-amount-input { -moz-appearance: textfield; appearance: textfield; }
.bom-unit {
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--bom-muted);
    margin-top: -2px;
}
.bom-clear-amount {
    margin-top: 12px;
    width: 100%;
    height: calc(46px * var(--s));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--bom-cream);
    background: var(--bom-surface-2);
    border: 1px solid var(--bom-line);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}
.bom-clear-amount:active { background: var(--bom-line); transform: translateY(1px); }

/* Amber max notice — distinct from the red error bar; space reserved to avoid jump */
.bom-max-notice {
    min-height: 1.4rem;
    margin-top: 10px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--bom-night);
    transition: opacity 0.15s ease;
}
.bom-max-notice:not(.is-hidden) {
    background: var(--bom-notice);
    border-radius: 999px;
    padding: 2px 12px;
    width: max-content;
    margin-left: auto;
    margin-right: auto;
}
.bom-max-notice.is-hidden { opacity: 0; }

/* Actions */
.bom-actions { display: flex; flex-direction: column; gap: 10px; }
.bom-save, .bom-undo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.05s ease, filter 0.15s ease;
}
.bom-save {
    height: calc(60px * var(--s));
    font-size: calc(1.2rem * var(--s));
    color: var(--bom-night);
    background: var(--bom-brass);
    border: none;
    box-shadow: 0 4px 0 var(--bom-brass-deep);
}
.bom-save:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--bom-brass-deep); }
.bom-undo {
    height: calc(50px * var(--s));
    font-size: calc(1rem * var(--s));
    color: var(--bom-brass);
    background: transparent;
    border: 1px solid var(--bom-brass-deep);
}
.bom-undo:active { transform: translateY(1px); filter: brightness(0.9); }

.bom-save:disabled, .bom-undo:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Undo confirmation dialog */
.bom-modal-scrim {
    position: fixed;
    inset: 0;
    background: rgba(10, 7, 5, 0.62);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 100;
    animation: bom-fade-in 0.15s ease-out;
}
.bom-modal {
    width: 100%;
    max-width: 320px;
    background: var(--bom-surface);
    border: 1px solid var(--bom-line);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
.bom-modal-title { margin: 0 0 6px; font-size: 1.1rem; font-weight: 800; color: var(--bom-cream); }
.bom-modal-text { margin: 0 0 12px; font-size: 0.9rem; color: var(--bom-muted); }
.bom-modal-actions { display: flex; gap: 10px; }
.bom-modal-actions button { flex: 1 1 0; min-width: 0; box-sizing: border-box; height: 48px; border-radius: 10px; font-weight: 800; font-size: 0.95rem; cursor: pointer; }
.bom-modal-cancel { color: var(--bom-cream); background: var(--bom-surface-2); border: 1px solid var(--bom-line); }
.bom-modal-confirm { color: #fff; background: var(--bom-sub); border: none; }
.bom-modal-confirm:disabled { opacity: 0.5; cursor: not-allowed; }
.bom-modal-actions button:active { filter: brightness(0.9); }

.bom-undo-order {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin: 0 0 18px;
    padding: 14px;
    background: var(--bom-surface-2);
    border: 1px solid var(--bom-line);
    border-radius: 12px;
}
.bom-undo-amount { font-size: 2.2rem; font-weight: 800; color: var(--bom-brass); font-variant-numeric: tabular-nums; line-height: 1; }
.bom-undo-unit { font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--bom-muted); }
.bom-undo-town { margin-top: 6px; font-size: 1.05rem; font-weight: 700; color: var(--bom-cream); }

/* Full-screen town picker */
.bom-picker {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: var(--bom-night);
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
}
.bom-picker-header { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }
.bom-picker-search {
    flex: 1 1 auto;
    min-width: 0;
    height: 52px;
    padding: 0 14px;
    font-size: 1.1rem;
    color: var(--bom-cream);
    background: var(--bom-surface-2);
    border: 1px solid var(--bom-line);
    border-radius: 10px;
}
.bom-picker-search::placeholder { color: #7d7264; }
.bom-picker-close {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bom-cream);
    background: var(--bom-surface-2);
    border: 1px solid var(--bom-line);
    border-radius: 10px;
    cursor: pointer;
}
.bom-picker-list {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 2px;
}
.bom-picker-item {
    width: 100%;
    min-height: 54px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    font-size: 1.1rem;
    text-align: left;
    color: var(--bom-cream);
    background: var(--bom-surface);
    border: 1px solid var(--bom-line);
    border-radius: 10px;
    cursor: pointer;
}
.bom-picker-item:active { background: var(--bom-surface-2); }
.bom-picker-create { color: var(--bom-brass); font-weight: 700; }
.bom-picker-create svg { color: var(--bom-brass); }
.bom-picker-empty { color: var(--bom-muted); text-align: center; margin-top: 24px; }

@keyframes bom-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Accessibility: visible keyboard focus */
.bom-town-input:focus-visible,
.bom-town-btn:focus-visible,
.bom-town-trigger:focus-visible,
.bom-lang-btn:focus-visible,
.bom-picker-search:focus-visible,
.bom-picker-close:focus-visible,
.bom-picker-item:focus-visible,
.bom-q:focus-visible,
.bom-save:focus-visible,
.bom-undo:focus-visible,
.bom-clear-amount:focus-visible,
.bom-modal-cancel:focus-visible,
.bom-modal-confirm:focus-visible {
    outline: 3px solid var(--bom-brass);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .bom-q, .bom-save, .bom-undo, .bom-town-btn, .bom-max-notice { transition: none; }
    .bom-q:active, .bom-save:active, .bom-undo:active, .bom-town-btn:active { transform: none; }
    .bom-hint, .bom-modal-scrim { animation: none; }
}

/* ===================== CHART / RANKING PAGE ===================== */
.bom-chart {
    height: 100dvh;
    overflow: hidden;
    background: var(--bom-night);
    color: var(--bom-cream);
    display: flex;
    flex-direction: column;
    padding: clamp(12px, 2vw, 28px);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.bom-chart--center { align-items: center; justify-content: center; gap: 16px; text-align: center; }

.bom-chart-head {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    flex: 0 0 auto;
    padding-bottom: clamp(8px, 1.4vw, 18px);
    border-bottom: 1px solid var(--bom-line);
}
.bom-chart-brand {
    justify-self: start;
    font-size: clamp(1.1rem, 2vw, 2rem);
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bom-cream);
    display: inline-flex;
    align-items: center;
}
.bom-chart-clock {
    justify-self: center;
    text-align: center;
    font-size: clamp(1.2rem, 2.4vw, 2.6rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    color: var(--bom-cream);
}
.bom-chart-stamp { justify-self: end; text-align: right; font-size: clamp(0.7rem, 1vw, 1.1rem); color: var(--bom-muted); white-space: nowrap; }
.bom-chart-msg { color: var(--bom-muted); }
.bom-chart-msg--big { margin: auto; font-size: clamp(1rem, 2vw, 1.8rem); }

.bom-chart-bars {
    --gap: clamp(4px, 0.6vw, 16px);
    flex: 1 1 auto;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: var(--gap);
    padding-top: clamp(10px, 2vw, 28px);
    min-height: 0;
}
/* Rotating mode: pin the podium at the left and give every column a fixed, screen-sized width so
   the podium + separator never move and the name font stays constant between pages. */
.bom-chart-bars.is-rotating { justify-content: flex-start; }
.bom-chart-bars.is-rotating .bom-bar-col {
    flex: 0 0 calc((100% - var(--sepspace, 0px) - var(--gap) * var(--gaps, 0)) / var(--cols, 1));
}
.bom-bar-col {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(4px, 0.6vw, 10px);
}
.bom-bar-total {
    font-size: clamp(1rem, 2.2vw, 2.4rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    color: var(--medal);
}
.bom-bar-track { flex: 1 1 auto; width: 100%; min-height: 0; display: flex; align-items: flex-end; justify-content: center; }
.bom-bar-fill {
    width: 70%;
    max-width: 130px;
    min-width: 6px;
    border-radius: 10px 10px 0 0;
    background: linear-gradient(180deg, var(--medal), var(--medal2));
    transition: height 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), background 0.3s ease;
}
.bom-bar-name {
    width: 100%;
    line-height: 1.1;
    text-align: center;
    color: var(--bom-brass);
    overflow: hidden;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    height: var(--bom-name-h, 1.2em);
    display: flex;
    align-items: center;
    justify-content: center;
}

.bom-name-fit {
    font-size: var(--bom-name-size, 1rem);
}

.bom-bar-col {
    container-type: inline-size;
}
/* lets the name size track its own column width */
.bom-bar-rank {
    font-size: clamp(0.85rem, 1.5vw, 1.7rem);
    font-weight: 800;
    line-height: 1;
    color: var(--medal);
}

/* Medal palette (color follows rank; ties share the color) */
.bom-bar-col.is-gold {
    --medal: var(--rank1, #f2c24e);
}

.bom-bar-col.is-silver {
    --medal: var(--rank2, #d7dee6);
}

.bom-bar-col.is-bronze {
    --medal: var(--rank3, #d3884a);
}

.bom-bar-col.is-other {
    --medal: var(--rankother, #8a7c5f);
}
/* darker end of each bar's gradient, derived from the chosen color */
.bom-bar-col {
    --medal2: color-mix(in srgb, var(--medal) 78%, #000);
}

@media (prefers-reduced-motion: reduce) {
    .bom-bar-fill { transition: none; }
}

/* ===== Chart rotating overflow + podium separator + pager (Slice 3b) ===== */
.bom-bar-sep {
    flex: 0 0 2px;
    align-self: stretch;
    margin: 0;
    background: var(--bom-line);
    border-radius: 2px;
}

.bom-bar-col--rot {
    animation: bom-rot-in 0.45s ease;
}

@keyframes bom-rot-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bom-chart-pager {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding-top: clamp(6px, 1vw, 14px);
}

.bom-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--bom-line);
    transition: background 0.3s ease;
}

    .bom-dot.is-active {
        background: var(--bom-brass);
    }

@media (prefers-reduced-motion: reduce) {
    .bom-bar-col--rot {
        animation: none;
    }
}
/* ===================== ADMIN PAGE (Slice 4) ===================== */
.bom-admin {
    min-height: 100dvh;
    background: var(--bom-night);
    color: var(--bom-cream);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    padding: clamp(16px, 3vw, 40px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}
.bom-admin-head { display: flex; align-items: baseline; gap: 14px; }
.bom-admin-brand { font-size: 1.6rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; display: inline-flex; align-items: center; }
.bom-admin-sub { color: var(--bom-muted); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.85rem; }

.bom-admin-card {
    width: 100%;
    max-width: 640px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--bom-line);
    border-radius: 14px;
    padding: clamp(16px, 2.5vw, 28px);
}
.bom-admin-card h2 { margin: 0 0 6px; font-size: 1.2rem; }
.bom-admin-card h3 { margin: 22px 0 10px; font-size: 1rem; color: var(--bom-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.bom-admin-hint { color: var(--bom-muted); font-size: 0.9rem; margin: 6px 0; }
.bom-admin-error { color: var(--bom-sub); margin-top: 8px; }
.bom-admin-ok { color: var(--bom-brass); align-self: center; }

.bom-admin-login { max-width: 380px; display: flex; flex-direction: column; gap: 10px; }

.bom-admin-input {
    width: 100%;
    box-sizing: border-box;
    background: var(--bom-night);
    border: 1px solid var(--bom-line);
    border-radius: 10px;
    color: var(--bom-cream);
    font-size: 1rem;
    padding: 10px 12px;
}
.bom-admin-input:focus { outline: none; border-color: var(--bom-brass); }

.bom-admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bom-admin-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 0.95rem; }
.bom-admin-grid small { color: var(--bom-muted); font-size: 0.78rem; }
@media (max-width: 520px) { .bom-admin-grid { grid-template-columns: 1fr; } }

.bom-admin-colors { display: flex; flex-wrap: wrap; gap: 18px; }
.bom-admin-colors label { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--bom-muted); }
.bom-admin-colors input[type="color"] {
    width: 64px; height: 40px; border: 1px solid var(--bom-line);
    border-radius: 10px; background: transparent; cursor: pointer; padding: 2px;
}

.bom-admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 22px; }
.bom-admin-btn {
    border: 1px solid var(--bom-brass-deep);
    background: transparent;
    color: var(--bom-brass);
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.bom-admin-btn--primary { background: var(--bom-brass); color: var(--bom-night); border-color: var(--bom-brass); }
.bom-admin-btn:active { transform: translateY(1px); }

.bom-admin-foot { color: var(--bom-muted); font-size: 0.85rem; }

/* ----- Admin: sessions + confirm + links (Slice 4b) ----- */
.bom-admin-confirm {
    border: 1px solid var(--bom-brass-deep);
    background: rgba(224, 168, 60, 0.08);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.bom-admin-confirm p { margin: 0 0 12px; }

.bom-admin-sessions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.bom-session {
    border: 1px solid var(--bom-line);
    border-left: 4px solid var(--bom-line);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.bom-session.is-active { border-left-color: var(--bom-brass); background: rgba(255, 255, 255, 0.03); }

.bom-session-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; }
.bom-session-status {
    font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.78rem;
    color: var(--bom-muted);
}
.bom-session.is-active .bom-session-status { color: var(--bom-brass); }
.bom-session-when { font-weight: 700; }
.bom-session-code { color: var(--bom-muted); font-variant-numeric: tabular-nums; }
.bom-session-total { color: var(--bom-muted); margin-left: auto; }

.bom-session-links {
    display: grid;
    grid-template-columns: max-content max-content;
    gap: 8px 12px;
    align-items: center;
}
.bom-admin-link { color: var(--bom-brass); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.bom-admin-link:hover { text-decoration: underline; }
.bom-admin-btn--small { padding: 6px 10px; font-size: 0.82rem; font-weight: 600; }

/* ----- Admin: city management (Slice 4c) ----- */
.bom-city-add { display: flex; gap: 10px; align-items: stretch; margin-top: 16px; }
.bom-city-add .bom-admin-input { flex: 1 1 auto; }
.bom-admin-bullets { margin: 4px 0 0; padding-left: 1.25rem; }
.bom-admin-bullets li { margin: 2px 0; }

.bom-city-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.bom-city {
    border: 1px solid var(--bom-line);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}
.bom-city.is-hidden { opacity: 0.55; }
.bom-city-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; flex: 1 1 240px; min-width: 0; }
.bom-city-name { font-weight: 700; }
.bom-city-flag {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--bom-night); background: var(--bom-muted); border-radius: 6px; padding: 1px 7px;
}
.bom-city-meta { color: var(--bom-muted); font-size: 0.85rem; }
.bom-city-rename { flex: 1 1 200px; min-width: 160px; }
.bom-city-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

.bom-city-merge {
    flex: 1 1 100%;
    border-top: 1px dashed var(--bom-line);
    margin-top: 8px;
    padding-top: 10px;
}
.bom-city-merge p { margin: 0 0 8px; }
.bom-city-merge select { max-width: 280px; }

.bom-admin-cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bom-admin-cardhead h2 { margin: 0; }

/* ----- Admin: backup auto-settings + history (Slice 5) ----- */
.bom-admin-check { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; cursor: pointer; }
.bom-admin-check input { width: 18px; height: 18px; accent-color: var(--bom-brass); }

.bom-backup-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.bom-backup-row {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
    padding: 8px 12px; border: 1px solid var(--bom-line); border-radius: 8px;
}
.bom-backup-ico { font-weight: 900; width: 1.2em; text-align: center; }
.bom-backup-ico.is-ok { color: #4caf78; }
.bom-backup-ico.is-err { color: var(--bom-sub); cursor: help; }
.bom-backup-when { font-variant-numeric: tabular-nums; }
.bom-backup-file { color: var(--bom-muted); font-variant-numeric: tabular-nums; }
.bom-backup-tag {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--bom-night); background: var(--bom-muted); border-radius: 6px; padding: 1px 7px;
}
.bom-backup-err { color: var(--bom-sub); cursor: help; margin-left: auto; }

.bom-admin-field { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.bom-backup-file { cursor: help; }

/* ----- Entry: switch-session panel (paste new link when a session has ended) ----- */
.bom-switch { gap: 10px; }
.bom-switch-msg { margin: 0 0 4px; color: var(--bom-sub); font-weight: 700; }
.bom-switch-input {
    width: 100%;
    box-sizing: border-box;
    height: calc(54px * var(--s));
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--bom-line);
    background: var(--bom-night);
    color: var(--bom-cream);
    font-size: calc(1rem * var(--s));
}
.bom-switch-input:focus { outline: none; border-color: var(--bom-brass); }
.bom-switch-btn { width: 100%; margin-top: 4px; }

/* ----- Public blank landing + dev landing (black bg, brass text) ----- */
.bom-blank {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    background: #000;
    color: var(--bom-brass);
}
.bom-blank p {
    margin: 0;
    font-size: clamp(1.1rem, 4vw, 1.8rem);
    font-weight: 700;
}

.bom-home {
    min-height: 100dvh;
    background: #000;
    color: var(--bom-brass);
    padding: 48px 24px;
}
.bom-home > * {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}
.bom-home h1 { color: var(--bom-brass); margin-top: 0; }
.bom-home .bom-o { color: var(--bom-sub); }
.bom-home a { color: var(--bom-brass); }
.bom-home strong { color: var(--bom-cream); }
.bom-home .bom-note { color: var(--bom-muted); font-size: 0.9rem; margin-top: 24px; }

.bom-admin-stack { display: flex; flex-direction: column; gap: 14px; }

/* ----- Admin: drinks (Getränke card) ----- */
.bom-drink-add { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.bom-drink-add .bom-admin-input { flex: 1 1 140px; }
.bom-drink-add .bom-drink-price { flex: 0 0 110px; }
.bom-drink-pfand { margin: 0; }

.bom-drink-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.bom-drink-row {
    border: 1px solid var(--bom-line);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}
.bom-drink-row .bom-admin-input { flex: 1 1 140px; }
.bom-drink-row .bom-drink-price { flex: 0 0 110px; }
.bom-drink-main { display: flex; flex-direction: column; gap: 2px; flex: 1 1 240px; min-width: 0; }
.bom-drink-name { font-weight: 700; }
.bom-drink-meta { color: var(--bom-muted); font-size: 0.85rem; }
.bom-drink-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

/* ===== Entry calculator mode ===== */
.bom-modes { display: flex; gap: calc(8px * var(--s)); margin-bottom: calc(12px * var(--s)); }
.bom-mode {
    flex: 1 1 0;
    padding: calc(10px * var(--s)) 0;
    border: 1px solid var(--bom-line);
    border-radius: 999px;
    background: transparent;
    color: var(--bom-cream);
    font-weight: 700;
    font-size: calc(0.98rem * var(--s));
    cursor: pointer;
}
.bom-mode.is-active { background: var(--bom-brass); color: var(--bom-night); border-color: var(--bom-brass); }

.bom-drinks { display: flex; flex-direction: column; gap: calc(10px * var(--s)); margin-top: calc(10px * var(--s)); }
.bom-drinks.is-scroll {
    max-height: calc(var(--bom-drinks-visible, 4) * 96px * var(--s));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
}
.bom-drink-line {
    display: flex; align-items: center; justify-content: space-between; gap: calc(12px * var(--s));
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--bom-line);
    border-radius: 14px;
    padding: calc(12px * var(--s)) calc(14px * var(--s));
}
.bom-drink-line-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bom-drink-line-name { color: var(--bom-cream); font-weight: 800; font-size: calc(1.15rem * var(--s)); }
.bom-drink-line-price { color: var(--bom-muted, #a99c87); font-size: calc(0.9rem * var(--s)); }
.bom-pfand-yes { color: var(--bom-brass); }
.bom-pfand-no { color: var(--bom-muted, #a99c87); }
.bom-drink-line-ctrl { display: flex; align-items: center; gap: calc(10px * var(--s)); flex: 0 0 auto; }
.bom-drink-line-ctrl .bom-q {
    width: calc(52px * var(--s)); height: calc(52px * var(--s)); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: calc(1.7rem * var(--s));
}
.bom-drink-qty { min-width: calc(30px * var(--s)); text-align: center; color: var(--bom-cream); font-weight: 800; font-size: calc(1.5rem * var(--s)); }

.bom-return-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: calc(10px * var(--s)); }
.bom-return-title { color: var(--bom-brass); font-weight: 800; font-size: calc(1.05rem * var(--s)); }
.bom-return-issued { color: #5aa6e0; font-weight: 700; font-size: calc(0.95rem * var(--s)); }
.bom-return-ctrl { display: flex; align-items: center; justify-content: space-between; gap: calc(12px * var(--s)); }
.bom-return-ctrl .bom-q { flex: 0 0 auto; width: calc(84px * var(--s)); }
.bom-return-qty { flex: 1 1 0; min-width: 0; text-align: center; color: var(--bom-brass); font-weight: 800; font-size: calc(1.9rem * var(--s)); }

.bom-pricebox {
    background: #26408b;
    border-radius: 16px;
    padding: calc(12px * var(--s)) calc(14px * var(--s));
    color: #eaf0ff;
}
.bom-price-row { display: flex; justify-content: space-between; gap: 12px; font-size: calc(1.05rem * var(--s)); padding: calc(3px * var(--s)) 0; }
.bom-price-total {
    display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
    margin-top: calc(6px * var(--s)); padding-top: calc(6px * var(--s));
    border-top: 1px solid rgba(255,255,255,0.25); font-weight: 900; line-height: 1;
}
.bom-price-total span:first-child { font-size: calc(1.5rem * var(--s)); }
.bom-price-total span:last-child { font-size: calc(1.9rem * var(--s)); }

/* Icon mode switch in the entry header (replaces the language toggle; same pill look) */
.bom-modeswitch { display: inline-flex; border: 1px solid var(--bom-line); border-radius: 999px; overflow: hidden; flex: 0 0 auto; }
.bom-modeswitch-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 36px; padding: 0;
    background: transparent; border: none; color: var(--bom-muted, #a99c87); cursor: pointer;
}
.bom-modeswitch-btn.is-active { background: var(--bom-brass); color: var(--bom-night); }

/* Typeable quantity fields (keep the look of the old readout spans; hide number spinners) */
.bom-qty-input {
    background: transparent; border: none; outline: none;
    text-align: center; color: inherit; font-family: inherit;
    padding: 0; appearance: textfield; -moz-appearance: textfield;
    min-width: 0;
}
.bom-qty-input::-webkit-outer-spin-button,
.bom-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bom-drink-qty.bom-qty-input { width: calc(58px * var(--s)); }

/* Disable double-tap-to-zoom app-wide (pinch/manual zoom stays available) */
html, body { touch-action: manipulation; }

/* Header controls: zoom block + mode switch grouped on the right */
.bom-header-controls { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

/* Per-device zoom block: 3 joined buttons (-, reset, +) styled like the mode toggle */
.bom-zoomblock { display: inline-flex; border: 1px solid var(--bom-line); border-radius: 999px; overflow: hidden; flex: 0 0 auto; }
.bom-zoom-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 36px; padding: 0;
    background: transparent; border: none; color: var(--bom-cream); cursor: pointer;
}
.bom-zoom-btn + .bom-zoom-btn { border-left: 1px solid var(--bom-line); }
.bom-zoom-btn:active { background: rgba(255, 255, 255, 0.10); }

/* Admin: drink unit-count field width */
.bom-drink-add .bom-drink-count { flex: 0 0 84px; }
.bom-drink-row .bom-drink-count { flex: 0 0 84px; }

/* Session-ended modal: label, fixed-size input (zoom-independent), brass OK button */
.bom-modal-label { display: block; text-align: left; font-size: 0.85rem; color: var(--bom-muted); margin: 2px 0 6px; }
.bom-modal .bom-switch-input { height: 50px; font-size: 1rem; margin-bottom: 14px; }
.bom-modal-ok { color: var(--bom-night); background: var(--bom-brass); border: none; }

/* Session-ended modal title: red alert line + normal resume line */
.bom-modal-alert { color: var(--bom-sub); margin: 0 0 2px; }
.bom-modal-resume { margin: 0 0 14px; color: var(--bom-cream); font-weight: 700; font-size: 1rem; }

/* Manual recovery link (bottom of entry page): small, muted, out of the way of tap targets */
.bom-recovery {
    margin: calc(6px * var(--s)) auto 0;
    background: none;
    border: none;
    color: var(--bom-muted, #a99c87);
    font-size: calc(0.8rem * var(--s));
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0.7;
    cursor: pointer;
    padding: 8px 10px;
}
.bom-recovery:active { opacity: 1; }

/* Hidden probe box: holds every town name so bomFitNames can measure the full set (off-screen). */
.bom-name-probe-box {
    position: absolute;
    left: -99999px;
    top: 0;
    visibility: hidden;
    white-space: normal;
    pointer-events: none;
}
.bom-name-probe { display: block; white-space: normal; overflow-wrap: normal; word-break: normal; font-weight: inherit; }
