/* =====================================================
   POS DAPOER BENGAWAN - DESIGN SYSTEM
   Premium Modern UI with Dark Mode Support
   ===================================================== */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Custom Properties ── */
:root {
    /* Brand Colors */
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --primary-light: #818CF8;
    --primary-50: #EEF2FF;

    --secondary: #F59E0B;
    --secondary-dark: #D97706;
    --secondary-light: #FBBF24;

    --accent: #06B6D4;
    --accent-dark: #0891B2;

    /* Semantic */
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;

    /* Neutrals */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --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(99, 102, 241, 0.3);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 250ms ease;
    --transition-slow: 400ms ease;

    /* Light theme defaults */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8FAFC;
    --bg-tertiary: #F1F5F9;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-tertiary: #94A3B8;
    --border-color: #E2E8F0;
    --card-bg: #FFFFFF;
    --sidebar-bg: #0F172A;
    --sidebar-text: #CBD5E1;
    --sidebar-active: #6366F1;
}

/* ── Dark Mode ── */
[data-theme="dark"] {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-tertiary: #64748B;
    --border-color: #334155;
    --card-bg: #1E293B;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* ── 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: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ── Typography ── */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 {
    font-size: 1.875rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.125rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

.text-mono {
    font-family: 'JetBrains Mono', monospace;
}

.text-muted {
    color: var(--text-secondary);
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

/* ── Layout Utilities ── */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.items-end {
    align-items: flex-end;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

.grid {
    display: grid;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

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

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

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.hidden {
    display: none !important;
}

.overflow-auto {
    overflow: auto;
}

.relative {
    position: relative;
}

/* Spacing */
.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.px-2 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.ml-auto {
    margin-left: auto;
}

/* ── Cards ── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px;
    /* Touch friendly */
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.45);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #DC2626);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), var(--secondary-dark));
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    min-height: 36px;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    min-height: 52px;
}

.btn-xl {
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    min-height: 56px;
    border-radius: var(--radius-lg);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 0.625rem;
    aspect-ratio: 1;
}

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

/* ── Forms ── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    min-height: 44px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

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

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 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

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

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.5;
}

.badge-primary {
    background: var(--primary-50);
    color: var(--primary-dark);
}

.badge-success {
    background: var(--success-light);
    color: #065F46;
}

.badge-warning {
    background: var(--warning-light);
    color: #92400E;
}

.badge-danger {
    background: var(--danger-light);
    color: #991B1B;
}

.badge-info {
    background: var(--info-light);
    color: #1E40AF;
}

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-600);
}

.badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 0.375rem;
    display: inline-block;
}

.badge-dot.badge-success::before {
    background: var(--success);
}

.badge-dot.badge-warning::before {
    background: var(--warning);
}

.badge-dot.badge-danger::before {
    background: var(--danger);
}

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

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

.data-table th {
    background: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

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

.data-table tr:hover td {
    background: var(--bg-tertiary);
}

/* ── Stats Cards ── */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    opacity: 0.08;
    transform: translate(30%, -30%);
}

.stat-card.stat-revenue::after {
    background: var(--primary);
}

.stat-card.stat-orders::after {
    background: var(--success);
}

.stat-card.stat-avg::after {
    background: var(--warning);
}

.stat-card.stat-pending::after {
    background: var(--danger);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.stat-revenue .stat-icon {
    background: var(--primary-50);
    color: var(--primary);
}

.stat-orders .stat-icon {
    background: var(--success-light);
    color: var(--success);
}

.stat-avg .stat-icon {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-pending .stat-icon {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.25rem;
}

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

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

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

.modal {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: all var(--transition);
}

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

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

.modal-xl {
    max-width: 960px;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    min-width: 320px;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease;
    transition: all var(--transition);
}

.toast.toast-success {
    border-left: 4px solid var(--success);
}

.toast.toast-error {
    border-left: 4px solid var(--danger);
}

.toast.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast.toast-info {
    border-left: 4px solid var(--info);
}

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

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1.125rem;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── Sidebar ── */
.app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: all var(--transition);
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    font-weight: 800;
}

.sidebar-brand-text {
    color: white;
    font-weight: 700;
    font-size: 1rem;
}

.sidebar-brand-text span {
    display: block;
    font-size: 0.6875rem;
    color: var(--sidebar-text);
    font-weight: 400;
}

.sidebar-nav {
    padding: 1rem 0;
    flex: 1;
}

.nav-section-title {
    padding: 0.75rem 1.5rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.3);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: white;
    border-left-color: var(--primary);
}

.nav-item .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1.125rem;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
}

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

.sidebar-user-name {
    color: white;
    font-weight: 600;
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    color: var(--sidebar-text);
    font-size: 0.6875rem;
}

/* ── Header ── */
.app-header {
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.25rem;
}

/* ── Main Content ── */
.app-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-content {
    flex: 1;
    padding: 1.5rem;
}

/* ── Loading ── */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

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

/* ── POS Specific ── */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    grid-template-rows: 1fr;
    height: calc(100vh - var(--header-height));
    max-height: calc(100vh - var(--header-height));
    overflow: hidden;
    gap: 0;
}

.pos-products {
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-secondary);
}

.pos-cart {
    background: var(--card-bg);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.category-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
    margin-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding-bottom: 0.5rem;
}

.category-tabs::-webkit-scrollbar {
    height: 6px;
}

.category-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.category-tabs::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 3px;
}

.category-tabs::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

.category-tab {
    flex-shrink: 0;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

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

.category-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

.product-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.product-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.product-card:active {
    transform: scale(0.97);
}

.product-card.unavailable {
    opacity: 0.5;
    pointer-events: none;
}

.product-emoji {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.product-card-name {
    font-weight: 600;
    font-size: 0.8125rem;
    margin-bottom: 0.375rem;
    line-height: 1.3;
    color: var(--text-primary);
}

.product-card-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.875rem;
}

.product-img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Cart */
.cart-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    min-height: 0;
    /* critical for flex overflow scroll */
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    transition: background var(--transition-fast);
}

.cart-item:hover {
    background: var(--bg-tertiary);
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.cart-item-subtotal {
    font-weight: 700;
    font-size: 0.875rem;
    white-space: nowrap;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.qty-btn {
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
    color: var(--text-primary);
}

.qty-btn:hover {
    background: var(--primary-50);
    color: var(--primary);
}

.qty-value {
    width: 36px;
    text-align: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.cart-summary {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    padding: 0.25rem 0;
}

.cart-summary-row.total {
    font-weight: 800;
    font-size: 1.25rem;
    padding-top: 0.75rem;
    border-top: 2px solid var(--border-color);
    margin-top: 0.5rem;
    color: var(--primary);
}

.cart-actions {
    padding: 1rem 1.25rem;
    display: flex;
    gap: 0.5rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* ── Kitchen Display ── */
.kitchen-layout {
    min-height: 100vh;
    background: #0F172A;
    color: #F8FAFC;
    padding: 1rem;
}

.kitchen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #1E293B;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.kitchen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.kitchen-card {
    background: #1E293B;
    border-radius: var(--radius-lg);
    border: 2px solid #334155;
    overflow: hidden;
    transition: all var(--transition);
    animation: fadeInUp 0.3s ease;
}

.kitchen-card.urgent {
    border-color: #EF4444;
    animation: pulse-border 2s infinite;
}

.kitchen-card.new-order {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

@keyframes pulse-border {

    0%,
    100% {
        border-color: #EF4444;
    }

    50% {
        border-color: #FCA5A5;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kitchen-card-header {
    padding: 1rem;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kitchen-order-number {
    font-weight: 800;
    font-size: 1.125rem;
}

.kitchen-timer {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
}

.kitchen-timer.normal {
    background: #10B981;
    color: white;
}

.kitchen-timer.warning {
    background: #F59E0B;
    color: #1E293B;
}

.kitchen-timer.danger {
    background: #EF4444;
    color: white;
}

.kitchen-card-body {
    padding: 1rem;
}

.kitchen-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #334155;
}

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

.kitchen-item-qty {
    font-weight: 800;
    font-size: 1.25rem;
    min-width: 30px;
    color: var(--secondary);
}

.kitchen-item-name {
    flex: 1;
    font-weight: 500;
}

.kitchen-item-note {
    font-size: 0.75rem;
    color: #94A3B8;
    font-style: italic;
}

.kitchen-item-status {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    transition: all var(--transition-fast);
}

.kitchen-card-actions {
    padding: 0.75rem 1rem;
    border-top: 1px solid #334155;
    display: flex;
    gap: 0.5rem;
}

/* ── Self Order (Mobile-first) ── */
.selforder-page {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-primary);
}

.selforder-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 1.5rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.selforder-header h1 {
    color: white;
    font-size: 1.25rem;
}

.selforder-table-info {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.selforder-categories {
    display: flex;
    overflow-x: auto;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 85px;
    z-index: 9;
}

.selforder-product {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.selforder-product-img {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

.selforder-product-info {
    flex: 1;
}

.selforder-product-name {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.125rem;
}

.selforder-product-price {
    color: var(--primary);
    font-weight: 700;
}

.selforder-cart-float {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    max-width: 460px;
    width: calc(100% - 2rem);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    z-index: 20;
    transition: all var(--transition);
}

.selforder-cart-float:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.5);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .pos-layout {
        grid-template-columns: 1fr;
    }

    .pos-cart {
        position: fixed;
        right: -400px;
        top: 0;
        bottom: 0;
        width: 380px;
        z-index: 200;
        transition: right var(--transition);
        border-left: 1px solid var(--border-color);
        box-shadow: var(--shadow-xl);
    }

    .pos-cart.open {
        right: 0;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

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

    .app-main {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 1rem;
    }

    .kitchen-grid {
        grid-template-columns: 1fr;
    }

    .modal {
        width: 100%;
        max-height: 100vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        margin-top: auto;
    }
}

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

    .app-content {
        padding: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }
}

/* ── Auth Page ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0F172A 0%, #1E1B4B 50%, #312E81 100%);
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.auth-header {
    padding: 2rem 2rem 1.5rem;
    text-align: center;
}

.auth-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.75rem;
    color: white;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.auth-title {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    color: var(--gray-900);
}

.auth-subtitle {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.auth-body {
    padding: 0 2rem 2rem;
}

.auth-footer {
    padding: 1rem 2rem;
    text-align: center;
    background: var(--gray-50);
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* ── Flash Messages ── */
.flash-message {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flash-error {
    background: var(--danger-light);
    color: #991B1B;
    border: 1px solid #FECACA;
}

.flash-success {
    background: var(--success-light);
    color: #065F46;
    border: 1px solid #A7F3D0;
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-tertiary);
}

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

.empty-state-text {
    font-size: 1rem;
    font-weight: 500;
}

/* ── Print Styles ── */
@media print {

    .app-sidebar,
    .app-header,
    .btn,
    .no-print {
        display: none !important;
    }

    .app-main {
        margin-left: 0;
    }

    .app-content {
        padding: 0;
    }

    body {
        background: white;
    }
}