/*
 * WinterBeer theme on top of Bootstrap 5.3 (self-hosted). Always dark (data-bs-theme="dark").
 * Brand colours from the logo: amber #D0741A (primary, buttons) and gold #F8BB36 (links, highlights).
 * Text on amber/gold is dark — white on #D0741A would fail WCAG contrast.
 * Mobile first: 375 px → tablet (≥ 768 px) → desktop (≥ 1200 px).
 */

:root,
[data-bs-theme="dark"] {
    --wb-amber: #d0741a;
    --wb-amber-hover: #e0852a;
    --wb-amber-active: #b8650f;
    --wb-gold: #f8bb36;
    --wb-gold-hover: #ffd26b;
    --wb-on-brand: #1c1207;
    --wb-bg: #15110d;
    --wb-surface: #1f1913;
    --wb-surface-2: #2a221a;
    --wb-border: #43382c;
    --wb-text: #f3ebe0;
    --wb-muted: #bfb1a0;
    --wb-topbar-height: 56px;
    --wb-tabbar-height: 64px;
    --wb-sidenav-width: 264px;

    color-scheme: dark;
    --bs-body-bg: var(--wb-bg);
    --bs-body-bg-rgb: 21, 17, 13;
    --bs-body-color: var(--wb-text);
    --bs-body-color-rgb: 243, 235, 224;
    --bs-emphasis-color: #fffaf3;
    --bs-secondary-color: var(--wb-muted);
    --bs-secondary-bg: var(--wb-surface-2);
    --bs-tertiary-bg: var(--wb-surface);
    --bs-border-color: var(--wb-border);
    --bs-primary: var(--wb-amber);
    --bs-primary-rgb: 208, 116, 26;
    --bs-primary-text-emphasis: var(--wb-gold);
    --bs-primary-bg-subtle: #3a230c;
    --bs-primary-border-subtle: #7e430e;
    --bs-warning: var(--wb-gold);
    --bs-warning-rgb: 248, 187, 54;
    --bs-link-color: var(--wb-gold);
    --bs-link-color-rgb: 248, 187, 54;
    --bs-link-hover-color: var(--wb-gold-hover);
    --bs-link-hover-color-rgb: 255, 210, 107;
    --bs-focus-ring-color: rgba(248, 187, 54, .45);
    --bs-card-bg: var(--wb-surface);
    --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    min-height: 100vh;
    background: var(--wb-bg);
}

/* The hidden attribute must always win — also over display utilities (.d-flex is !important) and
   component rules like .btn { display: inline-flex }. JS shows elements by removing "hidden". */
[hidden] { display: none !important; }

/* --- Buttons & form controls ---------------------------------------------------- */

.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-sm { min-height: 36px; }

.btn-primary {
    --bs-btn-color: var(--wb-on-brand);
    --bs-btn-bg: var(--wb-amber);
    --bs-btn-border-color: var(--wb-amber);
    --bs-btn-hover-color: var(--wb-on-brand);
    --bs-btn-hover-bg: var(--wb-amber-hover);
    --bs-btn-hover-border-color: var(--wb-amber-hover);
    --bs-btn-active-color: var(--wb-on-brand);
    --bs-btn-active-bg: var(--wb-amber-active);
    --bs-btn-active-border-color: var(--wb-amber-active);
    --bs-btn-disabled-color: var(--wb-on-brand);
    --bs-btn-disabled-bg: var(--wb-amber);
    --bs-btn-disabled-border-color: var(--wb-amber);
    --bs-btn-focus-shadow-rgb: 248, 187, 54;
    font-weight: 600;
}

.btn-accent {
    --bs-btn-color: var(--wb-on-brand);
    --bs-btn-bg: var(--wb-gold);
    --bs-btn-border-color: var(--wb-gold);
    --bs-btn-hover-color: var(--wb-on-brand);
    --bs-btn-hover-bg: var(--wb-gold-hover);
    --bs-btn-hover-border-color: var(--wb-gold-hover);
    --bs-btn-active-color: var(--wb-on-brand);
    --bs-btn-active-bg: #e9a91f;
    --bs-btn-active-border-color: #e9a91f;
    --bs-btn-focus-shadow-rgb: 208, 116, 26;
    font-weight: 600;
}

.btn-outline-primary {
    --bs-btn-color: var(--wb-gold);
    --bs-btn-border-color: var(--wb-amber);
    --bs-btn-hover-color: var(--wb-on-brand);
    --bs-btn-hover-bg: var(--wb-amber);
    --bs-btn-hover-border-color: var(--wb-amber);
    --bs-btn-active-color: var(--wb-on-brand);
    --bs-btn-active-bg: var(--wb-amber-active);
    --bs-btn-active-border-color: var(--wb-amber-active);
}

.form-control, .form-select { min-height: 44px; background-color: var(--wb-surface-2); border-color: var(--wb-border); }
.form-control:focus, .form-select:focus { border-color: var(--wb-gold); box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color); }
.form-check-input { width: 1.35em; height: 1.35em; }
.form-check-input:checked { background-color: var(--wb-amber); border-color: var(--wb-amber); }
.form-label { font-weight: 600; }
.form-text { color: var(--wb-muted); }

a:focus-visible, .btn:focus-visible, .nav-link:focus-visible, .form-check-input:focus-visible {
    outline: 3px solid var(--wb-gold);
    outline-offset: 2px;
    box-shadow: none;
}

.text-brand { color: var(--wb-gold) !important; }
.min-w-0 { min-width: 0; }
.bg-surface { background-color: var(--wb-surface) !important; }

/* --- App shell -------------------------------------------------------------------- */

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: .25rem;
    min-height: calc(var(--wb-topbar-height) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(.5rem, env(safe-area-inset-right)) 0 max(.5rem, env(safe-area-inset-left));
    background: rgba(31, 25, 19, .96);
    border-bottom: 1px solid var(--wb-border);
    backdrop-filter: blur(6px);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 44px;
    padding: 0 .25rem;
    color: var(--wb-text);
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
}
.app-brand img { width: 32px; height: 32px; }
.app-title { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 1.05rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: .5rem;
    background: transparent;
    color: var(--wb-text);
    font-size: 1.35rem;
    text-decoration: none;
}
.icon-button:hover { background: var(--wb-surface-2); color: var(--wb-gold); }
/* Profile image in the header (tester photo); the button keeps the 44 px touch target */
.app-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid var(--wb-surface-2); }
.icon-button:hover .app-avatar { border-color: var(--wb-gold); }

.app-shell { display: block; }

.app-main {
    width: 100%;
    max-width: 72rem;
    margin: 0 auto;
    padding: 1rem max(1rem, env(safe-area-inset-right)) calc(var(--wb-tabbar-height) + env(safe-area-inset-bottom) + 1.5rem) max(1rem, env(safe-area-inset-left));
}
/* Guest pages (login, password reset): narrow column, centred horizontally and vertically */
.app-main.app-main--guest {
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 26rem;
    min-height: calc(100vh - var(--wb-topbar-height));
    min-height: calc(100dvh - var(--wb-topbar-height) - env(safe-area-inset-top));
    padding-bottom: 2rem;
}

/* Side navigation: offcanvas below xl, persistent from xl */
.app-sidenav { --bs-offcanvas-width: var(--wb-sidenav-width); --bs-offcanvas-bg: var(--wb-surface); }
.app-sidenav .nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 44px;
    padding: .5rem .75rem;
    border-radius: .5rem;
    color: var(--wb-text);
}
.app-sidenav .nav-link .bi { font-size: 1.2rem; color: var(--wb-muted); }
.app-sidenav .nav-link:hover { background: var(--wb-surface-2); color: var(--wb-gold); }
.app-sidenav .nav-link.active { background: var(--bs-primary-bg-subtle); color: var(--wb-gold); font-weight: 600; }
.app-sidenav .nav-link.active .bi { color: var(--wb-gold); }
.app-sidenav .nav-link.disabled { color: var(--wb-muted); opacity: .75; }
.app-sidenav .nav-section { margin: 1rem .75rem .25rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--wb-muted); }

/* Bottom tab bar (phone) */
.app-tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: calc(var(--wb-tabbar-height) + env(safe-area-inset-bottom));
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: rgba(31, 25, 19, .98);
    border-top: 1px solid var(--wb-border);
}
.app-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--wb-muted);
    font-size: .75rem;
    text-decoration: none;
}
.app-tab .bi { font-size: 1.45rem; }
.app-tab.active, .app-tab:hover { color: var(--wb-gold); }
.app-tab--primary .bi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    background: var(--wb-amber);
    color: var(--wb-on-brand);
}
.app-tab[aria-disabled="true"] { opacity: .5; }

@media (min-width: 768px) {
    .app-main { padding: 1.5rem 2rem 2rem; }
}

@media (min-width: 1200px) {
    /* Only with a side navigation — guest pages keep the full width (otherwise login sits in the 264 px nav column) */
    .app-shell--nav { display: grid; grid-template-columns: var(--wb-sidenav-width) minmax(0, 1fr); align-items: start; }
    .app-sidenav {
        position: sticky;
        top: var(--wb-topbar-height);
        height: calc(100vh - var(--wb-topbar-height));
        overflow-y: auto;
        border-right: 1px solid var(--wb-border);
    }
    .app-main { padding: 2rem 2.5rem; }
    .app-main.app-main--guest { padding-top: 1rem; padding-bottom: 3rem; }
}

/* --- Components --------------------------------------------------------------------- */

.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-header h1 { margin: 0; font-size: 1.5rem; }

.card { --bs-card-bg: var(--wb-surface); --bs-card-border-color: var(--wb-border); }
.list-card { display: block; color: inherit; text-decoration: none; }
.list-card:hover .card, .list-card:focus-visible .card { border-color: var(--wb-amber); }
.list-card + .list-card { margin-top: .5rem; }
.list-thumb {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: .4rem;
    background: #fff8ee;
}
.list-thumb--empty { display: inline-flex; align-items: center; justify-content: center; background: var(--wb-surface-2); color: var(--wb-muted); font-size: 1.3rem; }
.detail-logo { width: 96px; height: 96px; object-fit: contain; border-radius: .5rem; background: #fff8ee; }
.detail-image { max-width: 100%; max-height: 20rem; border-radius: .5rem; }
.profile-image { width: 120px; height: 120px; object-fit: cover; border-radius: 50%; border: 3px solid var(--wb-amber); }
.form-section + .form-section { margin-top: 1rem; }
.form-section > .card-body > h2 { font-size: 1.1rem; margin-bottom: 1rem; color: var(--wb-gold); }

.table { --bs-table-bg: var(--wb-surface); --bs-table-hover-bg: var(--wb-surface-2); --bs-table-border-color: var(--wb-border); }
.table th { color: var(--wb-muted); font-weight: 600; white-space: nowrap; }

.grade-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 2.4rem; padding: .25rem .5rem; border-radius: .4rem; background: var(--wb-gold); color: var(--wb-on-brand); font-weight: 700; }

/* Grade picker: 18 large segmented buttons (3 per grade) + "keine Note" */
.grade-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; }
.grade-picker .btn { min-height: 48px; font-size: 1.1rem; font-weight: 700; }
.grade-picker .grade-none { grid-column: 1 / -1; font-size: .95rem; font-weight: 600; }
@media (min-width: 576px) { .grade-picker { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 992px) { .grade-picker { grid-template-columns: repeat(9, 1fr); } }

.btn-check:checked + .btn-outline-primary { background: var(--wb-amber); border-color: var(--wb-amber); color: var(--wb-on-brand); }

/* Tester chips */
.chip-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip-list .btn { min-height: 40px; border-radius: 999px; }

/* Typeahead */
.typeahead { position: relative; }
.typeahead-menu {
    position: absolute;
    z-index: 1040;
    top: 100%;
    right: 0;
    left: 0;
    max-height: 18rem;
    margin: .25rem 0 0;
    padding: .25rem;
    overflow-y: auto;
    list-style: none;
    background: var(--wb-surface-2);
    border: 1px solid var(--wb-border);
    border-radius: .5rem;
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .4);
}
.typeahead-option { display: flex; flex-direction: column; min-height: 44px; justify-content: center; padding: .4rem .6rem; border-radius: .35rem; cursor: pointer; }
.typeahead-option small { color: var(--wb-muted); }
.typeahead-option[aria-selected="true"], .typeahead-option:hover { background: var(--bs-primary-bg-subtle); color: var(--wb-gold); }
.typeahead-option--create { color: var(--wb-gold); font-weight: 600; }

/* Image input */
.image-input-preview { display: block; max-width: 100%; max-height: 16rem; margin-top: .5rem; border-radius: .5rem; border: 1px solid var(--wb-border); }

/* Sticky form action bar: above the tab bar on phone, normal flow from md */
.form-actions-sticky {
    position: sticky;
    bottom: calc(var(--wb-tabbar-height) + env(safe-area-inset-bottom));
    z-index: 1020;
    display: flex;
    gap: .5rem;
    margin: 1rem calc(-1 * max(1rem, env(safe-area-inset-left))) 0;
    padding: .75rem max(1rem, env(safe-area-inset-left));
    background: rgba(31, 25, 19, .97);
    border-top: 1px solid var(--wb-border);
}
.form-actions-sticky .btn { flex: 1 1 0; }
@media (min-width: 768px) {
    .form-actions-sticky { position: static; margin: 1.5rem 0 0; padding: 0; background: none; border: 0; }
    .form-actions-sticky .btn { flex: 0 0 auto; }
}

/* Empty state */
.empty-state { padding: 2.5rem 1rem; text-align: center; color: var(--wb-muted); }
.empty-state .bi { display: block; margin-bottom: .5rem; font-size: 2.5rem; color: var(--wb-amber); }

/* Skeleton */
.skeleton-line { display: block; height: 1rem; margin: .5rem 0; border-radius: .25rem; background: var(--wb-surface-2); }

/* Toasts */
.toast-area {
    position: fixed;
    z-index: 1090;
    right: 0;
    bottom: calc(var(--wb-tabbar-height) + env(safe-area-inset-bottom) + .5rem);
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 0 .75rem;
    pointer-events: none;
}
.toast-area .toast { pointer-events: auto; background: var(--wb-surface-2); border: 1px solid var(--wb-border); }
.toast-area .toast.toast-success { border-left: 4px solid #4fbf72; }
.toast-area .toast.toast-error { border-left: 4px solid #ff6b6b; }
@media (min-width: 768px) { .toast-area { right: 1rem; bottom: 1rem; left: auto; align-items: flex-end; } }

/* Auth / guest pages */
.auth-logo { display: block; width: 96px; height: 96px; margin: 1rem auto; }

/* Error & debug pages */
.error-page { padding: 2rem 0; text-align: center; }
.error-status { margin: 0; font-size: 3rem; font-weight: 700; color: var(--wb-amber); }
.debug-trace { padding: 1rem; overflow-x: auto; font-size: .8rem; background: var(--wb-surface); border: 1px solid var(--wb-border); border-radius: .5rem; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; }
.facts dt { font-weight: 600; color: var(--wb-muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* Tastings timeline (beer detail) */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--wb-border); }
.timeline-item { position: relative; padding: .5rem 0 .75rem .5rem; }
.timeline-item::before {
    content: ""; position: absolute; left: calc(-1.1rem - 6px); top: .85rem;
    width: 10px; height: 10px; border-radius: 50%; background: var(--wb-amber);
}

/* Tasting quick entry (step 10) */
.wizard-section { scroll-margin-top: calc(env(safe-area-inset-top, 0px) + 4.5rem); }
.wizard-step {
    display: inline-flex; align-items: center; justify-content: center; width: 1.8rem; height: 1.8rem; margin-right: .5rem;
    border-radius: 50%; background: var(--wb-amber); color: var(--wb-on-brand); font-size: .95rem; font-weight: 700;
}
.container-buttons { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; }
.container-buttons .btn { min-height: 48px; white-space: normal; line-height: 1.15; }
@media (min-width: 576px) { .container-buttons { grid-template-columns: repeat(4, 1fr); } }
.participant-grades { display: grid; gap: .75rem; }
.participant-grade { padding: .6rem; border: 1px solid var(--wb-border); border-radius: .5rem; background: var(--wb-surface-2); }
.participant-code { min-width: 2.5rem; color: var(--wb-gold); }
/* 6 columns (grade 1 … 6) × 3 rows (+ / plain / −), filled column by column */
.grade-grid { display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(3, auto); grid-auto-flow: column; gap: .25rem; }
.grade-grid .btn { min-height: 44px; padding: .25rem 0; font-weight: 700; }
.quick-beer { --bs-card-bg: var(--wb-surface-2); border-color: var(--wb-amber); }
.grade-badge--legacy { background: var(--wb-surface-2); color: var(--wb-muted); border: 1px dashed var(--wb-border); }
.badge-beer-of-month { background: var(--wb-gold); color: var(--wb-on-brand); font-size: .85rem; }
.tasting-photo-button { cursor: zoom-in; }
.tasting-photo-full { max-width: 100%; max-height: 100%; object-fit: contain; }
.tasting-notes { white-space: normal; overflow-wrap: anywhere; }

/* Master data (step 11) */
.btn-icon { width: 44px; min-width: 44px; padding: 0; }
.masterdata-tile-icon { font-size: 1.8rem; color: var(--wb-amber); }
.masterdata-card + .masterdata-card { margin-top: .5rem; }
.masterdata-image { flex: 0 0 auto; width: 40px; height: 40px; object-fit: contain; border-radius: .35rem; }
.masterdata-image--empty { display: inline-flex; align-items: center; justify-content: center; background: var(--wb-surface-2); color: var(--wb-muted); }
.masterdata-image-cell { width: 56px; }

/* Testers (step 12) */
.profile-image--empty { display: inline-flex; align-items: center; justify-content: center; background: var(--wb-surface-2); color: var(--wb-muted); font-size: 3rem; }
.rank-progress { display: block; width: 100%; height: .9rem; border: 0; border-radius: 999px; overflow: hidden; background: var(--wb-surface-2); appearance: none; -webkit-appearance: none; }
.rank-progress::-webkit-progress-bar { background: var(--wb-surface-2); border-radius: 999px; }
.rank-progress::-webkit-progress-value { background: linear-gradient(90deg, var(--wb-amber), var(--wb-gold)); border-radius: 999px; }
.rank-progress::-moz-progress-bar { background: linear-gradient(90deg, var(--wb-amber), var(--wb-gold)); border-radius: 999px; }
.year-chart { overflow-x: auto; }
.year-chart svg { display: block; width: 100%; min-width: 18rem; max-height: 14rem; }
.year-chart-bar { fill: var(--wb-amber); }
.year-chart g:hover .year-chart-bar { fill: var(--wb-gold); }
.year-chart-label, .year-chart-value { fill: var(--wb-muted); font-size: 11px; }
.year-chart-value { fill: var(--wb-gold); font-weight: 700; }

/* Jahresabschluss: horizontal bar charts, year tiles, section menu */
.hbar-chart { overflow-x: auto; }
.hbar-chart svg { display: block; width: 100%; min-width: 20rem; }
.hbar-bar { fill: var(--wb-amber); }
.hbar-chart g:hover .hbar-bar { fill: var(--wb-gold); }
.hbar-label, .hbar-value { fill: var(--wb-muted); font-size: 12px; }
.hbar-value { fill: var(--wb-text); font-weight: 600; }
.year-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .5rem; }
.year-tile { display: flex; flex-direction: column; justify-content: center; min-height: 4.5rem; padding: .75rem 1rem; text-decoration: none; color: var(--wb-text); }
.year-tile:hover { border-color: var(--wb-gold); color: var(--wb-gold); }
.year-tile__year { font-size: 1.4rem; font-weight: 700; }
.year-review-toc { display: flex; flex-wrap: wrap; gap: .375rem; }
.year-review-toc .btn { min-height: 44px; display: inline-flex; align-items: center; }
.bar-list-row { display: grid; grid-template-columns: minmax(4.5rem, 40%) 1fr auto; align-items: center; gap: .5rem; min-height: 1.9rem; }
.bar-list-label { font-size: .9rem; }
.bar-list-track { display: block; height: .6rem; border-radius: 999px; background: var(--wb-surface-2); overflow: hidden; }
.bar-list-fill { display: block; height: 100%; border-radius: 999px; background: var(--wb-amber); }
.bar-list-count { min-width: 2.5rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--wb-muted); font-size: .9rem; }
.bar-w-0 { width: 0%; }
.bar-w-5 { width: 5%; }
.bar-w-10 { width: 10%; }
.bar-w-15 { width: 15%; }
.bar-w-20 { width: 20%; }
.bar-w-25 { width: 25%; }
.bar-w-30 { width: 30%; }
.bar-w-35 { width: 35%; }
.bar-w-40 { width: 40%; }
.bar-w-45 { width: 45%; }
.bar-w-50 { width: 50%; }
.bar-w-55 { width: 55%; }
.bar-w-60 { width: 60%; }
.bar-w-65 { width: 65%; }
.bar-w-70 { width: 70%; }
.bar-w-75 { width: 75%; }
.bar-w-80 { width: 80%; }
.bar-w-85 { width: 85%; }
.bar-w-90 { width: 90%; }
.bar-w-95 { width: 95%; }
.bar-w-100 { width: 100%; }
.award-image { flex: 0 0 auto; width: 40px; height: 40px; object-fit: contain; }
.award-image--empty { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--wb-surface-2); color: var(--wb-gold); font-size: 1.2rem; }
details > summary.btn { list-style: none; }
details > summary.btn::-webkit-details-marker { display: none; }

/* Locations & events (step 13) */
.stars { display: inline-flex; align-items: center; gap: .1rem; color: var(--wb-gold); white-space: nowrap; }
.badge-private { background: var(--wb-surface-2); color: var(--wb-gold); border: 1px solid var(--wb-amber); }
.badge-confirmed { background: #2f6b3f; color: #e9f7ed; }
.event-month { margin: 1.25rem 0 .5rem; font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--wb-gold); }
.event-month:first-of-type { margin-top: 0; }
.event-day {
    display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 48px; height: 48px;
    border-radius: .5rem; background: var(--bs-primary-bg-subtle); color: var(--wb-gold); font-size: 1.25rem; font-weight: 700;
}
.event-card--cancelled .event-title, .event-title--cancelled, .event-cancelled a { text-decoration: line-through; }
.event-card--cancelled { opacity: .75; }

/* News & beer of the month (step 14) */
.news-body p:last-child { margin-bottom: 0; }
.news-body p { overflow-wrap: anywhere; }
.markdown-help code { color: var(--wb-gold); }
.botm-slot--empty { border-style: dashed; }
.botm-winner { display: flex; align-items: center; gap: .75rem; min-height: 56px; padding: .35rem 0; color: inherit; text-decoration: none; }
.botm-winner + .botm-winner { border-top: 1px solid var(--wb-border); }
.botm-winner:hover .fw-semibold { color: var(--wb-gold); }
.botm-candidate--chosen { border-color: var(--wb-gold); background: var(--bs-primary-bg-subtle); }

/* Stock & barcode scanner (step 15) */
.stock-item--soon { border-left: 4px solid var(--wb-gold); }
.stock-item--expired { border-left: 4px solid #ff6b6b; }
.badge-soon { background: var(--wb-gold); color: var(--wb-on-brand); }
.scanner {
    position: fixed; inset: 0; z-index: 1080; display: flex; flex-direction: column;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    background: #000; color: var(--wb-text); overflow-y: auto;
}
.scanner[hidden] { display: none; }
body.scanner-open { overflow: hidden; }
.scanner-header { display: flex; align-items: center; gap: .25rem; padding: .5rem .75rem; background: rgba(31, 25, 19, .96); border-bottom: 1px solid var(--wb-border); }
.scanner-view { position: relative; flex: 1 1 auto; min-height: 45vh; background: #000; }
.scanner-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: absolute; left: 10%; right: 10%; top: 35%; height: 30%; border: 3px solid var(--wb-gold); border-radius: .75rem; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
.scanner-body { padding: 1rem; background: var(--wb-bg); }
.scanner-status { min-height: 1.5rem; margin-bottom: .75rem; color: var(--wb-gold); }
.scanner-not-found { --bs-card-bg: var(--wb-surface); }
[data-scanner-torch][aria-pressed="true"] { color: var(--wb-gold); }

/* User administration (step 16) */
.user-card--inactive { opacity: .6; }
.home-checklist--open { border-color: var(--wb-gold); }
.list-card.mb-3 { display: block; }

/* Media admin (step 17) */
.media-report-table { overflow-x: auto; padding: .75rem; font-size: .8rem; background: var(--wb-surface-2); border: 1px solid var(--wb-border); border-radius: .5rem; }
.media-report div { overflow-wrap: anywhere; font-size: .9rem; }

/* EAN sub-form */
.ean-row + .ean-row { margin-top: .25rem; padding-top: .5rem; border-top: 1px dashed var(--wb-border); }
.ean-row .form-label { display: block; font-weight: 600; }
.ean-row .form-control { margin-top: .25rem; font-weight: 400; }
[data-ean-add] { margin-top: .75rem; }

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

/* --- Global search (step 19) ---------------------------------------------------- */

.app-search-trigger {
    align-items: center;
    gap: .5rem;
    min-height: 44px;
    width: 16rem;
    max-width: 30vw;
    padding: 0 .75rem;
    border: 1px solid var(--wb-border);
    border-radius: .5rem;
    background: var(--wb-surface-2);
    color: var(--wb-muted);
    text-decoration: none;
}
.app-search-trigger span { flex: 1 1 auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.app-search-trigger kbd { background: var(--wb-surface); color: var(--wb-muted); border: 1px solid var(--wb-border); }
.app-search-trigger:hover, .app-search-trigger:focus-visible { color: var(--wb-gold); border-color: var(--wb-amber); }

.search-overlay {
    /* Phone: full screen */
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: var(--wb-bg);
    color: var(--wb-text);
}
.search-overlay[open] { display: flex; flex-direction: column; }
.search-overlay::backdrop { background: rgba(0, 0, 0, .6); }

.search-overlay__form {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: calc(.5rem + env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right)) .5rem max(.75rem, env(safe-area-inset-left));
    border-bottom: 1px solid var(--wb-border);
    background: var(--wb-surface);
}
.search-overlay__icon { color: var(--wb-muted); font-size: 1.2rem; }
.search-overlay__input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--wb-text);
    font-size: 1.1rem;
}
.search-overlay__input:focus { outline: none; }
.search-overlay__form:focus-within { box-shadow: inset 0 -2px 0 var(--wb-amber); }

.search-overlay__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: .5rem max(.75rem, env(safe-area-inset-right)) calc(1rem + env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left));
}
.search-overlay__status { margin: .5rem 0; }
.search-overlay__status:empty { display: none; }
.search-overlay__group { margin-bottom: .75rem; }
.search-overlay__heading {
    margin: .5rem 0 .25rem;
    color: var(--wb-muted);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.search-overlay__option {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 48px;
    padding: .35rem .6rem;
    border-radius: .4rem;
    color: var(--wb-text);
    text-decoration: none;
}
.search-overlay__option .bi { color: var(--wb-muted); }
.search-overlay__option:hover, .search-overlay__option[aria-selected="true"] { background: var(--bs-primary-bg-subtle); color: var(--wb-gold); }
.search-overlay__text { display: flex; flex-direction: column; min-width: 0; }
.search-overlay__title, .search-overlay__text small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.search-overlay__text small { color: var(--wb-muted); }
.search-overlay__more, .search-overlay__all {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 .6rem;
    color: var(--wb-gold);
}
.search-overlay__all { font-weight: 600; }

@media (min-width: 768px) {
    /* Tablet / desktop: panel at the top */
    .search-overlay {
        width: min(40rem, calc(100% - 2rem));
        height: auto;
        max-height: min(36rem, calc(100% - 6rem));
        margin: 4rem auto auto;
        border: 1px solid var(--wb-border);
        border-radius: .75rem;
        box-shadow: 0 1rem 3rem rgba(0, 0, 0, .5);
    }
    .search-overlay__form { padding: .5rem .75rem; border-radius: .75rem .75rem 0 0; }
    .search-overlay__body { padding: .5rem .75rem 1rem; }
}

/* --- Audit log, recycle bin, merge, work queues (step 20) ---------------------- */

.audit-entry > summary { cursor: pointer; list-style: none; min-height: 44px; }
.audit-entry > summary::-webkit-details-marker { display: none; }
.audit-entry > summary::after { content: "\25BE"; color: var(--wb-muted); margin-left: auto; }
.audit-entry[open] > summary::after { content: "\25B4"; }
.audit-badge { color: var(--wb-on-brand); background: var(--wb-muted); }
.audit-badge--create { background: #6fbf73; }
.audit-badge--update { background: var(--wb-gold); }
.audit-badge--delete { background: #e06c5a; }
.audit-badge--restore { background: #6fa8dc; }
.audit-badge--merge { background: var(--wb-amber); }
.audit-diff th { width: 30%; font-weight: 600; }
.audit-diff td { word-break: break-word; }
.audit-diff__before { color: #f0a597; }
.audit-diff__after { color: #a8dcaa; }

.merge-card--source { border-color: #e06c5a; }
.merge-card--target { border-color: #6fbf73; }

.queue-tile { color: var(--wb-text); }
.queue-tile:hover, .queue-tile:focus-visible { border-color: var(--wb-amber); }
.queue-tile__icon { font-size: 1.6rem; color: var(--wb-gold); }
.queue-tile__count { font-size: 1.5rem; font-weight: 700; color: var(--wb-gold); }
.queue-tile--done .queue-tile__icon, .queue-tile--done .queue-tile__count { color: var(--wb-muted); }
.queue-check { width: 1.4rem; height: 1.4rem; }

/* --- Accessibility pass (step 21) ----------------------------------------------- */

summary:focus-visible, .search-overlay__input:focus-visible {
    outline: 2px solid var(--wb-gold);
    outline-offset: 2px;
}
.search-overlay__option:focus-visible { outline: 2px solid var(--wb-gold); outline-offset: -2px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Tester chips: no text selection / iOS callout on long press (tooltip with the full name) */
.chip-list .chip { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.chip-more { min-height: 44px; padding-left: 0; }

/* Tasting form: compact overall grade (calculated), picker behind "Ändern" */
.overall-summary { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.overall-summary__value { min-width: 3.25rem; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; }

/* Photo input: "Foto aufnehmen" (phones) + "Aus Galerie wählen" instead of the plain file field */
.image-input-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.image-input-actions .btn { min-height: 44px; }

/* Beer / tasting photo: full width of its card, height follows the photo (no cropping) */
.detail-image-card { overflow: hidden; }
.detail-image--full { display: block; width: 100%; height: auto; max-height: none; border-radius: 0; }
.detail-map-card { overflow: hidden; }
.detail-map { display: block; width: 100%; aspect-ratio: 4 / 3; max-height: 22rem; border: 0; background: var(--wb-surface-2); }

/* Overview map (/karte, Leaflet) */
.overview-map-card { overflow: hidden; }
.overview-map { height: calc(100vh - var(--wb-topbar-height) - var(--wb-tabbar-height) - 12rem); min-height: 22rem; background: var(--wb-surface-2); }
@media (min-width: 992px) { .overview-map { height: calc(100vh - var(--wb-topbar-height) - 11rem); } }
.map-layer-toggle { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .75rem; border: 1px solid var(--wb-border); border-radius: 2rem; background: var(--wb-surface); cursor: pointer; }
.map-layer-toggle .form-check-input { margin: 0; }
.map-marker { background: none; border: 0; }
.map-pin { display: flex; box-sizing: border-box; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); color: #fff; }
.map-pin > i { transform: rotate(45deg); font-size: 15px; line-height: 1; }
.map-pin--brewery { background: var(--wb-amber); }
.map-pin--location { background: #2f7d6d; }
.map-pin--private { border-style: dashed; opacity: .85; }
.map-pin--legend { width: 26px; height: 26px; }
.map-pin--legend > i { font-size: 12px; }
.leaflet-container .map-popup-title { font-weight: 600; font-size: 1rem; color: #7a3f06; }
.map-popup-meta { color: #555; margin-top: .25rem; }
.leaflet-container .map-popup .btn { color: var(--wb-on-brand); }
.tasting-photo-button:focus-visible { outline: 2px solid var(--wb-gold); outline-offset: -2px; }
