/* ─── RESET & MODERN CSS VARIABLES ───────────────────────────────────────── */
:root {
    --bg-dark: #080c14;
    --bg-panel: rgba(16, 23, 38, 0.75);
    --bg-panel-border: rgba(255, 255, 255, 0.08);
    --bg-input: rgba(10, 15, 26, 0.8);
    --input-border: rgba(255, 255, 255, 0.12);
    
    --primary-cyan: #00f2fe;
    --primary-indigo: #4facfe;
    --accent-purple: #7928ca;
    --accent-pink: #ff0080;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #ef4444;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --shadow-glow: 0 0 25px rgba(0, 242, 254, 0.25);
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 10%, rgba(121, 40, 202, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 85% 20%, rgba(0, 242, 254, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 50% 80%, rgba(16, 185, 129, 0.06) 0%, transparent 50%);
    background-attachment: fixed;
    overflow-x: hidden;
}

/* ─── GLASSMORPHIC UTILITY ────────────────────────────────────────────────── */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--bg-panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

/* ─── APP HEADER ──────────────────────────────────────────────────────────── */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    border-bottom: 1px solid var(--bg-panel-border);
    background: rgba(8, 12, 20, 0.85);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

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

.logo-icon {
    font-size: 24px;
    background: linear-gradient(135deg, var(--primary-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.4));
}

.brand-title {
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.5px;
    display: block;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-sub {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-muted);
    display: block;
}

.system-badges {
    display: flex;
    gap: 8px;
}

.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    letter-spacing: 0.3px;
}

.badge-purple {
    background: rgba(121, 40, 202, 0.2);
    color: #c084fc;
    border: 1px solid rgba(192, 132, 252, 0.3);
}

.badge-cyan {
    background: rgba(0, 242, 254, 0.15);
    color: var(--primary-cyan);
    border: 1px solid rgba(0, 242, 254, 0.3);
}

.badge-ai {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ─── MODE TOGGLE SWITCH ─────────────────────────────────────────────────── */
.mode-toggle-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--bg-panel-border);
    border-radius: var(--radius-full);
}

.mode-label {
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: var(--transition);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
}

input:checked + .slider {
    background: linear-gradient(135deg, var(--accent-purple), var(--primary-cyan));
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.job-count-badge {
    background: var(--primary-cyan);
    color: #0b0f19;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    margin-left: 4px;
}

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    outline: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    color: #050b14;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(0, 242, 254, 0.5);
    filter: brightness(1.08);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    border-color: var(--bg-panel-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
}

.btn-dispatch {
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(135deg, #10b981 0%, #00f2fe 100%);
    color: #04121e;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.btn-dispatch:hover {
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
    filter: brightness(1.05);
}

.btn-icon-tool {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-panel-border);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.btn-icon-tool:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.12);
}

/* ─── MAIN LAYOUT ─────────────────────────────────────────────────────────── */
.main-layout {
    width: 100%;
    max-width: 1680px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-x: hidden;
}

/* ─── UPLOAD SECTION ──────────────────────────────────────────────────────── */
.upload-section {
    padding: 24px 28px;
}

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

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

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

.upload-actions {
    display: flex;
    gap: 12px;
}

/* ─── IMPORTER PROFILE SELECTOR ─────────────────────────────────────────── */
.importer-selection-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.9) 100%);
    border: 1px solid rgba(192, 132, 252, 0.25);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.importer-selection-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.importer-avatar {
    font-size: 26px;
    background: rgba(121, 40, 202, 0.25);
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(192, 132, 252, 0.3);
}

.importer-text-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.importer-title {
    font-size: 14px;
    font-weight: 700;
    color: #f8fafc;
    cursor: pointer;
}

.importer-desc {
    font-size: 11px;
    color: var(--text-muted);
}

.importer-selection-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.importer-dropdown {
    background: #0b1324;
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.importer-dropdown:hover, .importer-dropdown:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* Dropzone */
.dropzone {
    border: 2px dashed rgba(0, 242, 254, 0.3);
    border-radius: var(--radius-lg);
    background: rgba(10, 16, 28, 0.4);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary-cyan);
    background: rgba(0, 242, 254, 0.05);
    box-shadow: inset 0 0 20px rgba(0, 242, 254, 0.1);
}

.drop-icon {
    font-size: 40px;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.3));
}

.drop-title {
    font-size: 15px;
    font-weight: 600;
    color: #f1f5f9;
}

.drop-hint {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 4px;
}

.browse-link {
    color: var(--primary-cyan);
    text-decoration: underline;
    font-weight: 600;
}

.supported-chips {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}

.chip {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

/* File Queue Preview */
.file-queue-container {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--bg-panel-border);
}

.queue-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.file-chips-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--bg-panel-border);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 12px;
}

.file-chip-icon {
    font-size: 14px;
}

.file-chip-name {
    color: #f8fafc;
    font-weight: 500;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-chip-size {
    color: var(--text-dim);
    font-size: 10px;
}

.file-chip-remove {
    background: none;
    border: none;
    color: var(--accent-rose);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
}

/* ─── STATUS BANNER ──────────────────────────────────────────────────────── */
.status-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

.status-banner.info {
    background: rgba(79, 172, 254, 0.15);
    border: 1px solid rgba(79, 172, 254, 0.3);
    color: #93c5fd;
}

.status-banner.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.status-banner.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.banner-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    margin-left: auto;
}

/* ─── WORKSPACE WORKSTATION: 100% RESPONSIVE FULL WIDTH ─────────────────── */
.workspace-grid {
    width: 100%;
    display: block;
    box-sizing: border-box;
    animation: fadeIn 0.4s ease;
}

.left-panel {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Left Panel Tabs */
.panel-tabs {
    display: flex;
    gap: 6px;
    background: rgba(10, 15, 26, 0.7);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--bg-panel-border);
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 12.5px;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: rgba(0, 242, 254, 0.14);
    color: var(--primary-cyan);
    border: 1px solid rgba(0, 242, 254, 0.35);
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.15);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Form Styles */
.form-card {
    padding: 24px;
}

.card-heading {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
    letter-spacing: 0.2px;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.database-badge {
    font-size: 10px;
    font-weight: 600;
    color: var(--primary-cyan);
    background: rgba(0, 242, 254, 0.1);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(0, 242, 254, 0.2);
}

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

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

.form-group.full-width {
    grid-column: span 2;
}

label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
    background: var(--bg-input);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 13px;
    padding: 9px 12px;
    transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary-cyan);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 242, 254, 0.25);
    background: rgba(14, 22, 38, 0.95);
}

.font-bold {
    font-weight: 700;
}

.text-cyan {
    color: var(--primary-cyan) !important;
}

/* Port Intelligence Box */
.port-match-box {
    background: rgba(10, 16, 28, 0.6);
    border: 1px solid var(--bg-panel-border);
    border-radius: var(--radius-md);
    padding: 16px;
}

.port-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.port-input-wrapper input {
    width: 100%;
    padding-right: 90px;
}

.port-badge {
    position: absolute;
    right: 8px;
    background: linear-gradient(135deg, var(--accent-purple), var(--primary-cyan));
    color: #fff;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.5px;
}

.port-suggestions {
    position: relative;
    max-height: 180px;
    overflow-y: auto;
    background: #0f172a;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    margin-top: 4px;
    display: none;
    z-index: 50;
}

.port-suggestion-item {
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
}

.port-suggestion-item:hover {
    background: rgba(0, 242, 254, 0.1);
    color: var(--primary-cyan);
}

/* ─── LINE ITEMS TOOLBAR & TABLE ─────────────────────────────────────────── */
.line-items-card {
    padding: 22px 24px;
}

.table-toolbar-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.table-title-group {
    display: flex;
    align-items: center;
}

.table-actions-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.invoice-picker-select {
    background: #0b1326;
    border: 1px solid rgba(0, 242, 254, 0.35);
    color: var(--primary-cyan);
    font-weight: 700;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
}

.table-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.items-search-input {
    background: #0b1326;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-sm);
    color: #f8fafc;
    font-size: 12px;
    padding: 7px 12px;
    width: 170px;
    transition: all 0.2s ease;
}

.items-search-input:focus {
    border-color: var(--primary-cyan);
    box-shadow: 0 0 0 2px rgba(0, 242, 254, 0.2);
    width: 240px;
    outline: none;
}

.row-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
}

.status-pill-ok {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.45);
}

.status-pill-diff {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.45);
}

.table-responsive {
    overflow-x: auto;
    max-height: 560px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: var(--radius-md);
    background: #070c18;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.4);
}

.table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.table-responsive::-webkit-scrollbar-track {
    background: #070c18;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

.data-table {
    width: 100%;
    min-width: 980px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.data-table th {
    background: #0d172e;
    padding: 11px 12px;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.data-table td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.data-table input {
    width: 100%;
    height: 36px;
    background: #0f1a30;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.data-table input:focus {
    background: #142240;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 0 2px rgba(0, 242, 254, 0.25);
    outline: none;
}

.data-table input.item-desc {
    min-width: 300px;
    font-weight: 500;
    color: #e2e8f0;
    text-transform: uppercase;
}

.data-table input.item-ritc {
    font-family: var(--font-mono);
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #cbd5e1;
}

.data-table input.item-qty {
    font-family: var(--font-mono);
    text-align: right;
    font-weight: 600;
    color: #f8fafc;
}

.data-table input.item-uqc {
    text-align: center;
    font-weight: 700;
    font-size: 12px;
    color: #94a3b8;
    background: #0a1122;
}

.data-table input.item-rate {
    font-family: var(--font-mono);
    text-align: right;
    font-weight: 600;
    color: #f8fafc;
}

.data-table input.item-amount {
    font-family: var(--font-mono);
    text-align: right;
    font-weight: 700;
    color: #38bdf8;
}

.data-table input.item-amt-mismatch {
    background: rgba(239, 68, 68, 0.16) !important;
    border: 1.5px solid #ef4444 !important;
    color: #fca5a5 !important;
}

.data-table input.item-amt-matched {
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
}

.data-table tr.row-amt-mismatch {
    background: rgba(239, 68, 68, 0.08) !important;
}

.table-delete-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 6px;
    color: var(--accent-rose);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.table-delete-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fff;
    border-color: var(--accent-rose);
}

/* ─── SLIDE-OVER CYBER DRAWER (JSON INSPECTOR) ────────────────────────── */
.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 7, 18, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 490;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.right-panel {
    position: fixed;
    top: 0;
    right: -720px;
    width: 680px;
    max-width: 95vw;
    height: 100vh;
    z-index: 500;
    background: #090e1c;
    border-left: 1px solid rgba(0, 242, 254, 0.3);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 242, 254, 0.15);
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.right-panel.drawer-open {
    right: 0 !important;
}

.json-inspector-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 0;
    border: none;
    background: transparent;
}

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

.json-badge {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--accent-purple);
    background: rgba(121, 40, 202, 0.15);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    margin-right: 6px;
}

.json-subtitle {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

.json-tools {
    display: flex;
    gap: 6px;
}

.json-viewer-container {
    flex: 1;
    overflow: auto;
    padding: 16px 20px;
    background: rgba(7, 10, 18, 0.9);
}

#json-pre-viewer {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 11.5px;
    line-height: 1.6;
    color: #e2e8f0;
}

.dispatch-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--bg-panel-border);
    background: rgba(10, 16, 28, 0.8);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.dispatch-mode-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: #a5b4fc;
    margin-bottom: 12px;
}

/* ─── MODALS ──────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(4, 7, 13, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.2s ease;
}

.modal-card {
    width: 90%;
    max-width: 580px;
    padding: 28px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.modal-large {
    max-width: 820px;
}

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

.modal-status-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.modal-status-badge.success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.job-id-banner {
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.1), rgba(121, 40, 202, 0.15));
    border: 1px solid rgba(0, 242, 254, 0.3);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    margin-bottom: 20px;
}

.job-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-dim);
}

.job-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary-cyan);
    font-family: var(--font-mono);
    letter-spacing: 1px;
    margin-top: 4px;
}

.modal-details-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.modal-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.detail-val {
    color: #f1f5f9;
    font-weight: 500;
}

.text-mono {
    font-family: var(--font-mono);
}

.text-xs {
    font-size: 11px;
}

.modal-response-box {
    background: rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-bottom: 20px;
}

.response-pre {
    font-family: var(--font-mono);
    font-size: 11px;
    color: #94a3b8;
    white-space: pre-wrap;
    max-height: 120px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 20px; }
.mb-1 { margin-bottom: 4px; }
.mb-3 { margin-bottom: 12px; }

/* ─── AMOUNT RECONCILIATION STYLES ────────────────────────────────────────── */
.reconciliation-card {
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 18px;
    transition: var(--transition);
    animation: fadeIn 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.reconciliation-card.mismatch {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(185, 28, 28, 0.16) 100%);
    border: 1px solid rgba(239, 68, 68, 0.35);
    box-shadow: 0 4px 24px rgba(239, 68, 68, 0.12);
}

.reconciliation-card.matched {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.15) 100%);
    border: 1px solid rgba(16, 185, 129, 0.35);
    box-shadow: 0 4px 24px rgba(16, 185, 129, 0.12);
}

.reconciliation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.reconciliation-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reconciliation-icon {
    font-size: 20px;
    line-height: 1;
}

.reconciliation-title {
    font-size: 14px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.2px;
}

.reconciliation-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reconciliation-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.4fr) minmax(290px, 2fr) minmax(120px, 0.8fr);
    align-items: center;
    gap: 16px;
    background: rgba(9, 14, 26, 0.75);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: all 0.2s ease;
    cursor: pointer;
}

.reconciliation-row:hover {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(0, 242, 254, 0.3);
    transform: translateY(-1px);
}

.reconciliation-row.active-row {
    background: rgba(14, 28, 54, 0.9);
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.18);
}

.recon-col {
    display: flex;
    align-items: center;
}

.recon-identity {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.recon-inv-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.recon-inv-tag {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary-cyan);
    background: rgba(0, 242, 254, 0.1);
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid rgba(0, 242, 254, 0.25);
}

.recon-inv-number {
    font-weight: 700;
    color: #f1f5f9;
    font-size: 13px;
}

.recon-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.recon-count {
    color: var(--text-muted);
    font-size: 11.5px;
}

.audit-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.audit-chip-ok {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.audit-chip-alert {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

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

.recon-metrics {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.recon-metric-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.metric-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.5px;
}

.metric-val {
    font-size: 12.5px;
    font-weight: 600;
    color: #f8fafc;
}

.recon-metric-divider {
    color: var(--text-dim);
    font-size: 11px;
}

.recon-diff-box {
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    padding-left: 10px;
    margin-left: 4px;
}

.recon-status {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.recon-active-indicator {
    font-size: 10.5px;
    color: var(--primary-cyan);
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.table-reconciliation-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    margin-top: 8px;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    line-height: 1.5;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.table-reconciliation-bar.mismatch {
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(239, 68, 68, 0.09);
}

.table-reconciliation-bar.matched {
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.09);
}

.btn-calc-all-items {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #60a5fa;
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-calc-all-items:hover {
    background: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
    border-color: #60a5fa;
}

#btn-toggle-table-width.active {
    background: rgba(0, 242, 254, 0.2);
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.25);
}

/* Row & Input Mismatch / Match states */
.row-amt-mismatch {
    background: rgba(239, 68, 68, 0.08) !important;
}

.item-amt-mismatch {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.18) !important;
    color: #fca5a5 !important;
    font-weight: 700 !important;
}

.item-amt-matched {
    border-color: rgba(16, 185, 129, 0.45) !important;
}

