:root {
  color-scheme: light;
  --paper: #f6f8f7;
  --card: #fff;
  --ink: #172c28;
  --muted: #4c625b;
  --accent: #214a3c;
  --accent-pale: #eaf1ed;
  --line: #ccd7d2;
  --focus: #487e60;
  --error: #8b3220;
  --sans: 'Instrument Sans', system-ui, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.6 var(--sans); }
:is(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: .19em; }
p { margin: 0 0 1em; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .55em; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.035em; }
h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 2.85rem); }
h3 { font-size: 1.03rem; }

.portal-header, .portal-footer {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px 24px; padding: 16px max(22px, calc((100% - 1152px) / 2));
}
.portal-header { border-bottom: 1px solid var(--line); }
.portal-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.portal-footer p { margin: 0; }
.portal-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; }
.portal-brand svg { flex: 0 0 38px; width: 38px; height: 38px; color: var(--accent); }
.portal-home-link { display: inline-flex; align-items: center; min-height: 44px; font-size: .925rem; }
.portal-skip { position: absolute; inset: 8px auto auto 8px; padding: 10px 14px; background: var(--card); transform: translateY(-160%); z-index: 2; }
.portal-skip:focus { transform: none; }
.portal-shell { width: min(1152px, calc(100% - 44px)); margin-inline: auto; min-height: 70vh; }
.portal-auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 470px); align-items: start; gap: clamp(32px, 7vw, 110px); padding-block: clamp(40px, 8vw, 112px); }
.portal-auth-intro { max-width: 34rem; }
.portal-auth-intro h1 { max-width: 12ch; }
.portal-auth-card { background: var(--card); border: 1px solid var(--line); padding: clamp(20px, 4vw, 34px); border-radius: 12px; min-width: 0; }
.portal-auth-card h2 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.portal-eyebrow, .portal-preview-label { color: var(--accent); font-size: .76rem; font-weight: 750; letter-spacing: .095em; text-transform: uppercase; }
.portal-preview-note { border-left: 2px solid var(--focus); background: var(--accent-pale); padding: 10px 14px; color: var(--muted); font-size: .93rem; max-width: 34rem; }
.portal-auth-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.portal-auth-tabs { margin: 0 0 20px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
.portal-primary, .portal-secondary, .portal-auth-tabs > button, .portal-tabs > button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  border: 1px solid transparent; padding: 7px 13px; border-radius: 6px; font-weight: 670; text-decoration: none;
}
.portal-primary { color: white; background: var(--accent); }
.portal-primary:hover { background: #18382e; }
.portal-secondary { background: var(--card); color: var(--accent); border-color: var(--line); }
.portal-secondary:hover { background: var(--accent-pale); }
.portal-auth-tabs > button, .portal-tabs > button { background: transparent; color: var(--muted); font-size: .92rem; }
.portal-auth-tabs > button:is(:hover, [aria-selected="true"]), .portal-tabs > button:is(:hover, [aria-selected="true"]) { color: var(--accent); background: var(--accent-pale); }
.portal-form, .portal-form label { display: grid; gap: 6px; }
.portal-form { gap: 15px; align-items: start; max-width: 47rem; }
.portal-form label { font-weight: 650; }
.portal-form small, .portal-muted, .portal-field-help { color: var(--muted); font-size: .9rem; font-weight: 400; margin: 0; }
.portal-form :is(input, select, textarea) {
  min-width: 0; width: 100%; min-height: 46px; border: 1px solid #9bafa6; background: var(--card);
  color: var(--ink); border-radius: 5px; padding: 8px 10px; font-weight: 400;
}
.portal-form textarea { resize: vertical; }
.portal-form > button { justify-self: start; }
.portal-form > label + :is(input, select, textarea) { margin-top: -9px; }
.portal-form [role="status"] { margin: 0; }
.portal-status { color: var(--muted); }
.portal-status:empty { display: none; }
.portal-status[data-error="true"] { color: var(--error); }
.portal-dashboard { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(22px, 5vw, 68px); align-items: start; padding-block: 34px 60px; }
.portal-dashboard > .portal-status { grid-column: 1 / -1; margin: 0; }
.portal-sidebar { border-right: 1px solid var(--line); padding: 4px 16px 16px 0; }
.portal-sidebar p { margin: 0 0 5px; overflow-wrap: anywhere; }
.portal-tabs { display: flex; flex-direction: column; gap: 3px; margin: 16px 0; }
.portal-tabs button { justify-content: start; text-align: left; }
.portal-profile { display: grid; gap: 2px; overflow-wrap: anywhere; }
.portal-profile span { color: var(--muted); font-size: .9rem; }
.portal-main { min-width: 0; }
.portal-main > header { margin-bottom: 20px; }
.portal-main > header p { margin-bottom: 0; }
.portal-main > section { border-top: 1px solid var(--line); padding-top: 20px; }
.portal-list { margin: 0 0 18px; padding: 0; list-style: none; }
.portal-list > li { border-bottom: 1px solid var(--line); padding-block: 13px; overflow-wrap: anywhere; }
.portal-list :is(h3, p) { margin: 0; }
.portal-list h3 + p { margin-top: 4px; }
.portal-preserve { white-space: pre-wrap; overflow-wrap: anywhere; }
.portal-entry-form { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 20px; }
.portal-entry-form + div { margin-block: 22px; }
#library-content > .portal-primary { margin-bottom: 22px; }
.portal-empty { color: var(--muted); }
.portal-account-line { font-weight: 700; }
.portal-status-block { margin-bottom: 20px; }
.portal-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  .portal-auth, .portal-dashboard { grid-template-columns: 1fr; }
  .portal-shell { width: calc(100% - 32px); }
  .portal-auth { gap: 22px; }
  .portal-sidebar { border: 0; border-bottom: 1px solid var(--line); padding-inline: 0; }
  .portal-tabs { flex-direction: row; flex-wrap: wrap; margin: 12px 0; }
  .portal-header, .portal-footer { padding-inline: 16px; }
}
