/* Dental Age research workspace
   Warm ivory canvas, clay accent, serif display type, hairline structure.
   Every colour is a token so light and dark themes stay in step. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #faf9f5;
  --bg-sunken: #f4f2ec;
  --sidebar: #f5f4ee;
  --surface: #ffffff;
  --surface-hover: #f7f5f0;
  --text: #1f1e1c;
  --text-body: #3d3b36;
  --muted: #75716a;
  --faint: #9c978e;
  --border: #e6e2d8;
  --border-strong: #d6d1c5;
  --hover: #eeebe3;
  --selected: #e9e5dc;
  --accent: #c15f3c;
  --accent-strong: #ad5130;
  --accent-hover: #974529;
  --accent-soft: #f6e8e0;
  --accent-ring: rgba(193, 95, 60, .22);
  --ink: #1f1e1c;
  --ink-hover: #000000;
  --on-ink: #faf9f5;
  --success: #3b7353;
  --success-soft: #e6f1ea;
  --warning: #9a6415;
  --warning-soft: #f8eedc;
  --danger: #b0402f;
  --danger-soft: #faeae6;
  --viewer: #141413;
  --shadow-sm: 0 1px 2px rgba(40, 32, 20, .04);
  --shadow-md: 0 4px 22px rgba(40, 32, 20, .06), 0 1px 2px rgba(40, 32, 20, .04);
  --shadow-lg: 0 24px 70px rgba(30, 22, 12, .18);
  --scrim: rgba(28, 24, 20, .42);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --font-sans: 'DM Sans', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Source Serif 4', 'Tiempos Text', Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Legacy names still referenced by inline scripts */
  --text-color: var(--text);
  --muted-color: var(--muted);
  --border-color: var(--border);
  --accent-color: var(--accent);
  --primary-color: var(--accent-strong);
  --success-color: var(--success);
  --error-color: var(--danger);
  --bg-color: var(--bg);
  --bg-color-alt: var(--bg-sunken);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #262624;
    --bg-sunken: #212120;
    --sidebar: #1f1e1d;
    --surface: #30302e;
    --surface-hover: #363633;
    --text: #f4f2ec;
    --text-body: #d9d6ce;
    --muted: #a6a29a;
    --faint: #85817a;
    --border: #3d3c38;
    --border-strong: #4c4a45;
    --hover: #2e2e2b;
    --selected: #353531;
    --accent: #d97757;
    --accent-strong: #c4633f;
    --accent-hover: #d6714c;
    --accent-soft: #3d2d26;
    --accent-ring: rgba(217, 119, 87, .3);
    --ink: #f4f2ec;
    --ink-hover: #ffffff;
    --on-ink: #1f1e1c;
    --success: #7fbf97;
    --success-soft: #25342b;
    --warning: #dcaa5c;
    --warning-soft: #3a3121;
    --danger: #e8836f;
    --danger-soft: #3d2622;
    --shadow-sm: none;
    --shadow-md: 0 4px 22px rgba(0, 0, 0, .25);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, .5);
    --scrim: rgba(0, 0, 0, .55);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-body);
  font: 14px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
img { max-width: 100%; }
::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3 { color: var(--text); font-family: var(--font-serif); font-weight: 400; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 3vw, 40px); line-height: 1.15; letter-spacing: -.025em; }
h2 { margin-bottom: 14px; font-size: clamp(21px, 1.9vw, 26px); line-height: 1.25; letter-spacing: -.018em; }
h3 { margin-bottom: 10px; font-size: 19px; line-height: 1.3; letter-spacing: -.01em; }
h4 { margin-bottom: 8px; color: var(--text); font-size: 14px; font-weight: 600; }
p { color: var(--muted); }
.mono, code { font-family: var(--font-mono); font-size: .92em; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 10000; padding: 9px 14px; border-radius: var(--radius-sm); background: var(--ink); color: var(--on-ink); font-weight: 600; }
.skip-link:focus { top: 12px; }

/* ---------- Layout ---------- */
.container { width: min(100%, 1180px); margin-inline: auto; padding-inline: 40px; }
.workspace-page .container { width: min(100%, 1200px); }
#main-content { min-height: calc(100vh - 80px); padding-block: 48px 96px; }
.workspace-page #main-content { min-height: 100vh; }

.app-shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.workspace-content { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }

/* Sidebar: quiet rail, thin line icons, collapsible to an icon strip */
.sidebar {
  position: sticky; top: 0; z-index: 50;
  display: flex; flex-direction: column;
  height: 100vh; padding: 12px 10px 12px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 48px; margin-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; width: fit-content; padding: 4px 6px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-crest { display: block; flex: none; width: 24px; height: 37px; object-fit: contain; mix-blend-mode: multiply; }
.brand-name { font: 400 21px/1.05 var(--font-serif); letter-spacing: -.03em; white-space: nowrap; }
.brand-name small { display: block; margin-top: 3px; color: var(--muted); font: 500 11px/1.2 var(--font-sans); letter-spacing: .01em; }
.public-nav .brand-name small { display: none; }

.sidebar-toggle, .new-action-icon {
  display: grid; place-items: center; flex: none;
}
.sidebar-toggle {
  width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted);
  transition: background .15s, color .15s;
}
.sidebar-toggle:hover { background: var(--hover); color: var(--text); }
.sidebar-toggle svg { width: 20px; height: 20px; }

.new-action {
  display: flex; align-items: center; gap: 10px;
  margin: 2px 0 14px; padding: 6px 8px; border-radius: 10px;
  color: var(--accent); font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background .15s;
}
.new-action-icon {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  transition: transform .2s var(--ease), background .15s;
}
.new-action-icon svg { width: 16px; height: 16px; stroke-width: 2; }
.new-action:hover { background: var(--hover); color: var(--accent); }
.new-action:hover .new-action-icon { transform: rotate(90deg) scale(1.05); background: var(--accent-strong); }

.nav-links { display: flex; flex-direction: column; gap: 1px; }
.nav-links a, .account-link {
  display: flex; align-items: center; gap: 12px;
  height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
  color: var(--text-body); font-size: 14px; font-weight: 450; white-space: nowrap;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-links a svg, .account-link svg { flex: none; width: 20px; height: 20px; color: var(--muted); transition: color .15s var(--ease); }
.nav-links a:hover, .account-link:hover { background: var(--hover); color: var(--text); }
.nav-links a:hover svg, .account-link:hover svg { color: var(--text); }
.nav-links a[aria-current='page'] { background: var(--selected); color: var(--text); font-weight: 550; }
.nav-links a[aria-current='page'] svg { color: var(--text); }
.account-link { color: var(--muted); font-size: 13.5px; }

.sidebar-bottom { display: flex; flex-direction: column; gap: 1px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); }
.account-card { display: flex; align-items: center; gap: 10px; min-width: 0; margin-top: 6px; padding: 8px; border-radius: 10px; }
.account-avatar {
  display: grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--ink); color: var(--on-ink);
  font: 500 14px/1 var(--font-serif); text-transform: uppercase;
}
.account-name { overflow: hidden; min-width: 0; color: var(--text); font-size: 13.5px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.account-name small { display: block; margin-top: 1px; color: var(--muted); font-size: 11.5px; font-weight: 400; }

/* Collapsed rail (desktop only) */
@media (min-width: 761px) {
  .app-shell { transition: grid-template-columns .22s var(--ease); }
  .sb-collapsed .app-shell { grid-template-columns: 60px minmax(0, 1fr); }
  .sb-collapsed .sidebar { padding-inline: 8px; }
  .sb-collapsed .sidebar-top { flex-direction: column; justify-content: flex-start; gap: 8px; min-height: 0; }
  .sb-collapsed .brand { padding: 4px 0; }
  .sb-collapsed .brand-name,
  .sb-collapsed .nav-label,
  .sb-collapsed .account-name { display: none; }
  .sb-collapsed .new-action,
  .sb-collapsed .nav-links a,
  .sb-collapsed .account-link,
  .sb-collapsed .account-card { justify-content: center; padding-inline: 0; }
  .sb-collapsed .new-action { margin-inline: 0; }
}

.mobile-header { display: none; }
.nav-scrim { display: none; }

/* Public header + footer */
.public-header { background: var(--bg); }
.public-nav { display: flex; align-items: center; justify-content: space-between; height: 80px; }
.public-nav .brand { padding-left: 0; gap: 12px; }
.public-nav .brand-crest { width: 30px; height: 46px; }
.public-nav .brand-name { font-size: 26px; }
.public-signin { padding: 8px 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); font-size: 13px; font-weight: 600; transition: background .15s, border-color .15s; }
.public-signin:hover { background: var(--surface); border-color: var(--faint); }

footer { margin-top: auto; border-top: 1px solid var(--border); color: var(--faint); font-size: 12px; }
footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 24px; padding-block: 22px; }
.workspace-page footer { display: none; }

/* ---------- Page scaffolding ---------- */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 20px;
  margin-bottom: 36px;
}
.page-header h1 { margin: 0 0 6px; }
.page-header p { margin: 0; color: var(--muted); font-size: 14.5px; }
.page-header form { display: flex; align-items: center; gap: 8px; }
.page-header input[type='search'], .page-header input[type='text'] { width: min(260px, 55vw); }
.brand-eyebrow { margin-bottom: 10px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.brand-eyebrow .sep { margin: 0 6px; color: var(--faint); }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.section-heading h2 { margin-bottom: 4px; }
.section-heading p { margin: 0; font-size: 13.5px; }
.section { margin-top: 72px; }

.card {
  margin-bottom: 20px; padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card p { margin-bottom: 0; }
.card > h3:first-child { margin-bottom: 16px; }

.search-bar { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-bottom: 24px; }
.search-bar .search-bar { margin: 0; }
.search-bar input { max-width: 280px; }

.page-footer-actions { display: flex; justify-content: center; gap: 10px; margin-top: 56px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 8px 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; line-height: 1.3; text-align: center; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .1s var(--ease);
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { background: var(--surface-hover); border-color: var(--faint); color: var(--text); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; box-shadow: none; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-ink { background: var(--ink); border-color: var(--ink); color: var(--on-ink); box-shadow: none; }
.btn-ink:hover { background: var(--ink-hover); border-color: var(--ink-hover); color: var(--on-ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: none; }
.btn-danger:hover { filter: brightness(.92); background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--hover); border-color: transparent; }
.btn-sm { min-height: 32px; padding: 5px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled, .btn[disabled] { opacity: .45; transform: none; pointer-events: none; }
.danger-outline { color: var(--danger); }
.danger-outline:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

/* Inline text actions used in tables */
.link-action {
  padding: 0; border: 0; background: none;
  color: var(--text-body); font-size: inherit; font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px;
  transition: color .15s, text-decoration-color .15s;
}
.link-action:hover { color: var(--accent); text-decoration-color: currentColor; }
.link-action.danger { color: var(--danger); text-decoration-color: transparent; }
.link-action.danger:hover { text-decoration-color: currentColor; }
.row-actions { display: inline-flex; align-items: center; gap: 14px; white-space: nowrap; }

/* ---------- Forms ---------- */
label { display: block; margin-bottom: 7px; color: var(--text); font-size: 13px; font-weight: 600; }
.form-group { margin-bottom: 20px; }
.optional, .field-caption { margin-left: 4px; color: var(--faint); font-size: 12px; font-weight: 400; }
.field-caption { display: block; margin: 0 0 6px; }
.field-hint { margin: -2px 0 10px; font-size: 13px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

input:not([type='checkbox']):not([type='radio']):not([type='hidden']):not([type='file']), select, textarea {
  width: 100%; min-height: 42px; padding: 9px 13px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 14px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
select {
  appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%239c978e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover:not(:disabled):not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input:disabled { background: var(--bg-sunken) !important; color: var(--muted) !important; }
input[type='search']::-webkit-search-cancel-button { filter: grayscale(1); opacity: .5; }
input[type='checkbox'] { width: 16px; height: 16px; margin: 0; vertical-align: middle; accent-color: var(--accent-strong); cursor: pointer; }

/* File input rendered as a drop-zone */
input[type='file'] {
  display: block; width: 100%; padding: 22px 18px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--bg-sunken); color: var(--muted); font-size: 13px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
input[type='file']:hover { border-color: var(--accent); background: var(--accent-soft); }
input[type='file']::file-selector-button {
  margin-right: 14px; padding: 7px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: 600 12.5px var(--font-sans); cursor: pointer;
}
.file-name { margin-top: 10px; color: var(--success); font-size: 13px; font-weight: 600; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border); }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 20px; color: var(--muted); font-size: 13px; font-weight: 500; }
.back-link:hover { color: var(--text); }

.progress { height: 6px; margin-top: 8px; overflow: hidden; border-radius: 99px; background: var(--border); }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s var(--ease); }
.progress-label { margin: 16px 0 0; color: var(--text-body); font-size: 13px; }

.form-page { width: min(100%, 640px); margin: 0 auto; }
.form-page-narrow { width: min(100%, 480px); }
.form-page .page-header { display: block; }
.form-page .card { padding: 32px; }

/* ---------- Tables ---------- */
.table-wrap, [id$='-table-container'] {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
table { width: 100%; margin: 0 0 24px; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.table-wrap table, [id$='-table-container'] table { margin: 0; }
th, td { padding: 13px 18px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
th { background: var(--bg-sunken); color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-hover); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:has(.patient-checkbox:checked) { background: var(--accent-soft); }
td { color: var(--text-body); }
td a:not(.btn) { font-weight: 600; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
td a:not(.btn):hover { color: var(--accent); text-decoration-color: currentColor; }
th.check, td.check { width: 44px; padding-right: 0; text-align: center; }
.align-right, th.align-right, td.align-right { text-align: right; }
.cell-strong { color: var(--text); font-weight: 600; }
.cell-sub { display: block; color: var(--muted); font-size: 12px; }
.code-cell { color: var(--text); font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.upper { text-transform: capitalize; }
.dash { color: var(--faint); }
.opg-thumb { display: block; width: 72px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--viewer); border: 1px solid var(--border); }

/* ---------- Status, badges, pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 99px;
  background: var(--bg-sunken); color: var(--muted);
  border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-success { background: var(--success-soft); border-color: transparent; color: var(--success); }
.badge-pending { background: var(--warning-soft); border-color: transparent; color: var(--warning); }

.status-text { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.status-text::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-text.success { color: var(--success); }
.status-text.missing { color: var(--danger); }

.diff { display: inline-block; min-width: 52px; padding: 2px 8px; border-radius: 6px; font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; text-align: center; }
.diff.good { background: var(--success-soft); color: var(--success); }
.diff.warn { background: var(--warning-soft); color: var(--warning); }
.diff.bad { background: var(--danger-soft); color: var(--danger); }
.diff-pair { display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.diff-pair small { color: var(--muted); font-size: 11.5px; font-weight: 500; }
.age-value { color: var(--text); font-weight: 600; }

/* ---------- Pagination / empty ---------- */
[data-swap-region] { scroll-margin-top: 24px; transition: opacity .15s var(--ease); }
[data-swap-region][aria-busy='true'] { opacity: .5; pointer-events: none; }
@media (max-width: 760px) { [data-swap-region] { scroll-margin-top: 72px; } }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; color: var(--muted); font-size: 13px; }
.pagination .pages { display: flex; gap: 8px; }
.pagination .btn[aria-disabled='true'] { opacity: .4; pointer-events: none; }

.empty-state {
  padding: 56px 24px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: transparent; color: var(--muted); text-align: center;
}
.empty-state svg { width: 28px; height: 28px; margin-bottom: 10px; color: var(--faint); }
.empty-state strong { display: block; margin-bottom: 4px; color: var(--text); font: 400 19px var(--font-serif); }
.empty-state p { margin: 0; }

/* ---------- Flash messages ---------- */
.flash-messages { display: grid; gap: 10px; margin-bottom: 28px; }
.flash-message {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text-body); font-size: 13.5px;
  box-shadow: var(--shadow-sm);
  animation: rise .35s var(--ease) both;
}
.flash-message::before { content: ''; flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--accent); }
.flash-message.success::before { background: var(--success); }
.flash-message.error::before, .flash-message.danger::before { background: var(--danger); }
.flash-message.warning::before { background: var(--warning); }
.public-page .flash-messages { width: min(100%, 420px); margin: 8px auto -8px; }
.form-page ~ .flash-messages, .workspace-page .flash-messages { max-width: 760px; }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: var(--scrim); backdrop-filter: blur(3px);
}
.modal-content {
  width: min(100%, 440px); padding: 28px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); animation: pop .22s var(--ease) both;
}
.modal-content h3 { font-size: 22px; }
.modal-content p { margin-bottom: 0; color: var(--text-body); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }

.lightbox {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center; padding: 24px;
  background: rgba(10, 10, 9, .86); backdrop-filter: blur(4px);
}
.lightbox.is-open { display: flex; }
.lightbox-frame { position: relative; max-width: 92vw; max-height: 92vh; overflow: hidden; border-radius: var(--radius); background: var(--viewer); box-shadow: var(--shadow-lg); animation: pop .22s var(--ease) both; }
.lightbox-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px 10px 18px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.lightbox-title { color: #d8d5cd; font-family: var(--font-mono); font-size: 12.5px; }
.lightbox-close { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: var(--radius-sm); background: transparent; color: #bdb9b0; font-size: 18px; line-height: 1; }
.lightbox-close:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.lightbox img { display: block; max-width: 92vw; max-height: 82vh; object-fit: contain; }

/* ---------- Landing ---------- */
.landing-hero {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); align-items: center;
  gap: clamp(40px, 6vw, 96px); min-height: calc(100vh - 80px); padding: 24px 0 72px;
}
.landing-hero .brand-eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 26px; padding: 5px 12px 5px 10px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--text-body); font-size: 12.5px; }
.landing-hero .brand-eyebrow::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.hero-title { max-width: 640px; margin-bottom: 24px; font: 400 clamp(48px, 6vw, 80px)/1.04 var(--font-serif); letter-spacing: -.045em; }
.hero-title em { color: var(--accent); font-style: italic; }
.hero-description { max-width: 520px; margin-bottom: 32px; color: var(--muted); font-size: 18px; line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-actions .btn { min-height: 46px; padding: 10px 22px; font-size: 14px; }
.hero-note {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  min-height: 520px; padding: 40px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  box-shadow: var(--shadow-md);
}
.hero-crest { display: block; width: auto; height: min(38vw, 380px); max-width: 100%; object-fit: contain; mix-blend-mode: multiply; }
.crest-caption { margin: 0; color: var(--muted); font-size: 12.5px; text-align: center; }

.feature-section { padding: 64px 0 96px; border-top: 1px solid var(--border); }
.feature-intro { max-width: 580px; margin-bottom: 32px; }
.feature-intro h2 { font-size: clamp(26px, 2.6vw, 34px); }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feature-grid .card { min-height: 210px; margin: 0; transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.feature-grid .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.feature-number { display: block; margin-bottom: 34px; color: var(--accent); font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.feature-grid h3 { font-size: 22px; }
.feature-grid p { font-size: 14px; line-height: 1.6; }

/* ---------- Login ---------- */
.login-container { width: min(100%, 420px); margin: clamp(32px, 9vh, 96px) auto 80px; }
.login-heading { margin-bottom: 28px; text-align: center; }
.login-heading .login-crest { display: block; width: 34px; height: 52px; margin: 0 auto 18px; object-fit: contain; mix-blend-mode: multiply; }
.login-heading h1 { font-size: 38px; }
.login-heading p { margin: 0; }
.login-container .card { padding: 30px; box-shadow: var(--shadow-md); }
.login-container .btn-primary { width: 100%; min-height: 44px; margin-top: 4px; font-size: 14px; }
.login-container .back-link { display: flex; justify-content: center; }

/* ---------- Dashboard (composer-style home) ---------- */
.dashboard-home { width: min(100%, 680px); margin: min(14vh, 130px) auto 80px; text-align: center; }
.dashboard-kicker { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; color: var(--accent); font: 400 15px/1.2 var(--font-serif); }
.dashboard-kicker svg { width: 18px; height: 18px; }
.dashboard-home h1 { margin: 0; font-size: clamp(34px, 4vw, 46px); letter-spacing: -.035em; }
.dashboard-subtitle { margin: 12px 0 32px; color: var(--muted); font-size: 15.5px; }
.workspace-prompt {
  overflow: hidden; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  box-shadow: var(--shadow-md);
  transition: border-color .2s, box-shadow .2s;
}
.workspace-prompt:focus-within, .workspace-prompt:hover { border-color: var(--border-strong); }
.prompt-title { margin: 0; padding: 18px 22px 6px; color: var(--faint); font-size: 13.5px; }
.prompt-links { padding: 4px 10px 12px; }
.prompt-links a { display: flex; align-items: center; gap: 14px; padding: 11px 12px; border-radius: 12px; transition: background .15s; }
.prompt-links a:hover { background: var(--surface-hover); }
.prompt-links .prompt-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--bg-sunken); color: var(--muted); transition: background .15s, color .15s; }
.prompt-links .prompt-icon svg { width: 18px; height: 18px; }
.prompt-links a:hover .prompt-icon { background: var(--accent-soft); color: var(--accent); }
.prompt-links .prompt-text { flex: 1; min-width: 0; }
.prompt-links span.prompt-label { display: block; color: var(--text); font-size: 14.5px; font-weight: 600; }
.prompt-links small { display: block; margin-top: 1px; color: var(--muted); font-size: 12.5px; }
.prompt-links .prompt-arrow { width: 16px; height: 16px; flex: none; color: var(--faint); opacity: 0; transform: translateX(-4px); transition: opacity .15s, transform .15s; }
.prompt-links a:hover .prompt-arrow { opacity: 1; transform: none; }
.prompt-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px 12px 22px; border-top: 1px solid var(--border); color: var(--faint); font-size: 12.5px; }
.prompt-footer .btn { min-height: 34px; padding: 6px 14px; }
.dashboard-metrics { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.dashboard-metrics span { padding: 5px 13px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--muted); font-size: 12.5px; }
.dashboard-metrics strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.dashboard-secondary { margin-top: 48px; }

/* ---------- Patients ---------- */
.patients-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 20px; margin-bottom: 64px; }
.patients-grid > div { padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.patients-grid h2 { margin-bottom: 4px; font-size: 22px; }
.patients-grid > div > p { margin-bottom: 22px; font-size: 13.5px; }
.patients-grid .card { margin: 0; padding: 0; border: 0; box-shadow: none; background: transparent; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }

.select-banner { display: none; margin-bottom: 14px; padding: 10px 16px; border-radius: var(--radius); background: var(--accent-soft); color: var(--text-body); font-size: 13.5px; text-align: center; }
.select-banner button { margin-left: 6px; padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Assessment (perform estimation) ---------- */
.assessment-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px;
  height: min(78vh, 760px); min-height: 480px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.assessment-image { position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--viewer); }
.opg-wrapper { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; overflow: hidden; cursor: grab; touch-action: none; }
.opg-wrapper img { max-width: 100%; max-height: 100%; user-select: none; -webkit-user-drag: none; transition: transform .08s linear; }
.no-image { color: #a6a29a; font-size: 14px; }
.zoom-controls {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px; padding: 4px;
  background: rgba(31, 30, 28, .82); border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px;
  backdrop-filter: blur(8px);
}
.zoom-controls button { display: grid; place-items: center; min-width: 34px; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: #eeeae2; font-size: 13px; font-weight: 600; }
.zoom-controls button:hover { background: rgba(255, 255, 255, .12); }
.zoom-controls .zoom-level { min-width: 52px; color: #a6a29a; font-family: var(--font-mono); font-size: 12px; text-align: center; }
.viewer-hint { position: absolute; top: 14px; left: 16px; color: rgba(238, 234, 226, .55); font-size: 12px; pointer-events: none; }

.assessment-panel { display: flex; flex-direction: column; padding: 24px; background: var(--surface); border-left: 1px solid var(--border); }
.assessment-panel h2 { margin: 0 0 18px; font-size: 21px; }
.meta-list { display: grid; gap: 0; margin: 0 0 24px; border: 1px solid var(--border); border-radius: var(--radius); }
.meta-list div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.meta-list div:last-child { border-bottom: 0; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; color: var(--text); font-weight: 600; text-transform: capitalize; }
.meta-list dd.mono { text-transform: none; }
.assessment-form { margin-top: auto; }
.age-input-wrap { position: relative; }
.age-input-wrap input.age-input { min-height: 64px !important; padding-right: 64px !important; font: 400 30px/1 var(--font-serif) !important; letter-spacing: -.02em; }
.age-input-wrap .unit { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 13px; pointer-events: none; }
.assessment-form .btn-primary { width: 100%; min-height: 46px; font-size: 14px; }
.assessment-panel .back-link { justify-content: center; margin-top: 14px; }

/* ---------- Analysis ---------- */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 18px; margin-bottom: 56px; }
.chart-grid .card { margin: 0; }
.chart-grid img { display: block; width: 100%; height: auto; border-radius: var(--radius-sm); background: #fff; }
.chart-img { aspect-ratio: 5 / 3; object-fit: contain; background: linear-gradient(90deg, var(--bg-sunken), var(--surface-hover), var(--bg-sunken)) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
.chart-img:is([data-loaded]) { animation: none; background: #fff; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
#main-content > * { animation: rise .4s var(--ease) both; }
#main-content > *:nth-child(2) { animation-delay: .04s; }
#main-content > *:nth-child(3) { animation-delay: .08s; }

/* ---------- Dark-mode image handling ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .brand-crest,
  :root:not([data-theme='light']) .mobile-crest,
  :root:not([data-theme='light']) .login-crest { mix-blend-mode: normal; padding: 3px; border-radius: 6px; background: #faf9f5; }
  :root:not([data-theme='light']) .hero-crest { mix-blend-mode: normal; padding: 18px; border-radius: 16px; background: #faf9f5; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 224px minmax(0, 1fr); }
  .container { padding-inline: 28px; }
  .patients-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .assessment-layout { grid-template-columns: 1fr; height: auto; }
  .assessment-image { min-height: 52vh; }
  .assessment-panel { border-top: 1px solid var(--border); border-left: 0; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed; top: 56px; left: 0; width: min(284px, 85vw); height: calc(100vh - 56px);
    visibility: hidden; transform: translateX(-101%);
    transition: transform .22s var(--ease), visibility .22s;
    box-shadow: var(--shadow-lg);
  }
  .nav-open .sidebar { visibility: visible; transform: none; }
  .nav-open .nav-scrim { position: fixed; inset: 56px 0 0; z-index: 49; display: block; width: 100%; border: 0; background: var(--scrim); }
  .mobile-header {
    position: sticky; top: 0; z-index: 51;
    display: flex; align-items: center; justify-content: space-between;
    height: 56px; padding: 0 16px;
    background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
  }
  .mobile-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font: 400 20px var(--font-serif); letter-spacing: -.02em; }
  .mobile-crest { display: block; width: 20px; height: 31px; object-fit: contain; mix-blend-mode: multiply; }
  .menu-toggle { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
  .menu-toggle svg { width: 20px; height: 20px; }
  .sidebar-toggle { display: none; }
  .container { padding-inline: 16px; }
  #main-content { padding-block: 28px 72px; }
  .page-header { align-items: flex-start; }
  .page-header form { width: 100%; }
  .page-header input[type='search'], .page-header input[type='text'] { width: 100%; }
  .search-bar { justify-content: stretch; }
  .search-bar input { max-width: none; }
  .landing-hero { display: block; min-height: 0; padding: 40px 0 64px; }
  .hero-note { min-height: 360px; margin-top: 44px; padding: 28px; }
  .hero-crest { height: min(70vw, 300px); }
  .feature-grid { grid-template-columns: 1fr; }
  .dashboard-home { margin: 48px auto 56px; }
  .prompt-footer { flex-direction: column; align-items: stretch; padding: 14px; }
  .prompt-footer .btn { width: 100%; }
  .form-page .card, .card, .patients-grid > div { padding: 22px; }
  .pagination { flex-direction: column-reverse; }
  footer .container { flex-direction: column; }
}
@media (max-width: 520px) {
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions > * { width: 100%; }
  th, td { padding: 11px 13px; }
  .assessment-image { min-height: 340px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-delay: 0s !important; }
}

/* ---------- Landing (editorial: big type, line art on muted tiles, ink statement) ---------- */
.lp {
  --lp-ink: #141413;
  --lp-ivory: #faf9f5;
  --lp-clay: #d97757;
  --lp-oat: #e3dacc;
  --lp-cactus: #bcd1ca;
  --lp-heather: #cbcadb;
  display: block; padding: 0;
}
.lp-wrap { width: min(100%, 1280px); margin-inline: auto; padding-inline: clamp(20px, 4vw, 56px); }
.tile-oat { background: var(--lp-oat); }
.tile-clay { background: var(--lp-clay); }
.tile-cactus { background: var(--lp-cactus); }
.tile-heather { background: var(--lp-heather); }

.lp-header { position: sticky; top: 0; z-index: 60; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); }
.lp-nav { display: flex; align-items: center; gap: 32px; height: 76px; }
.lp-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
.lp-brand img { width: 24px; height: 37px; object-fit: contain; mix-blend-mode: multiply; }
.lp-links { display: flex; gap: 28px; margin-left: auto; }
.lp-links a { color: var(--text-body); font-size: 14.5px; font-weight: 500; transition: color .15s; }
.lp-links a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }

.lp-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 99px;
  background: var(--ink); color: var(--on-ink);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background .15s, transform .15s var(--ease);
}
.lp-pill svg { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.lp-pill:hover { background: var(--ink-hover); color: var(--on-ink); }
.lp-pill:hover svg { transform: translateX(3px); }
.lp-pill-lg { padding: 14px 24px; font-size: 15px; }
.lp-textlink { color: var(--text); font-size: 15px; font-weight: 600; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 5px; }
.lp-textlink:hover { text-decoration-color: currentColor; }

.lp-hero { padding-top: clamp(56px, 11vh, 128px); padding-bottom: 56px; }
.lp-hero h1 {
  max-width: 1100px; margin: 0 0 48px;
  font: 500 clamp(48px, 8.2vw, 116px)/.98 var(--font-sans); letter-spacing: -.055em;
  color: var(--text); text-wrap: balance;
}
.lp-hero-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 40px; padding-top: 28px; border-top: 1px solid var(--border-strong); }
.lp-hero-row p { max-width: 620px; margin: 0; color: var(--text-body); font: 400 clamp(18px, 1.7vw, 22px)/1.5 var(--font-serif); }
.lp-actions { display: flex; align-items: center; gap: 24px; }

.lp-visual { overflow: hidden; border-radius: 28px; }
.lp-illustration { display: block; width: 100%; height: auto; padding: clamp(8px, 3vw, 40px) clamp(0px, 2vw, 32px); }

.lp-section { padding-top: clamp(96px, 14vh, 160px); }
.lp-section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 40px; margin-bottom: 48px; }
.lp-kicker { margin: 6px 0 0; color: var(--muted); font-size: 14px; font-weight: 500; }
.lp-section-head h2, .lp-cta h2 {
  max-width: 760px; margin: 0;
  font: 500 clamp(32px, 4vw, 56px)/1.05 var(--font-sans); letter-spacing: -.045em; color: var(--text); text-wrap: balance;
}

.lp-steps { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border-strong); }
.lp-steps li {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr) minmax(0, 1.1fr); align-items: baseline; gap: 40px;
  padding: 30px 0; border-bottom: 1px solid var(--border-strong);
  transition: padding-left .25s var(--ease);
}
.lp-steps li:hover { padding-left: 12px; }
.lp-step-num { color: var(--muted); font-family: var(--font-mono); font-size: 14px; }
.lp-steps h3 { margin: 0; font: 500 clamp(26px, 2.6vw, 36px)/1.1 var(--font-sans); letter-spacing: -.035em; }
.lp-steps p { margin: 0; color: var(--text-body); font: 400 17px/1.55 var(--font-serif); }

.lp-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.lp-card-art { display: grid; place-items: center; aspect-ratio: 4 / 3; margin-bottom: 22px; border-radius: 20px; transition: transform .3s var(--ease); }
.lp-card-art svg { width: 62%; height: auto; }
.lp-card:hover .lp-card-art { transform: translateY(-4px); }
.lp-card h3 { margin-bottom: 8px; font: 500 24px/1.2 var(--font-sans); letter-spacing: -.03em; }
.lp-card p { margin: 0; color: var(--text-body); font: 400 16px/1.55 var(--font-serif); }

.lp-statement { margin-top: clamp(96px, 14vh, 160px); padding: clamp(80px, 12vh, 140px) 0; background: var(--lp-ink); color: var(--lp-ivory); }
.lp-statement .lp-kicker { color: #a6a29a; }
.lp-statement blockquote { max-width: 1080px; margin: 28px 0 56px; font: 400 clamp(30px, 4.2vw, 58px)/1.14 var(--font-serif); letter-spacing: -.025em; text-wrap: balance; }
.lp-statement-foot { display: flex; align-items: center; gap: 14px; color: #c9c5bb; font-size: 14px; }
.lp-statement-foot img { width: 30px; height: 46px; padding: 3px; border-radius: 6px; background: var(--lp-ivory); object-fit: contain; }

.lp-cta { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 32px; padding-block: clamp(96px, 14vh, 160px); }

.lp-footer { border-top: 1px solid var(--border-strong); color: var(--muted); font-size: 14px; }
.lp-footer-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 40px; padding-block: 56px 48px; }
.lp-footer-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.lp-footer-brand img { width: 40px; height: 62px; margin-bottom: 14px; object-fit: contain; mix-blend-mode: multiply; }
.lp-footer-brand strong { color: var(--text); font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.lp-footer h4 { margin-bottom: 14px; color: var(--text); font-size: 14px; }
.lp-footer nav a { display: block; margin-bottom: 8px; transition: color .15s; }
.lp-footer nav a:hover { color: var(--text); }
.lp-footer p { margin: 0; line-height: 1.6; }
.lp-footer-base { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-block: 20px 28px; border-top: 1px solid var(--border); font-size: 13px; }

.lp > * { animation: none; }
.lp-hero h1, .lp-hero-row, .lp-visual { animation: rise .6s var(--ease) both; }
.lp-hero-row { animation-delay: .08s; }
.lp-visual { animation-delay: .16s; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .lp-brand img,
  :root:not([data-theme='light']) .lp-footer-brand img { mix-blend-mode: normal; padding: 3px; border-radius: 6px; background: #faf9f5; }
  :root:not([data-theme='light']) .lp-statement { background: #141413; }
}
@media (max-width: 900px) {
  .lp-links { display: none; }
  .lp-nav { justify-content: space-between; }
  .lp-hero-row { grid-template-columns: 1fr; }
  .lp-section-head { grid-template-columns: 1fr; gap: 12px; }
  .lp-steps li { grid-template-columns: auto 1fr; gap: 8px 20px; }
  .lp-steps li p { grid-column: 2; }
  .lp-cards { grid-template-columns: 1fr; }
  .lp-footer-grid { grid-template-columns: 1fr 1fr; }
  .lp-footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .lp-brand span { font-size: 14px; }
  .lp-nav > .lp-pill { padding: 8px 14px; font-size: 13px; }
  .lp-actions { flex-direction: column; align-items: flex-start; gap: 18px; }
  .lp-visual { border-radius: 18px; }
}

/* ---------- Workspace typography: one sans family throughout ----------
   Signed-in pages use a single UI font (like Claude's app). Headings, the
   brand, blind codes and numbers all resolve to the sans stack; tabular
   numerals keep codes and ages aligned without a monospace face. */
.workspace-page {
  --font-serif: var(--font-sans);
  --font-mono: var(--font-sans);
  font-feature-settings: 'tnum' 1;
}
.workspace-page h1, .workspace-page h2, .workspace-page h3 { font-weight: 600; }
.workspace-page h1 { font-size: clamp(26px, 2.4vw, 32px); line-height: 1.2; letter-spacing: -.025em; }
.workspace-page h2 { font-size: clamp(19px, 1.6vw, 22px); letter-spacing: -.02em; }
.workspace-page h3 { font-size: 17px; letter-spacing: -.012em; }
.workspace-page .page-header p { font-size: 14px; }
.workspace-page .brand-name { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.workspace-page .mobile-brand { font-size: 16px; font-weight: 600; }
.workspace-page .dashboard-home h1 { font-size: clamp(28px, 3.2vw, 38px); font-weight: 600; letter-spacing: -.03em; }
.workspace-page .dashboard-kicker { font-size: 14px; font-weight: 500; }
.workspace-page .account-avatar { font-size: 13px; font-weight: 600; }
.workspace-page .empty-state strong { font-size: 16px; font-weight: 600; }
.workspace-page .modal-content h3 { font-size: 19px; }
.workspace-page .assessment-panel h2 { font-size: 18px; }
.workspace-page .age-input-wrap input.age-input { font-weight: 600 !important; font-size: 28px !important; letter-spacing: -.02em; }
.workspace-page .mono, .workspace-page code { font-size: 1em; letter-spacing: 0; }
.workspace-page .code-cell { font-size: 13.5px; letter-spacing: .01em; }
.workspace-page .diff { font-size: 12.5px; }
