/* ═══════════════════════════════════════════════════════════
   RESET & CSS VARIABLES
═══════════════════════════════════════════════════════════ */

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

::selection { background: var(--accent-soft); color: var(--accent); }

/* ─── Scrollbars ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--muted-soft); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
* { scrollbar-width: thin; scrollbar-color: var(--muted-soft) transparent; }

/* ─── Dark theme (default) ─── */
:root {
    /* Backgrounds & surfaces */
    --bg: #1C1D2A;
    --surface: rgba(226, 228, 235, 0.04);
    --surface-hover: rgba(226, 228, 235, 0.07);
    --border: rgba(226, 228, 235, 0.10);
    --text: #E2E4EB;
    --text-dim: rgba(226, 228, 235, 0.55);
    --bg-input: rgba(226, 228, 235, 0.05);
    --nav-bg: #222336;
    --modal-bg: rgba(0, 0, 0, 0.6);

    /* Accent */
    --accent: #74A3D7;
    --accent-hover: #6290C2;
    --accent-soft: rgba(116, 163, 215, 0.12);

    /* Semantic */
    --green: #7BC4A8;
    --green-soft: rgba(123, 196, 168, 0.12);
    --red: #F087B1;
    --red-soft: rgba(240, 135, 177, 0.12);
    --amber: #F7D16F;
    --amber-soft: rgba(247, 209, 111, 0.12);

    /* Neutral */
    --muted: #8B8FB0;
    --muted-soft: rgba(86, 89, 122, 0.15);

    /* Radius — flat design */
    --radius: 0px;
    --radius-sm: 4px;
    --radius-xs: 4px;

    /* Shadows — flat design */
    --shadow-card: none;
    --shadow-modal: 0 16px 48px rgba(0, 0, 0, 0.4);

    /* Layout */
    --sidebar-width: 260px;
    --panel-width: max(400px, calc(100vw / 3));

    /* Motion */
    --transition: all 0.15s ease;

    /* Font */
    --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

/* ─── Light theme ─── */
[data-theme="light"] {
    --bg: #FFFFFF;
    --surface: rgba(226,228,235,0.10);
    --surface-hover: rgba(226,228,235,0.20);
    --border: rgba(42, 45, 58, 0.12);
    --text: #2A2D3A;
    --text-dim: rgba(42, 45, 58, 0.65);
    --bg-input: rgba(42, 45, 58, 0.03);
    --nav-bg: #FFFFFF;
    --modal-bg: rgba(0, 0, 0, 0.3);
    --muted: #6E7191;
    --muted-soft: rgba(110, 113, 145, 0.10);
    --shadow-card: none;
    --shadow-modal: 0 16px 48px rgba(0, 0, 0, 0.15);
}


/* ═══════════════════════════════════════════════════════════
   BASE TYPOGRAPHY & ELEMENTS
═══════════════════════════════════════════════════════════ */

body {
    font-family: var(--font);
    font-weight: 300;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

h1 { font-size: 32px; font-weight: 300; letter-spacing: -0.02em; }
h2 { font-size: 24px; font-weight: 300; letter-spacing: -0.01em; }
h3 { font-size: 18px; font-weight: 400; }
h4 { font-size: 12px; font-weight: 300; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); }

.page-header h2 { font-size: 20px; font-weight: 400; }

.grid-stats .card h4 { font-size: 15px; font-weight: 500; }

.icon-label-row { display: flex; align-items: center; gap: 8px; }
.stat-card-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-number { font-size: 21px; font-weight: 600; text-align: left; }
.stat-label { font-size: 13px; color: var(--text-dim); font-weight: 300; text-align: left; }
.section-title { font-size: 15px; font-weight: 500; margin-bottom: 12px; }

/* ─── Typography scale (shared across all apps) ─── */
.ts-display { font-size: 24px; font-weight: 400; letter-spacing: -0.02em; line-height: 1; }
.ts-featured { font-size: 17px; font-weight: 400; }
.ts-primary { font-size: 15px; font-weight: 500; }
.ts-amount { font-size: 15px; font-weight: 600; }
.ts-body { font-size: 13px; font-weight: 400; }
.ts-small { font-size: 12px; font-weight: 300; }
.ts-micro { font-size: 11px; font-weight: 300; text-transform: uppercase; letter-spacing: 0.1em; }


/* ═══════════════════════════════════════════════════════════
   SHARED COMPONENTS
═══════════════════════════════════════════════════════════ */

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
    outline: none;
}

.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: var(--accent-soft);
    color: var(--accent);
    border: none;
    border-left: 1px solid var(--accent);
}

.btn-primary:hover { background: var(--accent); color: #fff; }

.btn-danger {
    background: var(--red-soft);
    color: var(--red);
    border: none;
    border-left: 1px solid var(--red);
}

.btn-danger:hover { background: var(--red); color: #fff; }

.btn-secondary {
    background: var(--muted-soft);
    color: var(--text);
    border: none;
    border-left: 1px solid var(--muted);
}

.btn-secondary:hover { background: var(--surface-hover); }

.btn-success {
    background: var(--green-soft);
    color: var(--green);
    border: none;
    border-left: 1px solid var(--green);
}

.btn-success:hover { background: var(--green); color: #fff; }

.btn-icon { padding: 8px; border-radius: 0; background: none; border: none; color: var(--text-dim); display: inline-flex; align-items: center; justify-content: center; transition: var(--transition); }
.btn-icon:hover { color: var(--text); background: var(--surface-hover); }

.btn-fab {
    position: fixed;
    bottom: 80px;
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(116, 163, 215, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: var(--transition);
}

.btn-fab:hover { transform: scale(1.05) rotate(90deg); box-shadow: 0 6px 24px rgba(116, 163, 215, 0.4); }
.btn-fab svg { width: 24px; height: 24px; }

.btn-xs { padding: 4px 8px; font-size: 12px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

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

.form-group label {
    font-size: 11px;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.form-input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--muted-soft);
    border: none;
    border-left: 1px solid var(--muted);
    border-radius: 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    outline: none;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.form-input[type="number"] {
    -webkit-appearance: auto;
    appearance: auto;
    color-scheme: dark;
}
[data-theme="light"] .form-input[type="number"] {
    color-scheme: light;
}

.form-group select,
.form-select {
    cursor: pointer;
    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='rgba(226,228,235,0.35)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

[data-theme="light"] .form-group select,
[data-theme="light"] .form-select {
    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='rgba(42,45,58,0.4)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

.form-group select option,
.form-select option {
    background: var(--bg);
    color: var(--text);
}

.form-input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-left-color: var(--accent);
    background-color: var(--accent-soft);
}

.form-select {
    padding: 12px 16px;
    padding-right: 40px;
    background-color: var(--muted-soft);
    border: none;
    border-left: 1px solid var(--muted);
    border-radius: 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    outline: none;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}
.form-select:focus { border-left-color: var(--accent); background-color: var(--accent-soft); }

/* ─── Cards ─── */
.card {
    border-left: 1px solid var(--muted);
    border-radius: 0;
    padding: 24px;
    box-shadow: none;
    transition: var(--transition);
    color: var(--text);
}

.card:hover { background: var(--surface-hover); }

.card-sm { padding: 12px; border-radius: 0; }
.glass { background: transparent; border: 1px solid var(--border); border-radius: 0; box-shadow: none; transition: var(--transition); }
.glass-sm { background: transparent; border: 1px solid var(--border); border-radius: 0; box-shadow: none; transition: var(--transition); }
.card-accent-teal { border-left: 1px solid var(--accent); }
.card-accent-green { border-left: 1px solid var(--green); }
.card-accent-red { border-left: 1px solid var(--red); }
.card-accent-amber { border-left: 1px solid var(--amber); }
.prod-card-accent-teal { border-left: 1px solid var(--accent); }
.prod-card-accent-green { border-left: 1px solid var(--green); }
.prod-card-accent-red { border-left: 1px solid var(--red); }
.prod-card-accent-amber { border-left: 1px solid var(--amber); }

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: var(--green);
    color: var(--modal-bg);
    font-weight: 600;
}

.badge-warning {
    background: var(--amber);
    color: var(--modal-bg);
    font-weight: 600;
}

.badge-danger {
    background: var(--red);
    color: var(--modal-bg);
    font-weight: 600;
}

.badge-info {
    background: var(--accent);
    color: var(--modal-bg);
    font-weight: 600;
}

.badge-muted {
    background: var(--muted);
    color: var(--modal-bg);
    font-weight: 600;
}

/* ─── Search ─── */
.search-bar {
    position: relative;
    margin-bottom: 16px;
}

.search-bar input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    background: var(--muted-soft);
    border: none;
    border-left: 1px solid var(--muted);
    border-radius: 0;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.search-bar input:focus { border-left-color: var(--accent); background: var(--accent-soft); }

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

/* ─── Empty State ─── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
    text-align: center;
    color: var(--text-dim);
}

.empty-state-icon { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.empty-state-desc { font-size: 14px; }


/* ═══════════════════════════════════════════════════════════
   APP LAYOUT
═══════════════════════════════════════════════════════════ */

/* ─── Header ─── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--nav-bg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 600;
    color: var(--accent);
}

.header-brand svg { width: 24px; height: 24px; }

.header-actions { display: flex; gap: 8px; }

.header-actions button {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.header-actions button:hover { background: var(--surface-hover); }
.header-actions button svg { width: 18px; height: 18px; }

/* ─── Main Content ─── */
#app {
    flex: 1;
    padding: 16px;
    padding-bottom: 80px;
    overflow-y: auto;
}

/* ─── Sidebar Nav ─── */
.sidebar-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: transparent;
    border-right: 1px solid var(--border);
    z-index: 100;
    flex-direction: column;
    overflow-y: auto;
}

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

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 0;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.sidebar-brand-text { display: flex; flex-direction: column; }
.sidebar-brand-name { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }

.sidebar-brand-tagline {
    font-size: 11px;
    color: var(--text-dim);
    font-weight: 400;
}

.sidebar-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 10px;
}

.sidebar-separator {
    height: 1px;
    background: var(--border);
    margin: 6px 14px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 0;
    color: var(--text-dim);
    font-size: 13.5px;
    font-weight: 400;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font);
}

.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-link:hover {
    background: var(--surface-hover);
    color: var(--text);
}

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

.sidebar-footer {
    padding: 12px 10px;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid var(--border);
}

.sidebar-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 0;
    color: var(--text-dim);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: var(--font);
}

.sidebar-action svg { width: 16px; height: 16px; }
.sidebar-action:hover { color: var(--text); background: var(--surface-hover); }

/* ─── Bottom Nav ─── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--nav-bg);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding: 4px 0;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
}

.nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
    font-family: var(--font);
}

.nav-tab svg { width: 20px; height: 20px; }
.nav-tab.active { color: var(--accent); }
.nav-tab:hover { color: var(--text); }

/* ─── More Menu ─── */
.more-menu {
    display: none;
    position: fixed;
    bottom: 64px;
    right: 8px;
    background: var(--nav-bg);
    border: 1px solid var(--border);
    border-radius: 0;
    box-shadow: var(--shadow-modal);
    z-index: 101;
    padding: 6px;
    min-width: 160px;
}

.more-menu.open { display: block; }

.more-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: none;
    background: none;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    border-radius: 0;
    width: 100%;
    text-align: left;
    transition: var(--transition);
}

.more-menu-item svg { width: 18px; height: 18px; }
.more-menu-item:hover { background: var(--surface-hover); }
.more-menu-item.active { background: var(--accent-soft); color: var(--accent); }

.more-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99;
}

.more-menu-overlay.open { display: block; }


/* ═══════════════════════════════════════════════════════════
   POS
═══════════════════════════════════════════════════════════ */

/* ─── Search Results ─── */
.pos-results {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    margin-bottom: 16px;
    max-height: 240px;
    overflow-y: auto;
}

.pos-result-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border);
}

.pos-result-item:last-child { border-bottom: none; }
.pos-result-item:hover { background: var(--surface-hover); }
.pos-result-item.disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Cart ─── */
.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.cart-item:last-child { border-bottom: none; }

.cart-qty {
    display: flex;
    align-items: center;
    gap: 4px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.qty-btn:hover { background: var(--accent-soft); color: var(--accent); }
.qty-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.qty-val { min-width: 24px; text-align: center; font-weight: 600; }

.cart-remove {
    background: none;
    border: 1px solid var(--text-dim);
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    margin-left: 4px;
}

.cart-remove:hover {
    color: var(--red);
    border: 1px solid var(--red);
}

/* ─── Footer & Payment ─── */
.pos-footer {
    position: sticky;
    bottom: 64px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 12px 0 0;
}

.pos-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 16px;
}

.pay-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border: none;
    border-left: 1px solid var(--muted);
    background: var(--surface);
    color: var(--text-dim);
    border-radius: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.pay-tab:hover { background: var(--surface-hover); }

.pay-tab.active {
    background: var(--accent-soft);
    color: var(--accent);
    border: none;
    border-left: 1px solid var(--accent);
}

.pay-tab.active:hover { background: var(--surface-hover); }

/* ─── Print Receipt ─── */
@media print {
    body > *:not(.modal-overlay) { display: none !important; }
    .sidebar-nav { display: none !important; }
    .modal-overlay { position: static; background: none; backdrop-filter: none; }
    .modal-content { box-shadow: none; border: none; max-width: 80mm; padding: 8px; }
    .modal-content > *:not(#receipt-content) { display: none !important; }
    #receipt-content { font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace; font-size: 12px; }
}


/* ═══════════════════════════════════════════════════════════
   REPORTS
═══════════════════════════════════════════════════════════ */

/* ─── Calendar ─── */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-header { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-dim); padding: 4px 0; text-transform: uppercase; }
.cal-cell { min-height: 72px; background: var(--muted-soft); border: none; border-left: 1px solid var(--muted); border-radius: 0; padding: 6px; cursor: pointer; transition: var(--transition); position: relative; overflow: hidden; }
.cal-empty { background: transparent; border-left-color: transparent; cursor: default; }
.cal-cell:not(.cal-empty):hover { background: var(--surface-hover); border-left-color: var(--accent); }
.cal-today { border-left-color: var(--accent) !important; background: var(--accent-soft) !important; }
.cal-has-data { border-left-color: var(--text-dim); }
.cal-day-num { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.cal-today .cal-day-num { color: var(--accent); }
.cal-revenue { font-size: 10px; font-weight: 600; color: var(--green); }
.cal-count { font-size: 10px; color: var(--text-dim); }


/* ═══════════════════════════════════════════════════════════
   GUIDE
═══════════════════════════════════════════════════════════ */

.guide-content { max-width: 720px; margin: 0 auto; line-height: 1.7; }
.guide-content h1 { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; color: var(--accent); }
.guide-content h2 { font-size: 26px; font-weight: 700; margin: 32px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.guide-content h3 { font-size: 18px; font-weight: 600; margin: 20px 0 8px; }
.guide-content p { margin-bottom: 12px; }
.guide-content ul, .guide-content ol { margin: 0 0 16px 20px; }
.guide-content li { margin-bottom: 6px; }
.guide-content code { background: var(--surface); padding: 2px 6px; border-radius: 0; font-size: 0.9em; }
.guide-toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin: 16px 0 24px; }
.guide-toc a { color: var(--accent); text-decoration: none; display: block; padding: 4px 0; }
.guide-toc a:hover { text-decoration: underline; }
.guide-tip { background: var(--green-soft); border: 1px solid var(--green); border-left: 3px solid var(--green); border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; }
.guide-tip::before { content: "Tip: "; font-weight: 600; color: var(--green); }
.guide-warn { background: var(--amber-soft); border: 1px solid var(--amber); border-left: 3px solid var(--amber); border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; }
.guide-warn::before { content: "Warning: "; font-weight: 600; color: var(--amber); }
.guide-step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.guide-step-num { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; margin-right: 8px; }
.guide-content pre { background: var(--surface); border: 1px solid var(--border); padding: 16px; margin: 12px 0; overflow-x: auto; font-size: 13px; line-height: 1.5; }
.guide-content pre code { background: none; padding: 0; }
.guide-screenshot { margin: 16px 0; text-align: center; }
.guide-screenshot img { max-width: 100%; border: 1px solid var(--border); }
.guide-screenshot-row { display: flex; gap: 16px; margin: 16px 0; align-items: flex-start; }
.guide-screenshot-row .guide-screenshot { flex: 1; margin: 0; }
.guide-screenshot-row .guide-screenshot.mobile { flex: 0 0 200px; }
@media (max-width: 600px) { .guide-screenshot-row { flex-direction: column; } .guide-screenshot-row .guide-screenshot.mobile { flex: 1; } }


/* ═══════════════════════════════════════════════════════════
   MODAL & TOAST
═══════════════════════════════════════════════════════════ */

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--modal-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
}

.modal-overlay.active { display: flex; }

.modal-content {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-modal);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
}

.modal-body { flex: 1; }

.modal-footer { margin-top: 16px; }

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

.modal-header h3 { font-size: 18px; font-weight: 300; letter-spacing: -0.01em; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
}

.modal-close svg { width: 20px; height: 20px; }

/* ─── Command Palette ─── */
.command-palette-overlay {
    position: fixed;
    inset: 0;
    background: var(--modal-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 300;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
}

.command-palette-overlay.open { display: flex; }

.command-palette {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-modal);
    width: 100%;
    max-width: 560px;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.command-palette-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.command-palette-icon { color: var(--text-dim); flex-shrink: 0; }

.command-palette-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-size: 16px;
    font-family: var(--font);
    font-weight: 300;
    outline: none;
}

.command-palette-input::placeholder { color: var(--text-dim); }

.command-palette-kbd {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-family: var(--font);
    color: var(--text-dim);
    flex-shrink: 0;
}

.command-palette-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.command-palette-group {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.command-palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s ease;
    color: var(--text);
    font-size: 14px;
}

.command-palette-item:hover,
.command-palette-item.selected { background: var(--surface-hover); }
.command-palette-item.selected { background: var(--accent-soft); color: var(--accent); }

.command-palette-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.command-palette-desc {
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.command-palette-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
}

/* ─── Toast ─── */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 20px;
    border-radius: 0;
    font-size: 14px;
    box-shadow: none;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    pointer-events: auto;
}

.toast.show { transform: translateX(0); }
.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-info { border-left: 3px solid var(--accent); }


/* ═══════════════════════════════════════════════════════════
   DETAIL PANEL
═══════════════════════════════════════════════════════════ */

.detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--panel-width);
    height: 100vh;
    background: var(--bg);
    border-left: 1px solid var(--border);
    box-shadow: none;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 150;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.detail-panel.open { transform: translateX(0); }

body.panel-open #app {
    margin-right: var(--panel-width);
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.detail-panel-title {
    font-size: 18px;
    font-weight: 300;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 12px;
}

.detail-panel-close {
    width: 32px;
    height: 32px;
    border-radius: 0;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.detail-panel-close svg { width: 16px; height: 16px; }
.detail-panel-close:hover { background: var(--red-soft); color: var(--red); }

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

.detail-panel-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 149;
}

/* ─── Detail Panel Mobile ─── */
@media (max-width: 768px) {
    .detail-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        max-height: 85vh;
        border-radius: 0;
        border-left: none;
        border-top: 1px solid var(--border);
        box-shadow: none;
        transform: translateY(100%);
    }
    .detail-panel.open { transform: translateY(0); }
    body.panel-open #app { margin-right: 0; }
    body.panel-open .detail-panel-overlay { display: block; }
}


/* ═══════════════════════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════════════════════ */

/* ─── Text ─── */
.text-muted { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--red); }
.text-warning { color: var(--amber); }
.text-success { color: var(--green); }
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

/* ─── Spacing ─── */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }

/* ─── Layout ─── */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }


/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */

/* ─── Base layout helpers (mobile) ─── */
.grid-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.filter-row { display: flex; flex-direction: column; gap: 12px; }
.filter-row .search-bar { margin-bottom: 0; }
.product-list { display: flex; flex-direction: column; }
.sales-list { display: flex; flex-direction: column; gap: 8px; }
.pos-layout { display: flex; flex-direction: column; }

/* ─── Tablet (768px+) ─── */
@media (min-width: 768px) {
    #app { padding: 24px; padding-bottom: 80px; max-width: 960px; margin: 0 auto; }
    .bottom-nav { justify-content: center; }
    .bottom-nav .nav-tab { max-width: 100px; font-size: 11px; }
    .bottom-nav .nav-tab svg { width: 22px; height: 22px; }
    .product-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .product-list .product-card { margin-bottom: 0; }
    .grid-stats { grid-template-columns: repeat(4, 1fr); }
    .modal-lg { max-width: 720px; }
}

/* ─── Desktop (1024px+) ─── */
@media (min-width: 1024px) {
    .sidebar-nav { display: flex; }
    .bottom-nav { display: none; }
    .more-menu { display: none !important; }
    .more-menu-overlay { display: none !important; }
    .header { display: none; }
    #app { margin-left: var(--sidebar-width); width: calc(100% - var(--sidebar-width)); padding: 24px 32px; padding-bottom: 24px; max-width: none; }
    .btn-fab { right: 32px; bottom: 24px; }
    .pos-footer { bottom: 0; }
    .modal-content { max-width: 560px; }
    .product-list { grid-template-columns: repeat(4, 1fr); }
    .sales-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
    .pos-layout { flex-direction: row; gap: 24px; }
    .pos-search-col { flex: 3; min-width: 0; }
    .pos-cart-col { flex: 2; min-width: 300px; }
    .filter-row { flex-direction: row; }
    .filter-row .search-bar { flex: 1; margin-bottom: 0; }
    .filter-row .form-select { flex-shrink: 0; }
    .stock-layout { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(320px, 1.5fr); gap: 24px; }
    .alert-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
}

/* ═══════════════════════════════════════════════════════════
   AUTH SCREEN (login / first-run setup)
═══════════════════════════════════════════════════════════ */

.auth-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
    overflow-y: auto;
}

.auth-screen.open { display: flex; }

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 32px 28px;
    width: min(420px, 100%);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.auth-brand svg { width: 18px; height: 18px; }

.auth-card h2 {
    font-size: 22px;
    font-weight: 400;
    margin: 0;
    color: var(--text);
}

.auth-hint {
    color: var(--text-dim);
    font-size: 13px;
    margin: -4px 0 8px 0;
}

.auth-error {
    color: var(--red);
    font-size: 13px;
    min-height: 1.2em;
}

.auth-submit { width: 100%; justify-content: center; margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════
   ROLE-AWARE NAV VISIBILITY
═══════════════════════════════════════════════════════════ */

.admin-only { display: none !important; }
body.role-admin .sidebar-link.admin-only { display: flex !important; }
body.role-admin .more-menu-item.admin-only { display: flex !important; }
