/* ============================================
   LÄLLI-ZUNFT WEINVERWALTUNG – DESIGN SYSTEM
   ============================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,300;0,400;0,700;0,900;1,400&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
    /* Brand Colors */
    --wine-burgundy: #722F37;
    --wine-burgundy-dark: #5A252C;
    --wine-burgundy-light: #8B3A44;
    --wine-gold: #C5A55A;
    --wine-gold-light: #D4BB7A;
    --wine-gold-dark: #A68B42;
    --wine-cream: #F5F0E8;
    --wine-rose: #E8C4C8;

    /* Dark Theme (Anthrazit) */
    --bg-primary: #121212;
    --bg-secondary: #1E1E1E;
    --bg-card: #252525;
    --bg-card-hover: #2A2A2A;
    --bg-input: #1A1A1A;
    --bg-sidebar: #181818;
    --bg-modal-overlay: rgba(0, 0, 0, 0.7);

    /* Text */
    --text-primary: #F0EDE8;
    --text-secondary: #A8A4B8;
    --text-muted: #6E6B80;
    --text-accent: var(--wine-gold);
    --text-on-primary: #FFFFFF;

    /* Borders */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-light: rgba(255, 255, 255, 0.12);
    --border-color-focus: var(--wine-gold);

    /* Status Colors */
    --status-success: #4ADE80;
    --status-success-bg: rgba(74, 222, 128, 0.12);
    --status-warning: #FBBF24;
    --status-warning-bg: rgba(251, 191, 36, 0.12);
    --status-error: #F87171;
    --status-error-bg: rgba(248, 113, 113, 0.12);
    --status-info: #60A5FA;
    --status-info-bg: rgba(96, 165, 250, 0.12);

    /* Glassmorphism */
    --glass-bg: rgba(37, 37, 37, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --glass-blur: blur(16px);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 20px rgba(197, 165, 90, 0.15);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 0px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-Indices */
    --z-sidebar: 100;
    --z-header: 90;
    --z-modal: 200;
    --z-toast: 300;
    --z-tooltip: 150;

    /* Dynamic UI Elements */
    --nav-item-hover: rgba(255, 255, 255, 0.04);
    --nav-item-active-text: var(--wine-gold);
    --nav-item-active-border: var(--wine-gold);
    --table-header-bg: rgba(255, 255, 255, 0.04);
    --table-row-hover: rgba(255, 255, 255, 0.03);
    --btn-ghost-hover: rgba(255, 255, 255, 0.05);
}

/* ---------- Light Theme Overrides ---------- */
:root[data-theme="light"] {
    /* Backgrounds */
    --bg-primary: #F8F9FA;
    --bg-secondary: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F1F5F9;
    --bg-input: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --bg-modal-overlay: rgba(0, 0, 0, 0.4);

    /* Text */
    --text-primary: #1E293B;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --text-accent: var(--wine-burgundy);
    --text-on-primary: #FFFFFF;

    /* Borders */
    --border-color: rgba(0, 0, 0, 0.1);
    --border-color-light: rgba(0, 0, 0, 0.05);
    --border-color-focus: var(--wine-burgundy);

    /* Glassmorphism adjustments for light theme */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.05);
    --glass-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(114, 47, 55, 0.15);

    /* Dynamic UI Elements */
    --nav-item-hover: rgba(0, 0, 0, 0.04);
    --nav-item-active-text: var(--wine-burgundy);
    --nav-item-active-border: var(--wine-burgundy);
    --table-header-bg: rgba(0, 0, 0, 0.02);
    --table-row-hover: rgba(0, 0, 0, 0.02);
    --btn-ghost-hover: rgba(0, 0, 0, 0.05);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background pattern */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(114, 47, 55, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(197, 165, 90, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(30, 30, 30, 0.4) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

:root[data-theme="light"] body::before {
    background:
        radial-gradient(ellipse at 20% 20%, rgba(114, 47, 55, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(197, 165, 90, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
}

a {
    color: var(--wine-gold);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--wine-gold-light); }

::selection {
    background: var(--wine-burgundy);
    color: var(--text-on-primary);
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb {
    background: var(--wine-burgundy-dark);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--wine-burgundy); }

/* ---------- App Layout ---------- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar);
    transition: transform var(--transition-normal);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--wine-burgundy), var(--wine-burgundy-dark));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(114, 47, 55, 0.3);
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-title {
    font-family: 'Lato', sans-serif;
    font-size: 1.05rem;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--text-primary);
    line-height: 1.2;
}

.sidebar-brand-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 16px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.88rem;
    font-weight: 450;
    user-select: none;
    position: relative;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: var(--nav-item-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(114, 47, 55, 0.25), rgba(114, 47, 55, 0.12));
    color: var(--nav-item-active-text);
    border-color: rgba(114, 47, 55, 0.3);
    font-weight: 500;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--nav-item-active-border);
    border-radius: 0 3px 3px 0;
}

.nav-item-icon {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item-badge {
    margin-left: auto;
    background: var(--wine-burgundy);
    color: var(--wine-cream);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-footer-text {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    user-select: none;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

:root[data-theme="light"] .theme-toggle {
    background: rgba(0, 0, 0, 0.04);
}

:root[data-theme="light"] .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* ---------- Main Content ---------- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 36px;
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

.page-header {
    margin-bottom: 28px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-family: 'Lato', sans-serif;
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1.3;
}

.page-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.page-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* ---------- Cards ---------- */
.card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--glass-shadow);
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: var(--border-color-light);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title-icon {
    font-size: 1.1rem;
}

.card-body {
    /* default: no extra styles */
}

.card-clickable {
    cursor: pointer;
}
.card-clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(197, 165, 90, 0.2);
}

/* ---------- Stats Grid ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--border-color-light);
    transform: translateY(-2px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-card.red::before { background: linear-gradient(90deg, var(--wine-burgundy), var(--wine-burgundy-light)); }
.stat-card.white::before { background: linear-gradient(90deg, var(--wine-gold-dark), var(--wine-gold)); }
.stat-card.green::before { background: linear-gradient(90deg, #22c55e, #4ade80); }
.stat-card.blue::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.stat-card.purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.stat-card.orange::before { background: linear-gradient(90deg, #f97316, #fb923c); }

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 450;
}

.stat-detail {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    line-height: 1.4;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--wine-burgundy), var(--wine-burgundy-dark));
    color: var(--text-on-primary);
    box-shadow: 0 4px 12px rgba(114, 47, 55, 0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--wine-burgundy-light), var(--wine-burgundy));
    box-shadow: 0 6px 18px rgba(114, 47, 55, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: var(--border-color-light);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-color-light);
}

.btn-gold {
    background: linear-gradient(135deg, var(--wine-gold), var(--wine-gold-dark));
    color: #1a1a2e;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(197, 165, 90, 0.25);
}
.btn-gold:hover {
    box-shadow: 0 6px 18px rgba(197, 165, 90, 0.35);
}

.btn-danger {
    background: rgba(248, 113, 113, 0.12);
    color: var(--status-error);
    border-color: rgba(248, 113, 113, 0.2);
}
.btn-danger:hover {
    background: rgba(248, 113, 113, 0.2);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}
.btn-ghost:hover {
    background: var(--btn-ghost-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 0.72rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn-icon.btn-sm {
    width: 30px;
    height: 30px;
}

/* ---------- Forms ---------- */
.form-group {
    margin-bottom: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-row-3 {
    grid-template-columns: repeat(3, 1fr);
}

.form-row-4 {
    grid-template-columns: repeat(4, 1fr);
}

label, .form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

input, select, textarea {
    font-family: inherit;
    font-size: 0.88rem;
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--wine-gold);
    box-shadow: 0 0 0 3px rgba(197, 165, 90, 0.12);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23A8A4B8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

input[type="date"] {
    cursor: pointer;
}

.form-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Checkbox & Radio */
.checkbox-group, .radio-group {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input, .radio-group input {
    width: 18px;
    height: 18px;
    accent-color: var(--wine-burgundy);
    cursor: pointer;
}

/* ---------- Data Tables ---------- */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    background: var(--table-header-bg);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.76rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-primary);
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--table-row-hover);
}

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

.table-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted) !important; }
.text-nowrap { white-space: nowrap; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-red {
    background: rgba(114, 47, 55, 0.2);
    color: var(--wine-rose);
}
.badge-gold, .badge-white {
    background: rgba(197, 165, 90, 0.15);
    color: var(--wine-gold);
}
.badge-success {
    background: var(--status-success-bg);
    color: var(--status-success);
}
.badge-warning {
    background: var(--status-warning-bg);
    color: var(--status-warning);
}
.badge-error {
    background: var(--status-error-bg);
    color: var(--status-error);
}
.badge-info {
    background: var(--status-info-bg);
    color: var(--status-info);
}
.badge-muted {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

/* ---------- Modals ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal-overlay);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    padding: 24px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-normal);
    overflow: hidden;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-lg { max-width: 800px; }
.modal-sm { max-width: 420px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1rem;
}

.modal-close:hover {
    background: rgba(248, 113, 113, 0.15);
    color: var(--status-error);
    border-color: rgba(248, 113, 113, 0.3);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* ---------- Toasts ---------- */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    font-size: 0.88rem;
    pointer-events: auto;
    transform: translateX(120%);
    animation: toastSlideIn var(--transition-normal) forwards;
    max-width: 400px;
}

.toast.hiding {
    animation: toastSlideOut var(--transition-fast) forwards;
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast.success { border-left: 3px solid var(--status-success); }
.toast.success .toast-icon { color: var(--status-success); }
.toast.error { border-left: 3px solid var(--status-error); }
.toast.error .toast-icon { color: var(--status-error); }
.toast.info { border-left: 3px solid var(--status-info); }
.toast.info .toast-icon { color: var(--status-info); }
.toast.warning { border-left: 3px solid var(--status-warning); }
.toast.warning .toast-icon { color: var(--status-warning); }

@keyframes toastSlideIn {
    to { transform: translateX(0); }
}

@keyframes toastSlideOut {
    to { transform: translateX(120%); opacity: 0; }
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state-text {
    font-size: 0.88rem;
    max-width: 360px;
    margin: 0 auto 20px;
    line-height: 1.5;
}

/* ---------- Progress Bar ---------- */
.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width var(--transition-slow);
    position: relative;
}

.progress-fill.red {
    background: linear-gradient(90deg, var(--wine-burgundy-dark), var(--wine-burgundy));
}

.progress-fill.gold {
    background: linear-gradient(90deg, var(--wine-gold-dark), var(--wine-gold));
}

.progress-fill.green {
    background: linear-gradient(90deg, #22c55e, #4ade80);
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.76rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ---------- Tabs ---------- */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab {
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--wine-gold);
    border-bottom-color: var(--wine-gold);
}

/* ---------- Filter Bar ---------- */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.filter-bar input, .filter-bar select {
    max-width: 220px;
    padding: 8px 12px;
    font-size: 0.82rem;
}

.filter-bar .search-input {
    max-width: 280px;
}

/* ---------- Grid Layouts ---------- */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* ---------- Wine Color Indicators ---------- */
.wine-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.wine-dot.rot { background: var(--wine-burgundy); box-shadow: 0 0 6px rgba(114, 47, 55, 0.4); }
.wine-dot.weiss { background: var(--wine-gold); box-shadow: 0 0 6px rgba(197, 165, 90, 0.4); }

.wine-bottles {
    display: flex;
    align-items: center;
    gap: 6px;
    font-variant-numeric: tabular-nums;
}

/* ---------- Divider ---------- */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

/* ---------- Confirm Dialog ---------- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: calc(var(--z-modal) + 10);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.confirm-overlay.active {
    opacity: 1;
    visibility: visible;
}

.confirm-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.confirm-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.confirm-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.confirm-message {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ---------- Tag / Chip ---------- */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.74rem;
    color: var(--text-secondary);
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.animate-fade { animation: fadeIn var(--transition-normal) forwards; }
.animate-slide { animation: slideUp var(--transition-normal) forwards; }
.animate-scale { animation: scaleIn var(--transition-normal) forwards; }

/* Stagger children */
.stagger-children > * {
    opacity: 0;
    animation: slideUp var(--transition-normal) forwards;
}
.stagger-children > *:nth-child(1) { animation-delay: 50ms; }
.stagger-children > *:nth-child(2) { animation-delay: 100ms; }
.stagger-children > *:nth-child(3) { animation-delay: 150ms; }
.stagger-children > *:nth-child(4) { animation-delay: 200ms; }
.stagger-children > *:nth-child(5) { animation-delay: 250ms; }
.stagger-children > *:nth-child(6) { animation-delay: 300ms; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .form-row-4 { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 20px 16px;
    }
    .mobile-menu-btn {
        display: flex !important;
    }
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    .form-row-3 {
        grid-template-columns: 1fr;
    }
    .page-header {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .filter-bar {
        flex-direction: column;
    }
    .filter-bar input, .filter-bar select {
        max-width: none;
    }
    .modal {
        margin: 8px;
        max-height: 95vh;
    }
}

/* Mobile menu button (hidden on desktop) */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: calc(var(--z-sidebar) + 1);
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.3rem;
    box-shadow: var(--shadow-md);
}

/* ---------- Print Styles ---------- */
@media print {
    body { background: #fff; color: #000; }
    body::before { display: none; }
    .sidebar, .toast-container, .mobile-menu-btn,
    .page-actions, .btn, .modal-overlay, .filter-bar { display: none !important; }
    .main-content { margin-left: 0; padding: 0; }
    .card { background: #fff; border: 1px solid #ddd; box-shadow: none; backdrop-filter: none; }
    .data-table th { background: #f0f0f0; color: #333; }
    .data-table td { color: #333; }
    .stat-card { background: #f8f8f8; border: 1px solid #ddd; }
    .stat-value { color: #000; }
}

/* ---------- Utilities ---------- */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.p-0 { padding: 0; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.font-mono { font-family: 'SF Mono', 'Fira Code', monospace; }

/* ---------- Login Screen ---------- */
.login-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.login-overlay::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 25% 30%, rgba(114, 47, 55, 0.18) 0%, transparent 55%),
        radial-gradient(ellipse at 75% 70%, rgba(197, 165, 90, 0.12) 0%, transparent 55%);
    pointer-events: none;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
}

.login-logo-title {
    font-family: 'Playfair Display', 'Lato', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--wine-gold);
    letter-spacing: 0.02em;
}

.login-logo-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 24px;
}

.login-error {
    background: var(--status-error-bg);
    border: 1px solid rgba(248, 113, 113, 0.25);
    border-radius: var(--radius-sm);
    color: var(--status-error);
    padding: 10px 14px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
}

.login-error.visible { display: block; }

.login-form .form-group { margin-bottom: 16px; }

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ---------- User Info Bar (sidebar) ---------- */
.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    cursor: default;
}

.sidebar-user-avatar {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.sidebar-user-details {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: var(--wine-gold);
}

.sidebar-logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
    transition: color var(--transition-fast);
    flex-shrink: 0;
}

.sidebar-logout-btn:hover {
    color: var(--status-error);
}

/* ---------- Change Password Banner ---------- */
.change-pw-banner {
    background: var(--status-warning-bg);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--status-warning);
}

/* ---------- 4-column grid ---------- */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .grid-4 { grid-template-columns: 1fr; }
    .login-card { padding: 32px 24px; }
}

