:root {
  --ink: #18212f;
  --muted: #64748b;
  --line: #d8dee8;
  --surface: #ffffff;
  --canvas: #f3f5f8;
  --nav: #161b23;
  --nav-hover: #252d39;
  --primary: #b4232f;
  --primary-dark: #8f1823;
  --green: #18794e;
  --green-soft: #e9f7ef;
  --yellow: #8a5d00;
  --yellow-soft: #fff5d6;
  --red-soft: #fcebed;
  --blue: #245ea8;
  --blue-soft: #eaf2ff;
  --sidebar: 248px;
  --topbar: 58px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--canvas); }
body { font-size: 14px; line-height: 1.5; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
code, pre { font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; }
code { overflow-wrap: anywhere; }

.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40; display: flex; flex-direction: column; background: var(--nav); color: #dce3ed; border-right: 1px solid #303846; }
.brand { min-height: var(--topbar); padding: 10px 16px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid #303846; }
.brand > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.brand strong { color: #fff; font-size: 15px; }
.brand small { color: #8f9bad; font-size: 11px; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; border: 2px solid #f1c84b; color: #f1c84b; font-weight: 800; font-size: 12px; }
.brand-mark.large { width: 48px; height: 48px; font-size: 16px; }
.sidebar nav { overflow-y: auto; padding: 10px 8px; flex: 1; scrollbar-width: thin; }
.nav-link { min-height: 38px; margin: 2px 0; padding: 8px 10px; display: flex; align-items: center; gap: 10px; border-radius: 5px; color: #b8c2d0; }
.nav-link:hover { background: var(--nav-hover); color: #fff; }
.nav-link.active { background: #f1c84b; color: #1b2029; font-weight: 700; }
.sidebar-foot { padding: 10px 8px; border-top: 1px solid #303846; }
.status-line { min-height: 34px; padding: 8px 10px; display: flex; align-items: center; gap: 8px; color: #98a5b6; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #7b8796; }
.status-dot.online { background: #4fd18b; box-shadow: 0 0 0 3px rgba(79, 209, 139, .14); }
.topbar { position: fixed; left: var(--sidebar); right: 0; top: 0; height: var(--topbar); z-index: 30; padding: 0 22px; display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.98); border-bottom: 1px solid var(--line); }
.topbar-title { font-weight: 700; }
.topbar-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.user-chip { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 12px; border-left: 1px solid var(--line); color: var(--ink); font-weight: 650; }
.app-main { margin-left: var(--sidebar); padding: calc(var(--topbar) + 26px) 28px 44px; min-height: 100vh; }
.public-main { min-height: 100vh; }
.drawer-overlay { display: none; }
.mobile-only { display: none !important; }

.page-header { min-height: 66px; margin-bottom: 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.page-header h1 { margin: 0; font-size: 25px; line-height: 1.2; }
.page-header p { margin: 5px 0 0; color: var(--muted); }
.eyebrow { margin: 0 0 4px !important; color: var(--primary) !important; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.date-label { color: var(--muted); font-size: 12px; }
h2 { margin: 0 0 14px; font-size: 16px; }
.muted { color: var(--muted); }
.block { display: block; }

.button { min-height: 38px; padding: 8px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 5px; cursor: pointer; font-weight: 700; white-space: nowrap; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.button.secondary:hover { border-color: #aeb8c7; background: #f8fafc; }
.button.success { background: var(--green); color: #fff; }
.button.danger { background: #9d2430; color: #fff; }
.button.small { min-height: 30px; padding: 5px 9px; font-size: 12px; }
.button.full { width: 100%; }
.icon-button { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:hover { background: #eef1f5; color: var(--ink); }
.icon-button.danger:hover { color: var(--primary); background: var(--red-soft); }
.actions { display: flex; align-items: center; gap: 6px; }

.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 10px; margin-bottom: 24px; }
.stats-grid.compact { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.stat { min-height: 94px; padding: 15px; display: flex; flex-direction: column; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid #7c899a; border-radius: 6px; }
.stat:nth-child(2) { border-top-color: var(--primary); }
.stat:nth-child(3) { border-top-color: var(--blue); }
.stat:nth-child(4) { border-top-color: var(--yellow); }
.stat:nth-child(5) { border-top-color: var(--green); }
.stat.accent { border-top-color: #8b4ab4; }
.stat.danger { border-top-color: var(--primary); background: var(--red-soft); }
.stat span { color: var(--muted); font-size: 12px; }
.stat strong { font-size: 27px; line-height: 1; }
.stat strong.small-value { font-size: 18px; }

.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.two-column.wide-left { grid-template-columns: minmax(0, 1.7fr) minmax(280px, .7fr); align-items: start; }
.three-column { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 16px; margin-bottom: 16px; }
.section-block { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 16px; min-width: 0; }
.section-heading { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading h2 { margin: 0; }
.section-heading a { color: var(--primary); font-size: 12px; font-weight: 700; }
.list-row { min-height: 50px; padding: 9px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid #edf0f4; }
.list-row:first-of-type { border-top: 0; }
.list-row > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.list-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row small { color: var(--muted); }

.filter-bar { margin-bottom: 12px; display: flex; gap: 8px; }
.filter-bar input, .filter-bar select { min-height: 38px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.search-field { min-width: 260px; max-width: 520px; flex: 1; position: relative; }
.search-field .icon { position: absolute; left: 11px; top: 10px; color: var(--muted); }
.search-field input { width: 100%; padding-left: 38px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { height: 38px; padding: 8px 12px; text-align: left; color: #596779; background: #f6f7f9; border-bottom: 1px solid var(--line); font-size: 11px; text-transform: uppercase; }
td { min-height: 52px; padding: 10px 12px; border-bottom: 1px solid #e8ecf1; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
td.truncate { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pagination { margin-top: 12px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted); font-size: 12px; }

.identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.identity img, .avatar-fallback { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; }
.avatar-fallback { display: grid; place-items: center; background: #e6eaf0; color: #425066; font-weight: 800; }
.identity > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.identity.large img, .identity.large .avatar-fallback { width: 54px; height: 54px; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 4px; background: #eef1f5; color: #4d5b6d; font-size: 11px; font-weight: 750; white-space: nowrap; }
.badge.active, .badge.approved, .badge.open { background: var(--green-soft); color: var(--green); }
.badge.pending, .badge.waiting, .badge.review, .badge.warning { background: var(--yellow-soft); color: var(--yellow); }
.badge.suspended, .badge.banned, .badge.rejected { background: var(--red-soft); color: var(--primary); }
.badge.closed, .badge.archived, .badge.left, .badge.cancelled, .badge.ended { background: #eef1f5; color: #58677a; }
.chip-list { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-list.roomy { gap: 8px; }
.chip { padding: 3px 7px; border-left: 3px solid var(--chip-color, #64748b); background: #f2f4f7; font-size: 11px; }
.data-list { margin: 0; }
.data-list > div { padding: 9px 0; display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; border-top: 1px solid #edf0f4; }
.data-list > div:first-child { border-top: 0; }
.data-list dt { color: var(--muted); }
.data-list dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.prose { max-width: 900px; line-height: 1.7; }
.prose p:first-child { margin-top: 0; }

.timeline { position: relative; }
.timeline article { position: relative; padding: 0 0 20px 24px; border-left: 1px solid var(--line); }
.timeline article:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -5px; top: 4px; width: 9px; height: 9px; background: var(--primary); border-radius: 50%; box-shadow: 0 0 0 4px #fff; }
.entry-head { display: flex; justify-content: space-between; gap: 10px; }
.entry-head span { color: var(--muted); font-size: 11px; }
.timeline p { margin: 7px 0; }
.timeline small { color: var(--muted); }
.inline-form, .compact-form { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.inline-form p, .compact-form p { margin: 0 0 12px; }
.file-row { min-height: 52px; display: grid; grid-template-columns: 20px minmax(0, 1fr) 34px; align-items: center; gap: 8px; border-top: 1px solid #edf0f4; }
.file-row > span { display: flex; flex-direction: column; min-width: 0; }
.file-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row small { color: var(--muted); }
.file-name { display: flex; align-items: center; gap: 9px; }
.file-name > span { display: flex; flex-direction: column; }

.form-section { max-width: 780px; padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.field { margin-bottom: 16px; }
.field > label, .compact-form label, .inline-form label, .section-block form > label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 750; }
.form-control, .form-section input, .form-section select, .form-section textarea, .compact-form input, .compact-form select, .compact-form textarea, .inline-form input, .inline-form select, .inline-form textarea { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid #bdc6d3; border-radius: 5px; background: #fff; color: var(--ink); }
textarea.form-control { resize: vertical; }
.form-control:focus, input:focus, select:focus, textarea:focus { outline: 3px solid rgba(36,94,168,.15); border-color: var(--blue); }
.field-check { display: flex; align-items: center; gap: 10px; }
.field-check label { order: 2; margin: 0; }
.field-check input { width: 18px; min-height: 18px; }
.field small { display: block; color: var(--muted); margin-top: 4px; }
.errorlist { margin: 5px 0 0; padding-left: 20px; color: var(--primary); }
.form-actions { margin-top: 22px; padding-top: 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }

.audit-list.full { background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.audit-row { min-height: 48px; padding: 8px 0; display: grid; grid-template-columns: 110px minmax(0, 1fr) 110px; gap: 12px; align-items: center; border-top: 1px solid #edf0f4; }
.audit-list.full .audit-row { padding: 9px 12px; }
.audit-row:first-child { border-top: 0; }
.audit-row > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; }
.audit-row small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-time, .area-label { color: var(--muted); font-size: 11px; }
.area-label { text-align: right; text-transform: uppercase; }
.empty-state { min-height: 92px; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); }

.document-grid, .role-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.document-card, .role-card { min-height: 150px; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.document-card:hover { border-color: #aab5c4; box-shadow: 0 5px 16px rgba(19,31,48,.07); }
.document-card strong { font-size: 16px; }
.document-card small { color: var(--muted); }
.document-card .badge { margin-top: auto; align-self: flex-start; }
.doc-kind { color: var(--primary); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.document-body { max-width: 920px; min-height: 450px; padding: 46px 54px; background: #fff; border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(22,31,44,.08); line-height: 1.8; }
.role-card { border-top: 3px solid var(--role-color); }
.role-head { display: flex; align-items: center; gap: 10px; }
.role-head > div { min-width: 0; display: flex; flex-direction: column; flex: 1; }
.role-head small, .role-card p, .role-meta { color: var(--muted); }
.role-swatch { width: 12px; height: 32px; background: var(--role-color); }
.role-card p { margin: 4px 0; flex: 1; }
.role-meta { display: flex; justify-content: space-between; font-size: 11px; }
.role-checklist { display: grid; gap: 7px; margin-bottom: 14px; }
.role-checklist label { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; align-items: start; cursor: pointer; }
.role-checklist input { margin-top: 6px; }
.role-checklist label > span { padding: 7px 9px; display: flex; flex-direction: column; border-left: 3px solid var(--role-color); background: #f7f8fa; }
.role-checklist small { color: var(--muted); }

.draft-lock { margin-bottom: 16px; padding: 13px 15px; display: flex; align-items: flex-start; gap: 11px; border: 1px solid #d5a43a; border-left: 5px solid #d5a43a; background: var(--yellow-soft); }
.draft-lock .icon { margin-top: 2px; color: var(--yellow); }
.draft-lock div { display: grid; gap: 2px; }
.draft-lock span { color: #6f5825; font-size: 12px; }
.questionnaire-layout { align-items: start; }
.dm-preview { padding: 22px; background: #111318; color: #d9dce1; border: 1px solid #30343b; border-radius: 6px; }
.dm-preview-head { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid #30343b; }
.dm-preview-head > div { display: flex; flex-direction: column; }
.dm-preview-head strong, .dm-title { color: #fff; }
.dm-preview-head small { color: #9198a1; }
.dm-title { margin: 18px 0 8px; font-size: 17px; font-weight: 800; }
.dm-preview > p:not(.dm-title) { color: #b9bec6; line-height: 1.65; }
.question-preview-list { margin: 20px 0; padding: 0; display: grid; gap: 8px; list-style: none; }
.question-preview-list li { padding: 12px; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; background: #1a1d23; border: 1px solid #30343b; }
.question-preview-list li > span { width: 27px; height: 27px; display: grid; place-items: center; background: var(--primary); color: #fff; font-size: 10px; font-weight: 800; }
.question-preview-list strong, .question-preview-list small { display: block; }
.question-preview-list p { margin: 3px 0; color: #e6e8eb; }
.question-preview-list small { color: #929aa5; }
.photo-prompt-preview { padding: 14px; border-left: 4px solid #f1c84b; background: #20242b; }
.photo-prompt-preview p { margin: 5px 0 8px; color: #c7cbd1; }
.photo-prompt-preview ul { margin: 0; padding-left: 19px; color: #aeb4bd; }
.button:disabled { cursor: not-allowed; opacity: .58; }

.message-stack { position: fixed; top: 70px; right: 18px; z-index: 100; width: min(410px, calc(100vw - 36px)); display: grid; gap: 8px; }
.message { min-height: 48px; padding: 9px 9px 9px 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--blue); box-shadow: 0 8px 24px rgba(22,31,44,.14); border-radius: 5px; transition: opacity .2s, transform .2s; }
.message.success { border-left-color: var(--green); }
.message.error { border-left-color: var(--primary); }
.message.hiding { opacity: 0; transform: translateX(20px); }
.lockdown-banner { margin: -26px -28px 22px; min-height: 38px; padding: 8px 28px; display: flex; align-items: center; gap: 8px; background: var(--primary); color: #fff; font-weight: 750; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, .8fr) minmax(420px, 1.2fr); background: #fff; }
.auth-brand { padding: 56px; display: flex; flex-direction: column; justify-content: flex-end; background: var(--nav); color: #fff; border-right: 8px solid #f1c84b; }
.auth-brand h1 { margin: 18px 0 2px; font-size: 34px; }
.auth-brand p { margin: 0; color: #aeb9c8; }
.auth-panel { width: min(440px, calc(100% - 48px)); margin: auto; }
.auth-panel h2 { font-size: 22px; margin-bottom: 18px; }
.auth-copy { margin: -7px 0 18px; color: var(--muted); line-height: 1.55; }
.setup-step { display: inline-block; margin-bottom: 8px; color: var(--primary); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.setup-form { display: grid; gap: 15px; }
.field-group { display: grid; gap: 6px; }
.field-group label { font-size: 12px; font-weight: 750; }
.field-group small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.field-error { color: var(--primary); font-size: 12px; font-weight: 700; }
.auth-step { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; }
.auth-step > span { width: 28px; height: 28px; display: grid; place-items: center; background: var(--primary); color: #fff; font-weight: 800; }
.auth-step p { margin: 3px 0 14px; }
.command-box { min-height: 58px; padding: 10px 10px 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #171c24; color: #f8fafc; border-radius: 5px; }
.command-box code { font-size: 14px; }
.command-box .icon-button { color: #fff; }
.waiting { margin: 18px 0 8px; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.spinner { width: 16px; height: 16px; border: 2px solid #ccd3dd; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-divider { margin: 22px 0; display: flex; align-items: center; color: var(--muted); font-size: 11px; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.auth-divider span { padding: 0 10px; }
.center-state { min-height: 100vh; max-width: 620px; margin: auto; padding: 40px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.center-state h1 { margin: 6px 0; font-size: 32px; }
.center-state p { color: var(--muted); font-size: 16px; }
.state-number { color: var(--primary); font-weight: 800; }
.center-state.danger { border-top: 8px solid var(--primary); }

.portal-header { min-height: 150px; padding: 28px 30px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; background: var(--nav); color: #fff; border-bottom: 6px solid #f1c84b; }
.portal-header h1 { margin: 3px 0 5px; font-size: 34px; }
.portal-header p:not(.eyebrow) { margin: 0; color: #b8c2d0; }
.portal-header .eyebrow { color: #f1c84b; }
.portal-status { padding: 8px 10px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid #485466; font-size: 12px; white-space: nowrap; }
.portal-section { padding: 30px 0 6px; }
.section-heading { margin-bottom: 16px; display: flex; align-items: flex-end; justify-content: space-between; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin: 2px 0 14px; font-size: 23px; }
.section-icon { width: 24px; height: 24px; margin-bottom: 14px; color: var(--primary); }
.org-chart { margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; list-style: none; }
.org-level { position: relative; width: var(--level-width); max-width: 100%; padding: 0; display: grid; gap: 8px; justify-items: center; }
.org-level:not(:last-child) { padding-bottom: 34px; }
.org-level:not(:last-child)::after { content: ""; position: absolute; bottom: 0; left: 50%; width: 2px; height: 26px; background: #aeb8c5; }
.org-level-heading { min-width: 220px; padding: 7px 16px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--primary); background: var(--nav); color: #fff; text-align: center; }
.org-level-heading span { color: #b8c2d0; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.org-level-heading strong { font-size: 12px; text-transform: uppercase; }
.org-level-offices { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.org-office { min-width: 0; padding: 15px; border: 1px solid var(--line); border-top: 4px solid var(--office-color, var(--blue)); background: #fff; border-radius: 5px; }
.org-office h3 { margin: 0 0 13px; padding-bottom: 9px; border-bottom: 1px solid var(--line); font-size: 14px; overflow-wrap: anywhere; }
.org-office-members { display: grid; gap: 11px; }
.portal-person { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 10px; }
.portal-person img, .portal-person .avatar-fallback { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.portal-person .avatar-fallback { display: grid; place-items: center; background: var(--nav); color: #fff; font-weight: 800; }
.portal-person strong, .portal-person small { display: block; overflow-wrap: anywhere; }
.portal-person small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.office-vacant { color: var(--muted); font-size: 12px; }
.rulebook-list { display: grid; gap: 8px; }
.rulebook-item { border: 1px solid var(--line); background: #fff; border-radius: 5px; }
.rulebook-item summary { min-height: 68px; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; list-style: none; }
.rulebook-item summary::-webkit-details-marker { display: none; }
.rulebook-item summary strong, .rulebook-item summary small { display: block; }
.rulebook-item summary small { margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 500; }
.rulebook-toggle { color: var(--primary); font-size: 11px; font-weight: 800; }
.rulebook-item[open] .rulebook-toggle { font-size: 0; }
.rulebook-item[open] .rulebook-toggle::after { content: "Schließen"; font-size: 11px; }
.rulebook-body { padding: 18px 16px; border-top: 1px solid var(--line); line-height: 1.65; }
.rulebook-body p:first-child { margin-top: 0; }
.portal-empty { padding: 28px 18px; border: 1px dashed #b8c2cf; color: var(--muted); text-align: center; }

details summary { cursor: pointer; font-weight: 650; }
details pre { max-width: 500px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
  .document-grid, .role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .three-column { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: translateX(0); }
  .drawer-overlay { position: fixed; inset: 0; z-index: 35; background: rgba(9,14,22,.55); }
  body.nav-open .drawer-overlay { display: block; }
  .topbar { left: 0; padding: 0 12px; }
  .mobile-only { display: inline-grid !important; }
  .app-main { margin-left: 0; padding: calc(var(--topbar) + 18px) 14px 36px; }
  .topbar-title { flex: 1; margin-left: 8px; }
  .user-chip { max-width: 100px; }
  .two-column, .two-column.wide-left, .detail-grid { grid-template-columns: 1fr; }
  .stats-grid, .stats-grid.compact { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .page-header { min-height: 0; flex-direction: column; }
  .page-header .button { width: 100%; }
  .filter-bar { flex-wrap: wrap; }
  .search-field { min-width: 100%; }
  .filter-bar select, .filter-bar .button { flex: 1; }
  .document-grid, .role-grid { grid-template-columns: 1fr; }
  .document-body { padding: 26px 20px; }
  .portal-header { min-height: 175px; margin: -18px -14px 0; padding: 28px 20px; align-items: flex-start; flex-direction: column; justify-content: flex-end; }
  .org-level { width: 100%; }
  .audit-row { grid-template-columns: 86px minmax(0, 1fr); }
  .audit-row .area-label { display: none; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { min-height: 210px; padding: 28px; justify-content: center; border-right: 0; border-bottom: 6px solid #f1c84b; }
  .auth-brand h1 { font-size: 27px; }
  .auth-panel { padding: 36px 0; }
  .lockdown-banner { margin: -18px -14px 18px; padding: 8px 14px; }
}

@media (max-width: 480px) {
  .stats-grid, .stats-grid.compact { grid-template-columns: 1fr 1fr; }
  .stat { min-height: 82px; padding: 12px; }
  .stat strong { font-size: 23px; }
  .topbar-meta #session-countdown { display: none; }
  .data-list > div { grid-template-columns: 1fr; gap: 2px; }
  .message-stack { top: 64px; right: 8px; width: calc(100vw - 16px); }
  .command-box { align-items: flex-start; }
  .command-box code { font-size: 12px; }
  .portal-header h1 { font-size: 29px; }
  .portal-status { white-space: normal; }
  .rulebook-item summary { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
