:root {
    --bg: #eef2ff;
    --card: #ffffff;
    --ink: #1e1b4b;
    --muted: #64748b;
    --line: #e2e8f0;
    --primary: #4f46e5;
    --primary-ink: #ffffff;
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(30, 27, 75, 0.08);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: linear-gradient(180deg, #eef2ff 0%, #f8fafc 100%);
    color: var(--ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { max-width: 960px; margin: 0 auto; padding: 32px 20px 64px; }

.topbar { display: flex; align-items: center; margin-bottom: 24px; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 13px;
}
.brand strong { display: block; font-size: 18px; }
.muted { color: var(--muted); margin: 4px 0 0; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}
.narrow { max-width: 460px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-weight: 600; }
.field .req { color: var(--danger); text-decoration: none; }
.field input {
    font: inherit;
    font-weight: 400;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
}
.field input:focus { outline: 2px solid #c7d2fe; border-color: var(--primary); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.ghost { background: #eef2ff; color: var(--ink); }
.btn:hover { text-decoration: none; opacity: 0.94; }

.alert, .error { color: var(--danger); }
.alert { background: var(--danger-bg); padding: 10px 12px; border-radius: 10px; margin-bottom: 16px; }

.folder-hint { color: var(--muted); margin-top: 0; }

.crumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; color: var(--muted); }
.browse-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.select-all, .file-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
}
.file-check { margin: 0; }
.file-check input, .select-all input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.listing { list-style: none; margin: 0; padding: 0; }
.listing li + li { border-top: 1px solid var(--line); }
.row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    color: inherit;
    text-decoration: none;
}
.row:hover { background: #f8fafc; }
.grow { display: flex; align-items: center; gap: 12px; flex: 1; color: inherit; text-decoration: none; }
.listing button.btn { flex-shrink: 0; }
.icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
}
.icon.folder { background: #e0e7ff; }
.icon.pdf { background: #fee2e2; color: #b91c1c; }

.viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.pager { display: flex; align-items: center; gap: 8px; }
.viewer-card { overflow: auto; text-align: center; }
#pdf-canvas { max-width: 100%; height: auto; }
.pdf-frame {
    width: 100%;
    min-height: 80vh;
    border: 0;
    background: #fff;
}
