* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #8B1A4A;
    --primary-light: #A93366;
    --primary-dark: #6D1038;
    --gold: #C9A84C;
    --gold-light: #E8D48B;
    --bg: #F5F0EB;
    --card: #FFFFFF;
    --text: #2D2D2D;
    --text-light: #777;
    --border: #E0D8D0;
    --success: #2E7D32;
    --danger: #C62828;
    --whatsapp: #25D366;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 10px;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    flex: 1;
}
.header-logo {
    height: 48px;
    width: 140px;
    object-fit: contain;
    border-radius: 8px;
    background: white;
    padding: 2px 6px;
}
.header-text { flex: 1; }
.header-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.header-subtitle {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.85;
    letter-spacing: 0.3px;
}
.btn-icon {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.2s;
}
.btn-icon:active { background: rgba(255,255,255,0.15); }

/* Quick Menu */
.quick-menu {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 150;
}
.quick-menu-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
}
.quick-menu-panel {
    position: absolute;
    top: 60px;
    right: 12px;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    min-width: 200px;
    overflow: hidden;
}
.quick-menu-panel button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 18px;
    border: none;
    background: white;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.quick-menu-panel button:last-child { border-bottom: none; }
.quick-menu-panel button:active { background: var(--bg); }
.quick-menu-panel button svg { color: var(--primary); flex-shrink: 0; }

/* Screens */
.screen {
    display: none;
    padding: 16px;
    padding-bottom: 100px;
    max-width: 600px;
    margin: 0 auto;
}
.screen.active { display: block; }

.screen-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.screen-title h2 {
    flex: 1;
    font-size: 20px;
    font-weight: 600;
}
.order-num {
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
    background: rgba(139,26,74,0.1);
    padding: 3px 8px;
    border-radius: 6px;
}

.btn-back {
    background: none;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 20px;
    padding: 4px 10px;
    cursor: pointer;
    color: var(--text);
}
.btn-back:active { background: var(--border); }

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Forms */
.form-group {
    margin-bottom: 12px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: var(--bg);
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:active { background: var(--primary-dark); }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: white;
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.btn-secondary:active { background: var(--bg); }

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: white;
    color: #dc3545;
    border: 1.5px solid #dc3545;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.btn-danger:active { background: #fff5f5; }

.btn-large {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 16px;
}

.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: var(--whatsapp);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.btn-whatsapp:active { background: #1DA851; }

.btn-scan {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    padding: 14px;
    background: var(--gold);
    color: var(--text);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}
.btn-scan:active { background: var(--gold-light); }
.scan-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.btn-manual {
    padding: 14px 16px;
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.btn-manual:active { background: var(--bg); }

/* Dashboard */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.dashboard-header h2 { font-size: 22px; }

.dashboard-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
}
.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    box-shadow: var(--shadow);
}
.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}
.stat-label {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

.search-bar {
    margin-bottom: 12px;
}
.search-bar input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    background: white;
}
.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
}

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.order-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.1s;
    border-left: 4px solid var(--primary);
}
.order-card:active { transform: scale(0.98); }
.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.order-card-num {
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
}
.order-card-total {
    font-weight: 700;
    font-size: 15px;
}
.order-card-customer {
    font-size: 15px;
    font-weight: 500;
}
.order-card-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
    flex-wrap: wrap;
}
.order-card-balance {
    color: var(--danger);
    font-weight: 600;
}

.dashboard-actions {
    text-align: center;
    padding: 16px 0;
}

/* Photo capture */
.photo-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-light);
    font-size: 14px;
    gap: 8px;
    overflow: hidden;
    position: relative;
}
.photo-preview img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    border-radius: 6px;
}
.photo-preview.has-photo {
    border-style: solid;
    border-color: var(--success);
    min-height: auto;
}
.photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.photos-grid img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
}
.photo-thumb-wrap {
    position: relative;
}
.photo-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(198, 40, 40, 0.85);
    color: white;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-subtotal {
    text-align: right;
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
    padding: 8px 0 4px;
    border-top: 1.5px solid var(--border);
    margin-top: 4px;
}

/* Multiplier bar */
.multiplier-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    padding: 10px 14px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 8px;
}
.multiplier-bar label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.ot-select {
    padding: 6px 12px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    background: white;
    color: var(--primary);
    cursor: pointer;
}

/* Scan section */
.scan-section {
    margin-bottom: 12px;
}

/* Search results */
.search-results {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 12px;
}
.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.search-result-item:active { background: var(--bg); }
.search-result-item:last-child { border-bottom: none; }
.search-result-img {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--bg);
    flex-shrink: 0;
}
.search-result-img.no-img {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-light);
    text-align: center;
}
.search-result-info {
    flex: 1;
    min-width: 0;
}
.search-result-barcode {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
}
.search-result-name {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-price {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

/* Order sections */
.order-section {
    margin-bottom: 8px;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--card);
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    box-shadow: var(--shadow);
}
.section-header h3 {
    font-size: 14px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.item-count {
    background: var(--primary);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
}
.items-list {
    background: var(--card);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow);
}

/* Order item */
.order-item {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}
.order-item:last-child { border-bottom: none; }
.order-item-img {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--bg);
    flex-shrink: 0;
}
.order-item-details {
    flex: 1;
    min-width: 0;
}
.order-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}
.order-item-top > div:first-child {
    min-width: 0;
    overflow: hidden;
}
.order-item-barcode {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
}
.order-item-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.order-item-price {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}
.order-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}
.qty-control {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qty-btn:active { background: var(--border); }
.qty-value {
    width: 36px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    border: none;
    background: white;
    padding: 4px;
}
.stock-toggle {
    display: flex;
    gap: 4px;
}
.stock-btn {
    padding: 4px 8px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    background: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}
.stock-btn.active-stock { background: var(--success); color: white; border-color: var(--success); }
.stock-btn.active-order { background: var(--gold); color: var(--text); border-color: var(--gold); }
.order-item-note {
    width: 100%;
    margin-top: 4px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    resize: none;
}
.btn-edit-item {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    opacity: 0.6;
}
.btn-edit-item:active { opacity: 1; }
.btn-remove {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    opacity: 0.6;
}
.btn-remove:active { opacity: 1; }
.edit-item-photo-preview {
    width: 100%;
    height: 160px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    overflow: hidden;
    color: var(--text-light);
    font-size: 13px;
    margin-bottom: 12px;
}
.edit-item-photo-preview.has-photo {
    border-style: solid;
    border-color: var(--primary);
}
.edit-item-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Screen footer */
.screen-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: white;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
    z-index: 50;
    max-width: 600px;
    margin: 0 auto;
}
.order-quick-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-light);
}
.share-buttons {
    display: flex;
    gap: 8px;
}
.share-buttons .btn-primary,
.share-buttons .btn-whatsapp,
.share-buttons .btn-secondary {
    flex: 1;
    justify-content: center;
    padding: 12px 8px;
    font-size: 14px;
}

/* Summary */
.summary-customer {
    font-size: 14px;
    line-height: 1.6;
}
.summary-customer strong { color: var(--primary); }
.summary-items {
    font-size: 14px;
}
.summary-item {
    display: flex;
    flex-wrap: wrap;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    gap: 4px 8px;
}
.summary-item:last-child { border-bottom: none; }
.summary-item-name { flex: 1; min-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-item-qty { color: var(--text-light); min-width: 40px; text-align: center; }
.summary-item-price { font-weight: 600; min-width: 70px; text-align: right; }
.summary-item-ws { font-size: 11px; color: var(--text-light); }
.summary-item-note { font-size: 12px; color: var(--primary); font-style: italic; width: 100%; }

.summary-totals { margin-top: 8px; }
.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}
.total-row input {
    width: 120px;
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    text-align: right;
    font-family: inherit;
}
.total-row select {
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: white;
}
.grand-total {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    border-top: 2px solid var(--primary);
    margin-top: 4px;
    padding-top: 10px;
}
.balance-due {
    font-size: 16px;
    font-weight: 700;
    color: var(--danger);
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-content {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; }
.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
}
.scanner-modal #scannerView {
    width: 100%;
    aspect-ratio: 4/3;
    background: black;
}
.scanner-status {
    padding: 10px 16px;
    text-align: center;
    font-size: 14px;
    color: var(--text-light);
}
.scanner-manual {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
}
.scanner-manual input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.scanner-manual button {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

/* View order */
#viewOrderContent .card { margin-bottom: 10px; }

/* Toast */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 300;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}
.empty-state svg { opacity: 0.3; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* Utility */
hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 4px 0;
}

/* OCR status */
.ocr-status {
    text-align: center;
    padding: 8px;
    font-size: 13px;
    color: var(--primary);
    font-weight: 500;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Crop modal */
.crop-modal { max-height: 95vh; }
.crop-container {
    position: relative;
    width: 100%;
    max-height: 60vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    touch-action: none;
}
.crop-container img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    display: block;
}
.crop-box {
    position: absolute;
    border: 2px solid white;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
    cursor: move;
    min-width: 40px;
    min-height: 40px;
}
.crop-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    justify-content: flex-end;
}

@media (min-width: 601px) {
    .screen { padding: 24px; max-width: 800px; }
    .screen-footer { left: 50%; transform: translateX(-50%); max-width: 800px; }
    .summary-item-name { max-width: 50%; }
}
@media (min-width: 1024px) {
    .screen { max-width: 900px; }
    .screen-footer { max-width: 900px; }
    .order-item-name { font-size: 13px; }
    .search-result-name { font-size: 13px; }
}

/* Login Screen */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: 20px;
}
.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px 28px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.login-logo {
    height: 100px;
    width: 200px;
    object-fit: contain;
    border-radius: 10px;
    margin-bottom: 12px;
}
.login-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}
.login-subtitle {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 28px;
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.login-form input, .login-setup input {
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}
.login-form input:focus, .login-setup input:focus {
    border-color: var(--primary);
}
.login-btn {
    padding: 13px !important;
    font-size: 16px !important;
    width: 100%;
    border-radius: var(--radius) !important;
    margin-top: 4px;
}
.login-error {
    color: var(--danger);
    font-size: 13px;
    min-height: 18px;
}
.login-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 16px;
}

/* Dashboard filters */
.dashboard-filters {
    margin-bottom: 12px;
}
.filter-row {
    display: flex;
    gap: 8px;
}
.filter-row input, .filter-row select {
    flex: 1;
    padding: 8px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    background: white;
}
.dashboard-stats .stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.dashboard-stats .stat-card {
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.dashboard-stats .stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}
.dashboard-stats .stat-label {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* User info in quick menu */
.quick-menu-user {
    padding: 10px 16px;
    font-size: 12px;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

/* Desktop orders table */
.orders-table-wrap {
    overflow-x: auto;
}
.orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.orders-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.orders-table th.num, .orders-table td.num {
    text-align: right;
}
.orders-table .order-row {
    cursor: pointer;
    transition: background 0.15s;
}
.orders-table .order-row:hover {
    background: #fdf2f4;
}
.orders-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.orders-table .order-num-cell {
    font-weight: 600;
    color: var(--primary);
}

/* Cancelled orders */
.cancelled-row { opacity: 0.5; }
.cancelled-row:hover { background: #f5f5f5; }
.cancelled-card { opacity: 0.5; border-left-color: #999; }
/* Manage Users list */
.user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.user-info { min-width: 0; flex: 1; }
.user-email { font-weight: 600; font-size: 14px; word-break: break-all; }
.user-role-label { font-size: 12px; color: var(--text-light); }
.user-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.user-action-btn {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    white-space: nowrap;
}
.user-action-btn:hover { background: var(--bg); }
.user-role-select {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}

.cancelled-banner {
    background: #fff5f5;
    color: #dc3545;
    border: 1px solid #dc3545;
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
}
.cancelled-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: #dc3545;
    background: #fff5f5;
    border: 1px solid #dc3545;
    border-radius: 4px;
    padding: 1px 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Desktop layout */
@media (min-width: 768px) {
    .screen { max-width: 1200px; margin: 0 auto; }
    .dashboard-stats .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    #screen-dashboard .search-bar {
        display: flex;
        gap: 12px;
        align-items: center;
    }

    /* Customer screen: visiting card + form side by side */
    .desktop-customer-row {
        display: flex;
        gap: 20px;
        align-items: flex-start;
    }
    .desktop-customer-row > .card:first-child {
        flex: 0 0 320px;
    }
    .desktop-customer-row > .card:last-child {
        flex: 1;
    }

    /* Order entry: wider scan bar */
    #screen-order .scan-section {
        display: flex;
        gap: 12px;
        align-items: center;
        flex-wrap: wrap;
    }
    #screen-order .scan-section .scan-row {
        flex: 0 0 auto;
    }
    #screen-order .scan-section .search-bar {
        flex: 1;
        min-width: 200px;
    }

    /* Order items in a wider table-like layout */
    .item-card {
        flex-direction: row;
        align-items: center;
        gap: 16px;
    }
    .item-card .item-photo {
        flex: 0 0 60px;
        height: 60px;
    }
    .item-card .item-info {
        flex: 1;
    }
    .item-card .item-actions {
        flex: 0 0 auto;
    }

    /* Order quick total bar wider */
    .order-quick-total {
        display: flex;
        gap: 24px;
    }
}

.date-quick-filters {
    display: flex;
    gap: 6px;
    padding: 0 16px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.date-quick-btn {
    padding: 7px 14px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    background: var(--card);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.date-quick-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.toggle-cancelled-btn {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    color: var(--text-light);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
.toggle-cancelled-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== Procurement ===== */
.procurement-tabs {
    display: flex;
    gap: 0;
    background: var(--card);
    border-radius: var(--radius);
    margin: 12px 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.proc-tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}
.proc-tab.active {
    background: var(--primary);
    color: white;
}
.proc-panel {
    padding: 0 16px 16px;
}
.proc-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.proc-card-tap {
    cursor: pointer;
    transition: transform 0.1s;
}
.proc-card-tap:active {
    transform: scale(0.98);
}
.proc-card-no-img {
    display: flex;
    align-items: center;
    justify-content: center;
}
.proc-card-photo {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg);
}
.proc-card-info {
    flex: 1;
    min-width: 0;
}
.proc-card-info h4 {
    font-size: 14px;
    margin-bottom: 2px;
}
.proc-card-info p {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 2px;
}
.proc-card-barcode {
    font-family: monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
}
.proc-card-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.proc-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.proc-btn-approve {
    background: var(--success);
    color: white;
}
.proc-btn-reject {
    background: var(--danger);
    color: white;
}
.proc-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.proc-status-pending {
    background: #FFF3E0;
    color: #E65100;
}
.proc-status-approved {
    background: #E8F5E9;
    color: #2E7D32;
}
.proc-status-rejected {
    background: #FFEBEE;
    color: #C62828;
}

/* Inward form */
.inward-photo-section {
    margin-bottom: 16px;
}
.inward-photo-preview {
    width: 100%;
    height: 200px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-light);
    font-size: 14px;
    overflow: hidden;
    background: var(--bg);
}
.inward-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.inward-barcode-preview {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 12px;
    text-align: center;
    font-family: monospace;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 2px;
}
.proc-form-row {
    display: flex;
    gap: 12px;
}
.proc-form-row .form-group {
    flex: 1;
}

/* Supplier list */
.supplier-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.supplier-card h4 {
    font-size: 15px;
    margin-bottom: 2px;
}
.supplier-card .supplier-code {
    font-family: monospace;
    font-size: 13px;
    color: var(--primary);
    font-weight: 700;
}
.supplier-card .supplier-count {
    font-size: 12px;
    color: var(--text-light);
}
.proc-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-light);
    font-size: 14px;
}
.browse-filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.browse-filters input,
.browse-filters select {
    padding: 12px 14px;
    font-size: 15px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}
.browse-filters input:focus,
.browse-filters select:focus {
    border-color: var(--primary);
    outline: none;
}

/* Desktop procurement */
@media (min-width: 768px) {
    .browse-filters {
        flex-direction: row;
    }
    .browse-filters input { flex: 2; }
    .browse-filters select { flex: 1; }

    .browse-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 12px;
    }
    .browse-grid .proc-card {
        flex-direction: column;
        margin-bottom: 0;
    }
    .browse-grid .proc-card-photo {
        width: 100%;
        height: 180px;
        border-radius: 8px 8px 0 0;
    }
    .browse-grid .proc-card-info {
        padding: 8px 4px;
    }
}

/* ===== Browse View Toggle ===== */
.browse-view-toggle {
    display: flex;
    gap: 2px;
    background: var(--bg);
    border-radius: 6px;
    padding: 2px;
}
.browse-view-btn {
    padding: 5px 8px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-light);
    display: flex;
    align-items: center;
}
.browse-view-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.browse-results-grid {
    display: grid;
    gap: 10px;
}
.browse-results-grid.view-large {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.browse-results-grid.view-large .proc-card {
    flex-direction: column;
    margin-bottom: 0;
    overflow: hidden;
}
.browse-results-grid.view-large .proc-card-photo {
    width: 100%;
    height: 180px;
    border-radius: 8px 8px 0 0;
}
.browse-results-grid.view-large .proc-card-info {
    padding: 8px 4px;
    min-width: 0;
    width: 100%;
}
.browse-results-grid.view-large .proc-card-info h4,
.browse-results-grid.view-large .proc-card-info p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.browse-results-grid.view-small {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
}
.browse-results-grid.view-small .proc-card {
    flex-direction: column;
    padding: 6px;
    margin-bottom: 0;
    overflow: hidden;
}
.browse-results-grid.view-small .proc-card-photo {
    width: 100%;
    height: 120px;
    border-radius: 6px 6px 0 0;
}
.browse-results-grid.view-small .proc-card-info {
    padding: 4px 2px;
    min-width: 0;
    width: 100%;
}
.browse-results-grid.view-small .proc-card-info h4,
.browse-results-grid.view-small .proc-card-info p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.browse-results-grid.view-small .proc-card-info h4 {
    font-size: 12px;
}
.browse-results-grid.view-small .proc-card-info p {
    font-size: 10px;
}
.browse-results-grid.view-small .proc-card-info p:last-child {
    display: none;
}

.browse-results-grid.view-list .proc-card {
    padding: 8px 10px;
    margin-bottom: 0;
    gap: 10px;
}
.browse-results-grid.view-list .proc-card-photo {
    width: 44px;
    height: 44px;
    border-radius: 6px;
}
.browse-results-grid.view-list .proc-card-info h4 {
    font-size: 13px;
}

/* ===== Ticket Summary on Dashboard ===== */
.offline-banner {
    position: sticky;
    top: 56px;
    z-index: 90;
    background: #333;
    color: #fff;
    text-align: center;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
}

.dashboard-ticket-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 16px 10px;
    padding: 10px 14px;
    background: #FFF8E1;
    border: 1.5px solid #FFD54F;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}
.dashboard-ticket-summary:active { background: #FFF3C4; }
.ticket-summary-icon { font-size: 20px; }
.ticket-summary-text { flex: 1; font-size: 13px; color: var(--text); }
.ticket-summary-text strong { display: block; }
.ticket-summary-overdue {
    color: var(--danger);
    font-size: 12px;
    font-weight: 600;
}
.ticket-summary-arrow {
    font-size: 18px;
    color: var(--text-light);
    font-weight: 700;
}

/* ===== Tickets ===== */
.ticket-stats {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
}
.ticket-stat {
    flex: 1;
    text-align: center;
    padding: 10px 6px;
    border-radius: var(--radius);
    background: white;
    border: 1.5px solid var(--border);
}
.ticket-stat-count {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}
.ticket-stat-label {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}
.ticket-stat.overdue .ticket-stat-count { color: var(--danger); }
.ticket-stat.closed .ticket-stat-count { color: #388E3C; }

.ticket-filters {
    display: flex;
    gap: 6px;
    padding: 0 16px 12px;
}
.ticket-filter-btn {
    flex: 1;
    padding: 8px 4px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    background: white;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
}
.ticket-filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tickets-list {
    padding: 0 16px 80px;
}
.ticket-card {
    background: white;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.ticket-card:active { border-color: var(--primary); }
.ticket-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}
.ticket-card-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
}
.ticket-card-subject {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 4px 0;
}
.ticket-card-meta {
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 6px;
}
.ticket-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.ticket-status-badge.open { background: #FFF3E0; color: #E65100; }
.ticket-status-badge.overdue { background: #FFEBEE; color: #C62828; }
.ticket-status-badge.closed { background: #E8F5E9; color: #2E7D32; }

.ticket-detail-card {
    background: white;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    padding: 14px;
    margin: 0 16px 10px;
}
.ticket-detail-subject {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.ticket-detail-meta {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.8;
}
.ticket-detail-actions {
    display: flex;
    gap: 8px;
    padding: 0 16px 10px;
}
.ticket-detail-actions button { flex: 1; }

.ticket-notes-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-light);
    padding: 8px 16px 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ticket-note {
    background: white;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    padding: 10px 14px;
    margin: 0 16px 6px;
}
.ticket-note-author {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
}
.ticket-note-time {
    font-size: 11px;
    color: var(--text-light);
    margin-left: 8px;
}
.ticket-note-text {
    font-size: 13px;
    color: var(--text);
    margin-top: 4px;
    white-space: pre-wrap;
}
.ticket-note-input {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1.5px solid var(--border);
    padding: 10px 16px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    z-index: 50;
}
.ticket-note-input textarea {
    flex: 1;
    padding: 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    resize: none;
}
.ticket-note-input button {
    padding: 10px 16px;
    white-space: nowrap;
}

/* ===== Operations Screen ===== */
.ops-content { padding: 0 16px 24px; }
.ops-section { margin-bottom: 20px; }
.ops-section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.ops-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.ops-stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
}
.ops-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}
.ops-stat-label {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}
.ops-chart {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    overflow-x: auto;
}
.ops-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 120px;
    min-width: fit-content;
}
.ops-chart-bar {
    width: 16px;
    min-height: 2px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
    position: relative;
}
.ops-chart-bar:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
}
.ops-chart-labels {
    display: flex;
    gap: 3px;
    margin-top: 4px;
}
.ops-chart-labels span {
    width: 16px;
    text-align: center;
    font-size: 8px;
    color: var(--text-light);
}
.ops-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    font-size: 13px;
}
.ops-user-email { font-weight: 500; }
.ops-user-role {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #f0f0f0;
    color: var(--text-light);
}
.ops-user-role.admin { background: var(--primary); color: #fff; }
.ops-user-orders { font-size: 12px; color: var(--text-light); }
.ops-audit-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    font-size: 12px;
}
.ops-audit-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}
.ops-audit-body { flex: 1; min-width: 0; }
.ops-audit-action { font-weight: 600; font-size: 13px; }
.ops-audit-details { color: var(--text-light); margin-top: 2px; }
.ops-audit-meta {
    font-size: 11px;
    color: var(--text-light);
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
}
.ops-firebase-bar {
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    margin: 6px 0 4px;
}
.ops-firebase-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}
.ops-firebase-fill.green { background: #4caf50; }
.ops-firebase-fill.yellow { background: #ff9800; }
.ops-firebase-fill.red { background: #f44336; }
.ops-firebase-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-light);
}

/* Guest Scanner Session */
#guestSessionBar { padding: 0 16px; margin-bottom: 8px; }
.btn-guest-start {
    width: 100%;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    background: transparent;
    border: 1.5px dashed var(--primary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.guest-active-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f0faf0;
    border: 1px solid #b8e6b8;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #2d7a2d;
}
.guest-pulse {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: guestPulse 2s infinite;
}
@keyframes guestPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.guest-active-bar button {
    margin-left: auto;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #b8e6b8;
    border-radius: 4px;
    background: white;
    color: #2d7a2d;
    cursor: pointer;
}
.guest-active-bar .btn-end {
    color: #d32f2f;
    border-color: #f5c6c6;
    margin-left: 4px;
}

/* Live Orders */
.live-orders-wrap {
    margin: 0 16px 12px;
    border: 1px solid #22C55E;
    border-radius: 10px;
    overflow: hidden;
    background: #f0fdf4;
}
.live-orders-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #166534;
    border-bottom: 1px solid #bbf7d0;
}
.live-pulse {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #22C55E;
    animation: guest-pulse 1.5s ease-in-out infinite;
}
.live-order-card {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #dcfce7;
}
.live-order-card:last-child { border-bottom: none; }
.live-order-mine { cursor: pointer; }
.live-order-mine:active { background: #dcfce7; }
.live-order-info { flex: 1; min-width: 0; }
.live-order-num { font-size: 14px; font-weight: 700; color: #111; }
.live-order-meta { font-size: 12px; color: #666; margin-top: 2px; }
.live-order-stats {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    margin-left: 12px;
    text-align: center;
}
.live-stat-val { font-size: 18px; font-weight: 700; color: #166534; font-variant-numeric: tabular-nums; }
.live-stat-lbl { font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 0.03em; }
.live-end-btn {
    flex-shrink: 0;
    width: 28px; height: 28px;
    margin-left: 8px;
    border: 1px solid #fca5a5;
    border-radius: 50%;
    background: #fef2f2;
    color: #dc2626;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Invoice Status */
.btn-invoice {
    background: #0d6efd;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.invoiced-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: #0d6efd;
    background: #e7f1ff;
    border: 1px solid #0d6efd;
    border-radius: 4px;
    padding: 1px 6px;
    vertical-align: middle;
}
.invoiced-banner {
    background: #e7f1ff;
    color: #0d6efd;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
}
.stat-clickable {
    cursor: pointer;
    transition: transform 0.15s;
}
.stat-clickable:active {
    transform: scale(0.96);
}
.stat-sub {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}

/* Stat Drilldown */
.drilldown-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.drilldown-modal {
    background: white;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.drilldown-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    gap: 12px;
}
.drilldown-header h3 {
    margin: 0;
    font-size: 16px;
    flex: 1;
}
.drilldown-total {
    font-weight: 700;
    font-size: 15px;
    color: var(--primary);
}
.drilldown-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0 4px;
}
.drilldown-list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.drilldown-row {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}
.drilldown-row:active {
    background: #f5f5f5;
}
.drilldown-row-left {
    flex: 1;
    min-width: 0;
}
.drilldown-row-name {
    font-weight: 600;
    font-size: 14px;
}
.drilldown-row-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}
.drilldown-row-amount {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    margin-left: 12px;
}
@media (min-width: 768px) {
    .drilldown-modal {
        border-radius: 16px;
        margin-bottom: 10vh;
    }
    .drilldown-overlay {
        align-items: center;
    }
}
