:root {
            --bg: #09090b;
            --surface: #18181b;
            --surface-2: #27272a;
            --text: #f4f4f5;
            --muted: #a1a1aa;
            --gold: #c9a227;
            --green: #22c55e;
            --blue: #3b82f6;
            --red: #ef4444;
            --border: #3f3f46;
        }
        * { box-sizing: border-box; margin: 0; padding: 0; }
        body {
            font-family: 'Inter', sans-serif;
            background: var(--bg);
            color: var(--text);
            min-height: 100vh;
            display: flex;
        }

        /* Sidebar */
        aside {
            width: 240px;
            background: var(--surface);
            border-right: 1px solid var(--border);
            padding: 1.5rem 1rem;
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            height: 100vh;
            position: sticky;
            top: 0;
        }
        .brand { padding: 0 0.75rem 1.5rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
        .brand h1 { font-family: 'Playfair Display', serif; font-size: 1.35rem; }
        .brand h1 span[data-brand-accent] { color: var(--gold); }
        .brand small { color: var(--muted); font-size: 0.75rem; letter-spacing: 1px; text-transform: uppercase; }

        .nav-btn {
            display: flex; align-items: center; gap: 10px;
            padding: 0.75rem 0.85rem;
            border-radius: 10px;
            color: var(--muted);
            cursor: pointer;
            font-weight: 500;
            font-size: 0.95rem;
            transition: 0.15s;
            border: none; background: none;
            font-family: inherit;
            text-align: left;
        }
        .nav-btn:hover { background: var(--surface-2); color: var(--text); }
        .nav-btn.active { background: rgba(201, 162, 39, 0.12); color: var(--gold); }
        .nav-btn i { font-size: 1.15rem; }

        .nav-footer { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); }
        .nav-footer a { color: var(--muted); text-decoration: none; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; padding: 0.5rem 0.85rem; }
        .nav-footer a:hover { color: var(--gold); }

        /* Main */
        main {
            flex: 1;
            padding: 2rem 2.5rem;
            max-width: 100%;
            overflow-x: hidden;
        }
        .page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
        .page-header h2 { font-size: 1.75rem; font-weight: 700; }
        .page-header .sub { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }

        .btn {
            display: inline-flex; align-items: center; gap: 6px;
            padding: 0.6rem 1rem;
            border-radius: 10px;
            border: none; cursor: pointer;
            font-weight: 600; font-size: 0.9rem;
            font-family: inherit;
            transition: 0.15s;
        }
        .btn-primary { background: var(--gold); color: var(--bg); }
        .btn-primary:hover { filter: brightness(1.1); }
        .btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
        .btn-ghost:hover { color: var(--text); border-color: var(--muted); }
        .btn-danger { background: transparent; color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
        .btn-danger:hover { background: rgba(239,68,68,0.1); }

        .page { display: none; }
        .page.active { display: block; }

        /* Dashboard grid */
        .stat-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 1rem;
            margin-bottom: 2rem;
        }
        .stat-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 1.25rem;
            display: flex; flex-direction: column; gap: 0.5rem;
            position: relative; overflow: hidden;
        }
        .stat-card .stat-label { color: var(--muted); font-size: 0.85rem; font-weight: 500; }
        .stat-card .stat-value { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
        .stat-card .stat-icon {
            position: absolute; top: 1rem; right: 1rem;
            width: 42px; height: 42px; border-radius: 10px;
            display: flex; align-items: center; justify-content: center;
            font-size: 1.25rem;
        }
        .stat-card.gold .stat-icon { background: rgba(201,162,39,0.15); color: var(--gold); }
        .stat-card.green .stat-icon { background: rgba(34,197,94,0.15); color: var(--green); }
        .stat-card.blue .stat-icon { background: rgba(59,130,246,0.15); color: var(--blue); }
        .stat-card.red .stat-icon { background: rgba(239,68,68,0.15); color: var(--red); }

        .panel {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 1.5rem;
            margin-bottom: 1.5rem;
        }
        .panel h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; display: flex; align-items: center; gap: 8px; }
        .panel h3 i { color: var(--gold); }

        /* Top items chart */
        .bar-list { display: flex; flex-direction: column; gap: 0.75rem; }
        .bar-row { display: grid; grid-template-columns: 160px 1fr 60px; align-items: center; gap: 12px; font-size: 0.9rem; }
        .bar-row .name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .bar-row .bar-track { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
        .bar-row .bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold), #e8c364); border-radius: 6px; transition: width 0.4s ease; }
        .bar-row .count { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }

        /* Live orders */
        .order-row {
            display: grid;
            grid-template-columns: 80px 1fr auto auto;
            gap: 12px; align-items: center;
            padding: 0.75rem 0;
            border-bottom: 1px solid var(--border);
            font-size: 0.9rem;
        }
        .order-row:last-child { border-bottom: none; }
        .order-row .id { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
        .order-row .status-pill {
            padding: 2px 10px; border-radius: 100px; font-size: 0.75rem; font-weight: 600;
        }
        .status-new { background: rgba(234,179,8,0.15); color: #eab308; }
        .status-prep { background: rgba(59,130,246,0.15); color: var(--blue); }

        /* Table */
        table { width: 100%; border-collapse: collapse; }
        th, td { text-align: left; padding: 0.85rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
        th { color: var(--muted); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; }
        tr:last-child td { border-bottom: none; }
        tbody tr:hover { background: rgba(255,255,255,0.02); }
        .thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
        .price-cell { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 600; }
        .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
        .icon-btn {
            width: 32px; height: 32px; border-radius: 8px;
            background: transparent; border: 1px solid var(--border);
            color: var(--muted); cursor: pointer;
            display: inline-flex; align-items: center; justify-content: center;
            transition: 0.15s;
        }
        .icon-btn:hover { color: var(--text); border-color: var(--muted); }
        .icon-btn.danger:hover { color: var(--red); border-color: var(--red); background: rgba(239,68,68,0.08); }
        .badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 500; background: var(--surface-2); color: var(--muted); }
        .badge.featured { background: rgba(201,162,39,0.15); color: var(--gold); }

        /* Modal */
        .modal-overlay {
            position: fixed; inset: 0;
            background: rgba(0,0,0,0.75); backdrop-filter: blur(4px);
            display: none; align-items: center; justify-content: center;
            z-index: 100; padding: 1rem;
        }
        .modal-overlay.active { display: flex; }
        .modal {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 16px;
            width: 100%; max-width: 520px;
            max-height: 90vh; overflow-y: auto;
            padding: 1.75rem;
        }
        .modal h3 { font-size: 1.3rem; margin-bottom: 1.25rem; }
        .form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1rem; }
        .form-row label { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
        .form-row input, .form-row textarea, .form-row select {
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 0.7rem 0.9rem;
            color: var(--text);
            font-family: inherit; font-size: 0.95rem;
        }
        .form-row input:focus, .form-row textarea:focus, .form-row select:focus {
            outline: none; border-color: var(--gold);
        }
        .form-row textarea { resize: vertical; min-height: 70px; }
        .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
        @media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }

        .image-picker { display: flex; gap: 10px; align-items: flex-start; }
        .image-preview {
            width: 80px; height: 80px; border-radius: 8px;
            background: var(--surface-2); border: 1px solid var(--border);
            object-fit: cover; flex-shrink: 0;
        }
        .image-picker-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; }
        .image-picker input[type="file"] { display: none; }
        .upload-btn {
            display: inline-flex; align-items: center; gap: 6px;
            padding: 0.5rem 0.75rem;
            background: var(--surface-2); color: var(--text);
            border: 1px solid var(--border);
            border-radius: 8px; cursor: pointer;
            font-size: 0.85rem; font-weight: 500;
            transition: 0.15s;
            align-self: flex-start;
        }
        .upload-btn:hover { border-color: var(--gold); color: var(--gold); }

        .checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 1rem; }
        .checkbox-row input { width: 16px; height: 16px; accent-color: var(--gold); }
        .checkbox-row label { font-size: 0.9rem; cursor: pointer; }

        .modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
        .btn-small { padding: 5px 12px !important; font-size: 0.85rem !important; }

        /* QR Page */
        .qr-panel { padding: 1.5rem; }
        .qr-controls { display: grid; grid-template-columns: 110px 110px 1fr auto; gap: 1rem; align-items: flex-end; margin-bottom: 0.75rem; }
        @media (max-width: 760px) { .qr-controls { grid-template-columns: 1fr 1fr; } .qr-controls .qr-actions { grid-column: 1 / -1; } }
        .qr-controls .form-row { margin: 0; }
        .qr-actions { display: flex; gap: 0.5rem; }
        .qr-hint { color: var(--muted, #a8a29e); font-size: 0.85rem; line-height: 1.5; margin-bottom: 1.25rem; padding: 0.75rem 1rem; background: rgba(201, 162, 39, 0.06); border: 1px solid rgba(201, 162, 39, 0.2); border-radius: 8px; }
        .qr-hint code { background: rgba(255,255,255,0.08); padding: 1px 6px; border-radius: 4px; font-size: 0.82em; }
        .qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
        .qr-card {
            background: #fff;
            border-radius: 12px;
            padding: 1rem;
            display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
            color: #0f0c08;
            box-shadow: 0 4px 16px rgba(0,0,0,0.25);
        }
        .qr-card canvas { width: 100%; height: auto; max-width: 180px; }
        .qr-card .qr-label { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }
        .qr-card .qr-sub { color: #666; font-size: 0.75rem; text-align: center; word-break: break-all; }
        .qr-card .qr-download {
            margin-top: auto;
            background: #0f0c08; color: #fff; border: none;
            padding: 0.5rem 0.9rem; border-radius: 6px; font-size: 0.8rem; font-weight: 600;
            cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem;
            font-family: inherit;
        }
        .qr-card .qr-download:hover { background: #c9a227; color: #0f0c08; }

        @media print {
            body * { visibility: hidden; }
            #page-qr-codes, #page-qr-codes * { visibility: visible; }
            #page-qr-codes { position: absolute; inset: 0; padding: 1.5cm; background: #fff; color: #000; }
            #page-qr-codes .page-header, #page-qr-codes .qr-controls, #page-qr-codes .qr-hint, .qr-card .qr-download { display: none !important; }
            .qr-panel { background: transparent !important; padding: 0 !important; box-shadow: none !important; border: none !important; }
            .qr-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 0.6cm !important; }
            .qr-card { background: #fff !important; box-shadow: none !important; border: 1px solid #ddd !important; page-break-inside: avoid; }
            .qr-card .qr-label { color: #000 !important; }
        }

        .variant-editor { margin-top: 1rem; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 10px; padding: 0; }
        .variant-editor > summary { cursor: pointer; padding: 0.85rem 1rem; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 0.5rem; }
        .variant-editor > summary::-webkit-details-marker { display: none; }
        .variant-editor > summary::before { content: '▸'; color: var(--gold, #c9a227); transition: transform 0.2s; display: inline-block; }
        .variant-editor[open] > summary::before { transform: rotate(90deg); }
        .variant-editor .variant-count { color: var(--text-muted, #a8a29e); font-size: 0.85rem; font-weight: 500; }
        .variant-section { padding: 0.85rem 1rem; border-top: 1px solid var(--border); }
        .variant-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; font-size: 0.9rem; font-weight: 600; }
        .variant-hint { color: var(--text-muted, #a8a29e); font-size: 0.8rem; margin-top: 0.5rem; line-height: 1.4; }

        .variant-groups-list, .extras-list { display: flex; flex-direction: column; gap: 0.75rem; }
        .variant-group-card, .extra-row {
            background: rgba(255,255,255,0.04);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 0.75rem;
        }
        .variant-group-card .group-head {
            display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.6rem;
        }
        .variant-group-card .group-head input { flex: 1; }
        .variant-group-card .option-row,
        .extra-row .extra-fields {
            display: grid; grid-template-columns: 2fr 1fr auto; gap: 0.5rem; margin-bottom: 0.4rem; align-items: center;
        }
        .variant-group-card .option-row input,
        .extra-row .extra-fields input {
            width: 100%;
        }
        .variant-group-card .add-opt-btn { margin-top: 0.25rem; }
        .variant-editor .icon-btn {
            background: rgba(239, 68, 68, 0.1);
            border: 1px solid rgba(239, 68, 68, 0.3);
            color: #f87171;
            width: 32px; height: 32px; border-radius: 6px;
            cursor: pointer; display: flex; align-items: center; justify-content: center;
            font-size: 1rem;
        }
        .variant-editor .icon-btn:hover { background: rgba(239, 68, 68, 0.2); }

        .empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
        .empty-state i { font-size: 3rem; color: var(--border); display: block; margin-bottom: 0.75rem; }

        .toast {
            position: fixed; bottom: 20px; right: 20px;
            background: var(--surface); border: 1px solid var(--border);
            padding: 0.85rem 1.1rem; border-radius: 10px;
            display: flex; align-items: center; gap: 10px;
            transform: translateY(20px); opacity: 0;
            transition: 0.3s; z-index: 200;
            box-shadow: 0 10px 30px rgba(0,0,0,0.5);
        }
        .toast.active { transform: translateY(0); opacity: 1; }
        .toast i { color: var(--green); font-size: 1.15rem; }

        /* Settings Page */
        .settings-panel { max-width: 640px; }
        .settings-preview {
            background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
            padding: 1.25rem 1.5rem; margin-top: 1.25rem;
            display: flex; flex-direction: column; gap: 0.4rem;
        }
        .settings-preview .preview-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
        .settings-preview .preview-brand { font-family: 'Playfair Display', serif; font-size: 2rem; font-weight: 600; }
        .settings-preview .preview-brand span { color: var(--gold); }
        .settings-preview .preview-tagline { color: var(--muted); font-size: 0.9rem; }

        @media (max-width: 860px) {
            body { flex-direction: column; }
            aside { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 1rem; gap: 0.25rem; }
            .brand { width: 100%; padding: 0 0 0.75rem; margin-bottom: 0.5rem; }
            .nav-footer { width: 100%; margin-top: 0.5rem; }
            main { padding: 1.5rem 1rem; }
        }