@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800&family=Playfair+Display:wght@600;700;800&display=swap');

:root {
    --wine-bg: #ece6df;
    --wine-surface: #faf8f5;
    --wine-burgundy: #722f37;
    --wine-burgundy-dark: #3d1520;
    --wine-gold: #c9a962;
    --wine-text: #1a1210;
    --wine-muted: #6b5c58;
    --wine-border: #d9cfc4;
    --beer-bg: #ece6df;
    --beer-sidebar: #f5f0ea;
    --beer-sidebar-hover: rgba(114, 47, 55, 0.08);
    --beer-accent: #c9a962;
    --beer-accent-soft: rgba(201, 169, 98, 0.18);
    --beer-accent-dark: #722f37;
    --beer-border: #d9cfc4;
    --beer-text: #1a1210;
    --beer-shadow: 0 20px 50px rgba(26, 10, 14, 0.1);
}

html, body {
    font-family: 'DM Sans', system-ui, sans-serif !important;
    background: var(--wine-bg) !important;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

html {
    scroll-behavior: smooth;
}

/* ========== App shell — top header + slim side nav ========== */
.wine-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--wine-bg);
}

.wine-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: max(0.75rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) 0.75rem max(1.25rem, env(safe-area-inset-left));
    background: linear-gradient(135deg, #1a0a0e 0%, #2d1219 50%, #3d1520 100%);
    border-bottom: 2px solid rgba(201, 169, 98, 0.35);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    position: sticky;
    top: 0;
    z-index: 100;
}

.wine-header-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.wine-header-center {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.82rem;
    font-weight: 600;
}

.wine-header-date { color: var(--wine-gold); }
.wine-header-dot { opacity: 0.5; }
.wine-header-company {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wine-header-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.wine-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.wine-logo-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(145deg, #c9a962, #8b6914);
    box-shadow: 0 4px 16px rgba(201, 169, 98, 0.35);
    position: relative;
    flex-shrink: 0;
}

.wine-logo-mark::after {
    content: '';
    position: absolute;
    inset: 10px 14px 8px 14px;
    border-radius: 50% 50% 45% 45%;
    background: linear-gradient(180deg, #722f37 0%, #3d1520 100%);
}

.wine-logo-title {
    margin: 0;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
}

.wine-logo-sub {
    margin: 0.1rem 0 0;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(201, 169, 98, 0.85);
    font-weight: 700;
}

.wine-live-chip {
    background: rgba(201, 169, 98, 0.15) !important;
    border-color: rgba(201, 169, 98, 0.35) !important;
    color: #f5e6c8 !important;
}

.wine-user-chip {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
}

.wine-btn-ghost {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
}

.wine-header .beer-btn-primary {
    background: linear-gradient(135deg, #c9a962, #a8862e) !important;
    color: #1a0a0e !important;
    box-shadow: 0 4px 16px rgba(201, 169, 98, 0.3) !important;
}

.wine-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    padding: 0 9px;
}

.wine-menu-toggle span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: var(--wine-gold);
}

.wine-body {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
}

.wine-sidebar {
    width: 248px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #faf8f5 0%, #f0ebe3 100%);
    border-right: 1px solid var(--wine-border);
    padding: 1rem 0.65rem 2rem;
    overflow-y: auto;
}

.wine-sidebar-head {
    padding: 0.5rem 0.75rem 1rem;
    border-bottom: 1px solid var(--wine-border);
    margin-bottom: 0.75rem;
}

.wine-sidebar-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wine-burgundy);
    background: rgba(114, 47, 55, 0.08);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
}

.wine-sidebar-tagline {
    margin: 0.5rem 0 0;
    font-size: 0.78rem;
    color: var(--wine-muted);
    line-height: 1.4;
}

.wine-nav-group { margin-bottom: 0.35rem; }

.wine-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}

.wine-nav-toggle:hover {
    background: rgba(114, 47, 55, 0.06);
}

.wine-nav-toggle-label {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #9a8a84;
}

.wine-nav-chevron {
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid #9a8a84;
    border-bottom: 2px solid #9a8a84;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-top: -0.15rem;
}

.wine-nav-group.is-collapsed .wine-nav-chevron {
    transform: rotate(-45deg);
    margin-top: 0.1rem;
}

.wine-nav-items {
    overflow: hidden;
    max-height: 600px;
    opacity: 1;
    transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.2s ease;
    margin-top: 0.15rem;
    padding-left: 0.15rem;
}

.wine-nav-group.is-collapsed .wine-nav-items {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
}

.wine-nav-label {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #9a8a84;
    padding: 0.5rem 0.75rem 0.25rem;
}

.wine-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.58rem 0.75rem;
    margin-bottom: 2px;
    border-radius: 8px;
    color: #4a3f3c !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 0.86rem;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}

.wine-nav-link:hover {
    background: #fff;
    color: var(--wine-text) !important;
    border-left-color: rgba(114, 47, 55, 0.3);
}

.wine-nav-link.active {
    background: #fff;
    color: var(--wine-burgundy) !important;
    border-left-color: var(--wine-gold);
    box-shadow: 0 4px 16px rgba(26, 10, 14, 0.06);
}

.wine-nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--wine-gold);
    opacity: 0.5;
    flex-shrink: 0;
}

.wine-nav-link.active .wine-nav-dot {
    opacity: 1;
    background: var(--wine-burgundy);
}

.wine-main {
    flex: 1;
    min-width: 0;
    padding: clamp(1rem, 2vw, 1.35rem) clamp(1rem, 2.5vw, 1.5rem) max(2.5rem, env(safe-area-inset-bottom));
    background: var(--wine-bg);
    overflow-x: hidden;
}

.wine-main-content {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
}

.wine-nav-backdrop { display: none; }

/* ========== Page components — wine restyle ========== */
.beer-hero {
    background: linear-gradient(135deg, #2d1219 0%, #722f37 55%, #5c1825 100%) !important;
    border: 1px solid rgba(201, 169, 98, 0.25) !important;
    border-radius: 16px !important;
    box-shadow: var(--beer-shadow) !important;
}

.beer-hero h2 {
    font-family: 'Playfair Display', Georgia, serif !important;
}

.beer-hero-kicker {
    color: var(--wine-gold) !important;
}

.beer-kpi {
    border-radius: 12px !important;
    border-left: 4px solid var(--wine-burgundy) !important;
    border-color: var(--wine-border) !important;
    box-shadow: 0 8px 24px rgba(26, 10, 14, 0.04) !important;
}

.beer-kpi::after {
    background: radial-gradient(circle, rgba(114, 47, 55, 0.1), transparent 70%) !important;
}

.beer-kpi-value {
    font-family: 'Playfair Display', Georgia, serif !important;
    color: var(--wine-burgundy) !important;
}

.beer-panel {
    border-radius: 14px !important;
    border-color: #e0d6cc !important;
    box-shadow: 0 12px 40px rgba(26, 10, 14, 0.04) !important;
}

.beer-panel-head {
    background: linear-gradient(180deg, #faf8f5, #fff) !important;
    border-bottom-color: #e0d6cc !important;
}

.beer-panel-head h3,
.beer-panel-head h4 {
    font-family: 'Playfair Display', Georgia, serif !important;
}

.beer-btn-primary {
    background: linear-gradient(135deg, #722f37, #5c1825) !important;
    box-shadow: 0 8px 20px rgba(114, 47, 55, 0.25) !important;
}

.beer-btn-light {
    color: var(--wine-burgundy-dark) !important;
}

.beer-table thead th {
    background: linear-gradient(135deg, #2d1219, #722f37) !important;
}

.beer-table-matrix thead .beer-matrix-sticky {
    background: linear-gradient(135deg, #2d1219, #722f37) !important;
}

.beer-table tbody tr:hover {
    background: rgba(114, 47, 55, 0.04) !important;
}

.beer-quick-card {
    border-radius: 12px !important;
    border-left: 3px solid var(--wine-gold) !important;
}

.beer-quick-card:hover {
    border-color: var(--wine-burgundy) !important;
    box-shadow: 0 12px 32px rgba(26, 10, 14, 0.08) !important;
}

.beer-tab.active,
.beer-tab-primary {
    background: linear-gradient(135deg, #722f37, #5c1825) !important;
    border-color: #5c1825 !important;
    box-shadow: 0 6px 16px rgba(114, 47, 55, 0.25) !important;
}

.beer-nav-link.active {
    background: linear-gradient(135deg, #722f37, #5c1825) !important;
}

.beer-chip {
    background: rgba(114, 47, 55, 0.06) !important;
    border-color: var(--wine-border) !important;
    color: var(--wine-burgundy) !important;
}

.beer-input:focus,
.beer-select:focus,
.beer-textarea:focus {
    border-color: var(--wine-burgundy) !important;
    box-shadow: 0 0 0 3px rgba(114, 47, 55, 0.12) !important;
}

.beer-outlet-card {
    background: linear-gradient(180deg, #fff, #faf8f5) !important;
    border-color: var(--wine-border) !important;
    border-radius: 12px !important;
}

.beer-badge-primary {
    background: rgba(201, 169, 98, 0.2) !important;
    color: var(--wine-burgundy-dark) !important;
}

.beer-toast-progress {
    background: linear-gradient(90deg, var(--wine-gold), var(--wine-burgundy)) !important;
}

@media (max-width: 991px) {
    .wine-menu-toggle { display: flex; }

    .wine-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 90;
        width: min(85%, 280px);
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 8px 0 40px rgba(0, 0, 0, 0.2);
    }

    .wine-nav-open .wine-sidebar { transform: translateX(0); }

    .wine-nav-open .wine-nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 80;
    }

    .wine-main {
        padding: 0.85rem 0.75rem max(1.5rem, env(safe-area-inset-bottom));
    }

    .beer-quick-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.65rem !important;
    }

    .beer-grid-2,
    .beer-grid-3 {
        grid-template-columns: 1fr !important;
    }

    .beer-panel-body {
        padding: 0.9rem !important;
    }

    .beer-outlet-card .beer-grid-2 {
        grid-template-columns: 1fr !important;
    }
}

@media (min-width: 992px) and (max-width: 1280px) {
    .wine-header-center {
        max-width: 220px;
    }

    .wine-header-center .wine-header-company {
        max-width: 140px;
    }
}

@media (max-width: 600px) {
    .wine-header-center { display: none !important; }
    .wine-header-actions .wine-live-chip,
    .wine-header-actions .wine-user-chip { display: none; }

    .wine-header {
        padding: 0.6rem max(0.75rem, env(safe-area-inset-right)) 0.6rem max(0.75rem, env(safe-area-inset-left));
        gap: 0.5rem;
    }

    .wine-logo-title {
        font-size: 0.95rem;
    }

    .wine-logo-sub {
        font-size: 0.58rem;
        letter-spacing: 0.08em;
    }

    .wine-logo-mark {
        width: 36px;
        height: 36px;
    }

    .wine-menu-toggle {
        width: 44px;
        height: 44px;
    }

    .wine-header-actions .beer-btn-sm {
        min-height: 44px;
        padding: 0.45rem 0.75rem;
    }

    .wine-nav-link {
        min-height: 44px;
        padding: 0.7rem 0.85rem;
        font-size: 0.9rem;
    }

    .beer-kpi-grid-inline:not(.beer-kpi-grid-many) {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .beer-hero {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 1rem !important;
        margin-bottom: 0.85rem !important;
    }

    .beer-hero h2 {
        font-size: 1.2rem !important;
    }

    .beer-hero p {
        font-size: 0.82rem !important;
        line-height: 1.45 !important;
    }

    .beer-hero-actions {
        width: 100%;
        flex-direction: column;
        gap: 0.45rem;
    }

    .beer-hero-actions .beer-btn {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    .beer-kpi-grid.beer-kpi-compact .beer-kpi {
        padding: 0.45rem 0.55rem !important;
    }

    .beer-kpi-grid.beer-kpi-compact .beer-kpi-value {
        font-size: 1.05rem !important;
    }

    .beer-quick-grid {
        grid-template-columns: 1fr !important;
        gap: 0.55rem !important;
    }

    .beer-quick-card {
        padding: 0.75rem 0.85rem !important;
    }

    .beer-grid-2,
    .beer-grid-3 {
        grid-template-columns: 1fr !important;
    }

    .beer-panel-head {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.65rem;
    }

    .beer-panel-head .beer-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 380px) {
    .wine-logo-sub {
        display: none;
    }
}
