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

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

:root {
    --gold: #f5c842;
    --orange: #f08030;
    --bg: #f7f6f3;
    --surface: #ffffff;
    --border: rgba(0,0,0,0.07);
    --text: #0f0f0f;
    --text-muted: #555;
    --red: #dc2626;
    --green: #16a34a;
    --amber: #d97706;
    --nav-h: 52px;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
}

/* ── Nav ── */
.topnav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: rgba(247,246,243,0.97);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 0.5rem;
    z-index: 100;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }

.nav-logo {
    font-family: 'Syne', sans-serif;
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 7px;
    margin-right: 0.5rem;
    white-space: nowrap;
    text-decoration: none;
    flex-shrink: 0;
}
.nav-mark {
    width: 22px; height: 22px;
    background: linear-gradient(135deg, var(--gold), var(--orange));
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 900;
    color: #000;
    flex-shrink: 0;
}
.nav-links {
    display: flex;
    gap: 2px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-btn {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.nav-btn:hover { background: rgba(0,0,0,0.05); color: var(--text); }
.nav-btn.active { background: var(--text); color: #fff; }
.nav-btn.active.needs-action {
    background: var(--gold);
    color: #000;
    animation: pulse-tab 2s ease infinite;
}
@keyframes pulse-tab {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245,200,66,0.5); }
    50% { box-shadow: 0 0 0 6px rgba(245,200,66,0); }
}

.pending-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--red);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 1px 5px;
    margin-left: 3px;
}
.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}
.status-pill {
    font-size: 0.65rem;
    background: #f0fdf4;
    color: var(--green);
    border: 1px solid #bbf7d0;
    padding: 3px 8px;
    border-radius: 999px;
    font-weight: 500;
    white-space: nowrap;
}
.nav-home {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
}
.nav-home:hover { color: var(--text); }

/* ── Main ── */
.main-content {
    margin-top: var(--nav-h);
    padding: 1.5rem 1rem 5rem;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 640px) {
    .main-content { padding: 2rem 1.5rem 5rem; }
}
@media (min-width: 1024px) {
    .main-content { padding: 2rem 2.5rem 5rem; }
}

/* ── Views ── */
.view { display: none; }
.view.active { display: block; }
.view-header { margin-bottom: 1.25rem; }
.view-title {
    font-family: 'Syne', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 0.2rem;
}
@media (min-width: 640px) {
    .view-title { font-size: 1.4rem; }
}
.view-sub { font-size: 0.82rem; color: #555; }

/* ── Progress strip ── */
.progress-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 1.25rem;
    font-size: 0.75rem;
    color: #555;
}
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: #ddd; flex-shrink: 0; }
.step-dot.done { background: var(--green); }
.step-dot.current { background: var(--gold); width: 10px; height: 10px; }
.step-line { flex: 1; height: 1px; background: #ddd; }
.step-line.done { background: var(--green); }

/* ── Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
}
@media (min-width: 640px) {
    .card { padding: 1.25rem 1.5rem; }
}
.card-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}
.optional { font-weight: 400; color: #bbb; text-transform: none; letter-spacing: 0; font-size: 0.68rem; }

/* ── Drop zones ── */
.drop-zone {
    border: 1.5px dashed rgba(0,0,0,0.14);
    border-radius: 10px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg);
    -webkit-tap-highlight-color: transparent;
}
@media (min-width: 640px) {
    .drop-zone { padding: 2.5rem 1.5rem; }
}
.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--gold);
    background: rgba(245,200,66,0.04);
}
.drop-zone.loaded {
    border-style: solid;
    border-color: var(--green);
    background: #f0fdf4;
}
.drop-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.drop-title { font-size: 0.85rem; font-weight: 500; color: var(--text); margin-bottom: 0.2rem; }
.drop-hint { font-size: 0.75rem; color: #555; }

/* ── File list ── */
.file-list { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 6px; }
.file-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.78rem;
}
.file-item-name { flex: 1; color: var(--text); word-break: break-all; }
.file-item-size { color: #555; font-size: 0.7rem; flex-shrink: 0; }
.file-item-remove {
    cursor: pointer; color: #555;
    font-size: 0.8rem; border: none; background: none;
    padding: 4px 6px; border-radius: 4px; transition: all 0.15s;
    flex-shrink: 0; min-width: 28px; min-height: 28px;
    display: flex; align-items: center; justify-content: center;
}
.file-item-remove:hover { background: #fef2f2; color: var(--red); }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem; font-weight: 500;
    padding: 10px 18px; border-radius: 9px;
    border: none; cursor: pointer; transition: all 0.15s;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
}
.btn-primary { background: var(--text); color: #fff; }
.btn-primary:hover { background: #222; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }

.btn-approve {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 22px; font-size: 0.88rem; font-weight: 500;
    background: var(--green); color: #fff;
    border: none; border-radius: 9px; cursor: pointer;
    transition: all 0.15s;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}
.btn-approve:hover:not(:disabled) { background: #15803d; }
.btn-approve:disabled {
    background: #e5e7eb; color: #9ca3af;
    cursor: not-allowed;
}
.btn-reject {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 16px; font-size: 0.88rem;
    background: transparent; color: #555;
    border: 1px solid var(--border); border-radius: 9px;
    cursor: pointer; transition: all 0.15s;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}
.btn-reject:hover { background: #fef2f2; color: var(--red); border-color: #fecaca; }

/* ── Progress bar ── */
.progress-bar-bg { background: rgba(0,0,0,0.06); border-radius: 999px; height: 6px; overflow: hidden; }
.progress-bar-fill {
    height: 6px; border-radius: 999px;
    background: linear-gradient(90deg, var(--gold), var(--orange));
    transition: width 0.3s ease; width: 0%;
}
.progress-label { font-size: 0.75rem; color: #555; margin-top: 6px; }

/* ── Bank status ── */
.bank-status { margin-top: 8px; font-size: 0.78rem; }

/* ── Metrics row ── */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 1.25rem;
}
@media (min-width: 640px) {
    .metrics-row {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
        margin-bottom: 1.5rem;
    }
}
.metric-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 0.9rem 1rem;
}
.metric-val {
    font-family: 'Syne', sans-serif; font-size: 1.4rem;
    font-weight: 700; letter-spacing: -0.025em;
    line-height: 1; margin-bottom: 3px;
}
@media (min-width: 640px) {
    .metric-val { font-size: 1.6rem; }
}
.metric-lbl { font-size: 0.65rem; color: #555; text-transform: uppercase; letter-spacing: 0.08em; }

/* ── Badges ── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.68rem; font-weight: 500;
    padding: 2px 8px; border-radius: 999px;
}
.badge-green  { background: #f0fdf4; color: var(--green); border: 1px solid #bbf7d0; }
.badge-amber  { background: #fffbeb; color: var(--amber); border: 1px solid #fde68a; }
.badge-red    { background: #fef2f2; color: var(--red);   border: 1px solid #fecaca; }
.badge-gray   { background: #f9fafb; color: #6b7280;      border: 1px solid #e5e7eb; }

/* ── Invoice cards ── */
.invoice-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 10px;
    overflow: hidden;
}
.invoice-card-top {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: flex-start; gap: 10px;
    cursor: pointer; transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.invoice-card-top:hover { background: rgba(0,0,0,0.01); }
.invoice-file-icon {
    width: 38px; height: 38px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.invoice-card-filename { font-size: 0.85rem; font-weight: 500; color: var(--text); word-break: break-all; }
.invoice-card-meta { font-size: 0.72rem; color: #555; margin-top: 3px; }
.invoice-card-amount {
    margin-left: auto; text-align: right; flex-shrink: 0;
    font-family: 'Syne', sans-serif;
    font-size: 1.05rem; font-weight: 700; color: var(--text);
}
.invoice-card-amount-label { font-size: 0.68rem; color: #555; text-align: right; margin-top: 2px; }
.invoice-card-body { display: none; }
.invoice-card-body.open { display: block; }

/* Notices */
.notice {
    margin: 0.75rem 1rem 0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    display: flex; align-items: flex-start; gap: 8px;
    line-height: 1.5;
}
.notice.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.notice.ok   { background: #f0fdf4; color: #065f46; border: 1px solid #bbf7d0; }
.notice.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* Fields */
.fields-section { padding: 1rem; }
.field-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 10px;
}
@media (min-width: 540px) {
    .field-row { grid-template-columns: 1fr 1fr; }
}
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-label {
    font-size: 0.7rem; font-weight: 600;
    color: #444;
    text-transform: uppercase; letter-spacing: 0.06em;
    display: flex; align-items: center; gap: 4px;
}
.field-label.error { color: var(--red); }
.field-input {
    font-family: 'DM Sans', sans-serif; font-size: 0.92rem;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg); color: var(--text);
    outline: none; transition: border-color 0.15s;
    min-height: 44px; width: 100%;
}
.field-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,200,66,0.15); }
.field-input.error-border { border-color: var(--red); background: #fef2f2; }
.field-input.readonly { background: #f9fafb; color: #555; }
.field-select {
    font-family: 'DM Sans', sans-serif; font-size: 0.92rem;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg); color: var(--text);
    outline: none; cursor: pointer;
    min-height: 44px; width: 100%;
}
.field-select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,200,66,0.15); }
.field-select.error-border { border-color: var(--red); background: #fef2f2; }
.calc-hint {
    font-size: 0.72rem; color: #555;
    background: #f9f9f7; border: 1px solid rgba(0,0,0,0.05);
    border-radius: 6px; padding: 5px 9px; margin-top: 3px;
}

/* Confidence row */
.conf-row {
    padding: 10px 1rem;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 8px;
    font-size: 0.78rem; color: #444;
    cursor: pointer; transition: background 0.15s;
    user-select: none;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}
.conf-row:hover { background: rgba(0,0,0,0.01); }
.conf-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 500;
}
.conf-pill.high { background: #f0fdf4; color: var(--green); border: 1px solid #bbf7d0; }
.conf-pill.med  { background: #fffbeb; color: var(--amber); border: 1px solid #fde68a; }
.conf-pill.low  { background: #fef2f2; color: var(--red);   border: 1px solid #fecaca; }
.conf-chevron { margin-left: auto; font-size: 0.75rem; transition: transform 0.2s; }
.conf-chevron.open { transform: rotate(180deg); }
.conf-detail {
    padding: 12px 1rem;
    border-top: 1px solid var(--border);
    background: #fafaf9;
    display: none;
}
.conf-detail.open { display: block; }
.conf-item {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 8px; font-size: 0.78rem;
}
.conf-item:last-child { margin-bottom: 0; }
.conf-name { width: 100px; color: #444; flex-shrink: 0; font-size: 0.75rem; }
.conf-bar-bg { flex: 1; height: 4px; background: #eee; border-radius: 999px; overflow: hidden; }
.conf-bar-fg { height: 4px; border-radius: 999px; }
.conf-pct { width: 34px; text-align: right; font-size: 0.72rem; color: #444; }

/* Card actions */
.card-actions {
    padding: 0.9rem 1rem;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
}
.blocked-hint {
    font-size: 0.72rem;
    color: var(--red);
    display: flex; align-items: center; gap: 4px;
    width: 100%;
    margin-top: 2px;
}
@media (min-width: 480px) {
    .blocked-hint { width: auto; margin-top: 0; margin-left: auto; }
}

/* ── Confirm Modal ── */
.modal-overlay {
    position: fixed; inset: 0; z-index: 999;
    background: rgba(0,0,0,0.45);
    display: flex; align-items: flex-end; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
}
@media (min-width: 540px) {
    .modal-overlay { align-items: center; }
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-card {
    background: #fff;
    border-radius: 18px 18px 0 0;
    padding: 1.5rem 1.25rem 2rem;
    width: 100%;
    transform: translateY(20px);
    transition: transform 0.2s;
}
@media (min-width: 540px) {
    .modal-card {
        border-radius: 18px;
        padding: 2rem;
        width: 420px;
        max-width: 90vw;
    }
}
.modal-overlay.open .modal-card { transform: translateY(0); }
.modal-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: #f0fdf4;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; margin-bottom: 1rem;
}
.modal-title {
    font-family: 'Syne', sans-serif; font-size: 1.1rem;
    font-weight: 700; color: var(--text);
    margin-bottom: 0.4rem; letter-spacing: -0.01em;
}
.modal-body { font-size: 0.83rem; color: #555; line-height: 1.6; margin-bottom: 1.25rem; }
.modal-summary {
    background: var(--bg); border-radius: 10px;
    padding: 0.9rem 1.1rem; margin-bottom: 1.25rem;
    display: flex; flex-direction: column; gap: 8px;
}
.modal-summary-row { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; }
.modal-summary-label { color: #555; flex: 1; }
.modal-summary-val { font-weight: 500; color: var(--text); }
.modal-actions { display: flex; gap: 8px; }
.modal-btn-primary {
    flex: 1; padding: 12px; font-size: 0.9rem; font-weight: 500;
    background: var(--text); color: #fff;
    border: none; border-radius: 10px; cursor: pointer;
    min-height: 44px;
}
.modal-btn-primary:hover { background: #222; }
.modal-btn-secondary {
    padding: 12px 16px; font-size: 0.9rem;
    background: transparent; color: #555;
    border: 1px solid var(--border); border-radius: 10px;
    cursor: pointer; min-height: 44px;
}
.modal-btn-secondary:hover { background: var(--bg); }

/* ── Export bar ── */
.export-bar {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 1rem;
    margin-top: 1.25rem;
    display: flex; align-items: center; gap: 0.75rem;
    flex-wrap: wrap;
}
.export-label { font-size: 0.8rem; font-weight: 500; color: var(--text); flex: 1; min-width: 120px; }
.export-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Audit ── */
.audit-record {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 10px 14px;
    margin-bottom: 8px;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.audit-filename { font-size: 0.82rem; font-weight: 500; flex: 1; min-width: 120px; word-break: break-all; }
.audit-meta { font-size: 0.72rem; color: #555; }

/* ── Misc ── */
.divider { border: none; border-top: 1px solid var(--border); }
.empty-state { text-align: center; padding: 3rem 1.5rem; color: #555; }
.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.4; }
.empty-state-title { font-size: 0.9rem; font-weight: 500; color: #666; }
.empty-state-hint { font-size: 0.78rem; margin-top: 4px; }

/* ── Contact page ── */
.contact-wrap {
    max-width: 520px;
    margin: 0 auto;
    padding: 0.5rem 0 4rem;
}
.contact-hero { text-align: center; margin-bottom: 2rem; }
.contact-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto 1rem;
    border: 3px solid var(--gold);
}
.contact-avatar-placeholder {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5c842, #f08030);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Syne', sans-serif;
    font-size: 1.6rem; font-weight: 800; color: #000;
    margin: 0 auto 1rem;
}
.contact-name {
    font-family: 'Syne', sans-serif;
    font-size: 1.2rem; font-weight: 700;
    color: var(--text); margin-bottom: 0.35rem;
}
.contact-bio {
    font-size: 0.83rem; color: #555;
    line-height: 1.6; max-width: 340px; margin: 0 auto;
}
.contact-links { display: flex; flex-direction: column; gap: 8px; }
.contact-link {
    display: flex; align-items: center; gap: 12px;
    padding: 0.9rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.18s;
    min-height: 60px;
    -webkit-tap-highlight-color: transparent;
}
.contact-link:hover {
    border-color: var(--gold);
    background: rgba(245,200,66,0.04);
    transform: translateY(-1px);
}
.contact-link-icon {
    width: 38px; height: 38px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
}
.contact-link-text { flex: 1; }
.contact-link-label { font-size: 0.68rem; font-weight: 600; color: #555; text-transform: uppercase; letter-spacing: 0.08em; }
.contact-link-value { font-size: 0.88rem; font-weight: 500; color: var(--text); margin-top: 2px; }
.contact-link-arrow { font-size: 1rem; color: #aaa; flex-shrink: 0; }