:root {
    --ink: #172033;
    --muted: #65708a;
    --line: #dfe4ec;
    --panel: #fff;
    --canvas: #f4f6f9;
    --primary: #174e72;
    --primary-dark: #103c59;
    --accent: #0d8a76;
    --danger: #a6303a;
    --warning: #8a5a08;
    --radius: 14px;
    --shadow: 0 8px 28px rgba(23, 32, 51, .07);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { min-height: 100vh; margin: 0; }
a { color: var(--primary); }
.topbar { min-height: 72px; padding: 12px clamp(20px, 4vw, 64px); background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 32px; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 750; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 10px; background: var(--primary); color: #fff; font-size: 12px; letter-spacing: .08em; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.brand-mark-large { width: 48px; height: 48px; border-radius: 13px; font-size: 14px; }
nav { display: flex; gap: 6px; flex: 1; }
nav a { padding: 9px 11px; border-radius: 8px; color: #465068; text-decoration: none; font-size: 14px; font-weight: 650; }
nav a:hover { background: #eef3f7; color: var(--primary); }
.user-menu { display: flex; align-items: center; gap: 14px; }
.user-menu > div { display: flex; flex-direction: column; text-align: right; font-size: 13px; }
.user-menu span { color: var(--muted); }
.page-shell { width: min(1320px, calc(100% - 40px)); margin: 38px auto 70px; }
.guest .page-shell { width: min(460px, calc(100% - 32px)); min-height: 100vh; display: grid; place-items: center; margin-top: 0; }
.footer { padding: 22px; text-align: center; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
h1, h2 { margin: 0; letter-spacing: -.03em; }
h1 { font-size: clamp(28px, 3.2vw, 42px); line-height: 1.1; }
h2 { font-size: 21px; }
p { line-height: 1.6; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted, .optional { color: var(--muted); }
.optional { font-weight: 450; font-size: 13px; }
.lead { max-width: 760px; color: #465068; font-size: 16px; }
.page-heading { margin-bottom: 24px; }
.page-heading > .muted { margin-bottom: 0; }
.split-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.panel, .auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 26px; }
.auth-card { width: 100%; padding: 34px; }
.auth-heading { display: flex; align-items: center; gap: 15px; margin-bottom: 16px; }
.auth-heading h1 { font-size: 30px; }
.security-note { margin: 24px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.narrow-panel { max-width: 660px; margin: 0 auto; }
.form-panel { max-width: 860px; }
.form-stack { display: grid; gap: 18px; margin-top: 22px; }
.form-grid { display: grid; grid-template-columns: 1.2fr 1.4fr 1fr 1.3fr; gap: 16px; align-items: end; margin-top: 20px; }
.form-grid-action { grid-column: 1 / -1; }
label { display: grid; gap: 7px; font-size: 14px; font-weight: 700; color: #354058; }
input, textarea, select { width: 100%; border: 1px solid #cbd3df; border-radius: 9px; background: #fff; color: var(--ink); padding: 11px 12px; font: inherit; font-weight: 450; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23, 78, 114, .12); }
textarea { resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
legend { margin-bottom: 8px; font-size: 14px; font-weight: 750; }
.choice-card { grid-template-columns: auto 1fr; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.choice-card input { width: auto; margin: 4px 0 0; }
.choice-card span { display: grid; gap: 3px; }
.choice-card small, .file-field small { color: var(--muted); font-weight: 450; line-height: 1.45; }
.file-field { padding: 16px; border: 1px dashed #aeb9c8; border-radius: 10px; background: #f9fafc; }
.button { appearance: none; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: 9px; font: inherit; font-size: 14px; font-weight: 750; text-decoration: none; cursor: pointer; }
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { background: #fff; color: var(--primary); border-color: #bdc8d5; }
.button-quiet { min-height: 34px; padding: 6px 10px; background: #f3f5f8; color: #3b465d; }
.button-danger { background: var(--danger); color: #fff; }
.button-small { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.button-full { width: 100%; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.alert { margin-bottom: 18px; padding: 13px 15px; border: 1px solid; border-radius: 9px; line-height: 1.5; font-size: 14px; }
.alert-error { color: #7d2029; background: #fff0f1; border-color: #efc1c5; }
.alert-success { color: #116355; background: #eaf8f5; border-color: #afe0d7; }
.alert-info { color: #164f72; background: #eef7fc; border-color: #beddec; }
.alert-warning { color: #784c05; background: #fff8e7; border-color: #ead29c; }
.table-panel { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 12px 16px; background: #f7f8fa; color: #687289; text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
td { padding: 15px 16px; border-top: 1px solid #e8ebf0; vertical-align: middle; }
tbody tr:hover { background: #fbfcfd; }
.document-link { display: block; margin-bottom: 3px; color: var(--ink); font-weight: 750; text-decoration: none; }
.document-link:hover { color: var(--primary); }
.file-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 450; }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge-visible { color: #0b6b5c; background: #e6f6f2; }
.badge-hidden { color: #6b4d12; background: #faf0d9; }
.empty-state { padding: 64px 30px; text-align: center; }
.empty-state p { color: var(--muted); }
.back-link { display: inline-block; margin-bottom: 15px; color: var(--muted); font-size: 13px; font-weight: 650; text-decoration: none; }
.title-line { display: flex; align-items: center; gap: 12px; }
.metadata-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
.metadata-grid div { display: grid; gap: 5px; }
.metadata-grid span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.section-heading { padding: 22px 24px; }
.section-heading h2 { margin-top: 2px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
.two-column.uneven { grid-template-columns: minmax(280px, .7fr) minmax(520px, 1.5fr); margin-top: 0; }
.danger-panel { border-color: #e3bdc0; box-shadow: none; }
.danger-panel p { color: var(--muted); }
.hash { color: #43516b; font-size: 12px; }
.code-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 22px; letter-spacing: .12em; text-align: center; }
.steps { padding-left: 22px; color: #465068; line-height: 1.7; }
.totp-enrollment { display: grid; grid-template-columns: minmax(230px, .8fr) minmax(260px, 1.2fr); gap: 22px; align-items: center; margin: 22px 0; }
.totp-qr-panel { display: grid; justify-items: center; gap: 10px; }
.totp-qr-panel p { margin: 0; color: var(--muted); font-size: 12px; text-align: center; }
.totp-qr-code { display: grid; place-items: center; width: min(100%, 270px); aspect-ratio: 1; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--muted); font-size: 13px; text-align: center; }
.totp-qr-code svg { display: block; width: 100%; height: auto; shape-rendering: crispEdges; }
.totp-qr-code-error { border-color: #ead29c; background: #fff8e7; color: #784c05; }
.secret-box { display: grid; gap: 8px; margin: 22px 0; padding: 16px; background: #f2f5f8; border-radius: 10px; }
.secret-box span { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.secret-box code { font-size: 17px; letter-spacing: .08em; word-break: break-all; }
.breakable-code { display: block; margin-top: 10px; padding: 12px; background: #f2f5f8; word-break: break-all; }
.recovery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 24px 0; }
.recovery-grid code { padding: 12px; background: #f2f5f8; border-radius: 7px; text-align: center; font-size: 15px; letter-spacing: .08em; }
.admin-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 230px; }
.reset-details summary { color: var(--primary); cursor: pointer; font-size: 12px; font-weight: 700; }
.inline-reset { display: flex; gap: 6px; margin-top: 7px; }
.inline-reset input { min-width: 220px; padding: 7px 9px; font-size: 12px; }
.text-link { display: block; margin-top: 18px; text-align: center; font-size: 13px; }
.top-gap { margin-top: 22px; }
.error-code { color: var(--danger); font-size: 12px; font-weight: 900; letter-spacing: .15em; }
@media (max-width: 980px) {
    .topbar { align-items: flex-start; flex-wrap: wrap; gap: 12px; }
    nav { order: 3; width: 100%; overflow-x: auto; }
    .user-menu { margin-left: auto; }
    .form-grid { grid-template-columns: 1fr 1fr; }
    .two-column, .two-column.uneven { grid-template-columns: 1fr; }
    .totp-enrollment { grid-template-columns: 1fr; }
    .metadata-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
    .page-shell { width: min(100% - 24px, 1320px); margin-top: 24px; }
    .brand > span:last-child, .user-menu > div { display: none; }
    .split-heading { align-items: flex-start; flex-direction: column; }
    .panel, .auth-card { padding: 20px; }
    .table-panel { padding: 0; }
    .form-grid, .metadata-grid, .recovery-grid { grid-template-columns: 1fr; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .button { width: 100%; }
}
