.portal-body { min-height: 100vh; background: oklch(96% 0.01 245); }
[hidden] { display: none !important; }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .9fr) minmax(520px, 1.1fr); }
.auth-brand { padding: clamp(36px, 6vw, 82px); display: flex; flex-direction: column; justify-content: space-between; gap: 50px; background: var(--navy-deep); color: var(--surface); }
.auth-brand .brand img { width: min(250px, 72vw); height: auto; }
.auth-brand h1 { margin: 0; max-width: 660px; font-size: clamp(3rem, 6vw, 6.2rem); line-height: .94; letter-spacing: 0; }
.auth-brand p:not(.eyebrow) { max-width: 560px; color: oklch(79% 0.03 245); }
.auth-boundary { padding-top: 18px; border-top: 1px solid oklch(49% 0.07 255); font-size: .84rem; }
.auth-panel { width: min(540px, calc(100% - 48px)); margin: auto; padding: 42px 0; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; margin-bottom: 38px; border-bottom: 1px solid var(--line); }
.auth-tabs button { min-height: 48px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-weight: 750; cursor: pointer; }
.auth-tabs button[aria-selected="true"] { border-bottom-color: var(--red); color: var(--navy); }
.auth-form { display: grid; gap: 18px; }
.auth-form h2 { margin: 0; color: var(--navy-deep); font-size: 2rem; }
.auth-context { margin: 8px 0 0; color: var(--muted); font-size: .9rem; }
.auth-help-action { justify-self: start; }
.apple-button { justify-content: space-between; }
.apple-button span { color: var(--muted); font-size: .75rem; }
.account-options { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; }
.account-options legend { margin-bottom: 8px; font-size: .88rem; font-weight: 750; }
.account-options label { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.account-options label:has(input:checked) { border-color: var(--navy); background: oklch(96% 0.025 250); }
.account-options input { margin-top: 4px; accent-color: var(--navy); }
.account-options strong, .account-options small { display: block; }
.account-options small { margin-top: 2px; color: var(--muted); }
.consent { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: .86rem; }
.consent input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--navy); }
.confirmation-screen { display: grid; gap: 22px; }
.confirmation-screen h2 { margin: 0; color: var(--navy-deep); font-size: 2.35rem; line-height: 1.05; }
.confirmation-lead { margin: 10px 0 0; color: var(--muted); }
.confirmation-lead strong { color: var(--navy); overflow-wrap: anywhere; }
.confirmation-mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: var(--surface); font-size: 1.7rem; font-weight: 800; }
.confirmation-steps { margin: 0; padding: 0; display: grid; list-style: none; border-top: 1px solid var(--line); }
.confirmation-steps li { padding: 15px 0; display: grid; grid-template-columns: 30px 1fr; gap: 12px; border-bottom: 1px solid var(--line); }
.confirmation-steps li > span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: oklch(93% 0.03 250); color: var(--navy); font-size: .75rem; font-weight: 800; }
.confirmation-steps strong, .confirmation-steps small { display: block; }
.confirmation-steps small { margin-top: 3px; color: var(--muted); }
.confirmation-note { padding: 16px; border-left: 4px solid var(--red); background: var(--surface); }
.confirmation-note strong { color: var(--navy-deep); }
.confirmation-note p { margin: 4px 0 0; color: var(--muted); font-size: .88rem; }
.confirmation-access { padding-top: 18px; display: flex; flex-wrap: wrap; gap: 12px 18px; border-top: 1px solid var(--line); }
.confirmation-access > span { width: 100%; color: var(--muted); font-size: .78rem; font-weight: 750; text-transform: uppercase; }
.confirmation-restart { justify-self: start; color: var(--muted); }

.portal { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.portal-sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 20px; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); }
.portal-sidebar .brand { padding: 0 8px 28px; }
.portal-sidebar .brand img { width: 166px; }
.portal-nav { display: grid; gap: 4px; }
.portal-nav button { min-height: 46px; padding: 0 12px; border: 0; border-radius: 6px; display: flex; align-items: center; background: transparent; color: var(--muted); font-weight: 700; text-align: left; cursor: pointer; }
.portal-nav button:hover { background: oklch(96% 0.015 245); color: var(--navy); }
.portal-nav button[aria-current="page"] { background: oklch(93% 0.03 250); color: var(--navy); }
.portal-sidebar-foot { margin-top: auto; padding: 18px 8px 0; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.role-badge { width: fit-content; padding: 4px 8px; border-radius: 999px; background: oklch(93% 0.03 250); color: var(--navy); font-size: .75rem; font-weight: 800; }
.text-button { width: fit-content; padding: 0; border: 0; background: transparent; color: var(--red); font-weight: 750; cursor: pointer; }
.portal-content { min-width: 0; }
.portal-topbar { min-height: 72px; padding: 0 34px; display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.portal-topbar > div { display: grid; }
.portal-context { color: var(--muted); font-size: .74rem; }
.portal-topbar .button { margin-left: auto; }
.portal-menu { display: none; }
.portal-main { width: min(1100px, calc(100% - 64px)); margin: 0 auto; padding: 52px 0 90px; }
.portal-view { display: grid; gap: 34px; }
.view-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; }
.view-heading h1 { margin: 0; color: var(--navy-deep); font-size: 2.45rem; line-height: 1.08; }
.view-heading p:not(.eyebrow) { max-width: 670px; margin: 10px 0 0; color: var(--muted); }
.status-chip { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .75rem; font-weight: 800; }
.status-good { border-color: oklch(82% 0.09 150); background: oklch(95% 0.04 150); color: oklch(43% 0.14 150); }
.status-warning { border-color: oklch(82% 0.1 75); background: oklch(96% 0.05 85); color: oklch(45% 0.12 65); }
.summary-band { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.summary-band div { padding: 22px; border-right: 1px solid var(--line); }
.summary-band div:last-child { border-right: 0; }
.summary-band span, .summary-band strong { display: block; }
.summary-band span { color: var(--muted); font-size: .76rem; font-weight: 700; }
.summary-band strong { margin-top: 5px; color: var(--navy); font-size: 1.05rem; }
.action-list { border-top: 1px solid var(--line); }
.action-list button { width: 100%; padding: 20px 0; border: 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; background: transparent; color: var(--navy); text-align: left; cursor: pointer; }
.action-list strong, .action-list small { display: block; }
.action-list small { max-width: 680px; margin-top: 4px; color: var(--muted); font-size: .84rem; }

.workspace-form { padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.workspace-form .form-actions { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
.workspace-form .form-status { margin: 0; }
.compact-form { max-width: 760px; }
.workspace-section { padding-top: 14px; }
.workspace-section h2, .admin-columns h2 { margin: 0 0 16px; color: var(--navy-deep); font-size: 1.05rem; }
.data-list { border-top: 1px solid var(--line); }
.data-item { padding: 16px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 18px; }
.data-item strong, .data-item small { display: block; }
.data-item small { margin-top: 3px; color: var(--muted); }
.review-item { align-items: flex-start; flex-direction: column; }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.review-actions .button { min-height: 38px; padding: 0 14px; font-size: .82rem; }
.empty-state { padding: 18px 0; color: var(--muted); }
.admin-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 36px 44px; }
.security-callout { max-width: 760px; padding: 20px; border: 1px solid oklch(81% 0.09 75); border-radius: var(--radius); background: oklch(96% 0.045 85); }
.security-callout strong { color: var(--ink); }
.security-callout p { margin: 5px 0 0; color: oklch(40% 0.03 70); }
.integration-section { display: grid; gap: 22px; padding-top: 32px; border-top: 1px solid var(--line); }
.integration-section:first-of-type { padding-top: 0; border-top: 0; }
.section-heading-inline { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.section-heading-inline h2 { margin: 0; color: var(--navy-deep); font-size: 1.35rem; }
.section-heading-inline p { margin: 5px 0 0; color: var(--muted); }
.directory-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) 220px; gap: 14px; align-items: end; }
.admin-table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.admin-table { width: 100%; min-width: 820px; border-collapse: collapse; background: var(--surface); }
.admin-table th, .admin-table td { padding: 15px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.admin-table th { color: var(--muted); font-size: .73rem; text-transform: uppercase; }
.admin-table td strong, .admin-table td small { display: block; }
.admin-table td small { margin-top: 2px; color: var(--muted); }
.admin-table th:last-child, .admin-table td:last-child { text-align: right; }
.row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.row-actions .button { min-height: 36px; padding: 0 11px; font-size: .78rem; }
.category-registry { display: grid; gap: 18px; margin-top: 18px; border-top: 1px solid var(--line); }
.category-table { min-width: 620px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.admin-dialog { width: min(720px, calc(100% - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.admin-dialog::backdrop { background: oklch(16% 0.04 255 / .54); backdrop-filter: blur(3px); }
.dialog-shell { padding: 28px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.dialog-heading h2 { margin: 0; color: var(--navy-deep); font-size: 1.65rem; }
.dialog-close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: oklch(94% 0.02 250); color: var(--navy); font-size: 1.4rem; cursor: pointer; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand { min-height: 420px; }
  .portal { grid-template-columns: 1fr; }
  .portal-sidebar { position: fixed; z-index: 40; width: 264px; transform: translateX(-110%); transition: transform 180ms cubic-bezier(.22,1,.36,1); box-shadow: var(--shadow); }
  .portal-sidebar[data-open="true"] { transform: translateX(0); }
  .portal-menu { display: inline-flex; width: 44px; height: 44px; border: 0; border-radius: 50%; align-items: center; justify-content: center; background: oklch(94% 0.02 250); color: var(--navy); }
  .portal-main { width: min(100% - 36px, 1100px); }
}

@media (max-width: 620px) {
  .auth-brand { min-height: 350px; padding: 28px 22px; }
  .auth-brand h1 { font-size: 3rem; }
  .auth-panel { width: min(100% - 36px, 540px); }
  .portal-topbar { padding: 0 16px; }
  .portal-topbar .button { display: none; }
  .view-heading { display: grid; }
  .summary-band, .admin-columns { grid-template-columns: 1fr; }
  .summary-band div { border-right: 0; border-bottom: 1px solid var(--line); }
  .summary-band div:last-child { border-bottom: 0; }
  .workspace-form { padding: 18px; }
  .workspace-form .form-actions { align-items: stretch; flex-direction: column; }
  .directory-toolbar { grid-template-columns: 1fr; }
  .section-heading-inline { display: grid; }
  .dialog-shell { padding: 20px; }
  .dialog-actions { flex-direction: column-reverse; }
}
