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

:root {
    --ink: #211b2d;
    --muted: #756d80;
    --line: #e4ddec;
    --paper: #faf8fc;
    --white: #ffffff;
    --purple: #7651a8;
    --purple-dark: #56367f;
    --lavender: #eee7f8;
    --pink: #d986b7;
    --shadow: 0 20px 55px rgba(75, 45, 105, 0.1);
}

* { box-sizing: border-box; }

body {
    min-width: 320px;
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: "DM Sans", sans-serif;
    line-height: 1.6;
}

h1, h2 { margin: 0; font-family: "Space Grotesk", sans-serif; line-height: 1.12; }
h1 { max-width: 620px; font-size: clamp(2.4rem, 5vw, 4.7rem); letter-spacing: -0.07em; }
h2 { font-size: 1.45rem; letter-spacing: -0.04em; }
a { color: var(--purple-dark); font-weight: 600; text-decoration: none; }
a:hover { color: var(--purple); }
.container { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }

.site-header { border-bottom: 1px solid rgba(220, 229, 232, 0.8); background: rgba(247, 250, 249, 0.88); }
.nav { display: flex; align-items: center; justify-content: space-between; min-height: 82px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-family: "Space Grotesk", sans-serif; font-size: 1.15rem; letter-spacing: -0.04em; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; color: var(--white); background: var(--purple); border-radius: 10px 10px 10px 3px; font-weight: 700; }
.brand-muted { color: var(--purple); }
.nav-actions { display: flex; align-items: center; gap: 22px; }
.nav-actions form { margin: 0; }
.nav-link { color: var(--muted); font-size: 0.93rem; }
.user-pill { padding: 6px 12px; color: var(--muted); background: var(--white); border: 1px solid var(--line); border-radius: 999px; font-size: 0.82rem; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 20px; color: var(--white); background: var(--purple); border: 1px solid var(--purple); border-radius: 8px; font: 600 0.95rem "DM Sans", sans-serif; cursor: pointer; transition: background 0.2s, transform 0.2s; }
.button:hover { color: var(--white); background: var(--purple-dark); transform: translateY(-1px); }
.button-small { min-height: 38px; padding: 0 15px; font-size: 0.85rem; }
.button-ghost { color: var(--purple-dark); background: transparent; border-color: var(--line); }
.button-ghost:hover { color: var(--purple-dark); background: var(--white); }
.button-full { width: 100%; margin-top: 8px; }

.page { min-height: calc(100vh - 150px); padding-top: 64px; padding-bottom: 88px; }
.flash-stack { display: grid; gap: 10px; margin-bottom: 24px; }
.flash { padding: 12px 16px; color: #74455f; background: #fff0f8; border: 1px solid #edc9df; border-radius: 8px; }
.site-footer { padding: 22px 0; color: var(--muted); border-top: 1px solid var(--line); font-size: 0.84rem; }

.auth-layout { display: grid; grid-template-columns: 1fr minmax(340px, 430px); align-items: center; gap: 9vw; min-height: 600px; }
.eyebrow { margin: 0 0 14px; color: var(--purple); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.intro-copy { max-width: 520px; margin: 22px 0 0; color: var(--muted); font-size: 1.08rem; }
.accent-line { width: 76px; height: 5px; margin-top: 38px; background: var(--pink); border-radius: 5px; }
.card { background: var(--white); border: 1px solid rgba(220, 229, 232, 0.9); border-radius: 18px; box-shadow: var(--shadow); }
.auth-card { padding: 38px; }
.card-heading { margin-bottom: 30px; }
.form-stack { display: grid; gap: 9px; }
label { margin-top: 10px; color: var(--ink); font-size: 0.87rem; font-weight: 600; }
input { width: 100%; min-height: 49px; padding: 0 14px; color: var(--ink); background: #fbfdfc; border: 1px solid var(--line); border-radius: 8px; font: 400 0.95rem "DM Sans", sans-serif; outline: none; }
input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(118, 81, 168, 0.14); }
.field-help { margin: -2px 0 4px; color: var(--muted); font-size: 0.78rem; }
.forgot-link { justify-self: end; margin: 3px 0 5px; font-size: 0.8rem; }
.help-copy { margin: 0 0 28px; color: var(--muted); }
.form-footer { margin: 26px 0 0; color: var(--muted); text-align: center; font-size: 0.87rem; }

.dashboard-header { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 44px 0 54px; }
.dashboard-header h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.documents-card { margin-bottom: 30px; padding: 28px; box-shadow: none; }
.documents-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.documents-heading .eyebrow { margin-bottom: 7px; }
.document-count { color: var(--muted); font-size: 0.85rem; }
.document-list { display: grid; gap: 10px; }
.document-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.document-symbol { display: grid; width: 42px; height: 42px; place-items: center; color: var(--purple-dark); background: var(--lavender); border-radius: 10px; font-size: 0.62rem; font-weight: 700; }
.document-details h3 { margin: 0; overflow: hidden; font-size: 0.95rem; text-overflow: ellipsis; white-space: nowrap; }
.document-details p { margin: 3px 0 0; color: var(--muted); font-size: 0.78rem; }
.document-links { grid-column: 2 / -1; display: flex; gap: 12px; justify-self: start; font-size: 0.78rem; }
.summary-panel { grid-column: 2 / -1; width: min(100%, 720px); border-top: 1px solid var(--line); padding-top: 12px; }
.summary-title { margin: 0; color: var(--purple-dark); font-size: 0.82rem; font-weight: 700; }
.summary-panel pre { max-height: 260px; margin: 12px 0 0; padding: 14px; overflow: auto; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; font: 0.8rem/1.6 "DM Sans", sans-serif; white-space: pre-wrap; }
.status-processing { color: #aa7a36; }
.status-failed { color: #b34e65; }
.error-copy { color: #b34e65 !important; }
.empty-state { display: grid; justify-items: center; margin-bottom: 30px; padding: 45px 28px; text-align: center; box-shadow: none; }
.empty-state .feature-icon { margin-bottom: 18px; }
.empty-state p { max-width: 430px; margin: 12px 0 24px; color: var(--muted); }
.upload-layout { min-height: 520px; }
.feature-card { min-height: 260px; padding: 28px; box-shadow: none; }
.feature-icon { display: grid; width: 44px; height: 44px; margin-bottom: 32px; place-items: center; color: var(--purple-dark); background: var(--lavender); border-radius: 12px; font-size: 1.2rem; font-weight: 700; }
.feature-card p { min-height: 54px; margin: 12px 0 22px; color: var(--muted); font-size: 0.92rem; }
.status-label { color: var(--purple); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

@media (max-width: 760px) {
    .container { width: min(100% - 32px, 560px); }
    .nav { min-height: 70px; }
    .nav-actions { gap: 10px; }
    .user-pill { display: none; }
    .page { padding-top: 36px; }
    .auth-layout { grid-template-columns: 1fr; gap: 36px; min-height: 0; }
    .intro-panel h1 { font-size: 2.8rem; }
    .accent-line { margin-top: 24px; }
    .auth-card { padding: 26px; }
    .dashboard-header { align-items: start; flex-direction: column; padding: 20px 0 34px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .documents-card { padding: 20px; }
    .document-row { grid-template-columns: 42px minmax(0, 1fr); gap: 12px; }
    .document-row .status-label, .document-links { grid-column: 2; justify-self: start; }
    .summary-panel { grid-column: 1 / -1; }
}
