/* ═══════════════════════════════════════════════════════════════════════
   SO Lifecycle Tester — Big Sandy Superstore Brand
   Matches bigsandysuperstore.com: dark sidebar, white content, warm grays
   ═══════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ─── CSS Custom Properties ─── */
:root {
    /* Page & content backgrounds */
    --bg-base: #f5f5f5;
    --bg-surface: #ffffff;
    --bg-elevated: #fafafa;
    --bg-hover: #f0f0f0;
    --bg-active: #e8e8e8;

    /* Sidebar (dark, matches website header/footer) */
    --sidebar-bg: #2d3036;
    --sidebar-bg-hover: #383c44;
    --sidebar-bg-active: #3e4350;
    --sidebar-text: #c8cad0;
    --sidebar-text-bright: #ffffff;
    --sidebar-text-muted: #7d808a;
    --sidebar-border: rgba(255,255,255,0.08);

    /* Borders */
    --border: #dddddd;
    --border-light: #ebebeb;

    /* Text (warm charcoal, not blue-gray) */
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;

    /* Brand colors */
    --charcoal: #333333;
    --charcoal-light: #444444;
    --navy: #152943;
    --navy-dim: #e9eef4;

    --gold: #b8860b;
    --gold-light: #c9981f;
    --gold-dim: #fdf6e3;
    --gold-glow: rgba(184, 134, 11, 0.10);

    /* Functional colors */
    --blue: #2573b5;
    --blue-dim: #eef5fb;
    --blue-glow: rgba(37, 115, 181, 0.08);

    --green: #2e8540;
    --green-dim: #edf7ef;
    --green-glow: rgba(46, 133, 64, 0.08);

    --red: #c5392f;
    --red-dim: #fdf0ef;
    --red-glow: rgba(197, 57, 47, 0.08);

    /* Layout */
    --sidebar-width: 230px;
    --header-height: 0px;
    --inspector-height: 440px;

    /* Radii */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --radius-xl: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.10);

    /* Fonts */
    --font-ui: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --transition: 0.18s ease;
}

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

html, body {
    height: 100%;
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-primary);
    background: var(--bg-base);
    -webkit-font-smoothing: antialiased;
}

/* ─── Layout Shell ─── */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ─── Sidebar (dark charcoal, matching website header/footer) ─── */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-brand {
    padding: 22px 18px 18px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.sidebar-brand .brand-logo {
    height: 38px;
    width: auto;
    display: block;
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

.sidebar-brand h1 {
    font-size: 15px;
    font-weight: 700;
    color: var(--sidebar-text-bright);
    letter-spacing: -0.3px;
    line-height: 1.3;
}

.sidebar-brand .brand-sub {
    font-size: 10px;
    color: var(--gold-light);
    text-transform: uppercase;
    letter-spacing: 2.5px;
    font-weight: 600;
    margin-top: 8px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--sidebar-text-muted);
    font-weight: 700;
    padding: 0 10px;
    margin-bottom: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
}

.nav-item:hover {
    background: var(--sidebar-bg-hover);
    color: var(--sidebar-text-bright);
}

.nav-item.active {
    background: var(--sidebar-bg-active);
    color: var(--sidebar-text-bright);
    font-weight: 600;
    border-left: 3px solid var(--gold);
    padding-left: 9px;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.5;
}

.nav-item:hover svg { opacity: 0.8; }
.nav-item.active svg { opacity: 1; color: var(--gold-light); }

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.15);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gold);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

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

.user-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--sidebar-text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-store {
    font-size: 11px;
    color: var(--sidebar-text-muted);
    font-family: var(--font-mono);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.logout-btn:hover {
    color: var(--red);
    background: rgba(197, 57, 47, 0.15);
}

/* ─── Main Content ─── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    background: var(--bg-base);
}

.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
}

.content-scroll::-webkit-scrollbar { width: 6px; }
.content-scroll::-webkit-scrollbar-track { background: transparent; }
.content-scroll::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* ─── Page Header ─── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--charcoal);
    letter-spacing: -0.3px;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ─── Stat Cards ─── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

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

.stat-card .stat-label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1;
}

.stat-card.open .stat-value { color: var(--blue); }
.stat-card.finalized .stat-value { color: var(--green); }
.stat-card.voided .stat-value { color: var(--red); }
.stat-card.total .stat-value { color: var(--charcoal); }

.stat-card .stat-icon {
    float: right;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -4px;
}

.stat-card.open .stat-icon { background: var(--blue-dim); color: var(--blue); }
.stat-card.finalized .stat-icon { background: var(--green-dim); color: var(--green); }
.stat-card.voided .stat-icon { background: var(--red-dim); color: var(--red); }

/* ─── Status Pills ─── */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pill.open {
    background: var(--blue-dim);
    color: var(--blue);
    box-shadow: inset 0 0 0 1px rgba(37, 115, 181, 0.2);
}

.status-pill.finalized {
    background: var(--green-dim);
    color: var(--green);
    box-shadow: inset 0 0 0 1px rgba(46, 133, 64, 0.2);
}

.status-pill.voided {
    background: var(--red-dim);
    color: var(--red);
    box-shadow: inset 0 0 0 1px rgba(197, 57, 47, 0.2);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ─── Tables ─── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    font-weight: 700;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    background: var(--bg-elevated);
}

.data-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    vertical-align: middle;
}

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

.data-table .mono {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
}

.data-table .doc-link {
    color: var(--charcoal);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 600;
}

.data-table .doc-link:hover {
    color: var(--gold);
    text-decoration: underline;
}

.data-table .void-row td {
    text-decoration: line-through;
    opacity: 0.45;
}

/* ─── Sortable Headers ─── */
.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 22px;
    transition: color 0.15s ease;
}

.data-table th.sortable:hover {
    color: var(--text-primary);
}

.data-table th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    opacity: 0.3;
    transition: opacity 0.15s ease;
}

.data-table th.sortable:hover::after {
    opacity: 0.6;
}

.data-table th.sort-asc::after {
    content: '▲';
    opacity: 0.8;
    color: var(--gold);
}

.data-table th.sort-desc::after {
    content: '▼';
    opacity: 0.8;
    color: var(--gold);
}

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

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-elevated);
}

.card-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--charcoal);
}

.card-body { padding: 20px; }

.card-body .data-table th:first-child,
.card-body .data-table td:first-child { padding-left: 16px; }
.card-body .data-table th:last-child,
.card-body .data-table td:last-child { padding-right: 16px; }

.card-body .data-table th { background: transparent; }

/* ─── Order Header Grid ─── */
.order-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.info-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.info-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
}

.info-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.info-value.mono {
    font-family: var(--font-mono);
    font-size: 13px;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-size: 13.5px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: var(--charcoal);
    color: #ffffff;
}
.btn-primary:hover {
    background: #222222;
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--green);
    color: #fff;
}
.btn-success:hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 8px rgba(46, 133, 64, 0.2);
}

.btn-danger {
    background: var(--red);
    color: #fff;
}
.btn-danger:hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 8px rgba(197, 57, 47, 0.2);
}

.btn-amber {
    background: var(--amber);
    color: #000;
}
.btn-amber:hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 8px rgba(204, 153, 0, 0.2);
}

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

.btn-sm {
    padding: 6px 14px;
    font-size: 12.5px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 13px 28px;
    font-size: 15px;
    border-radius: var(--radius-md);
}

.action-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ─── Forms ─── */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 6px;
}

.form-input, .form-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 14px;
    transition: all var(--transition);
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--charcoal);
    box-shadow: 0 0 0 3px rgba(51, 51, 51, 0.08);
}

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

.form-input.mono {
    font-family: var(--font-mono);
    font-size: 13px;
}

/* Toggle button group (CC entry mode) */
.toggle-group {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-main);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}
.toggle-btn + .toggle-btn {
    border-left: 1px solid var(--border);
}
.toggle-btn:hover {
    background: var(--bg-card);
}
.toggle-btn.active {
    background: var(--charcoal);
    color: #fff;
}

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

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

.form-row > * { flex: 1; }

/* ─── Flash Messages / Toasts ─── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.35s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px) scale(0.96); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

.toast.success {
    background: var(--green-dim);
    border: 1px solid rgba(46, 133, 64, 0.25);
    color: var(--green);
}

.toast.error {
    background: var(--red-dim);
    border: 1px solid rgba(197, 57, 47, 0.25);
    color: var(--red);
}

.toast.info {
    background: var(--blue-dim);
    border: 1px solid rgba(37, 115, 181, 0.25);
    color: var(--blue);
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    margin-left: auto;
    padding: 2px;
    opacity: 0.6;
}

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

/* ─── Login Page ─── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 280px;
    background: var(--sidebar-bg);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 44px 36px;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo img {
    height: 44px;
    width: auto;
    margin-bottom: 8px;
}

.login-logo h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--charcoal);
    letter-spacing: -0.3px;
    margin-bottom: 4px;
}

.login-logo .sub {
    font-size: 11px;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 2.5px;
    font-weight: 700;
}

.login-form .form-group { margin-bottom: 20px; }

.login-form .form-input {
    padding: 13px 16px;
    font-size: 15px;
    background: var(--bg-elevated);
}

.login-form .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    justify-content: center;
    border-radius: var(--radius-md);
    margin-top: 8px;
}

/* ─── Search Input ─── */
.card:has(.search-box) { overflow: visible; }

.search-box {
    position: relative;
}

.search-box .form-input {
    padding-left: 38px;
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}

.search-results.active { display: block; }

.search-result-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-light);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-hover); }

.search-result-item .result-code {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--charcoal);
    min-width: 100px;
}

.search-result-item .result-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ─── Confirmation Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
    animation: fade-in 0.2s ease;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px;
    min-width: 360px;
    max-width: 640px;
    width: 90vw;
    max-height: 80vh;
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.25s ease;
    overflow: hidden;
}

/* Structured modal (has .modal-header + .modal-body) — remove default padding, use flex column */
.modal:has(.modal-header) {
    padding: 0;
    display: flex;
    flex-direction: column;
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--charcoal);
    margin: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.modal-close-btn:hover { color: var(--charcoal); }

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

.modal h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--charcoal);
    margin-bottom: 8px;
}

.modal p {
    color: var(--text-secondary);
    font-size: 13.5px;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.modal-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.modal-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}
.modal-table tr:last-child td { border-bottom: none; }

/* ─── Database Inspector Panel ─── */
.inspector-toggle {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--charcoal);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    z-index: 200;
    transition: all var(--transition);
}

.inspector-toggle:hover {
    transform: scale(1.08);
    background: #222222;
    box-shadow: var(--shadow-lg);
}

.inspector-toggle svg { width: 20px; height: 20px; }

.inspector-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gold);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.inspector-panel {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--inspector-height);
    background: var(--bg-surface);
    border-top: 2px solid var(--charcoal);
    z-index: 150;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
}

.inspector-panel.open {
    transform: translateY(0);
}

.inspector-header {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 40px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-elevated);
}

.inspector-header h4 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--charcoal);
    margin-right: auto;
}

.inspector-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.inspector-tab {
    padding: 8px 16px;
    font-size: 11.5px;
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.inspector-tab:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.inspector-tab.active {
    color: var(--charcoal);
    border-bottom-color: var(--charcoal);
}

.inspector-tab .tab-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
}

.inspector-tab .tab-badge.has-changes {
    background: var(--gold-dim);
    color: var(--gold);
}

.inspector-tab .tab-badge.no-changes {
    background: var(--bg-active);
    color: var(--text-muted);
}

.inspector-body {
    flex: 1;
    overflow: auto;
    font-family: var(--font-mono);
    font-size: 11.5px;
}

.inspector-body::-webkit-scrollbar { width: 6px; height: 6px; }
.inspector-body::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.inspector-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.inspector-table th {
    padding: 6px 12px;
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}

.inspector-table td {
    padding: 5px 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inspector-table tr.inserted td { background: var(--green-dim); color: var(--green); }
.inspector-table tr.updated td { background: var(--gold-dim); }
.inspector-table tr.deleted td { background: var(--red-dim); color: var(--red); text-decoration: line-through; }

.inspector-table td.changed {
    color: var(--gold);
    font-weight: 600;
}

.inspector-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition);
}

.inspector-close:hover { color: var(--text-primary); }

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

.inspector-op-count {
    font-weight: 400;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    margin-left: 8px;
}

.inspector-clear-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
}

.inspector-clear-btn:hover {
    color: var(--red);
    border-color: var(--red);
    background: var(--red-dim);
}

/* ─── Payment Terminal Layout ─── */
.payment-grid {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 24px;
    align-items: start;
}
@media (max-width: 1100px) {
    .payment-grid { grid-template-columns: 1fr; }
}

/* Receipt Card */
.receipt-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.receipt-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.receipt-header h3 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-primary);
    margin: 0;
}
.receipt-body {
    padding: 0;
}

/* Receipt line items */
.receipt-items {
    padding: 12px 20px;
}
.receipt-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 5px 0;
    font-size: 13px;
    color: var(--text-secondary);
}
.receipt-item.void-item {
    text-decoration: line-through;
    opacity: 0.45;
}
.receipt-item-detail {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    flex: 1;
}
.receipt-item-code {
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
    flex-shrink: 0;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.receipt-item-desc {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.receipt-item-qty {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 8px;
}
.receipt-item-amt {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    text-align: right;
    flex-shrink: 0;
    margin-left: 16px;
}

/* Receipt separator and totals */
.receipt-sep {
    border-top: 1px dashed var(--border);
    margin: 0 20px;
}
.receipt-sep-bold {
    border-top: 2px solid var(--text-primary);
    margin: 0 20px;
}
.receipt-totals {
    padding: 10px 20px 14px;
}
.receipt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
}
.receipt-row .label {
    color: var(--text-secondary);
}
.receipt-row .amt {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
}
.receipt-row.subtotal {
    padding-top: 8px;
}
.receipt-row.subtotal .label,
.receipt-row.subtotal .amt {
    font-weight: 600;
    color: var(--text-primary);
}
.receipt-row.grand-total {
    padding: 10px 0 4px;
    font-size: 15px;
}
.receipt-row.grand-total .label {
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.receipt-row.grand-total .amt {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.receipt-row .tax-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

/* Payments section within receipt */
.receipt-payments {
    padding: 10px 20px 14px;
}
.receipt-pmt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
}
.receipt-pmt-row .pmt-label {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.receipt-pmt-row .pmt-label .badge {
    font-size: 10px;
}
.receipt-pmt-row .pmt-amt {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 13px;
    color: var(--green);
}

/* Balance Due — the hero number */
.balance-block {
    padding: 16px 20px 20px;
    text-align: center;
}
.balance-label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}
.balance-amt {
    font-family: var(--font-mono);
    font-size: 40px;
    font-weight: 700;
    line-height: 1.1;
}
.balance-block.due .balance-label { color: var(--red); }
.balance-block.due .balance-amt { color: var(--red); }
.balance-block.paid .balance-label { color: var(--green); }
.balance-block.paid .balance-amt { color: var(--green); }

/* Finance info bar */
.finance-bar {
    padding: 10px 20px;
    display: flex;
    gap: 20px;
    font-size: 12px;
    background: var(--bg-elevated);
}
.finance-bar .fi-field {
    display: flex;
    gap: 6px;
    align-items: center;
}
.finance-bar .fi-label {
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.finance-bar .fi-value {
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--text-primary);
}

/* Accordion panels (details/summary) */
.accordion-panel summary::-webkit-details-marker,
.accordion-panel summary::marker {
    display: none;
    content: '';
}
.accordion-panel summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.accordion-chevron {
    transition: transform 0.2s ease;
    color: var(--text-muted);
    flex-shrink: 0;
}
.accordion-panel[open] > summary .accordion-chevron {
    transform: rotate(180deg);
}

/* ─── Inspector Split Layout ─── */
.inspector-split {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.inspector-history {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--bg-elevated);
}

.inspector-history-toolbar {
    padding: 8px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.inspector-search {
    width: 100%;
    padding: 6px 10px;
    font-size: 12px;
    font-family: var(--font-ui);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    outline: none;
    box-sizing: border-box;
}

.inspector-search:focus {
    border-color: var(--charcoal);
    box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.06);
}

.inspector-history-list {
    flex: 1;
    overflow-y: auto;
}

.inspector-history-list::-webkit-scrollbar { width: 5px; }
.inspector-history-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.history-entry {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background var(--transition);
    border-left: 3px solid transparent;
}

.history-entry:hover {
    background: var(--bg-hover);
}

.history-entry.active {
    background: var(--bg-active);
    border-left-color: var(--gold);
}

.history-entry.current-doc {
    background: var(--gold-dim);
}

.history-entry.current-doc.active {
    background: var(--bg-active);
}

.history-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
}

.history-doc {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--charcoal);
}

.history-changes {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--gold-dim);
    color: var(--gold);
    font-weight: 700;
}

.history-entry-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.history-time {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    flex-shrink: 0;
    margin-left: 8px;
}

.inspector-detail {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Detail header bar (doc + label + time shown above table tabs) */
.detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--charcoal);
    color: #ffffff;
    flex-shrink: 0;
    font-size: 12px;
}

.detail-doc {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 12px;
}

.detail-label {
    font-weight: 600;
    opacity: 0.85;
}

.detail-time {
    font-family: var(--font-mono);
    font-size: 10.5px;
    opacity: 0.5;
    margin-left: auto;
}

.detail-changes {
    font-size: 10px;
    padding: 1px 8px;
    border-radius: 10px;
    background: var(--gold);
    color: #fff;
    font-weight: 700;
}

.change-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.change-indicator.insert { background: var(--green); }
.change-indicator.update { background: var(--gold); }
.change-indicator.delete { background: var(--red); }

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 13px;
    max-width: 320px;
    margin: 0 auto;
}

/* ─── Badge / Tag ─── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.badge-amber { background: var(--navy-dim); color: var(--navy); }
.badge-blue { background: var(--blue-dim); color: var(--blue); }
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-red { background: var(--red-dim); color: var(--red); }

/* ─── Responsive ─── */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 90;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 100;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .mobile-toggle { display: flex; }
    .content-scroll { padding: 60px 16px 16px; }
    .inspector-panel { left: 0; }
    .inspector-history { width: 220px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}

/* ─── Animations ─── */
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: 200px 0; }
}

.loading {
    background: linear-gradient(90deg, var(--bg-surface) 0%, var(--bg-hover) 50%, var(--bg-surface) 100%);
    background-size: 400px 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* ─── Inventory availability inline ─── */
.inv-available {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--green-dim);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--green);
    font-weight: 600;
}

.inv-unavailable {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--red-dim);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--red);
    font-weight: 600;
}

/* ─── Welcome Banner ─── */
.welcome-banner {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.welcome-greeting {
    font-size: 24px;
    font-weight: 700;
    color: var(--charcoal);
    letter-spacing: -0.3px;
    margin-bottom: 4px;
}

.welcome-detail {
    font-size: 14px;
    color: var(--text-muted);
}

/* ─── Quick Lookup ─── */
.quick-lookup {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.quick-lookup-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 12px;
}

.quick-lookup-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.quick-lookup-form .form-input {
    font-size: 15px;
    padding: 12px 14px 12px 38px;
}

/* ─── Dashboard Action Cards ─── */
.dash-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.dash-action-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.dash-action-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #ccc;
}

.dash-action-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.dash-action-card:hover .dash-action-icon {
    background: var(--charcoal);
    color: #ffffff;
}

.dash-action-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 2px;
}

.dash-action-desc {
    font-size: 13px;
    color: var(--text-muted);
}

/* ─── Order Search Form ─── */
.order-search-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ─── Utilities ─── */
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-3 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-amber { color: var(--charcoal); }
.font-mono { font-family: var(--font-mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
