:root {
    --ink: #16211c;
    --muted: #67726c;
    --paper: #f4f1e9;
    --white: #fffdf8;
    --line: #d9d7cc;
    --green: #184f3b;
    --lime: #c8e36d;
    --coral: #e97955;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 2%, rgba(200, 227, 109, .28), transparent 25rem),
        var(--paper);
    font-family: "DM Sans", sans-serif;
    min-height: 100vh;
}

.page-shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 72px; }
.masthead { display: flex; align-items: center; justify-content: space-between; padding-bottom: 52px; }
.masthead p { color: var(--muted); margin: 0; font-size: .9rem; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--lime); background: var(--green); font-family: "DM Serif Display", serif; font-size: 1.25rem; }

.notice { margin-bottom: 20px; padding: 13px 18px; color: var(--green); background: rgba(200, 227, 109, .35); border: 1px solid rgba(24, 79, 59, .18); border-radius: 10px; font-weight: 600; }
.notice-error { color: #7a2c18; background: #f8d9cf; border-color: #e6aa97; }
.upload-panel { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(40px, 8vw, 100px); padding: clamp(35px, 6vw, 72px); color: var(--white); background: var(--green); border-radius: 28px 28px 28px 4px; box-shadow: 0 24px 60px rgba(22, 33, 28, .14); }
.eyebrow { display: block; margin-bottom: 12px; color: var(--coral); font-size: .72rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.upload-panel .eyebrow { color: var(--lime); }
h1, h2 { margin: 0; font-family: "DM Serif Display", serif; font-weight: 400; line-height: 1; }
h1 { max-width: 500px; font-size: clamp(3rem, 7vw, 5.8rem); letter-spacing: -.04em; }
h2 { font-size: clamp(2.1rem, 4vw, 3.5rem); }
.intro p { max-width: 470px; color: rgba(255, 253, 248, .72); font-size: 1.02rem; line-height: 1.7; }
form { align-self: center; }
.field { margin-bottom: 22px; }
label { display: block; margin-bottom: 8px; font-size: .82rem; font-weight: 700; }
input[type="text"], input[type="number"] { width: 100%; padding: 14px 16px; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; color: var(--white); background: rgba(255,255,255,.08); font: inherit; outline: none; }
input[type="text"]::placeholder, input[type="number"]::placeholder { color: rgba(255,255,255,.45); }
input[type="text"]:focus, input[type="number"]:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(200,227,109,.15); }
.page-field label span { font-weight: 400; opacity: .65; }
.file-input { padding: 13px; background: var(--white); border-radius: 8px; color: var(--ink); overflow: hidden; }
input[type="file"] { width: 100%; font: inherit; font-size: .8rem; }
input[type="file"]::file-selector-button { margin-right: 12px; padding: 8px 12px; color: var(--white); background: var(--green); border: 0; border-radius: 5px; font: inherit; font-weight: 600; cursor: pointer; }
small { display: block; margin-top: 7px; color: rgba(255,255,255,.54); }
.error { margin: 7px 0 0; color: #ffb49c; font-size: .8rem; }
button { width: 100%; padding: 15px 18px; display: flex; justify-content: space-between; border: 0; border-radius: 8px; color: var(--ink); background: var(--lime); font: inherit; font-weight: 700; cursor: pointer; transition: transform .15s, background .15s; }
button:hover { background: #d7ed88; transform: translateY(-2px); }

.library { padding-top: 72px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 28px; }
.count { padding: 7px 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 100px; font-size: .75rem; }
.document-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.document-card { overflow: hidden; background: var(--white); border: 1px solid var(--line); border-radius: 14px; transition: transform .2s, box-shadow .2s; }
.document-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(22, 33, 28, .08); }
.preview { display: grid; place-items: center; height: 180px; background: #e8e6dd; overflow: hidden; }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.pdf-badge { display: grid; place-items: center; width: 72px; height: 88px; color: var(--white); background: var(--coral); border-radius: 4px 14px 4px 4px; font: 700 1rem "DM Sans"; letter-spacing: .08em; box-shadow: 8px 10px 0 rgba(22,33,28,.08); }
.card-copy { padding: 19px; }
.status { display: inline-block; margin-bottom: 10px; padding: 4px 8px; border-radius: 100px; color: var(--muted); background: #ecebe4; font-size: .65rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.status-completed { color: var(--green); background: rgba(200, 227, 109, .38); }
.status-failed { color: #8a341e; background: #f8d9cf; }
.status-processing { color: #6e5610; background: #f6e8b5; }
.card-copy h3 { margin: 0 0 5px; font-size: 1rem; }
.card-copy > p { margin: 0; color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-copy .processing-error { margin-top: 10px; color: #8a341e; }
.card-copy .page-note { margin-top: 7px; color: var(--green); font-weight: 600; }
.card-meta { display: flex; justify-content: space-between; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; }
.card-meta a { color: var(--green); font-weight: 700; text-decoration: none; }
.card-actions { display: flex; gap: 12px; }
.delete-form { margin-top: 14px; }
.delete-button { width: auto; padding: 0; color: #9b3b25; background: transparent; font-size: .72rem; font-weight: 600; }
.delete-button:hover { color: #702310; background: transparent; transform: none; text-decoration: underline; }
.empty-state { padding: 70px 20px; text-align: center; border: 1px dashed #b7b8ad; border-radius: 14px; }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 16px; color: var(--white); background: var(--coral); border-radius: 50%; font-size: 1.8rem; }
.empty-state h3 { margin: 0 0 7px; font-family: "DM Serif Display", serif; font-size: 1.6rem; font-weight: 400; }
.empty-state p { margin: 0; color: var(--muted); }

@media (max-width: 760px) {
    .page-shell { width: min(100% - 24px, 600px); padding-top: 18px; }
    .masthead { padding-bottom: 30px; }
    .masthead p { display: none; }
    .upload-panel { grid-template-columns: 1fr; gap: 25px; padding: 30px 22px; border-radius: 20px 20px 20px 4px; }
    h1 { font-size: clamp(2.8rem, 15vw, 4.3rem); }
    .library { padding-top: 50px; }
    .document-grid { grid-template-columns: 1fr; }
    .preview { height: 210px; }
}
