/* public/css/app.css */

:root {
    --bg:           #f5f5f7;
    --bg-raised:    #ffffff;
    --bg-overlay:   #f0f0f2;
    --border:       #e2e2e7;
    --border-light: #ebebef;

    --text-primary:   #111114;
    --text-secondary: #5a5a6e;
    --text-muted:     #9999aa;

    --accent:       #d4870a;
    --accent-dim:   #d4870a14;
    --accent-hover: #b8720a;

    --status-pending:    #4a5af0;
    --status-review:     #d4870a;
    --status-approved:   #1a9e5c;
    --status-submitted:  #1a9e5c;
    --status-submitting: #4a5af0;
    --status-error:      #d93a3a;

    --sidebar-width: 180px;
    --font-sans: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'DM Mono', monospace;
    --radius-sm: 4px;
    --radius:    8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow:    0 4px 16px rgba(0,0,0,0.10);
}

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

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

a { color: inherit; text-decoration: none; }

button {
    font-family: var(--font-sans);
    cursor: pointer;
    border: none;
    background: none;
}

input, textarea, select {
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
input:disabled, textarea:disabled {
    opacity: 0.55;
    cursor: default;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Layout */
.shell        { display: flex; height: 100vh; overflow: hidden; }
.main-content { flex: 1; margin-left: var(--sidebar-width); overflow: hidden; display: flex; flex-direction: column; }

/* Buttons */
.btn {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: background 0.12s, opacity 0.12s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn:disabled { opacity: 0.3; cursor: default; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-overlay); color: var(--status-approved); border: 1px solid var(--status-approved); }
.btn-secondary:hover:not(:disabled) { background: #1a9e5c14; }
.btn-ghost     { background: var(--bg-overlay); color: var(--text-primary); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--border); }
.btn-danger    { background: #d93a3a14; color: var(--status-error); border: 1px solid var(--status-error); }
.btn-dark      { background: #111; color: #fff; border: 1px solid #111; }
.btn-dark:hover:not(:disabled) { background: #333; border-color: #333; }

/* Utility */
.mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-secondary); }

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow);
    z-index: 999;
    animation: fadeUp 0.2s ease;
    white-space: nowrap;
}
.toast-ok  { background: #f0faf5; color: var(--status-approved); border: 1px solid var(--status-approved); }
.toast-err { background: #fdf0f0; color: var(--status-error);   border: 1px solid var(--status-error); }

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

/* Spinner */
.spinner {
    width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-raised);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
}
.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 18px 20px;
    border-bottom: 1px solid var(--border);
}
.logo { width: 44px; height: auto; color: var(--accent); }
.wordmark {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.nav-section { margin-bottom: 20px; }
.nav-section-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 18px 6px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 18px;
    color: var(--text-secondary);
    font-size: 13.5px;
    cursor: pointer;
    transition: color 0.12s, background 0.12s;
    position: relative;
    text-decoration: none;
}
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.7; }
.nav-item:hover { color: var(--text-primary); background: var(--bg-overlay); }
.nav-item.active { color: var(--accent); background: var(--accent-dim); font-weight: 500; }
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 2px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}
.nav-label { flex: 1; }
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
}
.user-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
}
.avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.avatar-placeholder {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn { color: var(--text-muted); display: flex; align-items: center; padding: 4px; border-radius: var(--radius-sm); transition: color 0.12s; }
.logout-btn:hover { color: var(--text-primary); }

/* ── Status badge ── */
.badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 99px;
    text-transform: uppercase;
    white-space: nowrap;
}
.badge-pending         { background: #4a5af014; color: var(--status-pending); }
.badge-needs_review    { background: #d4870a14; color: var(--status-review); }
.badge-not_an_invoice  { background: #d93a3a14; color: var(--status-error); }
.badge-submitted       { background: #4a5af014; color: var(--status-pending); }
.badge-completed       { background: #1a9e5c14; color: var(--status-approved); }
.badge-error           { background: #d93a3a14; color: var(--status-error); }
.badge-archived        { background: #6b728014; color: var(--text-secondary); }

.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin: 0 0 12px;
}
.alert-warn {
    background: #d4870a14;
    border: 1px solid #d4870a44;
    color: #a06010;
}

/* ── Bill card ── */
.bill-card {
    padding: 12px 16px 12px 24px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
    user-select: none;
    text-align: left;
    width: 100%;
    position: relative;
}
.bill-card:hover { background: var(--bg-overlay); }
.bill-card.active { background: var(--accent-dim); border-left: 2px solid var(--accent); }
.card-btn { display: block; width: 100%; background: none; border: none; padding: 0; cursor: pointer; text-align: left; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 28px; margin-bottom: 6px; }
.vendor-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.score-pip { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.vendor { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amount { font-size: 14px; font-weight: 500; white-space: nowrap; }
.card-bottom { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bill-number { font-size: 11.5px; color: var(--text-muted); }
.date { font-size: 11.5px; color: var(--text-secondary); flex: 1; }

/* ── Vendor selector ── */
.vs-wrap { position: relative; }
.vs-input-row { display: flex; align-items: center; gap: 8px; }
.vs-input-row input { flex: 1; }
.inline-score { font-family: var(--font-mono); font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.inline-score.high { background: #1a9e5c14; color: var(--status-approved); }
.inline-score.mid  { background: #d4870a14; color: var(--status-review); }
.inline-score.low  { background: #d93a3a14; color: var(--status-error); }
.vs-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--bg-raised);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 200;
    max-height: 220px;
    overflow-y: auto;
}
.vs-loading { padding: 12px 14px; color: var(--text-muted); font-size: 13px; }
.vs-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 9px 14px;
    background: none;
    border: none;
    text-align: left;
    font-size: 13.5px;
    cursor: pointer;
    gap: 12px;
    font-family: var(--font-sans);
}
.vs-item:hover { background: var(--bg-overlay); }
.vs-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vs-score { font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.vs-score.high { color: var(--status-approved); }
.vs-score.mid  { color: var(--status-review); }
.vs-score.low  { color: var(--status-error); }

/* ── PDF viewer ── */
.pdf-viewer { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.pdf-canvas-wrap { flex: 1; overflow-y: auto; overflow-x: auto; display: flex; flex-direction: column; align-items: flex-start; }
.pdf-page-canvas { display: block; }
.pdf-controls { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; background: #222; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 6px; z-index: 10; }
.pdf-ctrl-btn { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--radius-sm); color: #FFF; background: none; border: none; cursor: pointer; transition: background 0.12s, color 0.12s; }
.pdf-ctrl-btn:hover { background: var(--bg-overlay); color: var(--text-primary); }
.pdf-zoom-label { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); min-width: 36px; text-align: center; user-select: none; }
.pdf-ctrl-sep { width: 1px; height: 16px; background: var(--border); margin: 0 4px; }
.pdf-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 5; }
.pdf-fallback { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 12px; color: var(--text-muted); }
.pdf-fallback a { color: var(--accent); font-size: 13px; }

/* ── Inbox ── */
.inbox { display: flex; height: 100vh; overflow: hidden; }
.panel-list { width: 300px; flex-shrink: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--bg-raised); overflow: hidden; }
.list-header { padding: 18px 16px 0; border-bottom: 1px solid var(--border); }
.list-header h1 { font-size: 17px; font-weight: 600; }
.list-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.list-search-row { padding-bottom: 10px; }
.list-search-input { width: 100%; box-sizing: border-box; font-family: var(--font-sans); font-size: 12.5px; padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none; }
.list-search-input:focus { border-color: var(--accent); }
.btn-pill-sm {
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 99px;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}
.btn-pill-sm:hover { background: var(--accent); color: #fff; }
.panel-list.drag-over { outline: 2px dashed var(--accent); outline-offset: -3px; background: var(--accent-dim); }
.upload-strip { border-bottom: 1px solid var(--border); }
.upload-strip-body { display: flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: 12px; color: var(--text-secondary); }
.upload-strip-done .upload-strip-body      { color: var(--status-approved); }
.upload-strip-error .upload-strip-body     { color: var(--status-error); }
.upload-strip-duplicate .upload-strip-body { color: var(--status-review); }
.upload-strip-dismiss { margin-left: auto; font-size: 15px; line-height: 1; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 0 2px; font-family: var(--font-sans); }
.upload-strip-dismiss:hover { color: var(--text-primary); }
.tabs { display: flex; overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.tab { font-size: 12.5px; font-weight: 500; color: var(--text-muted); padding: 7px 10px; border-bottom: 2px solid transparent; transition: color 0.12s, border-color 0.12s; white-space: nowrap; display: flex; align-items: center; gap: 5px; background: none; border-top: none; border-left: none; border-right: none; cursor: pointer; font-family: var(--font-sans); }
.tab:hover { color: var(--text-secondary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.count { background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 99px; }
.list-body { flex: 1; overflow-y: auto; }
.list-footer { border-top: 1px solid var(--border); flex-shrink: 0; }
.list-section-label { padding: 6px 16px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); border-top: 1px solid var(--border); background: var(--bg-page); }
.list-pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; }
.pag-btn { background: none; border: 1px solid var(--border); border-radius: 4px; padding: 2px 8px; font-size: 14px; cursor: pointer; color: var(--text-secondary); font-family: var(--font-sans); }
.pag-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pag-btn:disabled { opacity: 0.35; cursor: default; }
.pag-label { font-size: 12px; color: var(--text-muted); min-width: 40px; text-align: center; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; height: 200px; color: var(--text-muted); font-size: 13px; }
.panel-detail { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.detail-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); gap: 12px; flex-shrink: 0; background: var(--bg-raised); height: 60px;}
.detail-header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.detail-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 14px; padding: 2px 5px; border-radius: 3px; line-height: 1; transition: color 0.1s, background 0.15s; flex-shrink: 0; }
.detail-close:hover { color: var(--text-primary); background: var(--bg-overlay); }
.detail-vendor { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-id { font-size: 11px; color: var(--text-muted); }
.detail-actions { display: flex; gap: 8px; flex-shrink: 0; }
.detail-body { flex: 1; display: flex; overflow: hidden; }
.pdf-panel { flex: 1; border-right: 1px solid var(--border); overflow: hidden; }
.form-panel { width: 380px; flex-shrink: 0; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 24px; }
.not-invoice-message { padding: 24px 0; color: var(--text-secondary); font-size: 14px; line-height: 1.6; }
.form-section {}
.section-title { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title-row .section-title { margin-bottom: 0; }
.section-email-badge { display: inline-block; font-size: 0.7rem; font-weight: 500; color: #1c4a87; background: #dbeafe; border-radius: 999px; padding: 2px 10px; margin-left: 10px; letter-spacing: 0; text-transform: none; vertical-align: middle; }
.btn-link { font-size: 12px; color: var(--accent); background: none; border: none; cursor: pointer; font-family: var(--font-sans); padding: 0; }
.btn-link:hover { text-decoration: underline; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11.5px; font-weight: 500; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.field-hint { font-size: 11px; font-weight: 400; }
.field-hint.warn { color: var(--status-review); }
.field textarea { resize: vertical; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.line-items { display: flex; flex-direction: column; gap: 2px; }
.line-items-header { display: flex; flex-direction: column; gap: 1px; padding-bottom: 4px; border-bottom: 1px solid var(--border); margin-bottom: 2px; }
.line-header-top, .line-header-bottom { display: flex; gap: 6px; align-items: center; font-size: 10.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.line-header-top span { flex: 1; }
.line-row { display: flex; flex-direction: column; gap: 3px; padding: 6px 0; border-bottom: 1px solid var(--bg-overlay); }
.line-row:last-of-type { border-bottom: none; }
.line-row-top { display: flex; gap: 6px; align-items: center; }
.line-row-bottom { display: flex; gap: 6px; align-items: center; }
.line-row input { padding: 4px 6px; font-size: 12.5px; min-width: 0; }
.line-row-bottom input { font-size: 11.5px; color: var(--text-secondary); }
.line-amount { font-size: 12px; color: var(--text-secondary); text-align: right; padding: 4px 0; }
.remove-line { font-size: 11px; color: var(--text-muted); padding: 2px 4px; border-radius: 3px; transition: color 0.1s; background: none; border: none; cursor: pointer; }
.remove-line:hover { color: var(--status-error); background: #d93a3a14; }
.line-total { display: flex; justify-content: space-between; align-items: center; padding: 8px 0 0; border-top: 1px solid var(--border); font-size: 13px; font-weight: 600; margin-top: 4px; }
.no-selection { flex: 1; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 24px; }
.no-selection-inner { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 16px; }
.setup-heading { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.setup-section { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.setup-section-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.setup-section-body { font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin: 0; }
.setup-section-body code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-overlay); padding: 1px 5px; border-radius: 3px; }
.setup-email { color: var(--text-primary); }
.setup-password-code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-overlay); padding: 1px 5px; border-radius: 3px; user-select: all; }
.setup-copy-btn { font-size: 11px; font-weight: 500; font-family: var(--font-sans); color: var(--text-secondary); background: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 1px 7px; cursor: pointer; transition: background 0.15s, color 0.15s; vertical-align: middle; }
.setup-copy-btn:hover { background: var(--bg-overlay); color: var(--text-primary); }
.setup-download-btn { display: inline-block; align-self: flex-start; font-size: 12.5px; font-weight: 500; font-family: var(--font-sans); color: #673ab7; background: #590ad414; border: 1px solid transparent; border-radius: var(--radius); padding: 5px 12px; cursor: pointer; text-decoration: none; transition: background 0.15s; }
.setup-download-btn:hover { background: #590ad432; box-shadow: 0 2px 2px #590ad412;}
.setup-upload-btn { align-self: flex-start; font-size: 12.5px; font-weight: 500; font-family: var(--font-sans); color: var(--accent); background: var(--accent-dim); border: 1px solid transparent; border-radius: var(--radius); padding: 5px 12px; cursor: pointer; transition: background 0.15s; }
.setup-upload-btn:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* ── Upload ── */
.upload-page { padding: 32px 40px; max-width: 600px; }
.upload-header { margin-bottom: 24px; }
.upload-header h1 { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.upload-header p { color: var(--text-secondary); }
.upload-card { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 64px 40px; border: 2px dashed var(--border); border-radius: var(--radius-lg); background: var(--bg-raised); color: var(--text-muted); cursor: pointer; transition: border-color 0.15s, background 0.15s, color 0.15s; text-align: center; }
.dropzone:hover, .dropzone.drag-over { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.dropzone.has-error { border-color: var(--status-error); background: #d93a3a08; }
.drop-title { font-size: 15px; font-weight: 500; color: var(--text-primary); }
.drop-sub { font-size: 13px; color: var(--text-muted); }
.error-text { color: var(--status-error) !important; }
.progress-track { width: 100%; height: 4px; background: var(--bg-overlay); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.5s ease; }

/* ── Submission status ── */
.sub-grid  { display: flex; flex-direction: column; gap: 8px; }
.sub-row   { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sub-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); min-width: 90px; }
.sub-status {
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
}
.sub-ok      { background: #1a9e5c14; color: var(--status-approved); }
.sub-err     { background: #d93a3a14; color: var(--status-error); }
.sub-busy    { background: #4a5af014; color: var(--status-pending); }
.sub-pending { background: var(--bg-overlay); color: var(--text-muted); }
.sub-detail  { font-size: 11px; color: var(--text-muted); }
.sub-error   { margin-top: 8px; font-size: 12px; color: var(--status-error); background: #d93a3a08; border: 1px solid #d93a3a22; border-radius: var(--radius-sm); padding: 6px 10px; }

/* ── Auth error ── */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.error-card { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px 48px; max-width: 420px; width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; box-shadow: var(--shadow); }
.error-logo { width: 40px; height: auto; color: var(--accent); }
.error-wordmark { font-size: 13px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.error-card h1 { font-size: 18px; font-weight: 600; }
.error-card p  { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

/* ── Multi-file upload list ── */
.upload-list { padding: 24px 32px; display: flex; flex-direction: column; gap: 12px; }
.upload-item { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-base); }
.upload-item-header { display: flex; align-items: center; gap: 10px; }
.upload-item-name { font-size: 13px; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item-badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--bg-overlay); color: var(--text-secondary); white-space: nowrap; }
.upload-item-badge.is-done { background: #1a9e5c14; color: var(--status-approved); }
.upload-item-badge.is-error { background: #d93a3a14; color: var(--status-error); }
.upload-item-badge.is-duplicate { background: #f59e0b14; color: var(--warn, #f59e0b); }
.upload-item-bar { height: 3px; background: var(--bg-overlay); border-radius: 2px; overflow: hidden; }
.upload-item-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.5s ease; }
.upload-item-result { font-size: 12px; color: var(--text-secondary); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.upload-item-result .vendor { font-weight: 500; color: var(--text-primary); }
.upload-item-result .warn { color: var(--status-review); }
.upload-item-result .err { color: var(--status-error); }
.upload-list-actions { display: flex; gap: 10px; padding: 0 32px 28px; }

/* ── Dark mode ── */
@media (prefers-color-scheme: dark) {
    :root {
        --bg:           #1a1a1f;
        --bg-raised:    #26262d;
        --bg-overlay:   #2e2e38;
        --border:       #3a3a46;
        --border-light: #33333f;
        --text-primary:   #f0f0f5;
        --text-secondary: #9a9ab0;
        --text-muted:     #5e5e78;
        --accent:         #f0a020;
        --accent-dim:     #f0a02018;
        --accent-hover:   #d48c18;
        --status-pending:    #6b79f5;
        --status-review:     #f0a020;
        --status-approved:   #28c170;
        --status-submitted:  #28c170;
        --status-submitting: #6b79f5;
        --status-error:      #f05050;
        --shadow-sm: 0 1px 3px rgba(0,0,0,0.30);
        --shadow:    0 4px 16px rgba(0,0,0,0.40);
    }
    /* Invert PDF canvas colors; hue-rotate cancels the hue flip */
    .pdf-canvas-wrap { filter: invert(1) hue-rotate(180deg); }
}

/* ── Bill card meta row (doc type + due date) ── */
.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 3px 0 2px;
}
.doc-type-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 5px 2px;
    text-transform: uppercase;
    letter-spacing: .4px;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    text-align: center;
    writing-mode: vertical-lr;
    overflow: hidden;
    text-overflow: ellipsis;
    text-wrap: nowrap;
}
.doc-type-invoice {
    background: #adadad14;
    color: #b3b3b3;
}
.doc-type-other   { background: #0a50d414;         color: #0a0ed4; }
.due-date-tag {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 5px;
    border-radius: 5px;
}
.due-date-tag.past-due { color: #fff; background: var(--status-error); }
