/* ===== CSS Variables & Design Tokens ===== */
:root {
    /* Colors - Light Theme */
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #ffffff;
    --bg-sidebar: #ffffff;

    /* Accent Colors */
    --accent-primary: #4f46e5;
    --accent-primary-light: #6366f1;
    --accent-primary-dark: #4338ca;
    --accent-success: #10b981;
    --accent-success-light: #34d399;
    --accent-warning: #f59e0b;
    --accent-warning-light: #fbbf24;
    --accent-danger: #ef4444;
    --accent-danger-light: #f87171;
    --accent-info: #06b6d4;

    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-accent: #4f46e5;

    /* Borders */
    --border-color: #e2e8f0;
    --border-color-hover: #cbd5e1;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #4f46e5, #7c3aed);
    --gradient-success: linear-gradient(135deg, #059669, #0891b2);
    --gradient-warning: linear-gradient(135deg, #d97706, #dc2626);
    --gradient-card: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(124, 58, 237, 0.05));

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);

    /* Spacing */
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

body {
    font-family: 'Inter', 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

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

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

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

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

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

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.sidebar-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gradient-primary);
    border-radius: 0 2px 2px 0;
    opacity: 0;
    transform: scaleY(0);
    transition: all var(--transition-normal);
}

.nav-item:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-primary-light);
}

.nav-item.active::before {
    opacity: 1;
    transform: scaleY(1);
}

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

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

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

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

.main-content--customer {
    margin-left: 0;
}

.main-content--customer .content-wrapper {
    min-height: 100vh;
}

/* ===== Top Bar ===== */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 32px;
    gap: 16px;
    z-index: 50;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    transition: all var(--transition-fast);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
}

.topbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ===== Flash Messages ===== */
.flash-container {
    padding: 16px 32px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flash-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid;
}

.flash-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--accent-success-light);
}

.flash-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--accent-danger-light);
}

.flash-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--accent-warning-light);
}

.flash-info {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.2);
    color: var(--accent-info);
}

.flash-text {
    flex: 1;
}

.flash-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.flash-close:hover {
    opacity: 1;
}

/* ===== Content Wrapper ===== */
.content-wrapper {
    padding: 28px 32px;
    flex: 1;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all var(--transition-normal);
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card--primary::before { background: var(--gradient-primary); }
.stat-card--success::before { background: var(--gradient-success); }
.stat-card--warning::before { background: var(--gradient-warning); }
.stat-card--info::before { background: linear-gradient(135deg, #06b6d4, #3b82f6); }

.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.2s; }
.stat-card:nth-child(4) { animation-delay: 0.3s; }

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-color-hover);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    font-size: 40px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.stat-card--success .stat-icon { background: rgba(16, 185, 129, 0.1); }
.stat-card--warning .stat-icon { background: rgba(245, 158, 11, 0.1); }
.stat-card--info .stat-icon { background: rgba(6, 182, 212, 0.1); }

.stat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card--success .stat-value {
    background: var(--gradient-success);
    -webkit-background-clip: text;
    background-clip: text;
}

.stat-card--warning .stat-value {
    background: var(--gradient-warning);
    -webkit-background-clip: text;
    background-clip: text;
}

.stat-card--info .stat-value {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== Section ===== */
.section {
    margin-bottom: 32px;
}

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

.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== Category Grid ===== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-normal);
    cursor: pointer;
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.category-card:hover {
    transform: translateY(-3px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.1);
    background: var(--bg-card-hover);
}

.category-card-icon {
    font-size: 36px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.category-card-info {
    flex: 1;
    min-width: 0;
}

.category-card-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-card-stats {
    text-align: right;
    flex-shrink: 0;
}

.category-card-count {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.category-card-value {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-primary-light);
    margin-top: 2px;
}

/* ===== Products Grid ===== */
.products-view-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin: -8px 0 16px;
}

.products-view-label {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.products-view-toggle {
    display: inline-flex;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
}

.products-view-btn {
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    border-right: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.products-view-btn:last-child {
    border-right: 0;
}

.products-view-btn:hover,
.products-view-btn.active {
    background: var(--accent-primary);
    color: white;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.products-grid.products-grid--list {
    grid-template-columns: 1fr;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.product-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-color-hover);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.product-card-image {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--bg-secondary);
}

.product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform var(--transition-slow);
}

.product-card:hover .product-card-image img {
    transform: scale(1.05);
}

.product-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
}

.product-card-placeholder span {
    font-size: 40px;
    opacity: 0.4;
}

.product-card-placeholder small {
    font-size: 0.8rem;
}

.product-card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
}

.product-card-body {
    padding: 16px 20px;
    flex: 1;
    min-width: 0;
}

.product-card-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.product-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.product-price {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--accent-primary-light);
}

.product-qty {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}

.inline-stock-form {
    display: inline-flex;
    margin: 0;
}

.inline-stock-actions {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.stock-action-btn,
.stock-add-btn {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 999px;
    background: var(--accent-success);
    color: white;
    font: inherit;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.stock-action-btn--decrease {
    background: var(--accent-info);
}

.stock-action-btn--empty {
    width: auto;
    min-width: 42px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--accent-danger);
    font-size: 0.72rem;
}

.stock-action-btn:hover,
.stock-add-btn:hover {
    background: var(--accent-success-light);
    transform: translateY(-1px);
}

.stock-action-btn--decrease:hover {
    background: #3b82f6;
}

.stock-action-btn--empty:hover {
    background: #ef4444;
}

.stock-action-btn:disabled,
.stock-add-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.stock-action-btn.is-loading,
.stock-add-btn.is-loading {
    transform: none;
}

.product-card-actions {
    display: flex;
    border-top: 1px solid var(--border-color);
    padding: 8px 12px;
    gap: 4px;
}

.product-card-actions .btn {
    flex: 1;
    text-align: center;
    justify-content: center;
}

.products-grid--list .product-card {
    display: grid;
    grid-template-columns: 156px minmax(0, 1fr) 148px;
    align-items: stretch;
}

.products-grid--list .product-card:hover {
    transform: translateY(-2px);
}

.products-grid--list .product-card-image {
    aspect-ratio: auto;
    min-height: 132px;
}

.products-grid--list .product-card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.products-grid--list .product-card-name {
    -webkit-line-clamp: 1;
}

.products-grid--list .product-card-desc {
    -webkit-line-clamp: 1;
}

.products-grid--list .product-card-meta {
    justify-content: flex-start;
}

.products-grid--list .product-card-actions {
    border-top: 0;
    border-left: 1px solid var(--border-color);
    flex-direction: column;
    justify-content: center;
    padding: 12px;
}

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-normal);
    white-space: nowrap;
}

.filter-chip:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.08);
}

.filter-chip.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.sales-calendar-filter {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
}

.sales-calendar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.sales-date-input {
    width: 190px;
}

.sales-period-buttons {
    margin-bottom: 0;
}

/* ===== Table ===== */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

.data-table thead {
    background: rgba(99, 102, 241, 0.06);
}

.data-table th {
    text-align: left;
    padding: 14px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 14px 20px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

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

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

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

.table-total-row {
    background: rgba(99, 102, 241, 0.08) !important;
}

.table-total-row td {
    border-top: 2px solid var(--accent-primary);
    font-size: 0.95rem;
}

.table-total-row--danger {
    background: rgba(239, 68, 68, 0.12) !important;
}

.table-total-row--danger td {
    border-top-color: var(--accent-danger);
    color: var(--accent-danger);
}

.table-icon {
    font-size: 24px;
    margin-right: 8px;
    vertical-align: middle;
}

.table-link {
    color: var(--accent-primary-light);
    font-weight: 600;
    transition: color var(--transition-fast);
}

.table-link:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

button.table-link {
    background: transparent;
    border: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.order-customer-cell {
    padding: 0 !important;
}

.order-customer-toggle {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px !important;
    text-align: left;
}

.order-customer-toggle:hover {
    background: rgba(99, 102, 241, 0.08);
    text-decoration: none;
}

.order-toggle-hint {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
}

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

.text-accent {
    color: var(--accent-primary-light);
    font-weight: 600;
}

/* Product thumb in tables */
.product-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.product-thumb {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    flex-shrink: 0;
}

.product-thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    font-size: 18px;
}

.action-btns {
    display: flex;
    gap: 4px;
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge--success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success-light);
}

.badge--warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning-light);
}

.badge--danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger-light);
}

.badge--info {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary-light);
}

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

.btn-sm {
    padding: 7px 16px;
    font-size: 0.82rem;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

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

.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
    border-color: var(--border-color-hover);
}

.btn-danger {
    background: var(--accent-danger);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--accent-danger-light);
    transform: translateY(-2px);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    font-size: 16px;
}

.btn-danger-hover:hover {
    color: var(--accent-danger-light) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

/* ===== Forms ===== */
.form-container {
    max-width: 720px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 36px;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group--half {
    flex: 1;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.required {
    color: var(--accent-danger);
}

.form-input {
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition-normal);
    outline: none;
}

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

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

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

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* Icon Picker */
.icon-picker {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.icon-input {
    width: 80px;
    text-align: center;
    font-size: 28px;
    padding: 8px;
}

.icon-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.1);
}

/* Upload Area */
.upload-area {
    position: relative;
}

.upload-input {
    display: none;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--bg-input);
}

.upload-placeholder:hover,
.upload-placeholder.drag-over {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    font-size: 40px;
    opacity: 0.5;
}

.upload-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.upload-preview {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-width: 400px;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--border-color);
}

.upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.upload-preview-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    display: flex;
    gap: 8px;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.upload-preview:hover .upload-preview-overlay {
    opacity: 1;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
}

.empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

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

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 36px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-slow);
}

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

.modal-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 28px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    }

    .sidebar-close {
        display: block;
    }

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

    .menu-toggle {
        display: flex;
    }

    .topbar {
        padding: 0 16px;
    }

    .content-wrapper {
        padding: 20px 16px;
    }

    .flash-container {
        padding: 12px 16px 0;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
        gap: 12px;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 28px;
    }

    .stat-value {
        font-size: 1.35rem;
    }

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

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
        gap: 16px;
    }

    .product-card-body {
        padding: 14px 16px;
    }

    .product-card-meta {
        align-items: flex-start;
        flex-direction: column;
    }

    .product-qty {
        width: 100%;
        justify-content: space-between;
        row-gap: 8px;
    }

    .inline-stock-actions {
        margin-left: 0;
    }

    .product-card-actions {
        padding: 8px;
    }

    .products-grid--list .product-card {
        grid-template-columns: 132px minmax(0, 1fr);
    }

    .products-grid--list .product-card-image {
        min-height: 128px;
    }

    .products-grid--list .product-card-actions {
        grid-column: 1 / -1;
        border-left: 0;
        border-top: 1px solid var(--border-color);
        flex-direction: row;
    }

    .form-container {
        padding: 24px;
    }

    .form-row {
        flex-direction: column;
        gap: 20px;
    }

    .data-table {
        font-size: 0.82rem;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }

    .modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

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

    .products-view-toolbar {
        justify-content: space-between;
        margin-top: -4px;
    }

    .products-view-toggle {
        flex: 0 0 auto;
    }

    .products-grid--list .product-card {
        grid-template-columns: 96px minmax(0, 1fr);
    }

    .products-grid--list .product-card-image {
        min-height: 116px;
    }

    .products-grid--list .product-card-body {
        padding: 12px;
    }

    .product-card-meta {
        gap: 10px;
    }

    .product-qty,
    .inline-stock-actions {
        justify-content: flex-start;
    }

    .page-title {
        font-size: 1rem;
    }

    .topbar-actions .btn span:not(:first-child) {
        display: none;
    }
}

/* ===== Customer Buy Order ===== */
.customer-order-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ordered-history-section {
    margin-bottom: 18px;
}

.ordered-history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.ordered-history-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ordered-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ordered-history-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ordered-history-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    font-size: 0.86rem;
}

.ordered-history-row span:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ordered-history-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.order-link-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.order-link-card h2 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.order-link-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
    word-break: break-all;
}

.customer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
    align-items: start;
}

.category-heading {
    font-size: 1rem;
    margin-bottom: 12px;
}

.customer-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.customer-menu-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.customer-menu-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background: var(--bg-secondary);
}

.customer-menu-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--text-muted);
}

.customer-menu-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.customer-menu-body h4 {
    font-size: 1rem;
}

.customer-menu-body p {
    color: var(--text-muted);
    font-size: 0.85rem;
    flex: 1;
}

.customer-menu-meta,
.customer-menu-actions,
.cart-row,
.order-item-row,
.order-card-header,
.order-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.customer-menu-meta span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.cart-qty {
    width: 52px;
    height: 34px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: center;
    font: inherit;
    font-weight: 700;
}

.cart-panel {
    position: sticky;
    top: calc(var(--topbar-height) + 20px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.cart-panel h3 {
    margin-bottom: 16px;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 72px;
}

.cart-row {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    align-items: flex-start;
}

.cart-row-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cart-row-info span {
    font-weight: 600;
}

.cart-row-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.cart-row-image {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-secondary);
}

.cart-row-image--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.cart-row-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.cart-row-text span {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.cart-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.cart-control-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cart-control-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.cart-row-qty {
    min-width: 24px;
    text-align: center;
    font-weight: 700;
}

.cart-remove-btn {
    border: 0;
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-danger);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
}

.cart-remove-btn:hover {
    background: rgba(239, 68, 68, 0.18);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-top: 8px;
    font-size: 1.05rem;
}

.cart-total strong {
    color: var(--accent-primary);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

/* ===== Admin Orders ===== */
.order-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.live-refresh-indicator {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.order-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.order-link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.order-link-input {
    margin-top: 10px;
    font-size: 0.82rem;
}

.order-link-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.qr-modal {
    max-width: 420px;
}

.qr-modal-image {
    width: min(280px, 100%);
    aspect-ratio: 1;
    display: block;
    margin: 14px auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
}

.order-card-header h3 {
    font-size: 1rem;
}

.order-card-header p {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.order-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.order-item-row {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.9rem;
}

.order-detail-row td {
    background: rgba(99, 102, 241, 0.035);
}

.order-detail-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
}

.order-detail-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.order-detail-table th,
.order-detail-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
}

.order-detail-table th {
    color: var(--text-secondary);
    background: rgba(99, 102, 241, 0.06);
    font-weight: 700;
}

.order-detail-table td:nth-child(3),
.order-detail-table th:nth-child(3) {
    text-align: center;
    width: 100px;
}

.order-detail-table td:nth-child(4),
.order-detail-table th:nth-child(4) {
    text-align: right;
    width: 140px;
}

.order-detail-table tfoot td {
    background: rgba(99, 102, 241, 0.08);
    border-bottom: 0;
}

@media (max-width: 900px) {
    .customer-layout {
        grid-template-columns: 1fr;
    }

    .cart-panel {
        position: static;
    }
}

@media (max-width: 560px) {
    .sales-calendar-row .btn,
    .sales-date-input {
        width: 100%;
    }

    .order-link-card,
    .order-card-header,
    .order-card-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .customer-menu-grid,
    .order-board {
        grid-template-columns: 1fr;
    }
}

/* ===== Professional UI Refresh ===== */
:root {
    --bg-primary: #f5f7f8;
    --bg-secondary: #eef3f4;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fbfa;
    --bg-input: #ffffff;
    --bg-sidebar: #10201d;
    --accent-primary: #0f766e;
    --accent-primary-light: #14b8a6;
    --accent-primary-dark: #115e59;
    --accent-success: #16a34a;
    --accent-warning: #d97706;
    --accent-danger: #dc2626;
    --accent-info: #2563eb;
    --text-primary: #17212b;
    --text-secondary: #4b5563;
    --text-muted: #74818c;
    --text-accent: #0f766e;
    --border-color: #d9e3e7;
    --border-color-hover: #b7c6ce;
    --gradient-primary: linear-gradient(135deg, #0f766e 0%, #2563eb 100%);
    --gradient-success: linear-gradient(135deg, #16a34a 0%, #0f766e 100%);
    --gradient-warning: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 12px;
    --shadow-card: 0 12px 34px rgba(15, 23, 42, 0.08);
    --shadow-card-hover: 0 16px 42px rgba(15, 23, 42, 0.12);
    --shadow-soft: 0 4px 16px rgba(15, 23, 42, 0.06);
}

body {
    font-family: 'Prompt', 'Noto Sans Thai', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background:
        radial-gradient(circle at 8% 8%, rgba(20, 184, 166, 0.08), transparent 28%),
        linear-gradient(180deg, #f9fbfb 0%, var(--bg-primary) 52%, #eef3f4 100%);
    color: var(--text-primary);
    letter-spacing: 0;
}

.sidebar {
    background: linear-gradient(180deg, #10201d 0%, #162420 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.12);
}

.logo-icon,
.nav-icon,
.modal-icon {
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1;
}

.logo-icon {
    background: rgba(20, 184, 166, 0.14);
    color: #a7f3d0;
    border: 1px solid rgba(167, 243, 208, 0.18);
}

.logo-text,
.sidebar-username {
    color: #f8fafc;
}

.sidebar-footer-text {
    color: rgba(226, 232, 240, 0.62) !important;
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.nav-item {
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: rgba(226, 232, 240, 0.78);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
    transform: translateX(2px);
}

.nav-item.active {
    background: rgba(20, 184, 166, 0.14);
    border-color: rgba(45, 212, 191, 0.22);
    color: #ffffff;
    box-shadow: none;
}

.nav-item.active::before {
    background: #2dd4bf;
}

.nav-icon {
    min-width: 42px;
    height: 30px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    color: inherit;
}

.topbar {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
    box-shadow: 0 2px 16px rgba(15, 23, 42, 0.05);
}

.page-title {
    font-weight: 800;
    color: var(--text-primary);
}

.content-wrapper {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
}

.card,
.stat-card,
.form-container,
.table-container,
.summary-card,
.order-card,
.ordered-history-card,
.cart-panel,
.customer-menu-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.card:hover,
.stat-card:hover,
.customer-menu-item:hover,
.ordered-history-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
}

.btn {
    min-height: 40px;
    border-radius: 8px;
    font-weight: 700;
    letter-spacing: 0;
    box-shadow: none;
}

.btn-primary {
    background: var(--gradient-primary);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.form-input,
.form-select,
.sales-date-input {
    min-height: 42px;
    border-radius: 8px;
    border-color: var(--border-color);
    background: var(--bg-input);
}

.form-input:focus,
.form-select:focus,
.sales-date-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.data-table th {
    background: #f2f7f7;
    color: var(--text-secondary);
    font-size: 0.78rem;
    letter-spacing: 0;
}

.data-table tr:hover td {
    background: #f8fbfa;
}

.badge,
.status-badge {
    border-radius: 999px;
    font-weight: 800;
}

.main-content--customer .content-wrapper {
    max-width: none;
    padding: 0;
}

.customer-order-page {
    min-height: 100svh;
    padding: clamp(14px, 3vw, 28px);
    background:
        radial-gradient(circle at top left, rgba(20, 184, 166, 0.12), transparent 32%),
        linear-gradient(180deg, #f9fbfb, #eef3f4);
}

.customer-name-card {
    width: min(520px, 100%);
    margin: 32px auto;
    padding: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
}

.customer-name-header {
    margin-bottom: 20px;
}

.customer-name-kicker,
.section-kicker {
    display: block;
    margin: 0 0 4px;
    color: var(--accent-primary-dark);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.customer-name-header h1 {
    margin: 0;
    font-size: clamp(1.45rem, 4vw, 2rem);
}

.customer-name-header p {
    margin: 8px 0 0;
    color: var(--text-secondary);
}

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

.customer-layout {
    width: min(1220px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
    gap: 18px;
    align-items: start;
}

.menu-list {
    min-width: 0;
}

.customer-category-section,
.ordered-history-section {
    background: transparent;
}

.customer-menu-heading {
    margin: 18px 0 12px;
}

.customer-menu-grid {
    gap: 14px;
}

.customer-menu-item {
    overflow: hidden;
    background: var(--bg-card);
}

.customer-menu-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #e8f0ef;
}

.customer-menu-placeholder,
.cart-row-image--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 800;
}

.customer-menu-body {
    min-width: 0;
}

.customer-menu-body h4,
.cart-row-text span {
    overflow-wrap: anywhere;
}

.customer-menu-meta span {
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.08);
    color: var(--accent-primary-dark);
    font-weight: 700;
}

.customer-menu-actions {
    display: grid;
    grid-template-columns: 42px 58px minmax(82px, 1fr);
    gap: 8px;
    align-items: center;
}

.customer-menu-actions .btn {
    min-width: 0;
    justify-content: center;
}

.cart-qty {
    min-height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #f8fbfa;
    color: var(--text-primary);
    font-weight: 800;
}

.cart-panel {
    top: 18px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
}

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

.cart-panel h3 {
    margin: 0;
    font-size: 1.25rem;
}

.cart-row {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #ffffff;
}

.cart-row-item {
    min-width: 0;
}

.cart-row-image {
    flex: 0 0 auto;
}

.cart-row-actions {
    gap: 6px;
}

.cart-control-btn,
.cart-remove-btn {
    min-height: 34px;
    border-radius: 7px;
    font-weight: 800;
}

.cart-total {
    border-top: 1px solid var(--border-color);
}

.order-success-page {
    min-height: 100svh;
    padding: clamp(14px, 3vw, 28px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background:
        radial-gradient(circle at top left, rgba(20, 184, 166, 0.12), transparent 34%),
        linear-gradient(180deg, #f9fbfb, #eef3f4);
}

.order-success-card {
    width: min(760px, 100%);
    padding: clamp(18px, 4vw, 28px);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
}

.order-success-header {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    margin-bottom: 18px;
}

.order-success-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(22, 163, 74, 0.12);
    color: var(--accent-success);
    font-size: 1.7rem;
    font-weight: 900;
}

.order-success-header h1 {
    margin: 0;
    font-size: clamp(1.35rem, 5vw, 2rem);
    line-height: 1.22;
}

.order-success-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 8px 0 0;
    color: var(--text-secondary);
    line-height: 1.55;
}

.order-success-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-success-item {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.order-success-thumb {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    background: #e8f0ef;
}

.order-success-thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.order-success-info {
    min-width: 0;
}

.order-success-info h2 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.order-success-info p {
    margin: 5px 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.order-success-line-total {
    text-align: right;
    white-space: nowrap;
}

.order-success-line-total span {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
}

.order-success-line-total strong {
    color: var(--accent-primary-dark);
    font-size: 1rem;
}

.order-success-footer {
    position: sticky;
    bottom: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    margin: 16px -6px -6px;
    padding: 12px 6px 6px;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
}

.order-success-total span {
    display: block;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.order-success-total strong {
    display: block;
    color: var(--accent-primary-dark);
    font-size: 1.45rem;
    line-height: 1.15;
}

.cart-checkout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.cart-checkout #submitCustomerOrder {
    width: 100%;
    justify-content: center;
}

.customer-empty-state {
    padding: 18px;
}

.customer-empty-state p {
    margin: 0;
}

@media (max-width: 1100px) {
    .customer-layout {
        grid-template-columns: 1fr;
    }

    .cart-panel {
        position: sticky;
        z-index: 20;
    }
}

@media (max-width: 820px) {
    .sidebar {
        width: min(320px, 86vw);
    }

    .filter-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: thin;
    }

    .filter-chip {
        flex: 0 0 auto;
    }

    .topbar {
        min-height: 64px;
        padding: 12px 16px;
    }

    .content-wrapper {
        padding: 16px;
    }

    .table-container {
        overflow-x: auto;
    }

    .data-table {
        min-width: 760px;
    }

    .customer-order-page {
        padding: 12px;
    }

    .customer-layout {
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    .cart-panel {
        order: -1;
        top: 0;
        width: calc(100% + 24px);
        margin: -12px -12px 4px;
        border-radius: 0 0 12px 12px;
        max-height: 54svh;
        overflow: auto;
    }

    .cart-items {
        max-height: 230px;
        overflow: auto;
    }

    .cart-checkout {
        position: sticky;
        bottom: -18px;
        z-index: 2;
        margin: 12px -18px -18px;
        padding: 12px 18px 18px;
        background: rgba(255, 255, 255, 0.96);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -10px 24px rgba(15, 23, 42, 0.08);
        backdrop-filter: blur(12px);
    }

    .cart-checkout .cart-total {
        padding-top: 0;
        border-top: 0;
    }

    .cart-checkout #submitCustomerOrder {
        min-height: 46px;
        font-size: 0.95rem;
    }

    .customer-menu-grid,
    .ordered-history-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .customer-menu-item {
        display: grid;
        grid-template-columns: 96px minmax(0, 1fr);
        min-height: 128px;
    }

    .customer-menu-image {
        width: 96px;
        height: 100%;
        aspect-ratio: auto;
    }

    .customer-menu-body {
        padding: 12px;
    }

    .customer-menu-body h4 {
        font-size: 0.98rem;
    }

    .customer-menu-body p {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .customer-menu-actions {
        grid-template-columns: 40px 52px minmax(72px, 1fr);
    }

    .cart-row {
        padding: 10px;
    }

    .order-success-page {
        padding: 10px;
    }

    .order-success-card {
        padding: 16px;
        border-radius: 12px;
    }

    .order-success-header {
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 10px;
        margin-bottom: 14px;
    }

    .order-success-icon {
        width: 46px;
        height: 46px;
        font-size: 1.35rem;
    }

    .order-success-meta .badge {
        width: fit-content;
    }

    .order-success-item {
        grid-template-columns: 58px minmax(0, 1fr);
        gap: 10px;
        align-items: start;
        padding: 10px;
    }

    .order-success-thumb {
        width: 58px;
        height: 58px;
    }

    .order-success-line-total {
        grid-column: 2;
        text-align: left;
        white-space: normal;
    }

    .order-success-line-total span {
        display: inline;
        margin-right: 6px;
    }

    .order-success-footer {
        grid-template-columns: 1fr;
        margin: 14px -16px -16px;
        padding: 12px 16px 16px;
        border-radius: 0 0 12px 12px;
        box-shadow: 0 -10px 24px rgba(15, 23, 42, 0.08);
    }

}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.05rem;
    }

    .customer-name-card {
        margin: 16px auto;
        padding: 20px;
    }

    .customer-menu-item {
        grid-template-columns: 88px minmax(0, 1fr);
    }

    .customer-menu-image {
        width: 88px;
    }

    .customer-menu-body h4 {
        font-size: 0.92rem;
    }

    .customer-menu-meta {
        gap: 6px;
    }

    .customer-menu-meta strong {
        font-size: 0.95rem;
    }

    .customer-menu-actions {
        grid-template-columns: 36px 46px minmax(66px, 1fr);
        gap: 6px;
    }

    .customer-menu-actions .btn,
    .cart-qty {
        min-height: 36px;
        padding: 6px 8px;
    }

    .cart-row-actions {
        flex-wrap: wrap;
    }

    .cart-remove-btn {
        flex: 1 1 100%;
    }
}
