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

/* ABC Terminal - Mobile-First CSS */
.queue-diagnostics { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 65vh; overflow: auto; user-select: text; }
#queueReviewModal { z-index: 10000; }
/* ================================ */

:root {
    /* Dark theme with vibrant accents */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #252542;
    --bg-card: #16213e;
    
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --text-muted: #666;
    
    --accent-primary: #00d9ff;
    --accent-secondary: #7c3aed;
    --accent-success: #10b981;
    --accent-danger: #ef4444;
    --accent-warning: #f59e0b;
    
    --border-color: #2a2a4a;
    --shadow-color: rgba(0, 0, 0, 0.4);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    --top-bar-height: 60px;
    --bottom-bar-height: 80px;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ================================ */
/* Config Selection Screen */
/* ================================ */

.terminal-select-body {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, #1e1e3f 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.terminal-select-container {
    max-width: 600px;
    width: 100%;
    text-align: center;
}

.terminal-title {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.terminal-version {
    color: var(--accent-primary);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.terminal-user-login {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.terminal-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 40px;
}

.pibox-settings {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 24px;
    text-align: left;
}

.pibox-settings label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 12px 0 8px;
}

.pibox-settings label:first-child {
    margin-top: 0;
}

.pibox-settings-row {
    display: flex;
    gap: 8px;
}

.pibox-address-input,
.pibox-address-select {
    flex: 1;
    min-width: 0;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0 12px;
}

.pibox-address-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
        linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 17px,
        calc(100% - 13px) 17px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 32px;
}

.pibox-settings-links {
    margin-top: 6px;
}

.pibox-monitor-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 0.78rem;
}

.pibox-monitor-link:hover {
    text-decoration: underline;
}

.pibox-check-btn {
    border: none;
    border-radius: var(--radius-md);
    background: var(--accent-primary);
    color: var(--bg-primary);
    font-weight: 600;
    padding: 0 14px;
    cursor: pointer;
}

.pibox-status {
    color: var(--text-secondary);
    font-size: 0.78rem;
    margin-top: 8px;
    word-break: break-all;
}

.pibox-status:empty {
    display: none;
}

.pibox-status.ok {
    color: var(--accent-success);
}

.pibox-status.error {
    color: var(--accent-danger);
}

.printer-settings {
    margin-top: 12px;
}

.printer-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.printer-tab {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    min-height: 38px;
    padding: 0 14px;
    cursor: pointer;
    font-weight: 600;
}

.printer-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--bg-primary);
}

.manager-action-btn {
    font-size: 0.75rem;
    font-weight: 700;
}

.offline-indicator .cash-in-out-btn {
    width: 28px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: white;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.config-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.config-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-color);
}

.config-icon {
    color: var(--accent-primary);
}

.config-name {
    font-weight: 600;
    font-size: 1rem;
}

.config-warehouse {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.config-uid,
.terminal-uid-info {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.terminal-printer-name {
    color: var(--accent-primary);
    font-weight: 600;
}

.terminal-footer {
    margin-top: 20px;
}

.back-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.back-link:hover {
    text-decoration: underline;
}

/* No Session Screen */
.no-session-message {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 40px;
    margin-bottom: 24px;
}

.no-session-message svg {
    margin-bottom: 20px;
}

.no-session-message h2 {
    margin-bottom: 16px;
    color: var(--accent-danger);
}

.no-session-message p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.back-button {
    display: inline-block;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: background 0.2s;
}

.back-button:hover {
    background: var(--bg-card);
}

/* ================================ */
/* Main Terminal POS Screen */
/* ================================ */

.terminal-body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport for mobile browsers */
    background: var(--bg-primary);
}

/* TOP BAR */
.terminal-top-bar {
    flex-shrink: 0;
    height: var(--top-bar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
}

.terminal-config-pill {
    flex-shrink: 0;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: white;
    background: rgba(255, 255, 255, 0.16);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
}

.search-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 44px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 40px 0 44px;
    font-size: 16px; /* Prevents zoom on iOS */
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

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

.search-input:focus {
    border-color: var(--accent-primary);
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    width: 28px;
    height: 28px;
    background: var(--bg-primary);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.session-close-btn {
    color: var(--accent-warning);
}

.offline-indicator .session-close-btn {
    width: 28px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: white;
}

.offline-indicator .close-btn {
    width: 28px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: white;
}

.scan-btn {
    background: linear-gradient(135deg, var(--accent-primary), #00a8cc);
    color: var(--bg-primary);
}

.scan-btn:hover {
    transform: scale(1.05);
}

.close-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.close-btn:hover {
    background: var(--accent-danger);
    color: white;
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: var(--top-bar-height);
    left: 0;
    right: 0;
    max-height: 50vh;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 100;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s;
}

.search-result-item:hover,
.search-result-item:active {
    background: var(--bg-tertiary);
}

.search-result-img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-tertiary);
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-code {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.search-result-price {
    font-weight: 600;
    color: var(--accent-primary);
    font-family: var(--font-mono);
}

.search-loading,
.search-no-results {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
}

/* ORDER CONTAINER */
.terminal-order-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.order-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.order-title {
    flex: 1;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-secondary);
}

.kode-harga-btn {
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0 10px;
    cursor: pointer;
    white-space: nowrap;
}

.kode-harga-btn:hover {
    border-color: var(--accent-primary);
    background: var(--bg-card);
}

.clear-order-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.clear-order-btn:hover {
    background: var(--accent-danger);
    color: white;
}

.order-lines {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
}

.empty-order {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 16px;
}

.empty-order p {
    font-size: 0.9rem;
}

/* Order Line */
.order-line {
    display: flex;
    align-items: flex-start;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 8px;
    gap: 12px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.order-line:hover,
.order-line:active {
    border-color: var(--accent-primary);
}

.order-line-img {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.order-line-body {
    flex: 1;
    min-width: 0;
}

.order-line-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.order-line-info {
    flex: 1;
    min-width: 0;
}

.order-line-name-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.order-line-name {
    overflow-wrap: anywhere;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.line-note-btn {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    padding: 3px 7px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

.order-line-code {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    margin-top: 4px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.order-line-note {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-style: italic;
    margin-top: 4px;
    padding-left: 10px;
    border-left: 2px solid var(--accent-primary);
    white-space: pre-wrap;
}

.note-textarea {
    width: 100%;
    min-height: 120px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 12px;
    resize: vertical;
    font-family: var(--font-main);
}

.cash-type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.manage-orders-modal {
    max-width: 860px;
    width: 94vw;
}

.manage-orders-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 65vh;
    overflow-y: auto;
}

.managed-order {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px;
}

.managed-order.has-refund {
    background: rgba(231, 76, 60, 0.12);
    border-color: rgba(231, 76, 60, 0.4);
}

.managed-order-status {
    border-radius: var(--radius-sm);
    padding: 5px 6px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--accent-warning);
    color: var(--bg-primary);
}

.managed-order-status.synced {
    background: var(--accent-success);
}

.managed-order-main {
    min-width: 0;
    flex: 1 1 220px;
    overflow-wrap: anywhere;
}

.managed-order-ref {
    font-weight: 700;
}

.managed-order-codes {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.managed-order-btn {
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent-primary);
    color: var(--bg-primary);
    padding: 8px 10px;
    font-weight: 700;
    cursor: pointer;
}

.managed-order-btn.refund {
    background: var(--accent-warning);
}

.order-line-qty {
    background: var(--accent-secondary);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.order-line-price {
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--accent-primary);
    min-width: 64px;
    text-align: right;
    flex-shrink: 0;
    line-height: 1.4;
}

/* BOTTOM BAR */
.terminal-bottom-bar {
    flex-shrink: 0;
    min-height: var(--bottom-bar-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    gap: 8px;
}

.partner-section {
    flex: 1;
    min-width: 0;
}

.partner-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    cursor: pointer;
    width: 100%;
    transition: border-color 0.2s;
}

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

.partner-btn svg {
    flex-shrink: 0;
    color: var(--accent-secondary);
}

#partnerName {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem;
}

.total-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 90px;
}

.total-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.total-amount {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-primary);
}

.pay-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--accent-success), #059669);
    border: none;
    border-radius: var(--radius-md);
    padding: 0 24px;
    height: 52px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.pay-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pay-btn:not(:disabled):hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

/* ================================ */
/* Modals */
/* ================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

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

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

.kode-harga-modal {
    max-width: 900px;
}

.kode-harga-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    overflow: auto;
    max-height: 70vh;
    padding-bottom: 4px;
}

.kode-harga-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.kode-harga-table th,
.kode-harga-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
    font-family: var(--font-mono);
}

.kode-harga-table th:first-child,
.kode-harga-table td:first-child {
    text-align: left;
}

.kode-harga-table th {
    color: var(--text-secondary);
    background: var(--bg-card);
    position: sticky;
    top: 0;
}

@media (max-width: 640px) {
    .kode-harga-list {
        grid-template-columns: 1fr;
    }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

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

.modal-header h3 {
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

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

.modal-search-input {
    width: 100%;
    height: 44px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 16px;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
    margin-bottom: 16px;
}

.modal-search-input:focus {
    border-color: var(--accent-primary);
}

/* Partner List */
.partner-list {
    max-height: 300px;
    overflow-y: auto;
}

.partner-item {
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-color);
}

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

.partner-item-name {
    font-weight: 500;
}

.partner-item-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Cashier Section & Modal */
.cashier-partner-row {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-bottom: 8px;
}

.total-pay-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.cashier-section {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cashier-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.cashier-btn:hover {
    background: var(--bg-card);
    border-color: var(--accent-secondary);
}

#cashierName {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

#cashierName.has-cashier {
    color: var(--accent-success);
    font-weight: 500;
}

.clear-cashier-btn {
    background: var(--accent-danger);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    color: white;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.clear-cashier-btn:hover {
    background: #dc2626;
}

.nfc-indicator {
    background: var(--accent-secondary);
    border-radius: var(--radius-sm);
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: nfc-pulse 2s infinite;
}

@keyframes nfc-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.nfc-indicator svg {
    color: white;
}

.cashier-modal {
    max-height: 70vh;
}

.nfc-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid var(--accent-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    color: var(--accent-secondary);
    font-size: 0.85rem;
}

.cashier-list {
    max-height: 300px;
    overflow-y: auto;
}

.cashier-item {
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.cashier-item:hover {
    background: var(--bg-card);
}

.cashier-item.selected {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid var(--accent-success);
}

.cashier-item-name {
    font-weight: 500;
    color: var(--text-primary);
}

.cashier-item-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.no-cashiers {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
}

/* Cashier Notification Toast */
.cashier-notification {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    animation: slideDown 0.3s ease;
}

.cashier-notification.success {
    background: var(--accent-success);
    color: white;
}

.cashier-notification.error {
    background: var(--accent-danger);
    color: white;
}

.cashier-notification.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Adjust partner section for new layout */
.partner-section {
    flex: 1;
}

.partner-btn {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.8rem;
}

#partnerName {
    font-size: 0.8rem;
}

/* Payment Modal */
.modal-content.payment-modal {
    max-height: 95vh;
    max-height: 95dvh;
    min-height: 0;
    overflow: hidden;
    margin-bottom: 0;
}

.payment-modal > .modal-header,
.payment-modal > .modal-footer {
    flex: 0 0 auto;
}

.payment-modal > .modal-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

.payment-no-price-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
}

.payment-no-price-toggle input {
    width: 18px;
    height: 18px;
}

.payment-summary {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.payment-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.payment-row:last-child {
    margin-bottom: 0;
}

.payment-remaining {
    font-weight: 600;
    font-size: 1.1rem;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.payment-total-amount {
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-primary);
}

.payment-methods {
    display: grid;
    grid-template-rows: repeat(2, minmax(48px, auto));
    grid-auto-flow: column;
    grid-auto-columns: minmax(120px, 44%);
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}

.payment-method-btn {
    min-width: 0;
    overflow-wrap: anywhere;
    scroll-snap-align: start;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.payment-method-btn:hover,
.payment-method-btn.active {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.payment-lines {
    margin-bottom: 16px;
}

.payment-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.payment-line-name {
    font-weight: 500;
}

.payment-line-amount {
    display: flex;
    align-items: center;
    gap: 8px;
}

.payment-line-amount input {
    width: 100px;
    height: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    font-size: 0.95rem;
    font-family: var(--font-mono);
    color: var(--text-primary);
    text-align: right;
}

.payment-line-remove {
    width: 28px;
    height: 28px;
    background: var(--accent-danger);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Numpad */
.payment-numpad,
.qty-numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.numpad-btn {
    height: 56px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.numpad-btn:hover,
.numpad-btn:active {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
}

.numpad-backspace,
.qty-backspace {
    color: var(--accent-warning);
}

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

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #00a8cc);
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 24px;
    color: var(--bg-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary:not(:disabled):hover {
    transform: scale(1.02);
}

.btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 24px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-danger {
    background: var(--accent-danger);
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 24px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    opacity: 0.9;
}

.submit-payment-btn {
    width: 100%;
}

/* Quantity Modal */
.qty-modal {
    max-width: 360px;
}

.qty-display {
    font-size: 3rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-align: center;
    padding: 24px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    color: var(--accent-primary);
}

.qty-modal-footer {
    justify-content: space-between;
}

/* Success Modal */
.success-modal {
    border-radius: var(--radius-lg);
    text-align: center;
    padding: 40px 20px;
    max-width: 360px;
}

.success-icon {
    margin-bottom: 16px;
}

.success-modal h2 {
    margin-bottom: 8px;
    color: var(--accent-success);
}

.success-modal p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-family: var(--font-mono);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 26, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

#loadingText {
    color: var(--text-secondary);
}

/* Scanner Overlay */
.scanner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.scanner-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    width: 90%;
    max-width: 400px;
}

.scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-tertiary);
}

.scanner-close-btn {
    width: 36px;
    height: 36px;
    background: var(--accent-danger);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-reader {
    min-height: 300px;
    position: relative;
}

.scanner-video {
    width: 100%;
    max-height: 70vh;
    object-fit: cover;
    border-radius: var(--radius-md);
    background: #000;
}

.scanner-guide {
    position: absolute;
    left: 5%;
    right: 5%;
    top: 50%;
    height: 38%;
    transform: translateY(-50%);
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-md);
    box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.scanner-guide::before {
    content: 'Align barcode here';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Desktop Enhancements */
@media (min-width: 768px) {
    .modal-content {
        border-radius: var(--radius-lg);
        margin-bottom: 40px;
    }
    
    .terminal-top-bar {
        padding: 0 24px;
    }
    
    .terminal-bottom-bar {
        padding: 0 24px;
    }
    
    .order-lines {
        padding: 16px;
    }
    
    .order-line {
        padding: 16px;
    }
    
    .config-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

/* Dark scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ================================ */
/* Offline Mode Indicators */
/* ================================ */

#offlineIndicator.offline-indicator {
    position: fixed !important;
    top: 0;
    left: 0;
    right: auto;
    width: 100vw !important;
    min-width: 100vw;
    max-width: none;
    height: 32px;
    display: block;
    overflow: hidden;
    padding: 0;
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 500;
    transition: background 0.3s ease;
}

#offlineIndicator .terminal-status-left,
#offlineIndicator .terminal-status-center,
#offlineIndicator .terminal-status-right {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    min-width: 0;
}

#offlineIndicator .terminal-status-left {
    left: 8px;
    justify-content: flex-start;
    gap: 8px;
    max-width: 32%;
}

#offlineIndicator .terminal-status-center {
    /* Anchored from the left edge of the remaining space after
       .terminal-status-left (max-width:32%), instead of centered via
       left:50vw + transform:translateX(-50%) -- that centered the BOX
       itself, which combined with align-items only affects content
       inside it, not where the box sits, so shifting align-items alone
       never actually moved this leftward like it looked like it should. */
    left: 34%;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    max-width: 58%;
    text-align: left;
    pointer-events: none;
}

#offlineIndicator .terminal-status-right {
    right: auto;
    left: calc(100vw - 8px);
    transform: translateX(-100%);
    justify-content: flex-end;
    gap: 6px;
    pointer-events: auto;
}

#offlineIndicator .terminal-status-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
}

#offlineIndicator .terminal-status-center .terminal-uid-info {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.58rem;
    line-height: 1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#offlineIndicator .terminal-status-right .action-btn + .action-btn {
    margin-left: 6px;
}

.offline-indicator.online {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.9), rgba(16, 185, 129, 0.7));
    color: white;
}

.offline-indicator.offline {
    /* No more whole-bar red flash/pulse -- the connectivity chain now
       shows exactly which link is down on its own (foreground-only red),
       so a second, cruder blinking-red-bar signal on top was redundant
       and just noisy. Same neutral background as .online either way. */
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.9), rgba(16, 185, 129, 0.7));
    color: white;
}

.offline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

.offline-indicator.offline .offline-dot {
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.pending-badge {
    background: white;
    color: var(--accent-danger);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}

/* Adjust top-bar position when offline indicator is visible */
.terminal-body {
    padding-top: 32px;
}

.terminal-top-bar {
    top: 32px;
}

/* Sync button */
.sync-btn {
    background: linear-gradient(135deg, var(--accent-warning), #d97706);
    color: white;
}

.sync-btn:hover {
    transform: scale(1.05);
}

.sync-btn.syncing svg {
    animation: spin 1s linear infinite;
}

/* Sync notification toast */
.sync-notification {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-success);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    animation: slideUp 0.3s ease;
}

.sync-notification.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to { opacity: 0; transform: translateX(-50%) translateY(20px); }
}

/* Success message styling */
.success-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* Offline success icon (different color) */
.success-modal.offline .success-icon svg {
    stroke: var(--accent-warning);
}

/* ================================ */
/* Offline Page */
/* ================================ */

.offline-page {
    text-align: center;
    padding: 40px 20px;
}

.offline-page .offline-icon {
    margin-bottom: 24px;
}

.offline-page h2 {
    color: var(--text-primary);
    margin-bottom: 16px;
}

.offline-page p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.offline-page .offline-hint {
    color: var(--accent-success);
    font-weight: 500;
    margin-bottom: 24px;
}

/* ===================== piBox Monitor Dashboard ===================== */
.pibox-monitor-body {
    display: block;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0;
    background: var(--bg-primary);
    min-height: 100vh;
}

.pibox-monitor {
    max-width: 1120px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    color: var(--text-primary);
}

.pibox-monitor-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.pibox-monitor-header h1 {
    font-size: 1.4rem;
    margin: 0;
}

.pibox-monitor-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.pibox-live-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent-success);
    margin-right: 6px;
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.6);
    animation: piboxLive 1.6s ease-out infinite;
}

@keyframes piboxLive {
    0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(46, 204, 113, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

.pibox-monitor-back {
    color: var(--accent-primary);
    text-decoration: none;
}

.pibox-monitor-back:hover {
    text-decoration: underline;
}

.pibox-monitor-summary {
    margin-bottom: 16px;
}

.pibox-monitor-summary-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.pibox-monitor-summary-table th,
.pibox-monitor-summary-table td {
    text-align: center;
    padding: 12px 6px;
    border-right: 1px solid var(--border-color);
}

.pibox-monitor-summary-table th:last-child,
.pibox-monitor-summary-table td:last-child {
    border-right: none;
}

.pibox-monitor-summary-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
}

.pibox-monitor-summary-table td {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pibox-monitor-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.pibox-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
}

.pibox-card-idle { border-left-color: var(--accent-success); }
.pibox-card-syncing { border-left-color: var(--accent-primary); }
.pibox-card-error { border-left-color: var(--accent-danger); }
.pibox-card-offline { border-left-color: #6b6f7a; opacity: 0.85; }

.pibox-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.pibox-card-title {
    font-weight: 600;
}

.pibox-card-status {
    font-size: 0.78rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.pibox-card-status-idle { color: var(--accent-success); }
.pibox-card-status-syncing { color: var(--accent-primary); }
.pibox-card-status-error { color: var(--accent-danger); }
.pibox-card-status-offline { color: #9ba3b4; }

.pibox-card-body {
    overflow-wrap: anywhere;
    line-height: 1.6;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pibox-card-body strong {
    color: var(--text-primary);
}

.pibox-card-task {
    color: var(--accent-primary);
}

.pibox-card-body .pibox-card-error {
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid var(--accent-danger);
    border-radius: 6px;
    color: var(--accent-danger);
}

.pibox-monitor-events {
    overflow-x: auto;
}

.pibox-monitor-events h2 {
    font-size: 1rem;
    margin: 24px 0 8px;
    color: var(--text-secondary);
}

.pibox-monitor-events-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    font-size: 0.85rem;
}

.pibox-monitor-events-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: top;
}

.pibox-monitor-events-table tr:last-child td {
    border-bottom: none;
}

.pibox-event-time {
    white-space: nowrap;
    color: var(--text-primary);
    font-family: var(--font-mono);
    width: 110px;
}

.pibox-event-terminal {
    color: var(--text-primary);
    width: 240px;
}

.pibox-monitor-empty {
    padding: 18px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* ================================ */
/* Buyback popup */
/* ================================ */

.buyback-popup {
    max-width: 560px;
    max-height: 95vh;
}

.buyback-popup-body {
    padding: 16px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bb-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bb-field label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.bb-field input[type="text"],
.bb-field input[type="number"],
.bb-field input[type="date"] {
    height: 38px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: var(--font-main);
}

.bb-field input[type="number"] {
    font-family: var(--font-mono);
    text-align: right;
}

.bb-field input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.bb-field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.bb-inline-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bb-inline-group input[type="text"] {
    flex: 1 1 auto;
}

.bb-lm-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.bb-lm-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

.bb-camera-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.bb-camera-row .btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bb-camera-row .btn-secondary:hover {
    border-color: var(--accent-primary);
}

.bb-camera-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.bb-camera-status-ok {
    color: var(--accent-success);
}

.bb-image-preview {
    max-width: 96px;
    max-height: 96px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.bb-advanced {
    padding: 12px;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bb-advanced h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bb-total-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 10px;
    margin-top: 4px;
}

.bb-total-input {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bb-total-input label {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.bb-total-input input {
    height: 42px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    color: var(--accent-primary);
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 600;
    text-align: right;
}

.btn-icon {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    width: 42px;
    align-self: end;
    cursor: pointer;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

/* Shared camera overlay */
.camera-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-stage {
    width: min(96vw, 600px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.camera-stage video {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    background: black;
}

.camera-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.camera-controls .btn-primary,
.camera-controls .btn-secondary {
    flex: 1 1 0;
    height: 44px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    cursor: pointer;
    border: none;
}

.camera-controls .btn-primary {
    background: var(--accent-primary);
    color: var(--bg-primary);
    font-weight: 600;
}

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



/* --- Odoo backend chrome must never show on a dedicated terminal screen ---
   web.layout pulls in the full backend web client shell (top navbar etc).
   Nothing previously hid it; it only stayed invisible by accident of
   z-index/stacking, which broke after any navbar re-render. Force it off. */
body[class^="terminal"] .o_main_navbar,
body[class^="terminal"] nav.o_main_navbar,
body[class^="terminal"] .o_webclient > .o_main_navbar {
    display: none !important;
}

/* --- Loyalty points badge next to the selected customer --- */
.partner-loyalty-points {
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 10px;
    background: rgba(45, 212, 191, 0.18);
    color: #2dd4bf;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.partner-loyalty-points:empty {
    display: none;
}
.partner-item-points {
    color: #2dd4bf;
    font-weight: 600;
    font-size: 12px;
}

/* --- Deferred sync status badge (Manage Orders) --- */
.managed-order-status.deferred {
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
}

/* --- Reprint no-price toggle (mirrors the payment modal's toggle) --- */
.reprint-no-price-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary, #9ca3af);
    margin-bottom: 10px;
}

/* ================================================================
   Connectivity chain (Server <-> internet <-> piBox <-> session)
   ================================================================ */
.connectivity-chain {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 4px;
    font-size: 13px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    max-width: 100%;
    width: 100%;
}

.connectivity-chain .conn-node {
    padding: 2px 6px;
    border-radius: 4px;
    color: #000;
    font-weight: 700;
}

.connectivity-chain .conn-node.conn-down {
    /* Foreground only for offline -- no red box, just red text. The green
       background box is reserved for the up/good state; down is conveyed
       by color alone (matching the arrows, which are also foreground-only). */
    background: transparent;
    color: #b03a2e;
    animation: pulse-offline 2s infinite;
}

.connectivity-chain .conn-link {
    font-weight: 700;
}

.connectivity-chain .conn-link.conn-broken {
    color: #e74c3c;
    opacity: 1;
    animation: pulse-offline 2s infinite;
}

/* ================================================================
   Shared PIN keypad (terminal_keypad.js) -- manager PIN entry for
   opening a session and for selecting a manager cashier mid-order.
   ================================================================ */
.keypad-modal {
    max-width: 320px;
}

.keypad-subtitle {
    text-align: center;
    color: var(--text-secondary, #9ca3af);
    margin: 0 0 12px;
}

.keypad-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.keypad-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--text-secondary, #9ca3af);
    background: transparent;
}

.keypad-dot.filled {
    background: var(--accent-primary, #2dd4bf);
    border-color: var(--accent-primary, #2dd4bf);
}

.keypad-error {
    text-align: center;
    color: #e74c3c;
    font-size: 13px;
    margin-bottom: 8px;
}

.keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.keypad-key {
    padding: 16px 0;
    font-size: 20px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
    cursor: pointer;
}

.keypad-key:active {
    background: rgba(255, 255, 255, 0.14);
}

.keypad-key.keypad-clear,
.keypad-key.keypad-backspace {
    font-size: 16px;
    background: rgba(231, 76, 60, 0.12);
    color: #e74c3c;
}

.new-customer-form { gap: 8px; margin: 12px 0; }
.new-customer-form input { width: 100%; padding: 10px; box-sizing: border-box; }

.order-line-pricing { font-family: var(--font-sans, Arial, sans-serif); font-weight: 400; font-size: 0.8rem; }

/* Connection problems stay readable on phones without widening the status bar. */
.connectivity-issue {
    flex-shrink: 0;
    margin: 4px 8px;
    max-height: 25vh;
    overflow-y: auto;
    padding: 8px 12px;
    border: 1px solid var(--accent-danger);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--accent-danger);
    font-size: 12px;
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: anywhere;
}
.connectivity-chain .conn-node.conn-unknown {
    color: #666;
    opacity: 0.6;
}

.promo-modal { max-width: 520px; }
.promo-actions, .promo-code-form { display: flex; gap: 8px; margin-bottom: 14px; }
.promo-actions > button { flex: 1; }
.promo-code-form input { min-width: 0; margin: 0; }
.promo-choices { display: grid; gap: 8px; margin: 12px 0; }
.promo-choice {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px;
    text-align: left;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
}
.promo-choice span, #promoMessage { color: var(--text-secondary); font-size: 13px; }
.promo-modal .modal-body { overflow-y: auto; }
.order-header { flex-wrap: wrap; row-gap: 6px; }
