/* ============================================
   CVFormatic Portal — Custom Styles
   Phase 1 Internal Dashboard
   Updated: Sidebar Layout (ChatGPT-style dark sidebar)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* Brand Colors — legacy + new sidebar system */
:root {
    /* Legacy */
    --cvf-dark: #1a2332;
    --cvf-primary: #2563eb;
    --cvf-primary-hover: #1d4ed8;
    --cvf-accent: #38bdf8;
    --cvf-success: #22c55e;
    --cvf-warning: #f59e0b;
    --cvf-danger: #ef4444;
    --cvf-bg: #f1f5f9;
    --cvf-card-bg: #ffffff;
    --cvf-text: #334155;
    --cvf-text-muted: #94a3b8;

    /* Sidebar / new design system */
    --o:   #ff6b1a;
    --oh:  #e85f14;
    --op:  #fff4ef;
    --ob:  rgba(255,107,26,0.2);
    --dk:  #222;
    --dk2: #2c2c2c;
    --bg:  #f9fafb;
    --card:#fff;
    --text:#111827;
    --t2:  #4b5563;
    --mu:  #9ca3af;
    --bd:  #e5e7eb;
    --bd2: #d1d5db;
    --gr:  #15803d;
    --grp: #f0fdf4;
    --grb: #bbf7d0;
    --sh:  0 1px 2px rgba(0,0,0,0.05);
    --shm: 0 4px 16px rgba(0,0,0,0.08);
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html {
    overflow: hidden;
}

body {
    height: 100%;
    overflow: hidden;
    background-color: var(--bg);
    color: var(--text);
}

/* ============================================
   App Shell — Sidebar Layout
   ============================================ */

.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ── */
.sb {
    width: 220px;
    flex-shrink: 0;
    background: var(--dk);
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.sb-top {
    padding: 16px 14px 14px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.sb-logo {
    height: 24px;
    display: block;
}

.sb-upload-btn {
    display: block;
    width: 100%;
    margin: 8px 0 4px;
    background: var(--o);
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

.sb-upload-btn:hover {
    background: var(--oh);
    color: #fff;
    text-decoration: none;
}

/* ── Sidebar Nav ── */
.sb-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 6px;
}

.sb-nav::-webkit-scrollbar { width: 3px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }

.si {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 9px;
    color: rgba(255,255,255,.5);
    font-size: 13px;
    font-weight: 400;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    position: relative;
    margin-bottom: 2px;
}

.si:hover {
    background: rgba(255,255,255,.07);
    color: rgba(255,255,255,.9);
    text-decoration: none;
}

.si.active {
    color: #fff;
    font-weight: 500;
}

.si.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: var(--o);
    border-radius: 0 2px 2px 0;
}

.si svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.si.active svg,
.si:hover svg {
    opacity: 1;
}

.sb-section-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,.3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 10px 10px 4px;
}

/* ── Billing Widget (v3) ── */
.sb-cv-box {
    margin: 6px 10px 9px;
    background: rgba(255,107,26,.1);
    border: 1px solid rgba(255,107,26,.2);
    border-radius: 10px;
    padding: 10px 12px;
}
.sb-cv-box.sb-cv-low {
    background: rgba(251,191,36,.12);
    border-color: rgba(251,191,36,.35);
}
.sb-cv-box.sb-cv-negative {
    background: rgba(239,68,68,.15);
    border-color: rgba(239,68,68,.4);
}

.sb-cv-label {
    font-size: 10px;
    color: rgba(255,255,255,.4);
    font-weight: 500;
    margin-bottom: 2px;
}

.sb-cv-count {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
}

.sb-cv-warn {
    font-size: 10px;
    font-weight: 600;
    margin-top: 4px;
    color: #fbbf24;
}
.sb-cv-negative .sb-cv-warn {
    color: #f87171;
}

.sb-cv-bar-wrap {
    background: rgba(255,255,255,.1);
    border-radius: 4px;
    height: 5px;
    margin: 6px 0 4px;
    overflow: hidden;
}

.sb-cv-bar {
    height: 100%;
    background: var(--o);
    border-radius: 4px;
}

.sb-cv-sub {
    font-size: 10px;
    color: rgba(255,255,255,.35);
}

/* ── Sidebar Bottom ── */
.sb-bot {
    padding: 10px 10px 14px;
    border-top: 1px solid rgba(255,255,255,.07);
    margin-top: auto;
}

.sb-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sb-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--o);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

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

.sb-user-name {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.sb-user-role {
    font-size: 10px;
    color: var(--mu);
    line-height: 1.2;
}

.sb-logout {
    background: none;
    border: none;
    color: rgba(255,255,255,.4);
    padding: 4px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.12s, background 0.12s;
    text-decoration: none;
    flex-shrink: 0;
}

.sb-logout:hover {
    color: #ef4444;
    background: rgba(239,68,68,.1);
}

/* ── Topbar ── */
.topbar {
    height: 50px;
    background: #fff;
    border-bottom: 1px solid var(--bd);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.topbar-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.topbar-bell {
    background: none;
    border: none;
    color: var(--mu);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    transition: background 0.12s, color 0.12s;
}

.topbar-bell:hover {
    background: var(--bg);
    color: var(--t2);
}

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

/* ── Content Scroll Area ── */
.cta {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
}

.cta::-webkit-scrollbar { width: 6px; }
.cta::-webkit-scrollbar-thumb { background: var(--bd2); border-radius: 6px; }
.cta::-webkit-scrollbar-track { background: transparent; }

/* Navbar */
.bg-cvf-dark { background-color: var(--cvf-dark) !important; }
.text-cvf-accent { color: var(--cvf-accent) !important; }
.bg-cvf-accent { background-color: var(--cvf-accent) !important; }
.bg-cvf-primary { background-color: var(--cvf-primary) !important; }

.navbar-brand {
    font-size: 1.25rem;
    letter-spacing: 0.02em;
}

/* Stat Cards */
.stat-card {
    background: var(--cvf-card-bg);
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--cvf-dark);
}

.stat-card .stat-label {
    font-size: 0.82rem;
    color: var(--cvf-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Jobs Table */
.table-jobs {
    font-size: 0.9rem;
}

.table-jobs thead th {
    background-color: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: var(--cvf-text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.75rem;
}

.table-jobs td {
    padding: 0.75rem;
    vertical-align: middle;
}

.table-jobs tbody tr {
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.table-jobs tbody tr:hover {
    background-color: #f0f7ff;
}

/* Status Badges */
.badge-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

.badge-queued { background: #f1f5f9; color: #64748b; }
.badge-extracting, .badge-extracted { background: #eff6ff; color: #3b82f6; }
.badge-formatting, .badge-formatted { background: #fefce8; color: #ca8a04; }
.badge-checking, .badge-checked { background: #faf5ff; color: #9333ea; }
.badge-verifying, .badge-verified { background: #fff7ed; color: #ea580c; }
.badge-generating { background: #ecfdf5; color: #16a34a; }
.badge-completed { background: #dcfce7; color: #15803d; }
.badge-failed { background: #fef2f2; color: #dc2626; }

/* Login Page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--cvf-dark) 0%, #0f172a 100%);
}

.login-card {
    background: var(--cvf-card-bg);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 420px;
    width: 100%;
    padding: 2.5rem;
}

.login-card .brand-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--cvf-dark);
}

.login-card .brand-subtitle {
    color: var(--cvf-text-muted);
    font-size: 0.9rem;
}

/* Upload Area */
.upload-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    background: #fafbfc;
    transition: all 0.2s ease;
    cursor: pointer;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--cvf-primary);
    background: #eff6ff;
}

.upload-dropzone.dragover {
    border-style: solid;
    transform: scale(1.01);
}

.upload-dropzone .upload-icon {
    font-size: 3rem;
    color: #94a3b8;
    margin-bottom: 1rem;
}

.upload-dropzone.dragover .upload-icon {
    color: var(--cvf-primary);
}

.upload-dropzone .upload-text {
    font-size: 1.1rem;
    color: var(--cvf-text);
    margin-bottom: 0.25rem;
}

.upload-dropzone .upload-hint {
    font-size: 0.85rem;
    color: var(--cvf-text-muted);
}

/* File Preview */
.file-preview {
    display: none;
    background: var(--cvf-card-bg);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-top: 1rem;
}

.file-preview.visible {
    display: flex;
    align-items: center;
}

.file-preview .file-icon {
    font-size: 1.5rem;
    margin-right: 0.75rem;
}

.file-preview .file-icon.pdf { color: #ef4444; }
.file-preview .file-icon.docx { color: #2563eb; }

/* Section Title */
.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--cvf-dark);
    margin-bottom: 1.25rem;
}

/* Btn Primary Override */
.btn-cvf {
    background-color: var(--cvf-primary);
    border-color: var(--cvf-primary);
    color: #fff;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
}

.btn-cvf:hover {
    background-color: var(--cvf-primary-hover);
    border-color: var(--cvf-primary-hover);
    color: #fff;
}

.btn-cvf-lg {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
}

/* Quick Upload Button on Dashboard */
.quick-upload-card {
    background: linear-gradient(135deg, var(--cvf-primary) 0%, #1d4ed8 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    text-decoration: none;
    display: block;
    padding: 1.5rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.quick-upload-card:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37,99,235,0.3);
}

/* Alert Styles */
.alert-cvf {
    border-radius: 10px;
    border: none;
    font-size: 0.9rem;
}


/* ============================================
   Part 8B — Pipeline Status Page
   ============================================ */

.pipeline-tracker {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.5rem 0;
    position: relative;
}

.pipeline-tracker::before {
    content: '';
    position: absolute;
    top: 2.75rem;
    left: 2rem;
    right: 2rem;
    height: 3px;
    background: #e2e8f0;
    z-index: 0;
}

.pipeline-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
    text-align: center;
}

.stage-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    border: 3px solid #e2e8f0;
    background: var(--cvf-card-bg);
    color: var(--cvf-text-muted);
    transition: all 0.3s ease;
}

.pipeline-stage.done .stage-dot {
    background: var(--cvf-success);
    border-color: var(--cvf-success);
    color: #fff;
}

.pipeline-stage.active .stage-dot {
    background: var(--cvf-primary);
    border-color: var(--cvf-primary);
    color: #fff;
    animation: stagePulse 1.5s ease-in-out infinite;
}

.pipeline-stage.failed .stage-dot {
    background: var(--cvf-danger);
    border-color: var(--cvf-danger);
    color: #fff;
}

@keyframes stagePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37,99,235,0.4); }
    50% { box-shadow: 0 0 0 10px rgba(37,99,235,0); }
}

.stage-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--cvf-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pipeline-stage.done .stage-label { color: var(--cvf-success); }
.pipeline-stage.active .stage-label { color: var(--cvf-primary); font-weight: 700; }
.pipeline-stage.failed .stage-label { color: var(--cvf-danger); }

.stage-time {
    font-size: 0.7rem;
    color: var(--cvf-text-muted);
    margin-top: 0.15rem;
}


/* ============================================
   Part 8B — Results Page
   ============================================ */

/* QC Download Buttons */
.btn-download-green {
    background: linear-gradient(135deg, #16a34a, #15803d);
    border: none;
    color: #fff;
    padding: 1rem 2.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    border-radius: 12px;
    transition: all 0.2s ease;
}
.btn-download-green:hover {
    background: linear-gradient(135deg, #15803d, #166534);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(22,163,74,0.3);
}

.btn-download-yellow {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: none;
    color: #fff;
    padding: 1rem 2.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    border-radius: 12px;
    transition: all 0.2s ease;
}
.btn-download-yellow:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(245,158,11,0.3);
}

.btn-download-red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    color: #fff;
    padding: 1rem 2.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: not-allowed;
    opacity: 0.8;
}

/* QC Alert Boxes */
.qc-alert-green {
    background: #f0fdf4;
    border-left: 4px solid var(--cvf-success);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    color: #166534;
}

.qc-alert-yellow {
    background: #fffbeb;
    border-left: 4px solid var(--cvf-warning);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    color: #92400e;
}

.qc-alert-red {
    background: #fef2f2;
    border-left: 4px solid var(--cvf-danger);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    color: #991b1b;
}

/* QC Score Badge */
.qc-score {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}
.qc-score.green { color: var(--cvf-success); }
.qc-score.yellow { color: var(--cvf-warning); }
.qc-score.red { color: var(--cvf-danger); }

/* Change Log Table */
.changelog-table {
    font-size: 0.85rem;
}

.changelog-table thead th {
    background: #f8fafc;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cvf-text-muted);
    padding: 0.6rem 0.75rem;
}

.changelog-table td {
    padding: 0.6rem 0.75rem;
    vertical-align: top;
}

.changelog-type {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2em 0.5em;
    border-radius: 4px;
    display: inline-block;
}

.changelog-type.CONTENT_FIX { background: #fef2f2; color: #dc2626; }
.changelog-type.SPELLING { background: #eff6ff; color: #2563eb; }
.changelog-type.PROPER_CASE { background: #faf5ff; color: #9333ea; }
.changelog-type.DATE_FORMAT { background: #fff7ed; color: #ea580c; }
.changelog-type.STRUCTURE { background: #fefce8; color: #ca8a04; }
.changelog-type.OTHER { background: #f1f5f9; color: #64748b; }

/* Side by Side View */
.side-by-side-panel {
    background: var(--cvf-card-bg);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.side-by-side-panel .panel-header {
    background: #f8fafc;
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid #e2e8f0;
    color: var(--cvf-dark);
}

.side-by-side-panel .panel-body {
    padding: 1rem;
    max-height: 500px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* JSON Formatted View */
.json-section {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.json-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.json-section-heading {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--cvf-dark);
    margin-bottom: 0.4rem;
}


/* ============================================
   Part 8B — History Page
   ============================================ */

.filter-bar {
    background: var(--cvf-card-bg);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 1.25rem;
}

.filter-bar .form-control,
.filter-bar .form-select {
    border-radius: 8px;
    font-size: 0.9rem;
    border-color: #e2e8f0;
}

.filter-bar .form-control:focus,
.filter-bar .form-select:focus {
    border-color: var(--cvf-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* Pagination */
.pagination .page-link {
    border-radius: 8px;
    margin: 0 2px;
    font-size: 0.85rem;
    color: var(--cvf-primary);
    border-color: #e2e8f0;
}

.pagination .page-item.active .page-link {
    background: var(--cvf-primary);
    border-color: var(--cvf-primary);
}

/* Action buttons in table */
.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.78rem;
    border-radius: 6px;
    font-weight: 500;
}

/* Technical Details Compact */
.tech-detail {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
}

.tech-detail:last-child { border-bottom: none; }
.tech-detail .tech-label { color: var(--cvf-text-muted); font-weight: 500; }
.tech-detail .tech-value { font-weight: 600; color: var(--cvf-dark); }


/* ============================================
   Responsive tweaks
   ============================================ */

@media (max-width: 768px) {
    .stat-card .stat-value { font-size: 1.4rem; }
    .login-card { margin: 1rem; padding: 2rem; }
    main { padding: 1rem !important; }
    
    /* Stack pipeline stages on mobile */
    .pipeline-tracker {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .pipeline-tracker::before { display: none; }
    .pipeline-stage {
        flex-direction: row;
        text-align: left;
        gap: 0.75rem;
    }
    .stage-dot { margin-bottom: 0; }
    
    /* Stack side-by-side on mobile */
    .side-by-side-panel .panel-body {
        max-height: 300px;
    }
    
    .qc-score { font-size: 2rem; }
    .btn-download-green,
    .btn-download-yellow {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}


/* ============================================
   AUTH PAGES — Login / Signup / Forgot Password
   Standalone full-page design (no sidebar)
   ============================================ */

/* Page wrapper */
.auth-p {
    min-height: 100vh;
    width: 100%;
    margin: 0;
    padding: 24px 16px;
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    box-sizing: border-box;
}

/* Decorative orange glow orbs */
.ao1, .ao2 {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
}
.ao1 {
    width: 500px; height: 500px;
    background: rgba(255,107,26,.1);
    top: -150px; right: -100px;
}
.ao2 {
    width: 350px; height: 350px;
    background: rgba(255,107,26,.06);
    bottom: -100px; left: -80px;
}

/* Auth card */
.auth-box {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 390px;
    padding: 36px;
    position: relative;
    z-index: 1;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.auth-box.auth-wide { max-width: 440px; }

/* Logo */
.a-logo {
    text-align: center;
    margin-bottom: 28px;
}
.a-logo img { display: inline-block; }

/* Heading */
.a-h {
    font-size: 22px;
    font-weight: 800;
    text-align: center;
    margin: 0 0 5px;
    letter-spacing: -.02em;
    color: #111827;
    line-height: 1.2;
}

/* Subheading */
.a-sub {
    font-size: 14px;
    color: #9ca3af;
    text-align: center;
    margin: 0 0 24px;
    line-height: 1.55;
}

/* Field wrapper */
.fd {
    margin-bottom: 14px;
}
.fd label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 5px;
}
.fd input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    color: #111827;
    background: #fff;
    outline: none;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}
.fd input:focus {
    border-color: #ff6b1a;
    box-shadow: 0 0 0 3px rgba(255,107,26,.08);
}

/* Forgot password link */
.fgt {
    float: right;
    font-size: 12px;
    color: #ff6b1a;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    line-height: 1;
}
.fgt:hover { text-decoration: underline; color: #e85f14; }

/* Submit button */
.auth-btn {
    display: block;
    width: 100%;
    background: #ff6b1a;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 11px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, box-shadow .15s, transform .12s;
    margin-top: 6px;
}
.auth-btn:hover {
    background: #e85f14;
    box-shadow: 0 4px 12px rgba(255,107,26,.3);
    transform: translateY(-1px);
}

/* Footer link row */
.a-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: #9ca3af;
}
.a-footer a {
    color: #ff6b1a;
    font-weight: 500;
    text-decoration: none;
}
.a-footer a:hover { text-decoration: underline; }

/* Error message */
.auth-err {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #b91c1c;
    margin-bottom: 16px;
}
.auth-err ul { margin: 4px 0 0 0; padding-left: 18px; }
.auth-err li { margin-bottom: 2px; }

/* Success message */
.auth-ok {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #15803d;
    margin-bottom: 16px;
}

/* Success state (full card) */
.auth-success-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #f0fdf4;
    border: 2px solid #bbf7d0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: #15803d;
    font-size: 26px;
}

/* Account type selector cards (signup) */
.at-cards {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}
.at-card {
    flex: 1;
    border: 1.5px solid #d1d5db;
    border-radius: 12px;
    padding: 14px 12px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    text-align: center;
    user-select: none;
}
.at-card:hover { border-color: #ff6b1a; }
.at-card.active {
    border-color: #ff6b1a;
    background: rgba(255,107,26,.06);
}
.at-card input[type="radio"] { display: none; }
.at-card .at-icon { font-size: 22px; margin-bottom: 4px; }
.at-card .at-label {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    display: block;
}
.at-card .at-desc {
    font-size: 11px;
    color: #9ca3af;
    display: block;
    margin-top: 2px;
}

/* Field row (50/50) */
.fd-row {
    display: flex;
    gap: 10px;
}
.fd-row .fd { flex: 1; min-width: 0; }

/* Auth page responsive */
@media (max-width: 480px) {
    .auth-box { padding: 28px 20px; }
    .fd-row { flex-direction: column; gap: 0; }
    .at-cards { flex-direction: column; }
    .ao1 { width: 300px; height: 300px; }
    .ao2 { width: 200px; height: 200px; }
}

/* ══════════════════════════════════════════════════════
   DASHBOARD
══════════════════════════════════════════════════════ */

/* Flash banner */
.db-flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
}
.db-flash.success { background: #ecfdf5; color: #15803d; border: 1px solid #bbf7d0; }
.db-flash.danger  { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.db-flash.info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.db-flash-icon    { font-size: 16px; flex-shrink: 0; }

/* Welcome row */
.db-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.db-welcome-text h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 3px;
    line-height: 1.2;
}
.db-welcome-text p {
    font-size: 13px;
    color: var(--t2);
    margin: 0;
}
.db-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--o);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s;
    flex-shrink: 0;
}
.db-upload-btn:hover { background: var(--oh); color: #fff; }

/* Upload CTA card */
.upload-cta {
    display: flex;
    align-items: center;
    gap: 22px;
    background: linear-gradient(135deg, #ff6b1a 0%, #e8520d 100%);
    border-radius: 14px;
    padding: 24px 28px;
    margin-bottom: 20px;
    text-decoration: none;
    transition: opacity .15s, transform .15s;
}
.upload-cta:hover { opacity: .93; transform: translateY(-1px); }
.upload-cta-icon {
    width: 54px;
    height: 54px;
    background: rgba(255,255,255,.18);
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}
.upload-cta-text { flex: 1; }
.upload-cta-text strong {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 3px;
}
.upload-cta-text span {
    font-size: 13px;
    color: rgba(255,255,255,.82);
}
.upload-cta-arrow {
    font-size: 22px;
    color: rgba(255,255,255,.7);
    flex-shrink: 0;
}

/* Two-column grid */
.db-grid {
    display: grid;
    grid-template-columns: 1fr 272px;
    gap: 20px;
    align-items: start;
}

/* Recent jobs card */
.jobs-card {
    background: var(--card);
    border-radius: 14px;
    border: 1px solid var(--bd);
    overflow: hidden;
}
.jobs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid var(--bd);
}
.jobs-header-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.jobs-header-link {
    font-size: 12px;
    color: var(--t2);
    text-decoration: none;
    font-weight: 500;
    transition: color .12s;
}
.jobs-header-link:hover { color: var(--o); }

/* Empty state */
.jobs-empty {
    padding: 44px 20px;
    text-align: center;
    color: var(--t2);
    font-size: 14px;
    line-height: 1.7;
}
.jobs-empty-icon {
    font-size: 38px;
    display: block;
    margin-bottom: 10px;
    opacity: .45;
}

/* Job row */
.job-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--bd2);
    cursor: pointer;
    transition: background .12s;
    text-decoration: none;
    color: inherit;
}
.job-row:last-child { border-bottom: none; }
.job-row:hover { background: rgba(255,107,26,.04); }

.job-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
    font-weight: 700;
}
.job-icon.completed { background: #ecfdf5; color: #15803d; }
.job-icon.failed    { background: #fef2f2; color: #dc2626; }
.job-icon.progress  { background: #eff6ff; color: #2563eb; }

.job-info { flex: 1; min-width: 0; }
.job-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.job-meta {
    font-size: 11px;
    color: var(--t2);
}

.job-right { text-align: right; flex-shrink: 0; }
.job-time {
    font-size: 11px;
    color: var(--t2);
    margin-top: 3px;
}

/* Job status badges */
.job-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    line-height: 1.5;
}
.job-badge.completed  { background: #ecfdf5; color: #15803d; }
.job-badge.failed     { background: #fef2f2; color: #dc2626; }
.job-badge.processing { background: #eff6ff; color: #2563eb; }
.job-badge.queued     { background: #f5f3ff; color: #6d28d9; }

/* Right stats stack */
.stats-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.stats-card {
    background: var(--card);
    border-radius: 14px;
    border: 1px solid var(--bd);
    padding: 16px 18px;
}
.stats-card-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--t2);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 12px;
}
.stat-big {
    font-size: 34px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    margin-bottom: 3px;
}
.stat-big-sub {
    font-size: 12px;
    color: var(--t2);
    margin-bottom: 14px;
}
.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid var(--bd2);
}
.stat-row:last-child { border-bottom: none; }
.stat-row-label {
    font-size: 12px;
    color: var(--t2);
}
.stat-row-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}
.stat-row-value.green  { color: #16a34a; }
.stat-row-value.orange { color: #ff6b1a; }
.stat-row-value.red    { color: #dc2626; }
.stat-row-value.blue   { color: #2563eb; }
.stat-row-value.amber  { color: #d97706; }

/* Dashboard responsive */
@media (max-width: 900px) {
    .db-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .db-welcome { flex-direction: column; align-items: flex-start; gap: 12px; }
    .upload-cta { padding: 18px 20px; gap: 16px; }
    .upload-cta-icon { width: 44px; height: 44px; }
    .upload-cta-text strong { font-size: 15px; }
    .upload-cta-arrow { display: none; }
}

/* ══════════════════════════════════════════════════════
   UPLOAD PAGE
══════════════════════════════════════════════════════ */

/* Wrapper */
.up-wrap {
    max-width: 680px;
    margin: 0 auto;
}

/* Page header */
.up-h {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--text);
    margin: 0 0 6px;
}
.up-sub {
    font-size: 14px;
    color: var(--mu);
    margin: 0 0 24px;
    line-height: 1.6;
}

/* Drop zone */
.dz {
    border: 2px dashed #d1d5db;
    border-radius: 16px;
    padding: 52px 28px;
    text-align: center;
    cursor: pointer;
    background: #fff;
    margin-bottom: 20px;
    transition: border-color .2s, background .2s;
}
.dz:hover,
.dz.drag-over {
    border-color: #ff6b1a;
    background: #fff4ef;
}
.dz.has-file {
    border-color: #15803d;
    border-style: solid;
    background: #f0fdf4;
}

/* Drop zone icon box */
.dz-iw {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: #fff4ef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ff6b1a;
    margin: 0 auto 14px;
    transition: transform .2s;
}
.dz:hover .dz-iw { transform: scale(1.06); }

/* Drop zone text */
.dz-t {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 5px;
}
.dz-s {
    font-size: 14px;
    color: var(--mu);
    margin: 0 0 16px;
}

/* OR divider */
.dz-or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
    color: var(--mu);
    font-size: 12px;
}
.dz-or::before,
.dz-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* Browse button */
.dz-browse {
    display: inline-block;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .15s, color .15s;
}
.dz-browse:hover { border-color: #ff6b1a; color: #ff6b1a; }

/* Format pills */
.dz-fmts {
    display: flex;
    justify-content: center;
    gap: 7px;
    margin-top: 12px;
}
.dz-pill-pdf {
    background: #fff4ef;
    color: #ff6b1a;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
}
.dz-pill-docx {
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
}

/* File info (shown when file selected) */
.dz-fi-icon { font-size: 30px; display: block; margin-bottom: 4px; }
.dz-fi-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 8px 0 2px;
    word-break: break-all;
}
.dz-fi-size {
    font-size: 12px;
    color: var(--mu);
    margin: 0 0 8px;
}
.dz-fi-remove {
    border: 1px solid #fca5a5;
    color: #b91c1c;
    background: #fff;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background .12s;
}
.dz-fi-remove:hover { background: #fef2f2; }

/* Form field wrapper */
.up-field { margin-bottom: 20px; }
.up-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

/* Select element */
.up-sel {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 32px 10px 14px;
    font-size: 14px;
    color: #111827;
    background: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    outline: none;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}
.up-sel:focus {
    border-color: #ff6b1a;
    box-shadow: 0 0 0 3px rgba(255,107,26,.08);
}

/* Client info bar (non-admin, linked) */
.up-client-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff4ef;
    border: 1px solid rgba(255,107,26,.2);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #4b5563;
}
.up-client-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ff6b1a;
    flex-shrink: 0;
}

/* Unlinked warning bar */
.up-warn-bar {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #b91c1c;
}

/* Loading indicator */
.up-loading {
    text-align: center;
    padding: 8px 0;
    color: var(--mu);
    font-size: 13px;
}
.up-spinner {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255,107,26,.2);
    border-top-color: #ff6b1a;
    border-radius: 50%;
    animation: up-spin .7s linear infinite;
    vertical-align: middle;
    margin-right: 5px;
}
@keyframes up-spin { to { transform: rotate(360deg); } }

/* Submit button */
.up-btn-wrap { margin-top: 24px; }
.up-btn {
    width: 100%;
    background: #ff6b1a;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 13px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, box-shadow .15s, transform .12s;
}
.up-btn:hover:not(:disabled) {
    background: #e85f14;
    box-shadow: 0 4px 12px rgba(255,107,26,.3);
    transform: translateY(-1px);
}
.up-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Bottom hint */
.up-hint {
    text-align: center;
    font-size: 12px;
    color: var(--mu);
    margin-top: 12px;
}

/* ══════════════════════════════════════════════════════
   ── HISTORY PAGE ──
══════════════════════════════════════════════════════ */

/* Page header */
.hist-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.hist-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--text);
    margin: 0;
    display: inline;
}
.hist-count {
    font-size: 14px;
    font-weight: 400;
    color: var(--mu);
    margin-left: 8px;
    letter-spacing: 0;
}

/* Filter bar — the <form> itself is the bar */
form.hist-filter {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}
.hist-fi {
    flex: 1;
    min-width: 160px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s;
    box-sizing: border-box;
    color: var(--text);
}
.hist-fi:focus { border-color: #ff6b1a; }
.hist-fs {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    color: #4b5563;
    background: #fff;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color .15s;
    appearance: none;
    -webkit-appearance: none;
}
.hist-fs:focus { border-color: #ff6b1a; }
.hist-btn {
    background: #ff6b1a;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}
.hist-btn:hover { background: #e85f14; }
.hist-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 18px;
    line-height: 1;
    color: #4b5563;
    text-decoration: none;
    background: #fff;
    transition: border-color .12s, color .12s;
    flex-shrink: 0;
}
.hist-clear:hover { border-color: #ff6b1a; color: #ff6b1a; }

/* Jobs list card */
.hist-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

/* Column header row */
.hist-list-hdr {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .05em;
    gap: 10px;
}

/* Job row */
.hist-row {
    display: flex;
    align-items: center;
    padding: 11px 16px;
    border-bottom: 1px solid #f9fafb;
    cursor: pointer;
    transition: background .1s;
    gap: 10px;
}
.hist-row:last-of-type { border-bottom: none; }
.hist-row:hover { background: #f9fafb; }

/* File icon */
.hist-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.hist-icon.completed { background: #eff6ff; }
.hist-icon.failed    { background: #fef2f2; }
.hist-icon.progress  { background: #fff4ef; }

/* Columns */
.hist-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hist-client {
    width: 100px;
    flex-shrink: 0;
    font-size: 12px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hist-date {
    width: 100px;
    flex-shrink: 0;
    font-size: 12px;
    color: #9ca3af;
    white-space: nowrap;
}
.hist-actions {
    width: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

/* Action buttons (icon-only) */
.hist-act-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: none;
    background: transparent;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s;
    font-family: inherit;
}
.hist-act-btn.dl { color: #15803d; }
.hist-act-btn.dl:hover { background: #f0fdf4; }
.hist-act-btn.del { color: #b91c1c; }
.hist-act-btn.del:hover { background: #fef2f2; }

/* Empty state */
.hist-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--t2);
    font-size: 14px;
    line-height: 1.8;
}

/* Pagination */
.hist-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 14px 18px;
    border-top: 1px solid #f3f4f6;
    flex-wrap: wrap;
}
.hist-pnum {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #4b5563;
    transition: border-color .12s, color .12s;
    cursor: pointer;
}
.hist-pnum:hover:not(.active):not(.disabled) { border-color: #ff6b1a; color: #ff6b1a; }
.hist-pnum.active { background: #ff6b1a; color: #fff; border-color: #ff6b1a; }
.hist-pnum.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* Responsive */
@media (max-width: 640px) {
    .hist-client, .hist-date { display: none; }
    .hist-list-hdr { display: none; }
    form.hist-filter { gap: 8px; }
}

/* ══════════════════════════════════════════════════════
   ── STATUS PAGE ──
══════════════════════════════════════════════════════ */

/* Breadcrumb (shared with results) */
.bc {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    font-size: 12px;
    flex-wrap: wrap;
}
.bc-link { color: var(--mu); text-decoration: none; }
.bc-link:hover { color: var(--o); }
.bc-sep { color: var(--mu); }
.bc-cur { color: var(--t2); font-weight: 500; }

/* Generic status-page card */
.st-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    padding: 20px 24px;
    margin-bottom: 16px;
}

/* Job title header inside card */
.st-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.st-filename {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 5px;
    word-break: break-word;
}
.st-meta { font-size: 12px; color: var(--t2); }
.st-elapsed { font-size: 12px; color: var(--mu); margin-top: 6px; }

/* Progress bar */
.st-bar-wrap {
    height: 6px;
    border-radius: 3px;
    background: #f3f4f6;
    margin-bottom: 24px;
    overflow: hidden;
}
.st-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .5s ease;
}
.st-bar-fill.bar-active {
    background: #ff6b1a;
    animation: bar-shimmer 1.5s ease-in-out infinite;
}
.st-bar-fill.bar-done  { background: #15803d; }
.st-bar-fill.bar-failed { background: #b91c1c; }
@keyframes bar-shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: .65; }
}

/* Override active pipeline dot to orange */
.pipeline-stage.active .stage-dot {
    background: #ff6b1a !important;
    border-color: #ff6b1a !important;
    color: #fff !important;
    box-shadow: 0 0 0 3px rgba(255,107,26,.2) !important;
}
.pipeline-stage.active .stage-label { color: #ff6b1a !important; }

/* Completed card — green gradient */
.st-done-card {
    background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    box-shadow: 0 4px 20px rgba(21,128,61,.2);
}
.st-done-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.st-done-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: rgba(255,255,255,.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}
.st-done-title {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 3px;
}
.st-done-meta { font-size: 12px; color: rgba(255,255,255,.75); }
.st-results-btn {
    background: #fff;
    color: #15803d;
    font-weight: 800;
    font-size: 14px;
    padding: 11px 22px;
    border-radius: 10px;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-block;
    transition: transform .15s, box-shadow .15s;
}
.st-results-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(0,0,0,.15);
    color: #15803d;
}

/* Failed card — red gradient */
.st-fail-card {
    background: linear-gradient(135deg, #991b1b 0%, #b91c1c 100%);
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    box-shadow: 0 4px 20px rgba(185,28,28,.2);
}
.st-fail-left {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex: 1;
    min-width: 0;
}
.st-fail-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: rgba(255,255,255,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    flex-shrink: 0;
}
.st-fail-title { font-size: 15px; font-weight: 800; color: #fff; margin-bottom: 6px; }
.st-fail-meta { font-size: 12px; color: rgba(255,255,255,.75); }
.st-err-block {
    background: rgba(0,0,0,.22);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 8px;
}
.st-err-block code { font-size: 11px; color: rgba(255,255,255,.9); word-break: break-all; }
.st-reprocess-btn {
    background: #ff6b1a;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .15s;
    align-self: flex-start;
}
.st-reprocess-btn:hover { background: #e85f14; }

/* Queued card */
.st-queue-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    padding: 40px 24px;
    margin-bottom: 16px;
    text-align: center;
}
.st-queue-icon { font-size: 38px; display: block; margin-bottom: 10px; opacity: .45; }
.st-queue-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.st-queue-sub { font-size: 13px; color: var(--t2); margin: 0; }

/* Status responsive */
@media (max-width: 600px) {
    .st-done-card, .st-fail-card { flex-direction: column; }
}

/* ══════════════════════════════════════════════════════
   ── RESULTS PAGE ──
══════════════════════════════════════════════════════ */

/* Page header */
.res-hdr {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.res-filename {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 4px;
    word-break: break-word;
}
.res-meta { font-size: 12px; color: var(--t2); margin: 0; }
.res-hdr-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.res-ghost-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: border-color .12s, color .12s;
    white-space: nowrap;
}
.res-ghost-btn:hover { border-color: #ff6b1a; color: #ff6b1a; }

/* Hero banner */
.res-hero {
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.res-hero.green  { background: linear-gradient(135deg, #15803d 0%, #16a34a 100%); box-shadow: 0 4px 20px rgba(21,128,61,.2); }
.res-hero.yellow { background: linear-gradient(135deg, #b45309 0%, #d97706 100%); box-shadow: 0 4px 20px rgba(180,83,9,.2); }
.res-hero.red    { background: linear-gradient(135deg, #991b1b 0%, #b91c1c 100%); box-shadow: 0 4px 20px rgba(153,27,27,.2); }
.res-hero.nofile { background: linear-gradient(135deg, #374151 0%, #4b5563 100%); box-shadow: 0 4px 20px rgba(55,65,81,.2); }

.res-hero-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: rgba(255,255,255,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    flex-shrink: 0;
}
.res-hero-center { flex: 1; min-width: 0; }
.res-hero-title {
    font-size: 17px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 3px;
}
.res-hero-sub {
    font-size: 11px;
    color: rgba(255,255,255,.65);
    margin: 0;
}
.res-dl-btn {
    background: #fff;
    font-weight: 800;
    font-size: 14px;
    padding: 11px 20px;
    border-radius: 10px;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-block;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: transform .15s, box-shadow .15s;
}
.res-dl-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(0,0,0,.15); }
.res-dl-btn.green  { color: #15803d; }
.res-dl-btn.yellow { color: #b45309; }
.res-dl-btn.red    { color: #991b1b; }

/* Two-column grid */
.res-grid {
    display: grid;
    grid-template-columns: 1fr 255px;
    gap: 16px;
    margin-bottom: 20px;
    align-items: start;
}

/* QC card */
.res-qc-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    padding: 18px 20px;
}
.res-qc-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}
.res-qc-hdr-left { display: flex; align-items: center; gap: 12px; }
.res-qc-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #fff4ef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #ff6b1a;
    flex-shrink: 0;
}
.res-qc-label { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.res-qc-sub   { font-size: 12px; color: var(--mu); }
.res-qc-score { font-size: 28px; font-weight: 800; line-height: 1; }
.res-qc-score.green  { color: #15803d; }
.res-qc-score.yellow { color: #d97706; }
.res-qc-score.red    { color: #dc2626; }

/* Check items grid */
.res-ck-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.ck {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 500;
}
.ck.pass { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.ck.warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.ck.blue { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.ck-icon { font-size: 13px; flex-shrink: 0; }
.res-qc-msg {
    padding: 10px 12px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 500;
    grid-column: 1 / -1;
    margin-top: 2px;
}
.res-qc-msg.green  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.res-qc-msg.yellow { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.res-qc-msg.red    { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Actions sidebar card */
.res-act-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    padding: 16px;
}
.res-act-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--t2);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 12px;
}
.res-act-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 9px;
    border: 1px solid #d1d5db;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    margin-bottom: 8px;
    transition: border-color .12s, color .12s;
    box-sizing: border-box;
    text-align: left;
}
.res-act-btn:last-child { margin-bottom: 0; }
.res-act-btn:hover:not(:disabled) { border-color: #ff6b1a; color: #ff6b1a; }
.res-act-btn.warn:hover:not(:disabled) { border-color: #d97706; color: #d97706; }
.res-act-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Tabs card */
.res-tabs-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    margin-bottom: 20px;
}
.res-tabs-head {
    padding: 10px 14px 0;
    border-bottom: 1px solid #f3f4f6;
    background: #f9fafb;
}

/* Pill-style tabs — override Bootstrap nav-tabs */
ul.res-tab-bar {
    display: flex;
    gap: 2px;
    list-style: none;
    padding: 4px;
    margin: 0;
    background: #f3f4f6;
    border-radius: 10px;
    border: none !important;
}
ul.res-tab-bar .nav-link {
    border-radius: 8px !important;
    padding: 6px 14px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #4b5563 !important;
    background: transparent !important;
    border: none !important;
    transition: background .12s, color .12s, box-shadow .12s !important;
    white-space: nowrap;
}
ul.res-tab-bar .nav-link.active {
    background: #fff !important;
    color: #111827 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.08) !important;
}
ul.res-tab-bar .nav-link:hover:not(.active) { color: #111827 !important; }

/* Results responsive */
@media (max-width: 860px) {
    .res-grid { grid-template-columns: 1fr; }
    .res-ck-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .res-hero { padding: 16px; gap: 12px; }
    .res-dl-btn { font-size: 13px; padding: 9px 14px; }
}

/* ══════════════════════════════════════════════════
   ADMIN USERS
══════════════════════════════════════════════════ */

/* Page header */
.au-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.au-hdr-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.au-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}
.au-pending-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
}
.au-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--o);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    padding: 9px 18px;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}
.au-add-btn:hover { background: var(--oh); }

/* Flash */
.au-flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}
.au-flash-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.au-flash-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.au-flash-close {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    font-size: 16px;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}
.au-flash-close:hover { opacity: 1; }

/* User list card */
.au-card {
    background: #fff;
    border: 1px solid var(--bd);
    border-radius: 16px;
    overflow: hidden;
}

/* Grid: Name | Email | Type | Role | Billing | Client | Jobs | Balance | Status | Last Login | Actions */
.au-list-hdr,
.au-row {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr 0.7fr 0.8fr 1.2fr 0.5fr 0.8fr 1fr 0.9fr;
    align-items: center;
    gap: 0 12px;
    padding: 0 16px;
}
.au-list-hdr {
    padding-top: 10px;
    padding-bottom: 10px;
    background: #f9fafb;
    border-bottom: 1px solid var(--bd);
}
.au-list-hdr span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--mu);
}
.au-row {
    padding-top: 13px;
    padding-bottom: 13px;
    border-bottom: 1px solid #f3f4f6;
    transition: background .1s;
}
.au-row:last-child { border-bottom: none; }
.au-row:hover { background: #fafafa; }
.au-row.pending { background: #fffbeb; }
.au-row.pending:hover { background: #fef3c7; }

/* Avatar + name cell */
.au-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.au-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--o);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: .04em;
}
.au-name-info { min-width: 0; }
.au-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.au-jobtitle {
    font-size: 11.5px;
    color: var(--mu);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Email cell */
.au-email {
    font-size: 12.5px;
    color: var(--t2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badges */
.au-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
}
.au-badge-agency     { background: #eff6ff; color: #1d4ed8; }
.au-badge-individual { background: #f3f4f6; color: #374151; }
.au-badge-admin      { background: #fef2f2; color: #dc2626; }
.au-badge-user       { background: #eff6ff; color: #2563eb; }
.au-badge-active     { background: #f0fdf4; color: #16a34a; }
.au-badge-pending    { background: #fff7ed; color: #c2410c; }

/* Client cell */
.au-client-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.au-client-name {
    font-size: 12px;
    font-weight: 500;
    background: #f3f4f6;
    color: var(--text);
    border: 1px solid var(--bd);
    border-radius: 6px;
    padding: 2px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
}
.au-none { font-size: 12px; color: var(--mu); }

/* Link button (tiny) */
.au-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid var(--bd2);
    background: #fff;
    color: var(--t2);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .12s, color .12s;
}
.au-link-btn:hover { border-color: var(--o); color: var(--o); }

/* Jobs count */
.au-jobs {
    font-size: 13px;
    font-weight: 600;
    color: var(--t2);
}

/* Last login */
.au-date {
    font-size: 12px;
    color: var(--mu);
    white-space: nowrap;
}

/* Actions */
.au-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}
.au-act-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid var(--bd2);
    background: #fff;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    color: var(--t2);
    font-size: 13px;
}
.au-act-btn:hover { background: #f3f4f6; }
.au-act-approve  { color: #16a34a; border-color: #bbf7d0; }
.au-act-approve:hover  { background: #f0fdf4; border-color: #86efac; }
.au-act-deactivate { color: #d97706; border-color: #fde68a; }
.au-act-deactivate:hover { background: #fffbeb; border-color: #fcd34d; }
.au-act-pass     { color: #6366f1; border-color: #c7d2fe; }
.au-act-pass:hover { background: #eef2ff; border-color: #a5b4fc; }

/* ── Modals ── */
.au-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1050;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.au-modal-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}
.au-modal-box-sm { max-width: 400px; }
.au-modal-box-md { max-width: 520px; }
.au-modal-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--bd);
}
.au-modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.au-modal-close {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--bd2);
    background: #fff;
    color: var(--t2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: background .12s;
}
.au-modal-close:hover { background: #f3f4f6; }
.au-modal-body {
    padding: 20px;
}

/* Modal form fields */
.au-field {
    margin-bottom: 14px;
}
.au-field label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--t2);
    margin-bottom: 5px;
}
.au-input,
.au-select {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--bd2);
    border-radius: 9px;
    font-size: 13.5px;
    color: var(--text);
    background: #fff;
    font-family: inherit;
    transition: border-color .15s;
    box-sizing: border-box;
}
.au-input:focus,
.au-select:focus {
    outline: none;
    border-color: var(--o);
}
.au-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.au-modal-note {
    font-size: 12.5px;
    color: var(--mu);
    margin-bottom: 14px;
    line-height: 1.5;
}
.au-modal-desc {
    font-size: 13.5px;
    color: var(--t2);
    margin-bottom: 14px;
}

/* Modal submit buttons */
.au-submit-btn {
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    font-family: inherit;
    margin-top: 4px;
}
.au-submit-orange { background: var(--o); color: #fff; }
.au-submit-orange:hover { background: var(--oh); }
.au-submit-amber { background: #f59e0b; color: #fff; }
.au-submit-amber:hover { background: #d97706; }

/* Modal error list */
.au-err {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 9px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #991b1b;
}
.au-err ul {
    margin: 0;
    padding-left: 16px;
}

/* Empty state */
.au-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--mu);
    font-size: 14px;
}

/* ══════════════════════════════════════════════════
   DIAGNOSTIC
══════════════════════════════════════════════════ */

/* Page header */
.diag-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.diag-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.diag-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 9px;
    border: 1.5px solid var(--bd2);
    background: #fff;
    color: var(--t2);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: border-color .12s, color .12s;
    white-space: nowrap;
}
.diag-back-btn:hover { border-color: var(--o); color: var(--o); }

/* ── Job Selector Card ── */
.diag-selector {
    background: #fff;
    border: 1px solid var(--bd);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 24px;
}
.diag-sel-hdr {
    padding: 14px 20px;
    border-bottom: 1px solid var(--bd);
    background: #f9fafb;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.diag-sel-body {
    padding: 20px;
}
.diag-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
@media (max-width: 640px) { .diag-form-row { grid-template-columns: 1fr; } }
.diag-field-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--t2);
    margin-bottom: 6px;
}
.diag-input-wrap {
    display: flex;
    gap: 0;
    border-radius: 9px;
    overflow: hidden;
    border: 1.5px solid var(--bd2);
    transition: border-color .15s;
}
.diag-input-wrap:focus-within { border-color: var(--o); }
.diag-input-wrap input {
    flex: 1;
    border: none;
    outline: none;
    padding: 9px 12px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    min-width: 0;
}
.diag-btn-primary,
.diag-btn-compare {
    border: none;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background .12s;
}
.diag-btn-primary { background: var(--o); color: #fff; }
.diag-btn-primary:hover { background: var(--oh); }
.diag-btn-compare { background: #0891b2; color: #fff; }
.diag-btn-compare:hover { background: #0e7490; }

/* Recent jobs mini-table */
.diag-recent-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--t2);
    margin-bottom: 10px;
}
.diag-recent-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.diag-recent-table th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--mu);
    padding: 6px 10px;
    border-bottom: 1px solid var(--bd);
    text-align: left;
}
.diag-recent-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f3f4f6;
    color: var(--t2);
}
.diag-recent-table tr:last-child td { border-bottom: none; }
.diag-recent-table tr:hover td { background: #fafafa; }
.diag-diag-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 7px;
    border: 1.5px solid var(--o);
    color: var(--o);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background .12s, color .12s;
}
.diag-diag-link:hover { background: var(--o); color: #fff; }

/* ── Job cards ── */
.diag-job-card {
    border-radius: 16px;
    border: 1px solid;
    overflow: hidden;
    margin-bottom: 20px;
}
.diag-job-card.diag-has-issues { border-color: #fca5a5; }
.diag-job-card.diag-clean      { border-color: #86efac; }

.diag-job-hdr {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 18px;
    font-size: 13.5px;
    font-weight: 600;
}
.diag-job-hdr.diag-has-issues { background: #ef4444; color: #fff; }
.diag-job-hdr.diag-clean      { background: #22c55e; color: #fff; }
.diag-job-hdr-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
}
.diag-badge-warn { background: #fef08a; color: #854d0e; }
.diag-badge-ok   { background: rgba(255,255,255,.25); color: #fff; }

.diag-job-body {
    padding: 18px;
    background: #fff;
}

/* Issue alert */
.diag-issue-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13px;
    color: #991b1b;
    margin-bottom: 12px;
}

/* Files row */
.diag-files-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.diag-file-chip {
    font-size: 12px;
    color: var(--mu);
}
.diag-file-chip code {
    background: #f3f4f6;
    border-radius: 5px;
    padding: 2px 6px;
    font-size: 11.5px;
    color: var(--t2);
}

/* Tab nav wrapper */
.diag-tab-wrap {
    margin-bottom: 0;
}
.diag-tab-wrap ul.res-tab-bar {
    margin-bottom: 0;
    border-radius: 10px 10px 0 0;
}

/* Tab content panel */
.diag-tab-content {
    border: 1.5px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 16px;
    background: #fff;
    min-height: 80px;
}

/* Decision cards (tab 1) */
.diag-dec-card {
    border-radius: 10px;
    border-left: 4px solid;
    padding: 10px 14px;
    margin-bottom: 8px;
    background: #f9fafb;
}
.diag-dec-card.dec-multiple { border-left-color: #22c55e; }
.diag-dec-card.dec-single   { border-left-color: #f59e0b; }
.diag-dec-card.dec-other    { border-left-color: #9ca3af; }
.diag-dec-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
}
.diag-dec-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}
.diag-dec-badge.dec-multiple { background: #dcfce7; color: #166534; }
.diag-dec-badge.dec-single   { background: #fef3c7; color: #92400e; }
.diag-dec-badge.dec-other    { background: #f3f4f6; color: #4b5563; }
.diag-dec-reason {
    font-size: 12.5px;
    color: var(--t2);
    margin: 4px 0 0;
}
.diag-dec-src {
    font-size: 11.5px;
    color: var(--mu);
}

/* Same-company group card */
.diag-company-group {
    border-radius: 10px;
    border: 1px solid #fde68a;
    margin-bottom: 12px;
    overflow: hidden;
}
.diag-company-group-hdr {
    padding: 9px 14px;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 600;
}
.diag-cnt-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    background: #fde68a;
    color: #92400e;
}
.diag-company-group-body { padding: 10px 14px; }
.diag-err-banner {
    margin-top: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12.5px;
    color: #991b1b;
}

/* Compare summary card */
.diag-compare-card {
    background: #fff;
    border: 1px solid #bae6fd;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 24px;
}
.diag-compare-hdr {
    padding: 14px 20px;
    background: #0284c7;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}
.diag-compare-body { padding: 20px; }

.diag-match-banner {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    margin-top: 12px;
}
.diag-match-ok     { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.diag-match-diff   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ============================================
   Profile Page (profile.php)
   Tasks 1.1 + 1.2
   ============================================ */

.prof-wrap {
    max-width: 680px;
}

.prof-card {
    background: var(--card);
    border: 1px solid var(--bd);
    border-radius: 14px;
    padding: 24px 28px;
    margin-bottom: 20px;
    box-shadow: var(--sh);
}

.prof-card-hd {
    font-size: 13px;
    font-weight: 700;
    color: var(--t2);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--bd);
}

.fd input[readonly],
.fd input:disabled {
    background: #f9fafb;
    color: var(--t2);
    cursor: default;
    border-color: var(--bd);
}
.fd input[readonly]:focus,
.fd input:disabled:focus {
    border-color: var(--bd);
    box-shadow: none;
}

.fd-meta {
    font-size: 11px;
    color: var(--mu);
    margin-top: 4px;
}

.prof-badge {
    display: inline-block;
    background: var(--op);
    color: var(--o);
    border: 1px solid var(--ob);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    text-transform: capitalize;
}

.prof-save-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.btn-save {
    background: var(--o);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, box-shadow .15s, transform .12s;
}
.btn-save:hover {
    background: var(--oh);
    box-shadow: 0 4px 12px rgba(255,107,26,.28);
    transform: translateY(-1px);
}

.prof-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}
@media (max-width: 520px) {
    .prof-info-grid { grid-template-columns: 1fr; }
    .prof-card { padding: 18px 16px; }
}

/* ── Credits System ─────────────────────────────────── */

/* Dashboard credit bar */
.db-credit-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card);
    border: 1px solid var(--bd);
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--t2);
    margin-bottom: 16px;
}
.db-credit-bar svg { flex-shrink: 0; color: var(--o); }
.db-credit-bar strong { color: var(--t); }
.db-credit-bar.db-credit-low {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #92400e;
}
.db-credit-bar.db-credit-low svg { color: #f97316; }
.db-credit-bar.db-credit-low strong { color: #c2410c; }

/* Admin users — credits column */
.au-credits-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}
.au-credit-bal {
    font-size: 13px;
    font-weight: 600;
    color: var(--t);
    min-width: 24px;
    text-align: right;
}

/* Phase 2 — Dashboard Summary Table */
.usage-summary {
    margin-top: 20px;
}
.usage-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.usage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.usage-table th {
    font-size: 11px;
    font-weight: 600;
    padding: 9px 14px 8px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--mu);
    text-align: left;
    border-bottom: 1px solid var(--bd);
    white-space: nowrap;
}
.usage-table td {
    padding: 9px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: var(--t2);
    vertical-align: middle;
}
.usage-table tr:last-child td { border-bottom: none; }
.usage-table tbody tr:hover td { background: rgba(255,107,26,.03); }
.usage-file-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}
.usage-file-link:hover { color: var(--o); }
.usage-negative { color: #dc2626; }
.job-badge.pdf  { background: #eff6ff; color: #1d4ed8; }
.job-badge.docx { background: #f5f3ff; color: #5b21b6; }

/* Phase 2 — Download Blocked Popup */
.res-dl-btn.blocked {
    background: #dc3545;
    color: #fff;
    cursor: not-allowed;
    opacity: 0.85;
    border: none;
}
.res-dl-btn.blocked:hover {
    transform: none;
    box-shadow: none;
    background: #dc3545;
    color: #fff;
}
.cvf-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cvf-modal-box {
    background: #fff;
    max-width: 420px;
    width: 90%;
    padding: 2rem;
    border-radius: 8px;
    z-index: 1001;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.cvf-modal-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: #111;
}
.cvf-modal-body {
    font-size: 0.9rem;
    color: #444;
    line-height: 1.6;
}
.cvf-modal-body p { margin: 0 0 0.5rem; }
.cvf-modal-body p:last-child { margin-bottom: 0; }
.cvf-modal-footer {
    margin-top: 1.5rem;
    text-align: right;
}
.cvf-modal-close {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
.cvf-modal-close:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Phase 2 — Admin Client Billing */
.acb-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.acb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.acb-table th {
    font-size: 11px;
    font-weight: 600;
    padding: 10px 16px 9px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--mu);
    text-align: left;
    border-bottom: 1px solid var(--bd);
    white-space: nowrap;
    background: #fafafa;
}
.acb-table td {
    padding: 11px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: var(--t2);
    vertical-align: middle;
}
.acb-table tr:last-child td { border-bottom: none; }
.acb-table tbody tr:hover td { background: rgba(255,107,26,.03); }
.acb-client-name { font-weight: 600; color: var(--text); font-size: 13.5px; }
.acb-mono  { font-family: 'Courier New', monospace; font-size: 12.5px; }
.acb-center { text-align: center; }
.acb-empty { padding: 40px 16px; text-align: center; color: var(--mu); }

/* Balance/usage display colours */
.acb-bal-negative { color: #dc2626; font-weight: 700; }
.acb-bal-low      { color: #d97706; font-weight: 600; }
.acb-bal-ok       { color: #15803d; font-weight: 600; }
.acb-usage        { color: var(--t2); }
.acb-trial-usage  { color: var(--t2); }

/* Billing type badges */
.acb-badge-prepaid  { background: #eff6ff; color: #1d4ed8; }
.acb-badge-postpaid { background: #f0fdf4; color: #15803d; }
.acb-badge-trial    { background: #fff7ed; color: #c2410c; }

/* Action buttons */
.acb-edit-btn  { color: #6366f1; border-color: #c7d2fe; }
.acb-edit-btn:hover  { background: #eef2ff; border-color: #a5b4fc; }
.acb-topup-btn { color: #15803d; border-color: #bbf7d0; }
.acb-topup-btn:hover { background: #f0fdf4; border-color: #86efac; }

/* Edit modal section divider */
.acb-section-divider {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--mu);
    border-top: 1px solid var(--bd);
    padding-top: 14px;
    margin: 14px 0 12px;
}

/* Phase 2 — Admin Users Improvements */
/* Balance colour coding */
.au-credit-negative { color: #dc2626; font-weight: 700; }
.au-credit-zero     { color: var(--mu); }

/* Billing link action button */
.au-act-billing { color: #0891b2; border-color: #a5f3fc; text-decoration: none; }
.au-act-billing:hover { background: #ecfeff; border-color: #67e8f9; }

/* Phase 3 — Admin Usage Report */
.aur-filter-card { padding: 16px 20px; }
.aur-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}
.aur-filter-group { display: flex; flex-direction: column; gap: 5px; }
.aur-filter-group-wide { flex: 1; min-width: 160px; }
.aur-filter-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--mu);
}
.aur-date-input  { width: 148px; }
.aur-client-select { min-width: 160px; }
.aur-filter-actions { display: flex; align-items: flex-end; }
.aur-generate-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
}

.aur-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.aur-range-label {
    font-size: 12px;
    color: var(--mu);
    font-family: 'Courier New', monospace;
}
.aur-csv-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #15803d;
    border-color: #bbf7d0;
    text-decoration: none;
    font-size: 12px;
    padding: 5px 12px;
}
.aur-csv-btn:hover { background: #f0fdf4; border-color: #86efac; }

.aur-table-wrap { overflow-x: auto; }
.aur-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.aur-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--mu);
    border-bottom: 2px solid var(--bd);
    white-space: nowrap;
}
.aur-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: var(--t2);
    vertical-align: middle;
}
.aur-table tbody tr:last-child td { border-bottom: none; }
.aur-table tbody tr:hover td { background: rgba(255,107,26,.03); }
.aur-num  { text-align: right; }
.aur-mono { font-family: 'Courier New', monospace; font-size: 12.5px; }
.aur-amount { font-weight: 600; color: var(--text); }
.aur-client-name { font-weight: 600; color: var(--text); font-size: 13.5px; }
.aur-client-code {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    color: var(--mu);
    background: var(--bg2);
    border: 1px solid var(--bd);
    border-radius: 3px;
    padding: 1px 5px;
}
.aur-totals-row td {
    border-top: 2px solid var(--bd);
    border-bottom: none;
    background: var(--bg2);
    font-weight: 700;
    color: var(--text);
}
.aur-totals-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }

.aur-empty-card { text-align: center; padding: 40px 20px; }
.aur-empty-msg  { color: var(--mu); font-size: 14px; margin: 0; }

/* Phase 3 — Admin Invoices */
.ai-filter-card    { padding: 16px 20px; }
.ai-filter-form,
.ai-generate-form  {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}
.ai-filter-group       { display: flex; flex-direction: column; gap: 5px; }
.ai-filter-group-wide  { flex: 1; min-width: 180px; }
.ai-filter-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--mu);
}
.ai-filter-select    { min-width: 180px; }
.ai-filter-select-sm { min-width: 110px; }
.ai-month-input      { width: 148px; }
.ai-filter-actions   { display: flex; align-items: flex-end; }
.ai-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
}

/* Invoice table */
.ai-table-wrap { overflow-x: auto; }
.ai-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ai-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--mu);
    border-bottom: 2px solid var(--bd);
    white-space: nowrap;
}
.ai-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: var(--t2);
    vertical-align: middle;
}
.ai-table tbody tr:last-child td { border-bottom: none; }
.ai-table tbody tr:hover td { background: rgba(255,107,26,.03); }
.ai-inv-num    { font-family: 'Courier New', monospace; font-size: 12.5px; font-weight: 700; color: var(--text); }
.ai-client-name { font-weight: 600; color: var(--text); font-size: 13.5px; }
.ai-period     { font-size: 12px; color: var(--mu); white-space: nowrap; }
.ai-empty      { padding: 36px 14px; text-align: center; color: var(--mu); font-size: 13px; }

/* Invoice status badges */
.ai-badge-sent  { background: #eff6ff; color: #1d4ed8; }
.ai-badge-paid  { background: #f0fdf4; color: #15803d; }
.ai-badge-void  { background: #f3f4f6; color: #6b7280; }
.ai-badge-draft { background: #fff7ed; color: #c2410c; }
.ai-badge-failed{ background: #fef2f2; color: #dc2626; }

/* Invoice action buttons */
.ai-btn-download { color: #0891b2; border-color: #a5f3fc; text-decoration: none; }
.ai-btn-download:hover { background: #ecfeff; border-color: #67e8f9; }
.ai-btn-resend   { color: #7c3aed; border-color: #ddd6fe; }
.ai-btn-resend:hover { background: #f5f3ff; border-color: #c4b5fd; }
.ai-btn-paid     { color: #15803d; border-color: #bbf7d0; }
.ai-btn-paid:hover { background: #f0fdf4; border-color: #86efac; }
.ai-btn-void     { color: #dc2626; border-color: #fecaca; }
.ai-btn-void:hover { background: #fef2f2; border-color: #fca5a5; }

/* Inline action forms (no margin/padding) */
.ai-inline-form { display: inline; margin: 0; padding: 0; }

/* Flash warning variant */
.au-flash-warning { background: #fffbeb; border-left: 3px solid #f59e0b; color: #92400e; }

/* Generate card */
.ai-generate-card { margin-top: 20px; padding: 16px 20px; }
.ai-generate-hdr {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
}

/* Password Toggle */
.pw-wrap {
    position: relative;
    display: block;
    width: 100%;
}
.pw-wrap input[type="password"],
.pw-wrap input[type="text"] {
    width: 100% !important;
    padding-right: 3rem !important;
    box-sizing: border-box !important;
}
.pw-toggle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 2.8rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    font-size: 1rem;
    line-height: 1;
}
.pw-toggle:hover {
    color: #334155;
}
.pw-toggle i {
    display: block;
    line-height: 1;
}

/* ============================================
   Responsive — Sidebar
   ============================================ */

@media (max-width: 768px) {
    /* Allow the page to scroll vertically on small screens */
    html {
        overflow: auto;
    }
    body {
        overflow: auto;
        height: auto;
    }

    /* Stack sidebar above content instead of side-by-side */
    .app {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    /* Sidebar becomes a horizontal top bar */
    .sb {
        width: 100% !important;
        height: auto;
        min-height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 0.5rem 1rem;
        gap: 0.5rem;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    /* Top section: hide logo, keep upload button inline */
    .sb-top {
        display: contents; /* let children participate in parent flex */
        border-bottom: none;
        padding: 0;
    }
    .sb-logo {
        display: none;
    }
    .sb-upload-btn {
        margin: 0;
        padding: 6px 14px;
        font-size: 12px;
        width: auto;
        flex-shrink: 0;
    }

    /* Nav items flow horizontally */
    .sb-nav {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.2rem;
        flex: 1;
        overflow-y: visible;
        padding: 0;
    }
    .si {
        padding: 0.35rem 0.65rem;
        font-size: 12px;
        margin-bottom: 0;
    }
    .si.active::before {
        /* Reset vertical indicator — hide on horizontal bar */
        display: none;
    }

    /* Hide section labels (ADMIN, etc.) — no space for them */
    .sb-section-label {
        display: none;
    }

    /* Billing widget in sidebar — hide on mobile (banner still shows in main) */
    .sb-cv-box {
        display: none;
    }

    /* User row moves to its own line at the end */
    .sb-bot {
        width: 100%;
        padding: 0.4rem 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        margin-top: 0;
    }

    /* Main area and scroll container reset */
    .main-area {
        height: auto;
        overflow: visible;
        flex: none;
    }
    .cta {
        overflow-y: visible;
        padding: 1rem;
        height: auto;
    }
}

@media (max-width: 480px) {
    /* On very small screens hide nav icon SVGs to save space */
    .si svg {
        display: none;
    }
    .si {
        padding: 0.4rem 0.5rem;
    }
}

/* ============================================
   Google OAuth Button
   ============================================ */
.google-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: #94a3b8;
    font-size: 0.85rem;
}
.google-divider::before,
.google-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}
.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.google-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    color: #1e293b;
    text-decoration: none;
}

#g_id_signin_container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 0 auto;
}
#g_id_signin_container > div {
    width: 100% !important;
}
#g_id_signin_container iframe {
    width: 100% !important;
    margin: 0 auto !important;
    border-radius: 10px !important;
}
