:root {
    --bg: #f5f5f7;
    --surface: rgba(255, 255, 255, .82);
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --border: rgba(0, 0, 0, .07);
    --accent: #0066cc;
    --radius-lg: 24px;
    --radius-md: 16px;
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
    font-synthesis: none;
    color-scheme: light;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* Base and shared controls */
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button, a, input { transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease; }
button:disabled { cursor: default; opacity: .5; }
:where(button, a, input):focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
h1 { font-size: 30px; line-height: 1.15; letter-spacing: -1.2px; font-weight: 600; overflow-wrap: anywhere; }
h2 { font-size: 19px; letter-spacing: -.4px; font-weight: 600; }
.subtitle, .quiet-note, .upload-help, .file-meta, .count, footer { color: var(--text-secondary); }
.subtitle { margin-top: 9px; font-size: 14px; }
.surface { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 3px 20px #00000003; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.primary, .secondary, .download, .delete { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 12px; font-weight: 500; }
.primary { padding: 14px 18px; border: 1px solid var(--text); color: white; background: var(--text); }
.secondary { padding: 9px 18px; border: 1px solid var(--border); color: var(--text-secondary); background: #ffffff80; font-size: 13px; border-radius: 100px; }

/* Login: whitespace instead of a boxed admin panel */
.login-page { min-height: 100svh; display: grid; place-items: center; padding: 32px 24px; }
.login-shell { width: 100%; max-width: 320px; text-align: center; animation: appear 220ms ease both; }
.login-shell h1 { font-size: 40px; letter-spacing: -1.8px; }
.login-shell .subtitle { margin-top: 12px; font-size: 15px; }
.login-form { display: grid; gap: 12px; margin-top: 40px; }
input[type=password] { width: 100%; padding: 15px 17px; border: 1px solid #0000001a; border-radius: 12px; background: #ffffffb3; color: var(--text); font-size: 16px; }
input::placeholder { color: var(--text-secondary); }
.login-message { min-height: 40px; font-size: 13px; color: var(--text-secondary); text-align: left; }
.quiet-note { margin-top: 16px; font-size: 12px; }

/* Main application */
.app-shell { width: 100%; max-width: 960px; margin: 0 auto; padding: 68px 36px 28px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 44px; }
.page-header > div { min-width: 0; }
.upload-panel { padding: 10px 10px 19px; }
.drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: 288px; padding: 28px 16px; border: 1px dashed #0000001f; border-radius: var(--radius-md); background: transparent; color: var(--text); }
.drop-zone.drag-over { background: #0066cc06; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.upload-symbol { display: block; margin-bottom: 23px; color: var(--text-secondary); }
.icon { display: block; width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.drop-title { font-size: 23px; font-weight: 500; letter-spacing: -.6px; }
.drop-subtitle { margin-top: 7px; font-size: 14px; color: var(--text-secondary); }
.choose { color: var(--accent); }
.upload-help { margin-top: 17px; padding: 0 8px; font-size: 12px; text-align: center; }
.progress-area { padding: 20px 14px 2px; }
.progress-caption { display: flex; justify-content: space-between; gap: 14px; font-size: 12px; color: var(--text-secondary); }
#progress-label { overflow-wrap: anywhere; }
#progress-percent { flex-shrink: 0; font-variant-numeric: tabular-nums; }
progress { display: block; width: 100%; height: 4px; margin-top: 10px; appearance: none; border: 0; border-radius: 4px; overflow: hidden; background: #e5e5ea; }
progress::-webkit-progress-bar { background: #e5e5ea; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.status { min-height: 48px; padding: 13px 4px; color: var(--text-secondary); font-size: 13px; white-space: pre-line; overflow-wrap: anywhere; }
.status[data-success="true"] { color: #496254; }
.status:not(:empty) { animation: appear 180ms ease both; }

/* Files: aligned rows with quiet document badges */
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 12px 4px 18px; }
.count { font-size: 12px; font-variant-numeric: tabular-nums; }
.file-list { overflow: hidden; }
.file-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 22px 24px; }
.file-row.is-new { animation: appear 200ms ease both; }
.file-row + .file-row { border-top: 1px solid var(--border); }
.file-icon { display: grid; place-items: center; width: 40px; height: 48px; border: 1px solid var(--border); border-radius: 7px; background: #f5f5f7; color: #62626b; font-size: 9px; font-weight: 600; letter-spacing: .5px; }
.file-icon[data-type="pdf"] { background: #f5f1ef; color: #79645d; }
.file-icon[data-type="image"] { background: #f0f3f5; color: #5f7180; }
.file-icon[data-type="archive"] { background: #f3f2ee; color: #746d5b; }
.file-name { overflow-wrap: anywhere; font-size: 14px; font-weight: 550; }
.file-meta { margin-top: 5px; font-size: 12px; }
.file-actions { display: flex; align-items: center; gap: 8px; }
.download, .delete { padding: 9px 12px; border: 0; font-size: 12px; text-decoration: none; white-space: nowrap; }
.download { background: var(--bg); color: var(--text); }
.delete { background: transparent; color: var(--text-secondary); }
.empty { padding: 56px 24px; color: var(--text-secondary); font-size: 13px; text-align: center; }
.empty strong { display: block; margin-bottom: 6px; color: #424245; font-size: 15px; font-weight: 500; }
footer { margin-top: 34px; font-size: 12px; text-align: center; }

/* Small screens and motion preferences */
@media (hover: hover) {
    .primary:not(:disabled):hover { background: #353537; }
    .secondary:hover { background: white; color: var(--text); }
    .drop-zone:not(:disabled):hover { background: #0066cc04; border-color: #0066cc66; }
    .download:hover { background: #e8e8ed; }
    .delete:hover { background: var(--bg); color: var(--text); }
}
@media (max-width: 700px) {
    .app-shell { padding: 36px 20px 24px; }
    .page-header { gap: 16px; margin-bottom: 30px; }
    h1 { font-size: 27px; }
    .subtitle { font-size: 13px; }
    .secondary { padding: 9px 14px; }
    .drop-zone { min-height: 224px; }
    .file-row { grid-template-columns: 40px minmax(0, 1fr); gap: 12px 14px; padding: 18px; }
    .file-actions { grid-column: 2; flex-wrap: wrap; }
    .download, .delete { padding-inline: 10px; }
}
@keyframes appear { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
