:root {
  color-scheme: light;
  --ink: #20211f;
  --ink-soft: #333632;
  --paper: #fffdf9;
  --cream: #f4f0e9;
  --muted: #73766f;
  --line: #e4ded5;
  --gold: #b88f5c;
  --blush: #f2deda;
  --sage: #dfe8e1;
  --green: #3c574a;
  font-family: "DM Sans", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--cream);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; background: var(--cream); }
button, input, select, textarea { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #b88f5c; outline-offset: 3px; }
[hidden] { display: none !important; }

.portal-header { height: 76px; display: flex; justify-content: space-between; align-items: center; padding: 0 max(24px, calc((100vw - 1360px) / 2)); color: white; background: var(--ink); }
.portal-brand { display: flex; align-items: center; gap: 12px; color: white; text-decoration: none; font-size: 13px; font-weight: 700; letter-spacing: .12em; }
.portal-brand img { width: 42px; height: 36px; object-fit: cover; border-radius: 50%; }
.portal-brand small { display: block; margin-top: 4px; color: #d9c5aa; font-size: 9px; letter-spacing: .17em; }
.back-link { color: var(--blush); font-size: 13px; text-decoration: none; }
.portal-main { width: min(1360px, 100%); margin: 26px auto 0; padding: 0 24px 54px; }
.private-banner { margin-bottom: 18px; padding: 11px 16px; border: 1px solid #e4d8c8; background: #eee5d8; color: #5d4932; font-size: 12px; }

.login-panel { max-width: 540px; margin: 5vh auto; padding: clamp(26px, 6vw, 52px); border: 1px solid var(--line); background: var(--paper); box-shadow: 0 18px 55px #29251c0d; }
.eyebrow { margin: 0; color: var(--gold); font-size: 10px; font-weight: 700; letter-spacing: .19em; text-transform: uppercase; }
.login-panel h1, .workspace-heading h1 { margin: 9px 0 14px; font: 600 clamp(34px, 5vw, 52px)/1.08 Georgia, "Times New Roman", serif; }
.login-panel > p:not(.eyebrow) { color: var(--muted); font-size: 14px; line-height: 1.7; }
.stack-form { display: grid; gap: 16px; margin-top: 24px; }
.stack-form label, .field label { display: grid; gap: 7px; font-size: 12px; font-weight: 600; }
.stack-form input, .stack-form select, .stack-form textarea, .field input, .field select, .field textarea, .field-grid > label > input, .field-grid > label > select, .field-grid > label > textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #d6d0c7; border-radius: 2px; background: white; color: var(--ink);
}
.stack-form input:focus, .stack-form select:focus, .stack-form textarea:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.button { min-height: 42px; display: inline-flex; justify-content: center; align-items: center; padding: 10px 17px; border: 1px solid transparent; border-radius: 2px; font-size: 12px; font-weight: 700; letter-spacing: .035em; text-decoration: none; cursor: pointer; }
.button.primary { background: var(--ink); color: white; }
.button.outline { border-color: #c9c0b4; background: transparent; color: var(--ink); }
.button.soft { background: var(--blush); color: #382e2b; }
.button.sage { background: var(--sage); color: #26372e; }
.button:hover { filter: brightness(.96); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.invite-form { padding-top: 22px; border-top: 1px solid var(--line); }
.invite-form h2 { margin: 0; font: 500 24px Georgia, "Times New Roman", serif; }
.notice { min-height: 22px; color: #914d3f; font-size: 13px; }

.workspace-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 24px 28px; border: 1px solid #292a27; background: var(--ink); color: white; }
.workspace-heading .eyebrow { color: #d5b785; }
.workspace-heading h1 { margin-bottom: 6px; font-size: clamp(28px, 4vw, 40px); }
.workspace-account { margin: 0; color: #d2d2cc; font-size: 12px; }
.workspace-actions { display: flex; align-items: center; gap: 10px; }
.header-action, .header-menu > summary { min-height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid #5b5c57; background: #292a27; color: white; font-size: 11px; text-decoration: none; cursor: pointer; list-style: none; }
.header-menu > summary::-webkit-details-marker { display: none; }
.header-menu { position: relative; }
.menu-popover { position: absolute; z-index: 10; top: calc(100% + 8px); right: 0; width: min(310px, calc(100vw - 40px)); padding: 16px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); box-shadow: 0 15px 35px #0002; font-size: 12px; }
.menu-popover p { margin: 0; color: var(--muted); line-height: 1.6; }
.menu-popover strong, .profile-popover span { display: block; overflow-wrap: anywhere; }
.profile-popover span { margin: 6px 0 14px; color: var(--muted); }
.profile-popover .button { width: 100%; }
.notification-count { min-width: 18px; padding: 2px 5px; border-radius: 20px; background: var(--blush); color: var(--ink); text-align: center; font-size: 10px; }
.profile-dot { color: #d5b785; font-size: 15px; }
.management-mode-banner { margin-top: 14px; padding: 12px 16px; border: 1px solid #d8c49e; background: #f4ead7; color: #5b4731; font-size: 12px; font-weight: 700; }
.dashboard-switcher { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 14px 16px; border: 1px solid var(--line); background: var(--paper); }
.dashboard-switcher label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.dashboard-switcher select { min-width: 210px; min-height: 40px; padding: 8px 10px; border: 1px solid #d6d0c7; background: white; color: var(--ink); font-size: 12px; }
.dashboard-switcher .switcher-hint { flex: 1 1 100%; margin: 0; color: var(--muted); font-size: 11px; }

.dashboard-layout { display: grid; grid-template-columns: 228px minmax(0, 1fr); gap: 22px; margin-top: 18px; align-items: start; }
.workspace-nav { position: sticky; top: 16px; display: grid; gap: 3px; padding: 14px 10px; background: var(--ink-soft); }
.workspace-nav button { width: 100%; min-height: 42px; padding: 10px 13px; border: 0; border-left: 2px solid transparent; background: transparent; color: #e8e5dd; text-align: left; font-size: 12px; cursor: pointer; }
.workspace-nav button:hover { background: #41433f; }
.workspace-nav button[aria-current="page"] { border-left-color: #d4b47d; background: #484a45; color: white; font-weight: 700; }
.dashboard-body { min-width: 0; }
.breadcrumbs { display: flex; gap: 9px; align-items: center; margin: 3px 0 14px; color: var(--muted); font-size: 11px; }
.breadcrumbs strong { color: var(--green); font-weight: 700; }
.workspace-content { min-height: 260px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.card { min-width: 0; margin-bottom: 14px; padding: 19px; border: 1px solid var(--line); background: var(--paper); }
.card h2, .card h3 { margin: 0 0 13px; font: 500 21px Georgia, "Times New Roman", serif; }
.card h3 { font-size: 18px; }
.card p { color: var(--muted); font-size: 12px; line-height: 1.65; }
.metric { color: var(--green); font-size: 32px; font-weight: 700; }
.metric-label { color: var(--muted); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.record-list { display: grid; gap: 9px; }
.record { min-width: 0; padding: 14px; border: 1px solid var(--line); background: white; }
.record-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.record strong { font-size: 13px; }
.badge { display: inline-block; flex: none; padding: 5px 8px; border-radius: 2px; background: #eee8de; color: #564936; font-size: 10px; white-space: nowrap; }
.badge.success { background: var(--sage); color: #274134; }
.muted { color: var(--muted); font-size: 11px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.record details { margin-top: 10px; }
.check-row { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0; color: #444741; font-size: 12px; }
.check-row input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.empty { padding: 20px; border: 1px dashed #d7cec1; background: var(--paper); color: var(--muted); font-size: 12px; line-height: 1.6; }
.next-action { border-left: 4px solid var(--gold); background: #fffaf1; }
.progress-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.progress-step { padding: 10px 9px; border-top: 3px solid var(--line); background: var(--paper); color: var(--muted); font-size: 10px; }
.progress-step.done { border-color: var(--green); color: var(--green); }
.progress-step.current { border-color: var(--gold); color: var(--ink); font-weight: 700; }
.intake-step { margin-top: 12px; padding: 14px; border: 1px solid var(--line); background: #fff; }
.intake-step legend { padding: 0 5px; color: var(--green); font: 500 17px Georgia, "Times New Roman", serif; }
.preview-frame { width: 100%; min-height: 360px; border: 1px solid var(--line); background: white; }
.preview-frame.device-tablet, .preview-frame.device-mobile { display: block; margin: 0 auto; }
.preview-frame.device-tablet { width: 760px; max-width: 100%; }
.preview-frame.device-mobile { width: 390px; max-width: 100%; }
.preview-frame.device-desktop { width: 100%; }
.message-bubble { max-width: 850px; padding: 12px 14px; border-left: 3px solid var(--gold); background: #fbf5ed; }
.message-bubble.management { border-color: var(--green); background: #eff4ef; }
.toast { position: fixed; z-index: 20; right: 22px; bottom: 22px; max-width: min(400px, calc(100vw - 44px)); padding: 13px 18px; background: var(--ink); color: white; box-shadow: 0 8px 30px #0002; font-size: 12px; transform: translateY(120px); transition: transform .2s; }
.toast.show { transform: translateY(0); }
code { padding: 2px 5px; background: #f1ede6; font-size: .9em; }
.text-button { margin-top: 12px; padding: 8px 0; border: 0; background: transparent; color: #65533b; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 12px; }
.stack-form[hidden] { display: none; }
.stack-form p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.mfa-secret { overflow-wrap: anywhere; font-size: 18px; }

@media (max-width: 900px) {
  .dashboard-layout { grid-template-columns: 190px minmax(0, 1fr); gap: 14px; }
  .workspace-nav button { padding-left: 10px; font-size: 11px; }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .portal-header { height: 66px; padding: 0 15px; }
  .portal-brand { gap: 8px; font-size: 10px; }
  .portal-brand img { width: 34px; height: 31px; }
  .back-link { font-size: 11px; }
  .portal-main { margin-top: 15px; padding: 0 12px 36px; }
  .private-banner { margin-bottom: 12px; padding: 9px 11px; font-size: 10px; }
  .workspace-heading { align-items: flex-start; padding: 17px; }
  .workspace-heading h1 { font-size: 28px; }
  .workspace-account { max-width: 220px; }
  .workspace-actions { justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
  .header-action, .header-menu > summary { min-height: 36px; padding: 7px 9px; font-size: 10px; }
  #notificationCenter > summary span:nth-child(2) { display: none; }
  #profileName { display: none; }
  .dashboard-layout { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
  .workspace-nav { position: static; width: 100%; display: flex; overflow-x: auto; gap: 4px; padding: 8px; scrollbar-width: thin; }
  .workspace-nav button { width: auto; min-width: max-content; min-height: 38px; border-left: 0; border-bottom: 2px solid transparent; padding: 8px 11px; text-align: center; }
  .workspace-nav button[aria-current="page"] { border-bottom-color: #d4b47d; }
  .dashboard-body { width: 100%; }
  .dashboard-grid, .field-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .progress-steps { grid-template-columns: 1fr; }
  .progress-step { padding: 8px 10px; }
  .dashboard-switcher { align-items: stretch; }
  .dashboard-switcher label, .dashboard-switcher select, .dashboard-switcher .button { width: 100%; }
}
