/* ============================================
   Oemah Kwawak - Custom Styles
   Complements Tailwind CSS
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Brand - warm coffee tones */
    --primary: #8B6914;
    --primary-dark: #6B4F0A;
    --primary-light: #D4A843;
    --primary-lighter: #E8C97A;
    --primary-bg: #FDF6E3;

    /* Dark theme */
    --dark: #1a1a2e;
    --dark-mid: #16213e;
    --dark-deep: #0f3460;

    /* Accent */
    --accent: #e94560;
    --accent-light: #ff6b81;

    /* Surfaces */
    --surface: #ffffff;
    --surface-hover: #f9f5ee;
    --surface-card: #fffdf8;
    --surface-muted: #f5f0e8;

    /* Text */
    --text-primary: #2d2013;
    --text-secondary: #6b5b3e;
    --text-muted: #9a8c76;
    --text-on-dark: #e8dcc8;
    --text-on-primary: #ffffff;

    /* Status */
    --success: #27ae60;
    --success-bg: #eafaf1;
    --warning: #f39c12;
    --warning-bg: #fef9e7;
    --danger: #e74c3c;
    --danger-bg: #fdedec;
    --info: #3498db;
    --info-bg: #ebf5fb;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed: 0px;

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

/* --- Base / Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--surface-muted);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) transparent;
}

/* --- Layout --- */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--dark) 0%, var(--dark-mid) 50%, var(--dark-deep) 100%);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal), width var(--transition-normal);
    z-index: 40;
    overflow-y: auto;
    overflow-x: hidden;
}

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

.sidebar-logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: var(--primary-light);
}

.sidebar-logo p {
    font-size: 0.75rem;
    margin: 0.25rem 0 0;
    color: var(--text-muted);
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: 0.5rem;
    color: var(--text-on-dark);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
    position: relative;
    user-select: none;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: var(--primary-light);
}

.nav-item.active {
    background: var(--primary);
    color: var(--text-on-primary);
    box-shadow: 0 2px 8px rgba(139,105,20,0.3);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--primary-light);
    border-radius: 0 2px 2px 0;
}

.nav-icon {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Sidebar mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 35;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    position: relative;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    min-height: 56px;
    flex-shrink: 0;
}

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

.menu-toggle:hover {
    background: var(--surface-muted);
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* --- Page System --- */
.page {
    animation: pageIn var(--transition-normal) ease;
}

.page.hidden {
    display: none !important;
}

@keyframes pageIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Stat Cards --- */
.stat-card {
    background: var(--surface);
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.04);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 0.25rem 0;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-card .stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* --- Product Cards --- */
.product-card {
    background: var(--surface-card);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 0.75rem;
    padding: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

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

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

.product-card .product-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

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

.product-card .product-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    background: var(--primary-bg);
    color: var(--primary-dark);
    margin-top: 0.5rem;
}

/* Add-to-cart ripple effect */
.product-card.added::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139,105,20,0.15);
    font-size: 2rem;
    color: var(--primary);
    animation: addPulse 0.4s ease forwards;
    pointer-events: none;
}

@keyframes addPulse {
    0%   { opacity: 1; transform: scale(0.8); }
    100% { opacity: 0; transform: scale(1.2); }
}

/* --- Category Pills --- */
.category-pills {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
}

.category-pill {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    background: var(--surface);
    border: 1px solid rgba(0,0,0,0.08);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
    color: var(--text-secondary);
}

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

.category-pill.active {
    background: var(--primary);
    color: var(--text-on-primary);
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(139,105,20,0.25);
}

/* --- Cart --- */
.cart-panel {
    background: var(--surface);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.cart-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 0;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(0,0,0,0.03);
    transition: background var(--transition-fast);
    animation: cartItemIn 0.2s ease;
}

@keyframes cartItemIn {
    from { opacity: 0; transform: translateX(10px); }
    to   { opacity: 1; transform: translateX(0); }
}

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

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

.cart-item-title {
    font-weight: 600;
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}

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

.cart-item-subtotal {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
    white-space: nowrap;
    text-align: right;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 0 0 auto;
}

.cart-qty-btn,
.cart-item-del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--surface-muted);
    cursor: pointer;
    border-radius: 0.375rem;
    transition: background var(--transition-fast);
}

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

.cart-item-qty {
    min-width: 1.75rem;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.cart-item-del {
    flex: 0 0 auto;
    color: var(--text-muted);
}

.cart-item-del:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.cart-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(0,0,0,0.06);
    background: var(--surface-muted);
}

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    text-align: center;
}

.cart-empty .empty-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

/* Cart count badge */
.cart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 9999px;
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    animation: badgePop 0.3s ease;
}

@keyframes badgePop {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* --- Payment Section --- */
.payment-method-toggle {
    display: flex;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
}

.payment-method-btn {
    flex: 1;
    padding: 0.5rem;
    border: none;
    background: var(--surface);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    text-align: center;
}

.payment-method-btn:not(:last-child) {
    border-right: 1px solid rgba(0,0,0,0.1);
}

.payment-method-btn.active {
    background: var(--primary);
    color: var(--text-on-primary);
}

.payment-method-btn:hover:not(.active) {
    background: var(--surface-hover);
}

/* Number Pad */
.number-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.number-pad button {
    padding: 0.6rem;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 0.375rem;
    background: var(--surface);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.number-pad button:hover {
    background: var(--primary-bg);
    border-color: var(--primary-light);
}

.number-pad button:active {
    transform: scale(0.95);
}

.number-pad button.numpad-clear {
    background: var(--danger-bg);
    color: var(--danger);
}

.number-pad button.numpad-enter {
    background: var(--success);
    color: white;
}

/* Quick amount buttons */
.quick-amounts {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.quick-amount-btn {
    flex: 1;
    min-width: 70px;
    padding: 0.45rem 0.5rem;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 0.375rem;
    background: var(--surface);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    text-align: center;
    white-space: nowrap;
}

.quick-amount-btn:hover {
    background: var(--primary-bg);
    border-color: var(--primary-light);
    color: var(--primary);
}

/* --- Modal / Overlay --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--surface);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-normal);
}

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

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

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    color: var(--accent);
    background: var(--danger-bg);
}

.modal-body {
    padding: 1.5rem;
}

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

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

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-radius: 0.5rem;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--info);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 3.7s forwards;
    max-width: 380px;
    font-size: 0.9rem;
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.toast .toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon   { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(100%); }
}

/* --- Loading Spinner --- */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--surface-muted);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

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

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

/* --- Tables --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table thead {
    background: var(--surface-muted);
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

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

.data-table tbody tr:hover {
    background: var(--surface-hover);
}

.catalog-responsive-table td[data-label="Aksi"] button + button {
    margin-left: 0.5rem;
}

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

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

.form-input {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 0.375rem;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    background: var(--surface);
    color: var(--text-primary);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139,105,20,0.15);
}

.form-select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 0.375rem;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139,105,20,0.15);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--primary);
    color: var(--text-on-primary);
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover { background: #219a52; }

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover { background: #c0392b; }

.btn-secondary {
    background: var(--surface-muted);
    color: var(--text-secondary);
    border: 1px solid rgba(0,0,0,0.08);
}
.btn-secondary:hover { background: var(--surface-hover); }

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

.btn-lg {
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* --- Badge --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-primary { background: var(--primary-bg); color: var(--primary); }

/* --- Stock Level Colors --- */
.stock-ok      { color: var(--success); }
.stock-warning { color: var(--warning); }
.stock-low     { color: var(--danger); font-weight: 700; }

.stock-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.35rem;
}
.stock-indicator.ok      { background: var(--success); }
.stock-indicator.warning { background: var(--warning); }
.stock-indicator.low     { background: var(--danger); animation: pulse 1.5s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* --- Alert Banner --- */
.alert-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.alert-banner.warning {
    background: var(--warning-bg);
    border: 1px solid rgba(243,156,18,0.3);
    color: #7d6608;
}

.alert-banner.danger {
    background: var(--danger-bg);
    border: 1px solid rgba(231,76,60,0.3);
    color: #922b21;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    border-bottom: 2px solid rgba(0,0,0,0.06);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    user-select: none;
}

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

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* --- Empty States --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

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

.empty-state .empty-text {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.empty-state .empty-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Receipt / Print --- */
.receipt-container {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    width: 280px;
    margin: 0 auto;
    line-height: 1.4;
    color: #000;
    background: #fff;
}

.receipt-container .receipt-divider {
    border-top: 1px dashed #333;
    margin: 4px 0;
}

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

.receipt-container .receipt-row {
    display: flex;
    justify-content: space-between;
}

.receipt-container .receipt-total {
    font-weight: bold;
    font-size: 14px;
}

@media print {
    body * { visibility: hidden; }
    .receipt-print-area,
    .receipt-print-area * {
        visibility: visible;
    }
    .receipt-print-area {
        position: absolute;
        top: 0;
        left: 0;
        width: 80mm;
        margin: 0;
        padding: 5mm;
        font-family: 'Courier New', monospace;
        font-size: 12px;
        color: #000;
        background: #fff;
    }
}

/* --- Grand Total Display --- */
.grand-total {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    text-align: right;
}

/* --- Responsive --- */
@media (max-width: 1023px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        transform: translateX(-100%);
    }

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

    .sidebar-overlay.open {
        display: block;
    }

    .sidebar.collapsed {
        width: var(--sidebar-width) !important;
        min-width: var(--sidebar-width) !important;
    }

    .sidebar.collapsed .sidebar-logo h1,
    .sidebar.collapsed .sidebar-logo p,
    .sidebar.collapsed .nav-item span:not(.nav-icon),
    .sidebar.collapsed .sidebar-footer {
        display: initial !important;
    }

    .sidebar.collapsed .sidebar-logo {
        padding: 1.5rem 1.25rem;
        text-align: left;
    }

    .sidebar.collapsed .nav-item {
        justify-content: flex-start;
        padding: 0.75rem 1rem;
        margin: 0 0 0.25rem;
    }

    .menu-toggle {
        display: block;
    }

    .content-area {
        padding: 1rem;
    }

    .pos-layout {
        flex-direction: column;
    }

    .pos-products,
    .pos-cart {
        width: 100% !important;
    }

    .pos-cart {
        max-height: 50vh;
    }
}

@media (max-width: 640px) {
    .content-area {
        padding: 0.75rem;
    }

    .stat-card .stat-value {
        font-size: 1.2rem;
    }

    .product-card {
        padding: 0.75rem;
    }

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

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.65rem;
    }

    #tab-categories > .flex.items-center.justify-between {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    #category-table-container,
    #product-table-container,
    #recent-transactions,
    #ingredient-table-container,
    #opname-form-table,
    #opname-history-container,
    #report-transactions-container {
        overflow: visible;
    }

    .catalog-responsive-table,
    .mobile-cards-table {
        display: block;
        width: 100%;
    }

    .catalog-responsive-table thead,
    .mobile-cards-table thead {
        display: none;
    }

    .catalog-responsive-table tbody,
    .mobile-cards-table tbody {
        display: grid;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .catalog-responsive-table tbody.divide-y > :not(:first-child),
    .mobile-cards-table tbody.divide-y > :not(:first-child) {
        border-top-width: 0;
        border-bottom-width: 0;
    }

    .catalog-responsive-table tbody tr,
    .mobile-cards-table tbody tr {
        display: grid;
        gap: 0.35rem 0.75rem;
        min-width: 0;
        padding: 0.75rem;
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 0.75rem;
        background: var(--surface);
        box-shadow: var(--shadow-sm);
    }

    .catalog-responsive-table td {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        min-width: 0;
        padding: 0.35rem 0;
        border: 0;
        text-align: left;
        overflow-wrap: anywhere;
    }

    .catalog-responsive-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.68rem;
        font-weight: 600;
        line-height: 1.2;
    }

    .mobile-cards-table tbody tr {
        grid-template-columns: minmax(0, 1fr);
    }

    .mobile-cards-table td {
        display: grid;
        grid-template-columns: minmax(5.5rem, 0.4fr) minmax(0, 1fr);
        align-items: start;
        gap: 0.5rem;
        min-width: 0;
        padding: 0.45rem 0;
        border: 0;
        text-align: left;
        overflow-wrap: anywhere;
    }

    .mobile-cards-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.68rem;
        font-weight: 600;
        line-height: 1.3;
    }

    .mobile-cards-table td[data-label="Aksi"] {
        display: flex;
        gap: 0.5rem;
        padding-top: 0.65rem;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
    }

    .mobile-cards-table td[data-label="Aksi"]::before {
        display: none;
    }

    .mobile-cards-table td[data-label="Aksi"] button {
        flex: 1 1 0;
        min-width: 0;
        min-height: 40px;
        padding-right: 0.4rem;
        padding-left: 0.4rem;
    }

    .mobile-cards-table td[data-label="Aksi"] button + button {
        margin-left: 0;
    }

    .opname-input-table input.form-input {
        width: 100%;
        min-width: 0;
    }

    .catalog-category-table tbody tr {
        grid-template-columns: 2.5rem minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "icon name name"
            "order order status"
            "actions actions actions";
    }

    .catalog-category-table td[data-label="Ikon"] {
        grid-area: icon;
        align-items: center;
        justify-content: center;
    }

    .catalog-category-table td[data-label="Ikon"]::before,
    .catalog-category-table td[data-label="Nama Kategori"]::before {
        display: none;
    }

    .catalog-category-table td[data-label="Nama Kategori"] {
        grid-area: name;
        justify-content: center;
    }

    .catalog-category-table td[data-label="Urutan"] {
        grid-area: order;
    }

    .catalog-category-table td[data-label="Status"] {
        grid-area: status;
    }

    .catalog-product-table tbody tr {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "menu menu"
            "category category"
            "price status"
            "actions actions";
    }

    .catalog-product-table td[data-label="Menu"] {
        grid-area: menu;
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
    }

    .catalog-product-table td[data-label="Menu"]::before {
        display: none;
    }

    .catalog-product-table td[data-label="Menu"] > div {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .catalog-product-table td[data-label="Kategori"] {
        grid-area: category;
    }

    .catalog-product-table td[data-label="Kategori"] > span {
        max-width: 100%;
        flex-wrap: wrap;
        overflow-wrap: anywhere;
    }

    .catalog-product-table td[data-label="Harga"] {
        grid-area: price;
    }

    .catalog-product-table td[data-label="Status"] {
        grid-area: status;
    }

    .catalog-responsive-table td[data-label="Aksi"] {
        grid-area: actions;
        flex-direction: row;
        gap: 0.5rem;
        padding-top: 0.65rem;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
    }

    .catalog-responsive-table td[data-label="Aksi"]::before {
        display: none;
    }

    .catalog-responsive-table td[data-label="Aksi"] button {
        flex: 1 1 0;
        min-width: 0;
        min-height: 40px;
        padding-right: 0.4rem;
        padding-left: 0.4rem;
    }

    .catalog-responsive-table td[data-label="Aksi"] button + button {
        margin-left: 0;
    }

    .modal-content {
        max-width: 100%;
        border-radius: 0.75rem 0.75rem 0 0;
        max-height: 95vh;
    }

    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .grand-total {
        font-size: 1.25rem;
    }
}

/* --- Utility --- */
.text-rupiah {
    font-variant-numeric: tabular-nums;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* POS layout */
.pos-layout {
    display: flex;
    gap: 1rem;
    height: calc(100vh - 120px);
}

.pos-products {
    flex: 6;
    overflow-y: auto;
    min-width: 0;
}

.pos-cart {
    flex: 4;
    min-width: 300px;
}

.mobile-cart-toggle,
.mobile-cart-close {
    display: none;
}

.content-area.cart-modal-open {
    overflow: hidden;
}

.page-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 50;
    transition: opacity 150ms ease, visibility 150ms ease;
}

.page-loading.active {
    opacity: 1;
    visibility: visible;
}

.page-loading::after {
    content: "";
    display: block;
    width: 35%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light), var(--primary), var(--primary-light));
    animation: pageLoadingSlide 1s ease-in-out infinite;
}

.page-loading span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

@keyframes pageLoadingSlide {
    from { transform: translateX(-100%); }
    to { transform: translateX(300%); }
}

@media (max-width: 1023px) {
    .cart-items {
        min-height: 0;
    }

    .cart-footer {
        min-height: 0;
        flex: 0 1 auto;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .pos-cart {
        min-width: 0;
    }
}

@media (max-width: 640px) {
    .top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
    }

    .top-bar > div:first-child {
        width: 100%;
        min-width: 0;
    }

    .top-bar > div:first-child h2 {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .top-bar > div:last-child {
        width: 100%;
        min-width: 0;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    #shift-control,
    #clock {
        white-space: nowrap;
    }

    .product-actions,
    .stock-controls,
    .report-controls {
        width: 100%;
    }

    #page-pos {
        padding-bottom: 5.5rem;
    }

    .pos-layout {
        display: block;
        height: auto;
        min-height: 0;
    }

    .pos-products {
        flex: none;
        overflow: visible;
    }

    .pos-cart {
        display: none;
    }

    #page-pos.cart-open .pos-cart {
        position: fixed;
        inset: 0;
        z-index: 80;
        display: block;
        width: 100%;
        min-width: 0;
        height: 100dvh;
        max-height: none;
        overflow-y: auto;
        overflow-x: hidden;
        background: var(--surface);
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    #page-pos.cart-open {
        animation: none;
    }

    #page-pos.cart-open .cart-panel {
        height: auto;
        min-height: 100dvh;
        overflow: visible;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    #page-pos.cart-open .cart-header {
        position: sticky;
        top: 0;
        z-index: 1;
        padding: 0.75rem 1rem;
        background: var(--surface);
    }

    #page-pos.cart-open .mobile-cart-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: 0;
        border-radius: 9999px;
        background: var(--surface-muted);
        color: var(--text-primary);
        cursor: pointer;
    }

    #page-pos.cart-open .cart-items {
        flex: none;
        overflow: visible;
        max-height: none;
        padding-bottom: 0.5rem;
    }

    .cart-header {
        padding: 0.65rem 0.85rem;
    }

    .cart-item {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "info subtotal"
            "controls delete";
        align-items: center;
        gap: 0.6rem 0.75rem;
        padding: 0.8rem 0.75rem;
    }

    .cart-item-info {
        grid-area: info;
    }

    .cart-item-title {
        font-size: 0.9rem;
        line-height: 1.35;
    }

    .cart-item-subtotal {
        grid-area: subtotal;
        align-self: start;
        font-size: 0.9rem;
    }

    .cart-item-subtotal::before {
        content: "Subtotal";
        display: block;
        margin-bottom: 0.15rem;
        color: var(--text-muted);
        font-size: 0.65rem;
        font-weight: 500;
    }

    .cart-item-controls {
        grid-area: controls;
    }

    .cart-item-del {
        grid-area: delete;
        justify-self: end;
    }

    .cart-qty-btn,
    .cart-item-del {
        width: 40px;
        height: 40px;
    }

    .cart-item-qty {
        min-width: 2rem;
    }

    .cart-empty {
        padding: 0.75rem;
    }

    .cart-footer {
        display: flex;
        flex: none;
        flex-direction: column;
        padding: 0.75rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
        min-height: auto;
        overflow: visible;
    }

    .cart-footer-fields {
        flex: none;
        min-height: auto;
        overflow: visible;
    }

    #page-pos .cart-footer > .btn-success {
        flex: 0 0 auto;
        margin-top: 0.5rem;
    }

    #page-pos:not(.cart-open) .mobile-cart-toggle {
        position: fixed;
        right: 0.75rem;
        bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
        left: 0.75rem;
        z-index: 50;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        min-height: 56px;
        padding: 0.65rem 1rem;
        border: 0;
        border-radius: 0.875rem;
        background: var(--primary);
        color: var(--text-on-primary);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
        text-align: left;
        cursor: pointer;
    }

    .mobile-cart-toggle-info {
        display: flex;
        flex-direction: column;
        min-width: 0;
        line-height: 1.25;
    }

    .mobile-cart-toggle-label {
        font-weight: 700;
    }

    #mobile-cart-count {
        font-size: 0.75rem;
        opacity: 0.85;
    }

    #mobile-cart-total {
        flex: 0 0 auto;
        font-size: 0.95rem;
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .page-loading::after {
        animation: none;
        width: 100%;
    }
}

/* Confirm Dialog */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.confirm-box {
    background: var(--surface);
    border-radius: 0.75rem;
    padding: 1.5rem;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.confirm-box p {
    margin: 0 0 1.25rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}


/* --- Operational & Void Styles --- */
.badge-danger {
    background-color: #fee2e2;
    color: #b91c1c;
}
.badge-success {
    background-color: #dcfce7;
    color: #15803d;
}
.badge-warning {
    background-color: #fef3c7;
    color: #b45309;
}
.badge-info {
    background-color: #e0f2fe;
    color: #0369a1;
}

.receipt-voided {
    position: relative;
    border: 2px dashed #dc2626 !important;
}

.receipt-voided::before {
    content: "DIBATALKAN / VOID";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-35deg);
    font-size: 28px;
    font-weight: 900;
    color: rgba(220, 38, 38, 0.22);
    pointer-events: none;
    white-space: nowrap;
    border: 3px solid rgba(220, 38, 38, 0.22);
    padding: 8px 16px;
    letter-spacing: 2px;
}


/* --- Collapsible Sidebar Styles --- */

.sidebar.collapsed {
    width: 76px !important;
    min-width: 76px !important;
}

.sidebar.collapsed .sidebar-logo h1,
.sidebar.collapsed .sidebar-logo p,
.sidebar.collapsed .nav-item span:not(.nav-icon),
.sidebar.collapsed .sidebar-footer {
    display: none !important;
}

.sidebar.collapsed .sidebar-logo {
    padding: 1.25rem 0.5rem;
    text-align: center;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.85rem 0;
    margin: 0.35rem 0.5rem;
}

.sidebar.collapsed .nav-icon {
    font-size: 1.25rem;
    margin: 0;
}

/* Product Card Photo Support */
.product-card {
    padding: 0.65rem !important;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-card-img {
    width: 100%;
    height: 105px;
    object-fit: cover;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: #f5f0e8;
    transition: transform 0.3s ease;
}

@media (min-width: 1024px) {
    .sidebar {
        position: relative;
        transform: none;
    }
}

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