/* =====================================================
   WaWi Gastronomie – Design System
   Dark Glassmorphism Theme
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ---------- CSS Variables ---------- */
:root {
    --bg-primary: #0a0b0f;
    --bg-secondary: #111318;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --bg-input: rgba(255, 255, 255, 0.05);
    --bg-input-focus: rgba(255, 255, 255, 0.08);
    --bg-sidebar: rgba(10, 11, 15, 0.95);
    --bg-overlay: rgba(0, 0, 0, 0.6);
    --bg-modal: rgba(17, 19, 24, 0.98);

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.15);
    --border-focus: rgba(45, 212, 191, 0.5);

    --text-primary: #f0f0f5;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-inverse: #0a0b0f;

    --accent: #2dd4bf;
    --accent-dark: #0d9488;
    --accent-glow: rgba(45, 212, 191, 0.15);
    --accent-gradient: linear-gradient(135deg, #2dd4bf 0%, #0d9488 100%);

    --purple: #8b5cf6;
    --purple-glow: rgba(139, 92, 246, 0.15);
    --amber: #f59e0b;
    --amber-glow: rgba(245, 158, 11, 0.15);
    --cyan: #06b6d4;
    --cyan-glow: rgba(6, 182, 212, 0.15);
    --rose: #f43f5e;
    --rose-glow: rgba(244, 63, 94, 0.15);
    --green: #22c55e;
    --green-glow: rgba(34, 197, 94, 0.15);
    --blue: #3b82f6;
    --blue-glow: rgba(59, 130, 246, 0.15);

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #f43f5e;
    --info: #3b82f6;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px var(--accent-glow);

    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;

    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--text-primary); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

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

.app-sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-base), transform var(--transition-base);
    backdrop-filter: blur(20px);
    overflow-y: auto;
    overflow-x: hidden;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-base);
}

.app-header {
    height: var(--header-height);
    background: rgba(17, 19, 24, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.app-content {
    flex: 1;
    padding: 24px;
    max-width: 1600px;
    width: 100%;
}

/* ---------- Sidebar ---------- */
.sidebar-brand {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 8px;
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(45, 212, 191, 0.3);
    flex-shrink: 0;
}

.sidebar-brand-icon svg { width: 22px; height: 22px; color: white; }

.sidebar-brand-text h2 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.sidebar-brand-text small {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav { padding: 8px 12px; flex: 1; }

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 12px 12px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.sidebar-link:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 500;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--accent-gradient);
    border-radius: 0 3px 3px 0;
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active svg,
.sidebar-link:hover svg { opacity: 1; }

.sidebar-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.sidebar-user:hover { background: var(--bg-card-hover); }

.sidebar-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-info { overflow: hidden; }
.sidebar-user-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.7rem; color: var(--text-muted); }

/* ---------- Header ---------- */
.header-left { display: flex; align-items: center; gap: 16px; }
.header-right { display: flex; align-items: center; gap: 8px; }

.header-title {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.header-breadcrumb a { color: var(--text-secondary); }
.header-breadcrumb a:hover { color: var(--accent); }
.header-breadcrumb span { color: var(--text-muted); }

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.btn-icon svg { width: 20px; height: 20px; }

.btn-icon .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-secondary);
}

.mobile-toggle {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

.mobile-toggle svg { width: 24px; height: 24px; }

/* ---------- Glass Cards ---------- */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-base);
}

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

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title svg { width: 20px; height: 20px; color: var(--accent); }

/* ---------- KPI Cards ---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.kpi-card:hover::before { opacity: 1; }
.kpi-card:hover { border-color: var(--border-medium); transform: translateY(-2px); }

.kpi-card.purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.kpi-card.amber::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.kpi-card.cyan::before { background: linear-gradient(90deg, #06b6d4, #22d3ee); }
.kpi-card.rose::before { background: linear-gradient(90deg, #f43f5e, #fb7185); }

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.kpi-icon svg { width: 22px; height: 22px; }

.kpi-icon.teal { background: var(--accent-glow); color: var(--accent); }
.kpi-icon.purple { background: var(--purple-glow); color: var(--purple); }
.kpi-icon.amber { background: var(--amber-glow); color: var(--amber); }
.kpi-icon.cyan { background: var(--cyan-glow); color: var(--cyan); }
.kpi-icon.rose { background: var(--rose-glow); color: var(--rose); }

.kpi-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }
.kpi-value { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; }
.kpi-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

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

.btn svg { width: 18px; height: 18px; }

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(45, 212, 191, 0.25);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(45, 212, 191, 0.35);
    color: white;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(244, 63, 94, 0.1);
    color: var(--danger);
    border-color: rgba(244, 63, 94, 0.2);
}

.btn-danger:hover {
    background: rgba(244, 63, 94, 0.2);
    border-color: rgba(244, 63, 94, 0.3);
    color: var(--danger);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-sm svg { width: 16px; height: 16px; }

.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius-lg); }

.btn-block { width: 100%; justify-content: center; }

.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

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

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-control:focus {
    background: var(--bg-input-focus);
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

select, select.form-control {
    color-scheme: dark;
}

select option,
select.form-control option {
    background: #1e2330;
    color: #e2e8f0;
    padding: 8px 12px;
}

select option:checked,
select option:hover,
select.form-control option:checked,
select.form-control option:hover {
    background: #2dd4bf;
    color: #0f1219;
}

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

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

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

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

/* ---------- Tables ---------- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

tbody tr { transition: background var(--transition-fast); }
tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:last-child td { border-bottom: none; }

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

/* ---------- Status Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-success { background: var(--green-glow); color: var(--green); }
.badge-warning { background: var(--amber-glow); color: var(--amber); }
.badge-danger { background: var(--rose-glow); color: var(--danger); }
.badge-info { background: var(--blue-glow); color: var(--blue); }
.badge-neutral { background: rgba(255,255,255,0.05); color: var(--text-secondary); }
.badge-purple { background: var(--purple-glow); color: var(--purple); }

/* ---------- Search ---------- */
.search-box {
    position: relative;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9rem;
    outline: none;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    background: var(--bg-input-focus);
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box .search-shortcut {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    padding: 2px 6px;
    border-radius: 4px;
}

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

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

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.98);
    transition: transform var(--transition-base);
}

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

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

.modal-title { font-size: 1.1rem; font-weight: 600; }

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.modal-body { padding: 24px; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-lg { max-width: 900px; }

/* ---------- Alerts ---------- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.alert svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; }

.alert-success { background: var(--green-glow); border: 1px solid rgba(34, 197, 94, 0.2); color: var(--green); }
.alert-warning { background: var(--amber-glow); border: 1px solid rgba(245, 158, 11, 0.2); color: var(--amber); }
.alert-danger { background: var(--rose-glow); border: 1px solid rgba(244, 63, 94, 0.2); color: var(--danger); }
.alert-info { background: var(--blue-glow); border: 1px solid rgba(59, 130, 246, 0.2); color: var(--blue); }

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

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

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

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

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.pagination a { color: var(--text-secondary); background: transparent; }
.pagination a:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-medium); }
.pagination span.current { background: var(--accent-gradient); color: white; border-color: transparent; }

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

.empty-state svg { width: 64px; height: 64px; opacity: 0.3; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 0.88rem; margin-bottom: 20px; max-width: 400px; margin-inline: auto; }

/* ---------- Loading ---------- */
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 11, 15, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

/* ---------- Department Colors ---------- */
.dept-restaurant { --dept-color: var(--purple); --dept-glow: var(--purple-glow); }
.dept-kueche { --dept-color: var(--amber); --dept-glow: var(--amber-glow); }
.dept-zubehoer { --dept-color: var(--cyan); --dept-glow: var(--cyan-glow); }

.dept-tag {
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--dept-glow);
    color: var(--dept-color);
}

/* ---------- Notifications Dropdown ---------- */
.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    background: var(--bg-modal);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 300;
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.notif-dropdown.show { display: block; }

.notif-dropdown-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    gap: 10px;
    transition: background var(--transition-fast);
    cursor: pointer;
}

.notif-item:hover { background: var(--bg-card-hover); }
.notif-item:last-child { border-bottom: none; }

.notif-item.unread { background: rgba(45, 212, 191, 0.03); }

.notif-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-icon svg { width: 16px; height: 16px; }

.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 0.82rem; font-weight: 500; margin-bottom: 2px; }
.notif-text { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time { font-size: 0.68rem; color: var(--text-muted); margin-top: 4px; }

/* ---------- Utilities ---------- */
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.font-bold { font-weight: 700; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.w-full { width: 100%; }

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

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
        z-index: 200;
        transition: transform 0.3s ease;
    }
    .app-sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .mobile-toggle { display: flex; }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }

    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 199;
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }
    .sidebar-overlay.active { display: block; }
}

@media (max-width: 768px) {
    .app-content { padding: 12px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .kpi-card { padding: 12px; }
    .kpi-value { font-size: 1.3rem; }
    .kpi-label { font-size: 0.65rem; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .card { padding: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .card-header .btn { width: 100%; justify-content: center; }

    /* Header */
    .header-title { font-size: 1rem; }
    .header-breadcrumb { display: none; }
    .app-header { padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px 12px; height: auto; min-height: var(--header-height); }
    .app-sidebar { padding-top: env(safe-area-inset-top, 0px); }
    .header-actions { gap: 4px; }
    .search-box { display: none; }

    /* Tables: horizontal scroll */
    .table-wrapper { 
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }
    table { min-width: 600px; font-size: 0.78rem; }
    th, td { padding: 8px 6px; white-space: nowrap; }

    /* Buttons */
    .btn { padding: 8px 12px; font-size: 0.8rem; }
    .btn-sm { padding: 6px 10px; font-size: 0.75rem; }

    /* Filter bars */
    .filter-bar, form > div[style*="grid-template-columns"] {
        display: flex !important;
        flex-direction: column;
        gap: 8px;
    }
    .filter-bar .form-control, .filter-bar select { width: 100%; min-width: 0 !important; }
    .filter-bar .btn { width: 100%; }

    /* Modal */
    .modal { 
        margin: 0; 
        width: 100%; 
        height: 100%; 
        max-height: 100vh;
        border-radius: 0; 
    }

    /* Notifications dropdown */
    .notif-dropdown { width: calc(100vw - 24px); right: -48px; max-height: 70vh; }

    /* Sidebar footer */
    .sidebar-footer { padding-bottom: env(safe-area-inset-bottom, 12px); }
}

@media (max-width: 480px) {
    .app-content { padding: 8px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .kpi-card { padding: 10px; min-height: auto; }
    .kpi-value { font-size: 1.1rem; }
    .card { padding: 10px; border-radius: 8px; }
    .card-header h3 { font-size: 0.9rem; }

    /* Stack action buttons vertically */
    .card-header > div { width: 100%; display: flex; flex-direction: column; gap: 4px; }

    /* Touch-friendly inputs */
    .form-control { font-size: 16px !important; padding: 10px 12px; }
    select.form-control { padding: 10px 36px 10px 12px; }

    /* Larger touch targets */
    .btn { min-height: 44px; }
    td .btn-sm, td .btn-icon { min-width: 36px; min-height: 36px; }

    /* Badge */
    .badge { font-size: 0.65rem; padding: 2px 6px; }

    /* Table adjustments */
    table { min-width: 500px; font-size: 0.72rem; }

    /* Bottom safe area for iPhone */
    body { padding-bottom: env(safe-area-inset-bottom, 0); }
}

/* ---------- Print ---------- */
@media print {
    .app-sidebar, .app-header, .btn, .search-box, .modal-overlay { display: none !important; }
    .app-main { margin-left: 0 !important; }
    .app-content { padding: 0 !important; }
    body { background: white; color: black; }
    .card { border: 1px solid #ddd; box-shadow: none; background: white; }
    table { font-size: 10pt; }
    thead th { background: #f5f5f5; color: #333; }
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.animate-fade-in { animation: fadeIn 0.4s ease forwards; }
.animate-slide-in { animation: slideIn 0.4s ease forwards; }

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }

/* ---------- Chart Container ---------- */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ---------- Global Search ---------- */
.global-search-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
}

.global-search-overlay.active { display: flex; }

.global-search-box {
    width: 100%;
    max-width: 560px;
    background: var(--bg-modal);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.global-search-input {
    width: 100%;
    padding: 18px 20px 18px 52px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 1.1rem;
    outline: none;
}

.global-search-results {
    max-height: 360px;
    overflow-y: auto;
    border-top: 1px solid var(--border-subtle);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.search-result-item:hover { background: var(--bg-card-hover); }
.search-result-item.selected { background: var(--accent-glow); }

/* ==================== PWA & Sync Indicator ==================== */
.sync-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    cursor: default;
    transition: all 0.3s ease;
}
.sync-syncing { background: rgba(45,212,191,0.1); animation: syncPulse 1.5s ease-in-out infinite; }
.sync-success { background: rgba(16,185,129,0.1); }
.sync-error { background: rgba(251,113,133,0.15); }
.sync-offline { background: rgba(251,191,36,0.15); }
.sync-idle { opacity: 0.5; }
@keyframes syncPulse { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }

/* Install banner */
.pwa-install-banner {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-surface) 100%);
    border-top: 1px solid var(--border-subtle);
    padding: 16px 24px; display: flex; align-items: center; gap: 16px;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
    animation: slideUp 0.4s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ==================== Barcode Scanner ==================== */
.scanner-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 10000;
    background: rgba(0,0,0,0.9); display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
}
.scanner-container {
    width: 90vw; max-width: 500px; background: var(--bg-card); border-radius: var(--radius-xl);
    overflow: hidden; box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.scanner-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px; border-bottom: 1px solid var(--border-subtle);
}
.scanner-header h3 { margin: 0; font-size: 1rem; }
.scanner-close {
    background: none; border: none; color: var(--text-muted); font-size: 1.3rem; cursor: pointer;
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-full); transition: all 0.2s;
}
.scanner-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.scanner-viewport {
    position: relative; width: 100%; height: 280px; overflow: hidden; background: #000;
}
.scanner-viewport video { width: 100%; height: 100%; object-fit: cover; }
.scanner-viewport canvas { display: none; }
.scanner-guide {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 250px; height: 120px; z-index: 2;
}
.scanner-corner {
    position: absolute; width: 24px; height: 24px; border: 3px solid var(--accent);
}
.scanner-corner.tl { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 4px 0 0 0; }
.scanner-corner.tr { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 0 4px 0 0; }
.scanner-corner.bl { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 0 4px; }
.scanner-corner.br { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 4px 0; }
.scanner-line {
    position: absolute; top: 50%; left: 0; right: 0; height: 2px;
    background: var(--accent); box-shadow: 0 0 8px var(--accent);
    animation: scanMove 2s ease-in-out infinite;
}
@keyframes scanMove { 0%,100% { top: 20%; } 50% { top: 80%; } }
.scanner-result {
    padding: 12px 18px; text-align: center; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
    border-top: 1px solid var(--border-subtle);
}
.scanner-actions {
    padding: 12px 18px; display: flex; gap: 8px; align-items: center;
    border-top: 1px solid var(--border-subtle);
}
