:root {
  --ink: #1b2b34;
  --muted: #61727d;
  --brand: #163c4d;
  --brand-2: #227c78;
  --accent: #d58d35;
  --canvas: #edf2f3;
  --surface: #fff;
  --soft: #eef7f6;
  --line: #cad6da;
  --danger: #a8443d;
  --radius: 14px;
  --shadow: 0 12px 30px rgba(20, 46, 57, .09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.leader-entry-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(145deg, #e8f2f3, #f9fcfc); }
.leader-entry-card { width: min(480px, 100%); padding: clamp(28px, 6vw, 48px); border: 1px solid #c9dcdf; border-radius: 22px; background: #fff; box-shadow: 0 22px 56px rgba(20, 60, 77, .15); text-align: center; }
.leader-entry-card .wordmark { justify-content: center; margin-bottom: 25px; color: var(--brand); }
.leader-entry-card h1 { margin: 4px 0 9px; color: var(--brand); font-size: clamp(27px, 6vw, 38px); line-height: 1.12; }
.leader-entry-card > p:not(.eyebrow) { margin: 0; color: var(--muted); }
.leader-entry-actions { display: flex; justify-content: center; gap: 10px; margin-top: 25px; }
.support-content { width: min(760px, calc(100% - 36px)); min-height: calc(100vh - 190px); margin: 28px auto; }
.support-content h2 { color: var(--brand); }
.support-email { color: var(--brand-2); font-weight: 800; }
.leader-locked > :not(#leader-entry-gate):not(dialog) { display: none !important; }
.company-locked > :not(dialog) { display: none !important; }
.native-access-locked > :not(dialog) { display: none !important; }
body.native-access-locked .company-dialog { width: min(430px, calc(100% - 48px)); padding: 24px; border-radius: 20px; }
body.ios-app .ios-access-dialog { max-height: calc(100dvh - 44px); padding: 18px 20px 20px; overflow-y: auto; }
body.ios-app .ios-access-dialog .company-entry-wordmark { margin-bottom: 15px; }
body.ios-app .ios-access-dialog .wordmark-main { font-size: 25px; }
body.ios-app .ios-access-dialog .wordmark-sub { padding: 2px 6px; }
body.ios-app .ios-access-dialog h2 { font-size: clamp(25px, 7vw, 31px); line-height: 1.12; }
body.ios-app .ios-access-dialog .help { margin: 8px 0 14px; }
body.ios-app .ios-access-dialog .ios-company-code-label { margin-bottom: 10px; }
body.ios-app .ios-access-dialog .button { padding: 12px 15px; }
body.ios-app.ios-company-connected #company-connect { display: none; }
.company-logout { display: none; margin-left: auto; font-size: 12px; }
body.company-connected #company-connect { display: none; }
body.company-connected:not(.ios-app) .company-logout { display: inline-flex; }
html { overflow-x: hidden; }
body.ios-app { position: fixed; inset: 0; width: 100%; max-width: 100%; overflow-x: hidden; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
body.ios-app input,
body.ios-app textarea,
body.ios-app select { font-size: 16px; }
body.ios-app .site-header { padding: calc(18px + env(safe-area-inset-top)) 16px 18px; }
body.ios-app .header-inner { width: 100%; align-items: flex-start; flex-direction: column; gap: 8px; }
body.ios-app .header-inner h1 { font-size: 26px; line-height: 1.15; }
body.ios-app .header-inner p { font-size: 14px; }
body.ios-app .privacy-banner,
body.ios-app .mode-tabs,
body.ios-app main,
body.ios-app .site-footer { width: calc(100% - 28px); }
body.ios-app .privacy-banner { margin-top: 12px; }
body.ios-app .mode-tabs { margin-top: 14px; overflow-x: auto; flex-wrap: nowrap; }
body.ios-app .form-tabs-navigation,
body.ios-app .mode-tab { flex: 0 0 auto; }
body.ios-app .workspace,
body.ios-app .builder-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
body.ios-app .workspace > *,
body.ios-app .header-inner > * { min-width: 0; }
body.ios-app .panel { padding: 18px 16px; }
body.ios-app .narrative-panel,
body.ios-app .guidance-panel { position: static; }
body.ios-app .panel-heading { align-items: stretch; flex-direction: column; }
body.ios-app .runtime-grid,
body.ios-app .editor-grid { grid-template-columns: minmax(0, 1fr); }
body.ios-app .clinician-addon-picker { align-items: stretch; flex-direction: column; gap: 10px; padding: 12px; }
body.ios-app .clinician-addon-picker label { flex: 0 0 auto; width: 100%; }
body.ios-app .clinician-addon-picker .button { flex: 0 0 auto; width: 100%; }
body.native-access-locked .personal-use-copy { display: none; }
body.native-access-locked .personal-use-note { margin-top: 12px; text-align: center; }
.ios-personal-account { display: none; }
body.native-access-locked .ios-personal-account { display: inline-flex; }
.company-entry-wordmark { display: none; }
body.company-locked .company-dialog { width: min(480px, calc(100% - 64px)); padding: clamp(24px, 4vw, 36px); border: 1px solid #c9dcdf; border-radius: 20px; text-align: center; background: #fff; box-shadow: 0 22px 56px rgba(20, 60, 77, .15); }
body.company-locked .company-dialog .company-entry-wordmark { display: flex; justify-content: center; margin-bottom: 20px; color: var(--brand); }
body.company-locked .company-dialog .eyebrow { margin-bottom: 10px; font-size: 12px; color: var(--brand-2); }
body.company-locked .company-dialog h2 { margin: 0; color: var(--brand); font-size: clamp(28px, 5vw, 36px); line-height: 1.1; }
body.company-locked .company-dialog .help { width: min(420px, 100%); margin: 12px auto 18px; color: var(--muted); font-size: 15px; }
body.company-locked .company-dialog label { width: min(540px, 100%); margin: auto; text-align: left; }
body.company-locked .company-dialog input { padding: 14px 15px; font-size: 17px; }
body.company-locked .company-dialog .company-error { width: min(540px, 100%); margin: 8px auto; text-align: left; }
body.company-locked .company-dialog .personal-use-note { width: min(540px, 100%); margin: 14px auto 0; text-align: left; }
body.company-locked .company-dialog .action-row { justify-content: center; }
body.company-locked .company-dialog .action-row .button { flex: 0 1 260px; padding: 13px 18px; font-size: 17px; }
.ios-access-dialog { width: min(460px, calc(100% - 28px)); text-align: center; }
.ios-access-dialog .company-entry-wordmark { display: flex; justify-content: center; margin-bottom: 24px; color: var(--brand); }
.ios-access-dialog .help { margin: 10px 0 20px; }
.ios-company-code-label { text-align: left; margin-bottom: 12px; }
.personal-module-store { margin-top: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #f7faf9; }
.personal-module-store > summary { color: var(--brand); font-weight: 800; cursor: pointer; }
.personal-module-store > .help { margin: 5px 0 10px; }
.personal-module-list { display: grid; gap: 6px; }
.personal-module-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid #d9e0e2; border-radius: 8px; background: #eef1f2; color: #69747a; }
.personal-module-row.is-unlocked { border-color: #c9dcdf; background: #f1faf7; color: var(--brand); }
.personal-module-name { font-size: 13px; font-weight: 700; }
.personal-module-action { flex: 0 0 auto; min-width: 82px; padding: 6px 9px; border: 1px solid #b8c4c8; border-radius: 7px; background: #fff; color: var(--brand); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.personal-module-action:disabled { color: #748087; cursor: default; }
.ios-access-logout { display: none; margin-left: auto; font-size: 12px; }
body.ios-app:not(.native-access-locked) .ios-access-logout { display: inline-flex; }
.text-button { border: 0; background: transparent; color: var(--brand-2); font-weight: 800; }
.text-button:hover { background: #eef7f6; }

.site-header { background: var(--brand); color: #fff; padding: 26px 20px; }
.header-inner { width: min(1180px, 100%); margin: auto; display: flex; align-items: center; gap: 28px; }
.header-inner h1 { margin: 0; font-size: clamp(23px, 4vw, 34px); }
.header-inner p { margin: 4px 0 0; color: #cfe1e5; }
.wordmark { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.wordmark-main { font-size: 28px; font-weight: 900; letter-spacing: .02em; }
.wordmark-main span { color: #72c9bf; font-weight: 650; }
.wordmark-sub { padding: 2px 7px; border-radius: 5px; background: var(--accent); font-weight: 900; }
.leader-cloud-controls { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; font-size: 12px; font-weight: 700; color: #d8ebed; }
.button.light { border-color: #cfe1e5; background: #fff; color: var(--brand); }
.privacy-banner { width: min(1180px, calc(100% - 36px)); margin: 16px auto 0; color: #445861; font-size: 13px; }
.leader-preview-banner { width: min(1180px, calc(100% - 36px)); margin: 12px auto 0; padding: 10px 13px; border: 1px solid #d8b36c; border-radius: 9px; background: #fff6df; color: #664a17; font-size: 12px; }
.company-status { color: var(--brand-2); font-size: 11px; font-weight: 800; }
.company-dialog { width: min(460px, calc(100% - 28px)); padding: 22px; border: 0; border-radius: 16px; box-shadow: 0 24px 80px rgba(16, 44, 56, .28); }
.company-dialog::backdrop { background: rgba(16, 38, 48, .55); }
.company-dialog h2 { margin: 0; }
.reset-confirm-dialog { width: min(430px, calc(100% - 28px)); text-align: center; }
.reset-confirm-dialog .help { margin: 9px 0 0; }
.reset-confirm-dialog .action-row { margin-top: 22px; }
.reset-confirm-emoji { display: grid; width: 58px; height: 58px; place-items: center; margin: 0 auto 12px; border-radius: 50%; background: #e5f6f1; font-size: 34px; }
.company-error { min-height: 20px; color: var(--danger); font-size: 12px; font-weight: 750; }
.personal-use-note { display: grid; gap: 3px; margin-top: 14px; padding: 11px 12px; border: 1px solid #c9dcdf; border-radius: 10px; background: #f4faf9; color: #45606a; font-size: 12px; }
.personal-use-note strong { color: var(--brand); }
.personal-use-note a { color: var(--brand-2); font-weight: 850; text-decoration: none; }
.personal-use-note a:hover { text-decoration: underline; }
.leader-code { margin: 12px 0; padding: 13px; border: 2px dashed #72b9ac; border-radius: 11px; background: #eefbf7; color: var(--brand); font: 800 18px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; text-align: center; }
.dialog-rule { margin: 20px 0; border: 0; border-top: 1px solid var(--line); }
.mode-tabs { width: min(1180px, calc(100% - 36px)); margin: 20px auto 0; display: flex; gap: 8px; }
.mode-tab { border: 1px solid var(--line); border-radius: 10px 10px 0 0; padding: 10px 18px; background: #dce5e8; color: var(--brand); font: inherit; font-weight: 800; cursor: pointer; }
.mode-tab.active { border-color: var(--brand); background: var(--brand); color: #fff; }

main { width: min(1180px, calc(100% - 36px)); margin: 0 auto 56px; }
.site-footer { width: min(1180px, calc(100% - 36px)); margin: 0 auto 28px; color: var(--muted); font-size: 12px; text-align: center; }
.workspace, .builder-layout { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(340px, .88fr); gap: 22px; align-items: start; }
.panel { padding: clamp(18px, 3vw, 28px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 20px; }
.panel-heading h2 { margin: 0; font-size: 22px; }
.eyebrow { margin: 0 0 3px; color: var(--brand-2); font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.runtime-section + .runtime-section { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.runtime-section h3 { margin: 0 0 14px; color: var(--brand); font-size: 17px; }
.runtime-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.runtime-field.wide, .runtime-heading, .timeline-field { grid-column: 1 / -1; }

label { display: block; color: #34464f; font-size: 13px; font-weight: 750; }
input, textarea, select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid #b7c6cc;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { min-height: 82px; resize: vertical; }
input:hover, textarea:hover, select:hover { border-color: #6f9aaa; background: #fbfdfe; }
input:focus, textarea:focus, select:focus { outline: 0; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(34, 124, 120, .14); }
.invalid { border-color: var(--danger) !important; background: #fff4f3 !important; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand-2); }
.runtime-checkbox { display: flex; align-items: center; min-height: 42px; padding-top: 21px; }
.runtime-heading { margin: 4px 0 -3px; color: var(--brand); font-size: 16px; }
.time-control { display: flex; gap: 7px; margin-top: 6px; }
.time-control input { margin: 0; }

.button { border: 1px solid transparent; border-radius: 9px; padding: 10px 14px; font: inherit; font-weight: 800; cursor: pointer; transition: transform .12s, background .15s, border-color .15s; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--brand-2); color: #fff; }
.button.primary:hover { background: #176962; }
.button.secondary { border-color: #afc7cf; background: #edf5f7; color: var(--brand); }
.button.secondary:hover { background: #dcebee; }
.button.danger { background: var(--danger); color: #fff; }
.button.danger-outline { border-color: #d7aaa6; background: #fff; color: var(--danger); }
.button.small { padding: 8px 11px; font-size: 13px; }
.button.full { width: 100%; margin-top: 14px; }
.action-row, .builder-actions { display: flex; gap: 10px; margin-top: 16px; }
.action-row .button { flex: 1; }
.status { min-height: 20px; color: var(--brand-2); font-size: 12px; font-weight: 800; }
.success-toast { position: fixed; z-index: 1000; right: 20px; bottom: max(20px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; padding: 12px 17px 12px 12px; border: 2px solid #a7e0ce; border-radius: 16px; background: #e9fff6; color: #155a4c; box-shadow: 0 12px 28px rgba(18, 62, 57, .22); font-size: 14px; font-weight: 850; opacity: 0; pointer-events: none; transform: translateY(14px) scale(.96); transition: opacity .2s, transform .2s; }
.success-toast-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: #bff1dd; font-size: 23px; }
.success-toast.visible { opacity: 1; transform: translateY(0) scale(1); }
.success-toast.centered { top: 50%; right: auto; bottom: auto; left: 50%; min-width: min(390px, calc(100vw - 32px)); justify-content: center; transform: translate(-50%, -44%) scale(.96); }
.success-toast.centered.visible { transform: translate(-50%, -50%) scale(1); }
.notice-toast { border-color: #f0c66c; background: #fff8e6; color: #74500e; }
.notice-toast .success-toast-icon { background: #ffe6a9; }
.narrative-panel { position: sticky; top: 18px; }
#narrative-output { min-height: 520px; max-height: calc(100vh - 250px); margin: 0; padding: 16px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #f8faf9; color: #26373f; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }

.builder-heading { align-items: flex-start; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.builder-intro { padding: 15px; border-radius: 10px; background: var(--soft); }
.template-advanced-settings { margin-top: 13px; padding-top: 12px; border-top: 1px solid #c4dfdc; }
.template-advanced-settings summary { color: var(--brand-2); font-size: 13px; font-weight: 850; cursor: pointer; }
.template-advanced-settings .check { margin-top: 12px; }
.service-selector { min-width: 145px; }
.service-selector select { margin-top: 3px; }
.form-tabs { display: flex; flex: 1 1 260px; flex-wrap: wrap; gap: 7px; }
.form-tab { border: 1px solid #afc7cf; border-radius: 999px; padding: 8px 12px; background: #edf5f7; color: var(--brand); font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.form-tab.active { border-color: var(--brand); background: var(--brand); color: #fff; }
.form-tabs-navigation { flex: 1 1 auto; gap: 8px; }
.form-tabs-navigation .form-tab { border-radius: 10px 10px 0 0; padding: 10px 18px; background: #dce5e8; font-size: 15px; }
.form-tabs-navigation .form-tab.active { border-color: var(--brand); background: var(--brand); color: #fff; }
.form-tab-add { min-width: 44px; font-size: 20px !important; line-height: 1; }
.builder-template-controls { display: grid; grid-template-columns: minmax(150px,.7fr) minmax(200px,1.3fr) auto; gap: 12px; align-items: end; }
.builder-template-controls .button { margin-bottom: 1px; white-space: nowrap; }
.help { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.help-inline { color: var(--muted); font-size: 11px; font-weight: 500; }
.builder-section { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #f7faf9; }
.section-addons { margin-top: 12px; padding: 10px 12px; border: 1px dashed #b9cdd2; border-radius: 9px; background: #fff; }
.section-addons summary { color: var(--brand-2); font-size: 12px; font-weight: 850; cursor: pointer; }
.section-addon-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 10px; }
.clinician-addon-picker { display: flex; grid-column: 1 / -1; width: 100%; min-width: 0; align-items: end; gap: 8px; margin-top: 4px; padding: 12px; border: 1px dashed #8eb5b3; border-radius: 10px; background: #f2f9f8; }
.clinician-addon-picker label { flex: 1 1 260px; min-width: 0; }
.clinician-addon-picker select { min-width: 0; }
.clinician-addon-picker .button { flex: 0 0 auto; }
.clinician-addon-picker .button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.section-editor-head, .field-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-editor-head > label { flex: 1; }
.icon-actions { display: flex; gap: 6px; }
.icon-button { border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; background: #fff; color: var(--brand); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.icon-button:hover { background: #eaf3f4; }
.danger-text { color: var(--danger); }
.field-editor { margin-top: 13px; padding: 14px; border: 1px solid #d6e0e3; border-radius: 10px; background: #fff; }
.field-editor.editing { border-color: #78aaa7; box-shadow: 0 0 0 3px rgba(34,124,120,.08); }
.field-toggle { display: grid; flex: 1; min-width: 0; grid-template-columns: minmax(120px, 1fr) auto auto; align-items: center; gap: 10px; padding: 3px 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.field-number { min-width: 0; overflow: hidden; color: var(--brand); font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.field-summary { padding: 3px 8px; border-radius: 999px; background: #e9f2f3; color: var(--muted); font-size: 11px; font-weight: 750; }
.field-toggle-label { color: var(--brand-2); font-size: 12px; font-weight: 850; }
.field-editor-body { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.settings-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.settings-heading strong { color: var(--brand); font-size: 14px; }
.settings-heading span { color: var(--muted); font-size: 11px; text-align: right; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.editor-grid .wide { grid-column: 1 / -1; }
.editor-grid textarea { min-height: 64px; }
.toggle-row { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 13px; }
.basic-toggles { padding-bottom: 3px; }
.advanced-toggle { width: 100%; margin-top: 14px; padding: 10px 0; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; color: var(--brand-2); text-align: left; font: inherit; font-weight: 850; cursor: pointer; }
.advanced-toggle span { float: right; }
.advanced-settings { padding-top: 14px; }
.advanced-settings > label textarea { min-height: 66px; }
.advanced-reset-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding: 10px 12px; border: 1px solid #ead0cc; border-radius: 9px; background: #fff8f7; color: #73514c; font-size: 12px; }
.suggest-narrative { margin-top: 7px; border: 0; background: transparent; color: var(--brand-2); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.condition-heading { margin-top: 20px; }
.condition-builder { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.preset-setting { margin-top: 16px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: #f7faf9; }
.assessment-wdl-setting { margin-top: 16px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: #f7faf9; }
.assessment-wdl-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.assessment-wdl-actions span { color: var(--muted); font-size: 11px; }
.assessment-wdl-editor { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.assessment-wdl-editor textarea { min-height: 70px; }
.preset-editor-row { display: grid; grid-template-columns: minmax(120px,.7fr) minmax(180px,1.3fr) auto; gap: 8px; align-items: end; margin-top: 9px; }
.preset-editor-row textarea { min-height: 46px; height: 46px; }
.preset-editor-row .icon-button { margin-bottom: 1px; }
.readiness-list { margin: 0 0 18px; padding: 0; list-style: none; }
.readiness-list li { margin-top: 8px; padding-left: 24px; position: relative; }
.readiness-list li::before { position: absolute; left: 0; font-weight: 900; }
.readiness-list .ready::before { content: "✓"; color: var(--brand-2); }
.readiness-list .warning::before { content: "!"; color: var(--accent); }
.preview-tabs { display: flex; gap: 6px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.preview-tab { padding: 8px 10px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 850; cursor: pointer; }
.preview-tab.active { border-bottom-color: var(--brand-2); color: var(--brand); }
.builder-preview { max-height: 55vh; overflow: auto; }
.preview-section + .preview-section { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.preview-section h3 { margin: 0 0 8px; color: var(--brand); font-size: 14px; }
.preview-field { margin-top: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #f8faf9; color: #41545e; font-size: 12px; }
.preview-field small { float: right; color: var(--muted); }
.narrative-preview { min-height: 260px; padding: 12px; border-radius: 8px; background: #f7faf9; white-space: pre-wrap; }
.builder-help { margin-top: 16px; color: var(--muted); font-size: 12px; }
.builder-help summary { color: var(--brand-2); font-weight: 800; cursor: pointer; }
.guidance-panel { position: sticky; top: 18px; }
.guidance-panel h2 { margin-top: 0; }
.guidance-panel dt { float: left; clear: left; width: 90px; }
.guidance-panel dd { margin: 0 0 9px 98px; }
code { padding: 2px 5px; border-radius: 4px; background: #edf2f3; }
.example { padding: 12px; overflow: auto; border-radius: 8px; background: #f2f6f6; white-space: pre-wrap; }

.timeline-row { margin-top: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8faf9; }
.timeline-top { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 9px; align-items: end; }
.timeline-row textarea { min-height: 62px; }
.timeline-row .remove-note { padding: 10px; }
.timeline-add { margin-top: 10px; }

.choice-dialog { width: min(700px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; overflow: auto; border: 0; border-radius: 16px; box-shadow: 0 24px 80px rgba(16, 44, 56, .28); }
.choice-dialog::backdrop { background: rgba(16, 38, 48, .55); backdrop-filter: blur(2px); }
.choice-dialog form { padding: 22px; }
.choice-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.choice-dialog-head h2 { margin: 0; }
.picker-filters { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.picker-filter { padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--brand); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.picker-filter:hover { border-color: var(--brand-2); background: var(--soft); }
.picker-filter.active { border-color: var(--brand); background: var(--brand); color: #fff; }
.field-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
.field-choice { display: flex; min-height: 155px; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #f8faf9; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.field-choice:hover { border-color: var(--brand-2); background: var(--soft); box-shadow: 0 0 0 3px rgba(34,124,120,.09); }
.field-choice strong { color: var(--brand); font-size: 17px; }
.field-choice span:not(.choice-badge) { color: var(--muted); font-size: 13px; }
.choice-badge { padding: 3px 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.field-choice.featured { border-color: #88b7b3; background: #f1f9f8; }
.assessment-field-choice { cursor: default; }
.assessment-field-choice:hover { border-color: var(--line); background: #f8faf9; box-shadow: none; }
.assessment-field-choice label { width: 100%; }
.assessment-field-choice .button { width: 100%; margin-top: auto; }
.clinical-module { margin-top: 7px; padding: 16px; border: 1px solid #a9c9c7; border-radius: 12px; background: #f5faf9; }
.clinical-module-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.clinical-module-heading strong { color: var(--brand); font-size: 16px; }
.clinical-module-heading span { color: var(--muted); font-size: 11px; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.module-subhead { grid-column: 1 / -1; margin-top: 5px; padding-bottom: 5px; border-bottom: 1px solid var(--line); color: var(--brand); font-size: 13px; font-weight: 850; }
.assessment-module-heading > div { display: flex; flex-direction: column; }
.assessment-module-heading .assessment-wdl { flex: 0 0 auto; }
.assessment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.assessment-grid label:first-child, .assessment-grid label:nth-child(3), .assessment-grid label:nth-child(4), .assessment-grid label:nth-child(5) { grid-column: 1 / -1; }
.assessment-grid textarea { min-height: 68px; }
.nihss-calculator { grid-column: 1 / -1; margin-top: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.nihss-calculator-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.nihss-calculator-result { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: #e5f4ef; color: #17624f; font-weight: 850; }
.nihss-calculator-result.incomplete { background: #fff6df; color: #795817; }
.simple-module-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.simple-module-grid textarea { min-height: 66px; }
.delay-row { display: grid; grid-template-columns: 155px 170px minmax(180px, 1fr) auto; gap: 9px; align-items: end; margin-top: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.delay-row .button.danger { padding: 10px; }
.device-row { display: grid; grid-template-columns: 180px 1fr 110px 1.2fr auto; gap: 9px; align-items: end; margin-top: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.device-row .button.danger { padding: 10px; }

@media (max-width: 980px) {
  .builder-template-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .builder-template-controls .button { justify-self: start; }
  .builder-template-controls #copy-to-new-template { grid-column: 1 / -1; }
  .action-row, .builder-actions { flex-wrap: wrap; }
  .action-row .button { min-width: min(100%, 180px); }
}
@media (max-width: 860px) {
  .workspace, .builder-layout { grid-template-columns: 1fr; }
  .narrative-panel, .guidance-panel { position: static; }
  #narrative-output { max-height: none; }
}
@media (max-width: 720px) {
  .mode-tabs, .form-tabs-navigation { overflow-x: auto; flex-wrap: nowrap; }
  .mode-tab, .form-tabs-navigation .form-tab { flex: 0 0 auto; }
  .panel-heading > .service-selector { flex: 1 1 145px; }
  .panel-heading > #company-connect { flex: 0 0 auto; }
  .assessment-wdl-actions { align-items: stretch; flex-direction: column; }
}
@media (max-width: 600px) {
  .success-toast { right: 14px; left: 14px; bottom: max(14px, env(safe-area-inset-bottom)); justify-content: center; text-align: center; }
  .success-toast.centered { top: 50%; right: auto; bottom: auto; left: 50%; }
  .header-inner { align-items: flex-start; flex-direction: column; gap: 12px; }
  .leader-cloud-controls { margin-left: 0; justify-content: flex-start; }
  .runtime-grid, .editor-grid { grid-template-columns: 1fr; }
  .runtime-field.wide, .editor-grid .wide { grid-column: auto; }
  .timeline-top { grid-template-columns: 1fr; }
  .panel-heading, .section-editor-head { align-items: stretch; flex-direction: column; }
  .toolbar, .builder-actions { flex-wrap: wrap; }
  .builder-template-controls { grid-template-columns: 1fr; }
  .builder-template-controls .button { grid-column: auto !important; justify-self: stretch; white-space: normal; }
  .section-addon-options { grid-template-columns: 1fr; }
  .clinician-addon-picker { align-items: stretch; flex-direction: column; }
  .field-toggle { grid-template-columns: 1fr auto; }
  .field-summary { display: none; }
  .condition-builder, .preset-editor-row, .assessment-wdl-editor { grid-template-columns: 1fr; }
  .advanced-reset-row { align-items: stretch; flex-direction: column; }
  .field-choice-grid, .module-grid, .assessment-grid, .nihss-calculator-grid { grid-template-columns: 1fr; }
  .delay-row, .device-row { grid-template-columns: 1fr; }
  .action-row .button, .builder-actions .button { flex: 1 1 100%; }
  .module-subhead { grid-column: auto; }
  .assessment-grid label:first-child, .assessment-grid label:nth-child(3), .assessment-grid label:nth-child(4), .assessment-grid label:nth-child(5) { grid-column: auto; }
}
