:root {
  color-scheme: light;
  --primary: oklch(.43 .04 158);
  --primary-hover: oklch(.36 .04 158);
  --sage: oklch(.94 .016 155);
  --sage-mid: oklch(.86 .025 155);
  --ink: oklch(.25 .033 265);
  --muted: oklch(.47 .018 265);
  --line: oklch(.90 .006 265);
  --line-soft: oklch(.945 .004 265);
  --field-line: oklch(.64 .012 265); /* 3.3:1 on white: form field edges must be visible (WCAG 1.4.11) */
  --bg: oklch(.992 .002 155);
  --surface: oklch(1 0 0);
  --soft: oklch(.98 .003 265);
  --red: oklch(.43 .13 25);
  --red-soft: oklch(.96 .018 25);
  --blue: oklch(.40 .08 255);
  --blue-soft: oklch(.955 .014 255);
  --gold: oklch(.43 .072 72);
  --gold-soft: oklch(.966 .025 85);
  --sidebar-width: 232px;
  --header-height: 86px;
  --identity-height: 120px;
  --radius: 9px;
  --z-header: 10;
  --z-identity: 9;
  --z-overlay: 20;
  --z-sidebar: 30;
  --z-toast: 50;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
* {box-sizing:border-box;}
[hidden] {display:none !important;}
html {scroll-padding-top:calc(var(--header-height) + 16px);}
body,h1,h2,h3,h4,p,ul,ol,dl {margin:0;}
body {min-width:320px;}
button,input,textarea,select {font:inherit;color:inherit;}
button {cursor:pointer;background:none;border:0;}
a {text-decoration:none;color:inherit;}
button,a,input,textarea,select {-webkit-tap-highlight-color:transparent;}
button:disabled,[aria-disabled=true] {opacity:.5;cursor:not-allowed;}
button,a {touch-action:manipulation;}
h1,h2,h3 {text-wrap:balance;}
h1 {font:500 2.9rem/1.15 Georgia,'Times New Roman',serif;letter-spacing:-.035em;}
h2 {font:500 1.55rem/1.3 Georgia,'Times New Roman',serif;letter-spacing:-.02em;}
h3 {font-size:1rem;font-weight:600;}
p {text-wrap:pretty;}
strong {font-weight:600;}
small,.small {font-size:.84rem;}
.muted {color:var(--muted);}
.icon {height:21px;width:21px;flex-shrink:0;vertical-align:middle;}
label {display:flex;flex-direction:column;gap:7px;font-size:.9rem;font-weight:500;}
input,select,textarea {width:100%;border:1px solid var(--field-line);border-radius:5px;min-height:39px;padding:9px 11px;background:var(--surface);}
input::placeholder,textarea::placeholder {color:var(--muted);opacity:1;}
input[type=checkbox] {width:18px;height:18px;min-height:18px;padding:0;flex-shrink:0;accent-color:var(--primary);cursor:pointer;}
textarea {resize:vertical;line-height:1.7;}
select {padding-right:32px;cursor:pointer;appearance:none;background:var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6170' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center/16px;}
:focus-visible {outline:2px solid var(--primary);outline-offset:3px;}
input:focus,textarea:focus,select:focus {border-color:var(--primary);}
[tabindex='-1']:focus {outline:none;}
::selection {background:var(--sage-mid);}
.sr-only {position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}
.skip-link {position:fixed;top:-80px;left:12px;background:var(--primary);color:white;padding:12px;z-index:var(--z-toast);}
.skip-link:focus {top:12px;}
.button,.small-button,.icon-button,.text-button {display:inline-flex;align-items:center;justify-content:center;gap:8px;font-weight:500;transition:background .16s,color .16s,border-color .16s;}
.button,.small-button {border:1px solid var(--line);background:var(--surface);border-radius:6px;white-space:nowrap;}
.button {padding:10px 16px;min-height:42px;font-size:.94rem;}
.small-button {padding:7px 12px;min-height:33px;font-size:.85rem;}
.button:hover,.small-button:hover {border-color:var(--sage-mid);background:var(--soft);}
.button.primary,.small-button.primary {color:white;background:var(--primary);border-color:var(--primary);}
.button.primary:hover,.small-button.primary:hover {background:var(--primary-hover);}
.button.danger {color:var(--red);border-color:oklch(.77 .07 25);background:var(--red-soft);}
.primary-soft {color:var(--primary);background:var(--sage);border-color:var(--sage);}
.icon-button {width:36px;height:36px;border-radius:5px;flex-shrink:0;}
.icon-button:hover {background:var(--sage);}
.icon-button .icon,.small-button .icon {width:17px;height:17px;}
.text-button {color:var(--primary);font-size:.86rem;}
.text-button:hover {text-decoration:underline;text-underline-offset:3px;}
.text-button .icon {width:16px;height:16px;}
.button-group {display:flex;gap:10px;align-items:center;flex-wrap:wrap;}
.full {width:100%;}
.badge {display:inline-flex;align-items:center;justify-content:center;align-self:center;padding:4px 10px;font-size:.8rem;font-weight:500;line-height:1.4;border-radius:20px;white-space:nowrap;}
.badge.green {background:oklch(.952 .024 157);color:oklch(.38 .057 158);}
.badge.sage {background:var(--sage-mid);color:var(--primary-hover);}
.badge.gold {background:var(--gold-soft);color:var(--gold);}
.badge.red {background:var(--red-soft);color:var(--red);}
.badge.blue {background:var(--blue-soft);color:var(--blue);}
.badge.neutral {background:oklch(.95 .004 265);color:var(--muted);}
.avatar {height:39px;width:39px;display:inline-flex;align-items:center;justify-content:center;border-radius:50%;background:var(--sage);color:var(--primary);font-weight:500;flex-shrink:0;}
.avatar.large {height:72px;width:72px;font-size:1.5rem;font-family:Georgia,serif;}
.document-symbol,.attention-icon {width:36px;height:40px;display:inline-flex;align-items:center;justify-content:center;background:var(--soft);border-radius:6px;flex-shrink:0;}
.panel {border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);min-width:0;}
.panel-heading {display:flex;align-items:center;justify-content:space-between;gap:12px;padding:20px 22px;border-bottom:1px solid var(--line-soft);}
.panel-heading h2,.section-heading h3 {display:flex;align-items:center;gap:11px;}
.section-heading {display:flex;align-items:center;justify-content:space-between;gap:10px;}
.subtle-label {color:var(--muted);font-size:.8rem;border:1px solid var(--line);border-radius:4px;padding:3px 7px;white-space:nowrap;}
.quiet-message {padding:24px;color:var(--muted);font-size:.9rem;}
.empty-state {padding:45px 24px;text-align:center;}
.empty-state>.icon {color:var(--primary);width:30px;height:30px;margin-bottom:10px;}
.empty-state h3 {font-size:1.1rem;}
.empty-state p {color:var(--muted);max-width:43ch;margin:8px auto 18px;}
.back-link {display:inline-flex;align-items:center;gap:5px;color:var(--muted);font-size:.88rem;margin-bottom:14px;}
.back-link:hover {color:var(--primary);}
.back-link .icon {width:17px;height:17px;}
.page-heading {display:flex;justify-content:space-between;gap:20px;align-items:center;margin-bottom:26px;}
.page-heading p {color:var(--muted);margin-top:6px;max-width:80ch;}
.page-heading p strong {color:var(--ink);font-weight:500;}
.heading-divider {display:inline-block;height:15px;border-left:1px solid var(--line);margin:0 17px;vertical-align:middle;}
.date-controls {display:flex;align-items:center;gap:5px;}
.app-shell {min-height:100vh;}
.sidebar {width:var(--sidebar-width);position:fixed;inset:0 auto 0 0;z-index:var(--z-sidebar);background:var(--surface);border-right:1px solid var(--line);padding:30px 16px 0;display:flex;flex-direction:column;overflow:auto;}
.brand {display:flex;align-items:center;gap:8px;padding:0 9px;margin-bottom:38px;white-space:nowrap;}
.brand>span:last-child {font:500 1.75rem/1.15 Georgia,serif;letter-spacing:-.045em;}
.brand small {font:500 .8rem/1.3 -apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;letter-spacing:.02em;display:block;margin-top:4px;color:var(--muted);white-space:normal;}
.brand-leaves {display:flex;color:var(--primary);}
.brand-leaves .icon {height:36px;width:29px;stroke-width:1.3;}
.sidebar nav {display:flex;flex-direction:column;gap:9px;}
.nav-item {display:flex;align-items:center;gap:20px;min-height:50px;padding:12px 16px;border-radius:7px;transition:background .15s,color .15s;}
.nav-item:hover {background:var(--soft);}
.nav-item.active {color:var(--primary);background:var(--sage);font-weight:600;}
.nav-item .icon {width:22px;height:22px;}
.nav-count {margin-left:auto;min-width:23px;height:23px;background:var(--red-soft);color:var(--red);font-size:.8rem;display:grid;place-items:center;border-radius:50%;}
.sidebar-bottom {margin-top:auto;padding-top:48px;}
.sidebar-bottom .nav-item {font-size:.82rem;color:var(--muted);gap:14px;min-height:42px;}
.sidebar-bottom .nav-item .icon {width:17px;height:17px;}
.workspace {margin-left:var(--sidebar-width);min-width:0;}
.topbar {position:sticky;top:0;z-index:var(--z-header);height:var(--header-height);display:flex;align-items:center;gap:20px;padding:0 28px;background:var(--surface);border-bottom:1px solid var(--line);}
.global-search {display:flex;align-items:center;gap:10px;flex:1;min-width:140px;max-width:470px;border:1px solid var(--field-line);border-radius:6px;padding-left:13px;background:var(--soft);}
.global-search>.icon {color:var(--muted);}
.global-search input {border:0;min-width:0;background:none;min-height:44px;padding:10px 0;}
.global-search .icon-button {margin-right:3px;}
.practice-tabs {display:flex;gap:9px;margin-left:auto;flex-shrink:0;}
.practice-tab {display:flex;align-items:center;gap:9px;justify-content:center;min-height:45px;border:1px solid var(--line);border-radius:6px;padding:10px 14px;font-size:.91rem;color:var(--muted);background:var(--soft);}
.practice-tab.active {color:white;background:var(--primary);border-color:var(--primary);box-shadow:0 0 0 3px var(--sage);}
.practice-tab .icon {width:19px;height:19px;}
.notification-button {position:relative;margin-left:5px;}
.notification-button span {position:absolute;top:-3px;right:-3px;min-width:19px;height:19px;padding:0 4px;border-radius:10px;background:var(--red);color:white;font-size:.8rem;line-height:1;display:grid;place-items:center;}
.profile {display:flex;align-items:center;gap:10px;flex-shrink:0;}
.profile strong,.profile small {display:block;}
.profile small {color:var(--muted);font-size:.8rem;}
.profile>.icon {width:15px;height:15px;margin-left:8px;}
.topbar .menu-toggle {display:none;}
#main {padding:27px 28px 40px;max-width:1770px;margin:0 auto;min-height:calc(100vh - var(--header-height) - 54px);}
.app-footer {display:flex;justify-content:space-between;gap:15px;margin:0 28px;border-top:1px solid var(--line-soft);padding:17px 0;font-size:.8rem;color:var(--muted);}
.today-grid {display:grid;grid-template-columns:minmax(0,1.65fr) minmax(320px,1fr);grid-template-rows:auto 1fr;gap:22px;align-items:start;}
.today-aside {display:flex;flex-direction:column;gap:22px;min-width:0;grid-column:2;grid-row:1 / span 2;}
.next-body {display:flex;align-items:flex-start;gap:17px;padding:24px 22px;}
.next-info {flex:1;min-width:0;}
.name-line {display:flex;align-items:center;flex-wrap:wrap;gap:10px;}
.next-info h3 {font:500 1.7rem/1.3 Georgia,serif;letter-spacing:-.02em;}
.next-info>p {margin-top:5px;font-size:1rem;}
.next-info>p .icon {width:15px;height:15px;margin-right:5px;}
.intake-line {display:flex;align-items:center;flex-wrap:wrap;gap:9px;border-top:1px solid var(--line-soft);padding-top:12px;margin:15px 0 8px;}
.intake-line>.icon {color:var(--muted);height:18px;width:18px;}
.next-actions {display:flex;flex-direction:column;gap:9px;align-self:stretch;justify-content:center;border-left:1px solid var(--line-soft);padding-left:17px;}
.next-actions .button {font-size:.85rem;padding:10px 12px;min-width:136px;}
.next-actions .icon {width:17px;height:17px;}
.agenda {padding-bottom:12px;}
.agenda .panel-heading {margin:0 20px;padding:20px 0;}
.appointment-row {display:flex;align-items:center;gap:16px;margin:0 12px;padding:20px 8px;min-height:90px;border-bottom:1px solid var(--line-soft);}
.appointment-row:last-child {border-bottom:0;}
.appointment-row.is-next {background:var(--sage);border-radius:6px;border-color:transparent;}
.appointment-time {min-width:79px;font-size:.9rem;}
.appointment-time strong {font-weight:500;}
.appointment-time small {display:block;color:var(--muted);margin-top:3px;}
.schedule-dot {width:20px;height:20px;border-radius:50%;background:oklch(.83 .006 265);flex-shrink:0;}
.schedule-dot.next {background:oklch(.53 .045 155);}
.schedule-dot.complete {background:var(--primary);color:white;display:grid;place-items:center;}
.schedule-dot .icon {width:14px;height:14px;}
.appointment-client {display:flex;flex-direction:column;text-align:left;gap:3px;flex:1;min-width:0;padding:5px 0;}
.appointment-client strong {font-size:1rem;}
.appointment-client span {font-size:.87rem;color:var(--muted);}
.appointment-client:hover strong {text-decoration:underline;text-underline-offset:3px;}
.appointment-row>.badge {font-size:.8rem;}
.attention-panel .panel-heading .icon {color:var(--red);}
.attention-row {display:flex;gap:13px;margin:0 20px;padding:19px 0;border-bottom:1px solid var(--line-soft);}
.attention-row:last-child {border-bottom:0;}
.attention-more {border-top:1px solid var(--line-soft);}
.attention-more summary {cursor:pointer;margin:0 20px;padding:14px 0;font-size:.88rem;font-weight:600;color:var(--primary);border-radius:6px;}
.attention-more summary:hover {text-decoration:underline;}
.attention-row>div {min-width:0;}
.attention-row strong {display:block;font-size:.94rem;line-height:1.5;}
.attention-row small {display:block;color:var(--muted);font-size:.81rem;line-height:1.55;margin:3px 0 9px;}
.attention-row .button-group {gap:7px;}
.attention-row .small-button {font-size:.8rem;min-height:31px;padding:6px 10px;}
.list-toolbar {display:flex;gap:18px;align-items:center;padding:20px;border-bottom:1px solid var(--line-soft);}
.search-field {display:flex;flex-direction:row;align-items:center;gap:9px;flex:1;max-width:450px;}
.search-field input {min-width:0;}
.list-toolbar>select {width:155px;}
.list-toolbar>.small {margin-left:auto;white-space:nowrap;}
.table-scroll {overflow:auto;}
table {width:100%;border-collapse:collapse;text-align:left;}
th {background:var(--soft);color:var(--muted);font-weight:500;font-size:.83rem;padding:13px 19px;white-space:nowrap;}
td {padding:19px;border-top:1px solid var(--line-soft);font-size:.91rem;}
.person-cell {display:flex;align-items:center;gap:12px;}
.person-cell small {display:block;color:var(--muted);margin-top:3px;}
.person-cell:hover strong {color:var(--primary);text-decoration:underline;}
.client-heading {display:flex;align-items:center;gap:19px;margin-bottom:28px;}
.client-heading h1 {font-size:2.5rem;}
.client-heading p {margin-top:8px;color:var(--muted);font-size:.86rem;}
.client-heading>.button-group {margin-left:auto;}
.chart-layout {display:grid;grid-template-columns:270px minmax(0,1fr);gap:22px;align-items:start;}
.client-details {padding:24px;}
.client-details h2 {margin-bottom:20px;}
dl dt {color:var(--muted);font-size:.8rem;margin-bottom:4px;}
dl dd {margin:0 0 20px;overflow-wrap:anywhere;}
.client-details h3 {border-top:1px solid var(--line-soft);padding-top:20px;margin:20px 0 8px;}
.client-details p {font-size:.88rem;line-height:1.7;}
.client-details>.small {margin-top:22px;}
.tabs {display:flex;gap:10px;padding:0 18px;border-bottom:1px solid var(--line);}
.tabs>button,.tabs>a {display:flex;align-items:center;justify-content:center;gap:9px;min-height:48px;padding:13px 15px;color:var(--muted);border-bottom:2px solid transparent;white-space:nowrap;}
.tabs>button.active,.tabs>a.active {color:var(--primary);border-bottom-color:var(--primary);font-weight:600;}
.tabs>button:hover,.tabs>a:hover {background:var(--soft);}
.history-row {display:flex;align-items:flex-start;gap:15px;padding:22px;border-bottom:1px solid var(--line-soft);}
.history-row>div {flex:1;min-width:0;}
.history-row small {display:block;color:var(--muted);margin:4px 0 9px;}
.history-row p {color:var(--muted);font-size:.9rem;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
.history-row:hover,.record-row:hover {background:var(--soft);}
.record-row {display:flex;align-items:center;gap:12px;text-align:left;width:100%;padding:18px 22px;border-bottom:1px solid var(--line-soft);}
.record-row:last-child {border-bottom:0;}
.record-row>div,.record-row>span:not(.document-symbol):not(.badge):not(.avatar) {flex:1;min-width:0;}
.record-row strong {display:block;font-size:.93rem;}
.record-row small {display:block;color:var(--muted);font-size:.81rem;margin-top:3px;}
.record-row p {margin:8px 0;color:var(--muted);}
.record-row>.icon {height:17px;width:17px;color:var(--muted);}
.filter-bar {display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:22px;}
.segmented {display:inline-flex;gap:4px;border:1px solid var(--line);border-radius:6px;padding:4px;background:var(--surface);}
.segmented button {padding:7px 14px;border-radius:4px;min-height:35px;}
.segmented button.active {background:var(--sage);color:var(--primary);font-weight:600;box-shadow:inset 0 0 0 1px var(--primary);}
.segmented button:hover:not(.active) {background:var(--soft);color:var(--ink);}
.identity-strip {display:flex;align-items:center;gap:18px;padding:18px 20px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);position:sticky;top:calc(var(--header-height) + 10px);z-index:var(--z-identity);margin-bottom:20px;}
.identity-strip>.avatar {width:58px;height:58px;font-size:1.2rem;}
.identity-strip>div:not(.button-group) {min-width:0;}
.identity-strip h2 {font-size:1.6rem;}
.identity-strip p {font-size:.86rem;margin-top:5px;color:var(--muted);}
.identity-strip p>span {margin:0 10px;}
.identity-strip .identity-secondary {font-size:.8rem;}
.identity-strip>.button-group {margin-left:auto;flex-wrap:nowrap;}
.identity-strip>.button-group .button {font-size:.85rem;}
.note-workspace {display:grid;grid-template-columns:minmax(0,2.3fr) minmax(285px,1fr);gap:20px;align-items:start;}
.clinical-note>.panel-heading {flex-wrap:wrap;gap:10px;padding:18px 20px;}
.clinical-note>.panel-heading .subtle-label {margin-right:auto;}
.note-content {display:grid;grid-template-columns:126px minmax(0,1fr);gap:22px;padding:24px 20px;align-items:start;}
.soap-jumps {display:flex;flex-direction:column;gap:7px;position:sticky;top:calc(var(--header-height) + var(--identity-height) + 28px);}
.soap-jumps button {padding:11px 12px;text-align:left;font-size:.89rem;border-radius:4px;color:var(--muted);}
.soap-jumps button:hover,.soap-jumps button:focus-visible {background:var(--sage);color:var(--primary);}
.soap-sections {min-width:0;}
.soap-section {scroll-margin-top:calc(var(--identity-height) + 12px);margin-bottom:30px;}
.soap-section:last-child {margin-bottom:0;}
.soap-section h2 {font-size:1.65rem;}
.section-description {font-size:.84rem;color:var(--muted);margin:3px 0 12px;}
.soap-section textarea {padding:15px 17px;font-size:.96rem;min-height:180px;line-height:1.85;}
.signed-content {white-space:pre-wrap;font-size:.98rem;line-height:1.85;padding:12px 0;}
.editor-actions {padding:18px 20px;position:sticky;bottom:0;z-index:2;background:var(--surface);border-top:1px solid var(--line);border-radius:0 0 var(--radius) var(--radius);display:flex;align-items:center;justify-content:space-between;gap:15px;flex-wrap:wrap;}
.save-status {display:flex;align-items:center;flex-wrap:wrap;gap:7px;color:var(--primary);font-size:.84rem;min-height:24px;}
.save-status .icon {width:16px;height:16px;}
.save-status[data-state=error] {color:var(--red);font-weight:500;}
.save-status[data-state=saving],.save-status[data-state=dirty],.save-status[data-state=idle] {color:var(--muted);}
.editor-actions>.button-group {margin-left:auto;}
.client-context {position:sticky;top:calc(var(--header-height) + var(--identity-height) + 28px);max-height:calc(100vh - var(--header-height) - var(--identity-height) - 44px);overflow:auto;}
.client-context>.panel-heading {padding:16px 20px;}
.client-context>.panel-heading h2 {font-family:inherit;font-size:.97rem;color:var(--primary);}
.reference-section {padding:18px 18px 21px;border-bottom:1px solid var(--line-soft);}
.reference-section:last-child {border-bottom:0;}
.reference-section .section-heading {margin-bottom:13px;}
.reference-section h3 {font:500 1.15rem/1.3 Georgia,serif;}
.reference-section h3 .icon {width:18px;height:18px;}
.reference-section .text-button {font-size:.8rem;}
.reference-section details {border-radius:6px;background:var(--soft);margin-bottom:10px;}
.reference-section summary {display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px;cursor:pointer;font-size:.88rem;padding:11px;}
.reference-section summary>span {font-size:.81rem;}
.reference-section summary small {display:block;font-size:.8rem;color:var(--muted);margin-top:4px;}
.reference-section summary>.icon {width:14px;height:14px;margin-left:auto;}
.reference-excerpt {padding:0 12px 13px;}
.reference-excerpt p {font-size:.89rem;color:var(--muted);line-height:1.65;margin-bottom:10px;}
.reference-section .document-row {padding:10px 0;gap:9px;}
.reference-section .document-row strong {font-size:.83rem;}
.reference-section .document-row small {font-size:.8rem;}
.reference-section .document-symbol {height:33px;width:28px;}
.signed-banner {display:flex;gap:12px;padding:18px 20px;background:var(--sage);color:var(--primary);font-size:.86rem;}
.signed-banner p {margin-top:4px;font-size:.83rem;}
.addenda {border-top:1px solid var(--line);padding-top:20px;}
.addenda article {margin-top:16px;padding:15px;background:var(--sage);border-radius:6px;}
.addenda p {white-space:pre-wrap;margin:10px 0;}
.addenda small {color:var(--muted);}
.forms-tabs {padding:0;border:0;gap:10px;margin-bottom:20px;}
.forms-tabs>a {min-width:180px;border:1px solid var(--line-soft);border-radius:6px;background:var(--surface);}
.forms-tabs>a.active {background:var(--sage);border-bottom:2px solid var(--primary);}
.forms-workspace {display:grid;grid-template-columns:minmax(245px,.9fr) minmax(330px,1.2fr) minmax(270px,.85fr);gap:14px;align-items:start;}
.template-library .panel-heading {padding:17px 14px;gap:8px;}
.template-library h2 {font-size:1.25rem;}
.template-library .small-button {font-size:.8rem;padding:7px 10px;}
.template-item {display:flex;gap:9px;padding:17px 10px;border-bottom:1px solid var(--line-soft);position:relative;}
.template-item:last-child {border-bottom:0;}
.template-item.selected {background:var(--sage);}
.template-item>div {min-width:0;flex:1;}
/* The link holds only the template name (a short accessible name); ::after keeps the whole card clickable. */
.template-item strong a::after {content:'';position:absolute;inset:0;}
.template-item strong a:focus-visible {outline:none;}
.template-item:has(a:focus-visible) {outline:2px solid var(--primary);outline-offset:-2px;}
.template-item .document-symbol {width:29px;height:33px;background:transparent;}
.template-item strong {font-size:.89rem;display:block;}
.template-item p {font-size:.8rem;color:var(--muted);margin-top:3px;line-height:1.45;}
.template-item small {font-size:.8rem;color:var(--muted);display:block;margin:5px 0;}
.template-item .badge {font-size:.8rem;padding:2px 9px;}
.editor-heading {display:flex;align-items:center;justify-content:space-between;gap:10px;padding:18px 18px 9px;}
.editor-heading h2 {font-size:1.55rem;margin-top:2px;overflow-wrap:anywhere;}
.form-editor>.tabs {gap:15px;padding:0 17px;}
.form-editor>.tabs button {padding:12px 9px;font-size:.85rem;}
.question-list {padding:4px 16px 0;}
.question-group-heading {font:500 1.05rem/1.4 Georgia,serif;padding:17px 0 10px;}
.question-item {border:1px solid var(--line);border-radius:5px;margin-bottom:7px;}
.question-summary {display:flex;align-items:center;gap:9px;text-align:left;width:100%;padding:10px 9px;min-height:42px;}
.question-summary>.icon {width:15px;height:15px;color:var(--muted);}
.question-summary>span {font-size:.94rem;flex:1;min-width:0;overflow-wrap:anywhere;}
.question-summary>small {font-size:.8rem;background:var(--sage);border-radius:12px;padding:2px 5px;color:var(--primary);}
.question-summary>.icon:last-child {width:12px;height:12px;}
.question-summary:hover {background:var(--soft);}
.question-editor {padding:12px;border-top:1px solid var(--line-soft);background:var(--soft);}
.question-editor>label {margin-bottom:13px;font-size:.8rem;}
.question-editor input,.question-editor select {font-size:.83rem;}
.question-controls {display:flex;justify-content:space-between;align-items:center;gap:5px;}
.checkbox-label {flex-direction:row;align-items:center;gap:7px;font-weight:400;}
.question-controls>.checkbox-label {font-size:.8rem;}
.question-controls .icon-button {width:29px;height:29px;}
.add-question {margin:13px 16px;width:calc(100% - 32px);background:var(--soft);min-height:35px;padding:7px;font-size:.83rem;}
.editor-footnote,.panel-footnote {font-size:.8rem;color:var(--muted);padding:0 18px 19px;}
.panel-footnote {padding-top:16px;}
.form-settings {padding:21px 18px 4px;}
.form-settings label {margin-bottom:17px;}
.form-settings input,.form-settings textarea {font-size:.9rem;}
.preview-column {position:sticky;top:calc(var(--header-height) + 20px);}
.preview-panel {padding:12px 11px 0;overflow:hidden;}
.preview-title {display:flex;align-items:center;gap:8px;border:1px solid var(--line);border-radius:4px;padding:7px 10px;font-size:.81rem;}
.preview-title .icon {height:16px;width:16px;}
.phone-frame {margin:15px 8px 0;border:4px solid oklch(.62 .013 165);border-bottom:0;border-radius:32px 32px 0 0;padding:10px 0 0;height:475px;overflow:auto;background:var(--surface);}
.phone-speaker {width:55px;height:4px;border-radius:3px;background:var(--line);margin:0 auto 8px;}
.client-form {padding:9px 16px 20px;}
.mini-brand {display:flex;gap:5px;align-items:center;justify-content:center;margin:0 0 20px;font-family:Georgia,serif;font-size:1.15rem;white-space:nowrap;}
.mini-brand .brand-leaves .icon {width:21px;height:29px;}
.mini-brand small {display:block;font:500 .5rem/1.4 Arial,sans-serif;letter-spacing:.05em;color:var(--muted);}
.client-form h2 {font-size:1.3rem;}
.client-form>p {font-size:.8rem;color:var(--muted);margin:6px 0 18px;line-height:1.5;}
.client-form form h3 {font:500 .94rem/1.4 Georgia,serif;padding:12px 0 7px;margin-top:8px;}
.client-form label {font-size:.8rem;line-height:1.5;margin:11px 0;gap:6px;}
.client-form input,.client-form textarea,.client-form select {font-size:.8rem;min-height:34px;padding:8px;}
.client-form input[type=checkbox] {min-height:18px;}
.client-form .required {color:var(--red);}
.client-form button {font-size:.8rem;margin-top:13px;min-height:36px;padding:8px;}
.form-publish {margin-top:12px;}
.form-publish>p {display:flex;gap:9px;background:var(--blue-soft);color:var(--blue);border:1px solid var(--line);border-radius:6px;padding:12px;font-size:.8rem;}
.form-publish>p .icon {width:18px;height:18px;}
.form-publish>p small {display:block;font-size:.8rem;margin-top:3px;color:var(--muted);}
.form-publish>.button-group {margin:11px 0;gap:8px;flex-wrap:nowrap;}
.form-publish .button {font-size:.82rem;padding:10px;flex:1;}
.form-publish>.small {font-size:.8rem;}
.schedule-week {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;align-items:start;}
.schedule-day h2 {font-size:1.2rem;}
.calendar-appointment {display:flex;flex-direction:column;align-items:flex-start;gap:6px;width:calc(100% - 28px);padding:16px;margin:14px;border-radius:5px;text-align:left;background:var(--sage);}
.calendar-appointment>strong {font-size:.81rem;color:var(--primary);}
.calendar-appointment>span:not(.badge) {font-weight:600;}
.calendar-appointment>small {color:var(--muted);}
.calendar-appointment>.badge {align-self:flex-start;}
.setup-context {color:var(--muted);font-size:.83rem;margin:-10px 0 22px;}
.setup-grid {display:grid;grid-template-columns:minmax(0,1.6fr) minmax(310px,1fr);gap:22px;align-items:start;}
.setup-grid>div,.setup-grid>aside {display:flex;flex-direction:column;gap:22px;}
.progress-panel {display:flex;gap:28px;padding:25px;align-items:center;}
.progress-ring {width:130px;height:130px;border-radius:50%;background:conic-gradient(var(--primary) var(--progress),var(--line) 0);padding:13px;flex-shrink:0;}
.progress-ring>div {height:100%;width:100%;border-radius:50%;background:var(--surface);display:flex;flex-direction:column;align-items:center;justify-content:center;}
.progress-ring strong {font:500 1.6rem Georgia,serif;}
.progress-ring span {font-size:.83rem;margin-top:3px;}
.progress-panel h2 {margin-bottom:10px;}
.progress-panel p {color:var(--muted);font-size:.91rem;line-height:1.7;}
.progress-panel p.small {font-size:.8rem;margin-top:9px;}
.setup-row {display:flex;gap:10px;padding:18px 20px;border-bottom:1px solid var(--line-soft);align-items:center;}
.setup-row:last-child {border:0;}
.setup-row label {flex-direction:row;align-items:flex-start;gap:15px;flex:1;}
.setup-row input {margin-top:4px;}
.setup-row strong,.setup-row small {display:block;}
.setup-row small {font-size:.81rem;font-weight:400;margin-top:4px;color:var(--muted);}
.launch-steps {list-style:none;counter-reset:step;padding:7px 22px 16px;}
.launch-steps li {counter-increment:step;position:relative;padding:14px 0 14px 43px;}
.launch-steps li::before {content:counter(step);position:absolute;left:0;top:15px;display:grid;place-items:center;width:29px;height:29px;border-radius:50%;background:var(--sage);color:var(--primary);font-family:Georgia,serif;font-size:1.2rem;}
.launch-steps p {font-size:.84rem;color:var(--muted);margin-top:4px;line-height:1.6;}
.access-panel .record-row {padding:15px 20px;}
.access-panel .badge {font-size:.8rem;}
.import-intro {padding:26px;margin-bottom:24px;}
.import-intro>p {color:var(--muted);max-width:70ch;margin:12px 0;line-height:1.7;}
.inline-notice {display:flex;align-items:flex-start;gap:10px;font-size:.87rem;color:var(--primary);background:var(--sage);border-radius:6px;padding:14px;margin:18px 0;}
.inline-notice>.icon {width:19px;height:19px;}
.settings-grid {display:grid;grid-template-columns:1fr 1fr;gap:22px;align-items:start;}
.settings-panel {padding:25px;}
.settings-panel>p {color:var(--muted);margin:12px 0 22px;line-height:1.7;font-size:.91rem;}
.settings-panel .record-row {padding:18px 0;}
.settings-panel hr {border:0;border-top:1px solid var(--line);margin:25px 0;}
.toast {position:fixed;bottom:var(--toast-bottom,23px);left:50%;text-align:center;transform:translate(-50%,12px);opacity:0;pointer-events:none;background:var(--ink);color:white;padding:13px 19px;border-radius:7px;max-width:min(580px,90vw);width:max-content;z-index:var(--z-toast);font-size:.9rem;transition:opacity .16s,transform .16s;}
.toast.visible {opacity:1;transform:translate(-50%,0);}
#app:has(.app-shell) ~ .toast {left:calc(50% + var(--sidebar-width) / 2);}
.toast.at-top {bottom:auto;top:var(--toast-top,calc(var(--header-height) + 12px));}
#app ~ .toast.at-end {left:auto;right:16px;transform:translateY(12px);}
#app ~ .toast.at-end.visible {transform:none;}
.dialog-toast {flex:0 0 auto;margin:0 23px;border-radius:6px;font-size:.9rem;background:var(--ink);color:white;}
.dialog-toast:not(.visible) {height:0;overflow:hidden;}
.dialog-toast.visible {margin-top:14px;padding:10px 14px;}
.dialog-toast[data-tone=error] {background:var(--red);}
dialog {width:min(520px,calc(100vw - 32px));max-height:calc(100dvh - 42px);padding:0;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink);}
dialog.reading-dialog {width:min(730px,calc(100vw - 32px));}
dialog::backdrop {background:oklch(.2 .02 265 / .4);}
.dialog-heading {display:flex;justify-content:space-between;align-items:center;gap:15px;padding:18px 23px;border-bottom:1px solid var(--line);}
.dialog-heading h2 {font-size:1.5rem;}
.dialog-body {padding:23px;}
.dialog-body>p {color:var(--muted);line-height:1.7;margin-bottom:15px;}
.dialog-body form {display:flex;flex-direction:column;gap:17px;}
.dialog-footer {display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;padding:17px 23px;border-top:1px solid var(--line);background:var(--soft);}
.dialog-person {display:flex;gap:12px;align-items:center;margin-bottom:20px;}
.dialog-person strong,.dialog-person small {display:block;}
.dialog-person small {color:var(--muted);margin-top:3px;}
.submission-state {display:flex;align-items:center;gap:12px;margin-bottom:22px;flex-wrap:wrap;}
.submission-state small {color:var(--muted);}
.form-answers h3 {font-size:.93rem;margin-bottom:7px;}
.form-answers p {font-size:.94rem;margin-bottom:22px;white-space:pre-wrap;color:var(--muted);}
.review-note section {padding:14px 0;border-bottom:1px solid var(--line-soft);}
.review-note h3 {font:500 1.4rem Georgia,serif;margin-bottom:10px;}
.review-note p {white-space:pre-wrap;line-height:1.8;}
.reminder-details dd {margin-bottom:13px;}
.message-preview,.document-preview {background:var(--soft);border:1px solid var(--line);border-radius:6px;padding:20px;line-height:1.8;margin:18px 0;}
.document-preview h3 {font:500 1.3rem Georgia,serif;margin:24px 0 14px;}
.form-two-columns {display:grid;grid-template-columns:1fr 1fr;gap:14px;}
@media (min-width:1600px) {
  .next-body {padding:30px 25px;gap:23px;}
  .next-info h3 {font-size:1.9rem;}
  .appointment-row {padding-top:24px;padding-bottom:24px;}
}
@media (max-width:1340px) {
  :root {--sidebar-width:208px;}
  .topbar {gap:14px;padding:0 22px;}
  .profile>span:not(.avatar):not(.sr-only),.profile>.icon {display:none;}
  .practice-tab {padding:10px;font-size:.85rem;}
  .next-body {flex-wrap:wrap;}
  .next-actions {flex-direction:row;flex-basis:100%;padding:15px 0 0;border:0;border-top:1px solid var(--line-soft);}
  .next-actions .button {min-width:0;flex:1;}
  .today-grid {grid-template-columns:minmax(0,1.45fr) minmax(300px,1fr);}
  .forms-workspace {grid-template-columns:235px minmax(320px,1fr);}
  .preview-column {position:static;grid-column:2;}
  .template-library {grid-row:1 / span 2;}
  .phone-frame {max-width:320px;margin-left:auto;margin-right:auto;}
  .preview-panel {padding-bottom:0;}
  .note-content {grid-template-columns:1fr;}
  .soap-jumps {position:static;flex-direction:row;gap:3px;border-bottom:1px solid var(--line);padding-bottom:10px;}
  .soap-jumps button {padding:8px;font-size:.8rem;}
  .note-workspace {grid-template-columns:minmax(0,1.7fr) minmax(265px,1fr);}
  .identity-strip>.button-group {flex-direction:column;gap:7px;}
  .identity-strip>.button-group .button {min-height:35px;padding:7px 10px;}
  .identity-strip h2 {font-size:1.4rem;}

  .brand {gap:4px;padding:0 6px;}
  .brand>span:last-child {font-size:1.6rem;}
}
@media (min-width:1341px) and (max-width:1450px) {
  .forms-workspace {grid-template-columns:minmax(240px,.95fr) minmax(310px,1.2fr) minmax(250px,.95fr);}
  .next-body {gap:12px;}
  .next-body>.avatar {width:56px;height:56px;font-size:1.25rem;}
  .next-info h3 {font-size:1.5rem;}
  .next-info .badge {font-size:.8rem;}
  .next-actions {padding-left:12px;}
  .next-actions .button {min-width:118px;padding:9px;font-size:.8rem;}
  .appointment-row {gap:12px;}
}
@media (max-width:1100px) {
  .today-grid {grid-template-columns:minmax(0,1.3fr) minmax(280px,1fr);}
  .today-grid>:first-child {grid-column:1 / -1;}
  .today-aside {grid-row:2;}
  .appointment-row {display:grid;grid-template-columns:65px 1fr auto;gap:8px;margin:0 10px;padding:17px 8px;}
  .appointment-time {min-width:0;font-size:.82rem;grid-row:1 / span 2;align-self:start;padding-top:5px;}
  .appointment-row .schedule-dot {display:none;}
  .appointment-client {grid-column:2;}
  .appointment-row>.badge {grid-column:2;grid-row:2;justify-self:start;}
  .appointment-row>.icon-button {grid-column:3;grid-row:1 / span 2;}
  .agenda .panel-heading {flex-wrap:wrap;}
  .agenda .panel-heading h2 {white-space:nowrap;}
  .next-body {flex-wrap:nowrap;}
  .next-actions {flex-direction:column;flex-basis:auto;padding:0 0 0 16px;border-left:1px solid var(--line-soft);border-top:0;}
  .chart-layout {grid-template-columns:230px minmax(0,1fr);}
  .client-heading {flex-wrap:wrap;}
  .client-heading>.button-group {margin-left:0;flex-basis:100%;}
  .setup-grid {grid-template-columns:1fr;}
  .setup-grid>aside {display:grid;grid-template-columns:1fr 1fr;align-items:start;}
  .settings-grid {grid-template-columns:1fr;}
  .identity-strip {flex-wrap:wrap;}
  .identity-strip>.button-group {flex-direction:row;margin-left:0;}

}
@media (max-width:1000px) {
  :root {--sidebar-width:0px;--header-height:78px;}
  .sidebar {width:230px;transform:translateX(-100%);transition:transform .2s cubic-bezier(.22,1,.36,1);}
  .sidebar.is-open {transform:translateX(0);}
  .sidebar-scrim {position:fixed;inset:0;background:oklch(.2 .02 265 / .35);z-index:var(--z-overlay);}
  .workspace {margin-left:0;}
  .topbar .menu-toggle {display:inline-flex;}
  .topbar {padding:0 22px;gap:12px;}
  .notification-button {margin-left:0;}
  .global-search {max-width:none;}
  #main {padding:26px 24px 36px;}
  .app-footer {margin:0 24px;}
  .forms-workspace {grid-template-columns:250px minmax(0,1fr);}
}
@media (max-width:760px) {
  :root {--header-height:124px;}
  .topbar {height:124px;flex-wrap:wrap;gap:10px;padding:12px 18px;align-content:center;}
  .global-search {flex:1;order:1;min-width:0;}
  .topbar .menu-toggle {order:0;}
  .profile {order:2;}
  .profile .avatar {width:32px;height:32px;font-size:.8rem;}
  .notification-button {order:2;}
  .practice-tabs {order:3;width:100%;margin:0;padding-left:0;gap:9px;}
  .practice-tab {flex:1;min-height:36px;padding:7px 9px;font-size:.82rem;}
  .practice-tab .icon {width:16px;height:16px;}
  .global-search input {min-height:35px;font-size:.9rem;}
  .global-search .icon-button {width:28px;height:28px;}
  .global-search>.icon {width:18px;height:18px;}
  #main {padding:24px 18px 30px;}
  h1 {font-size:2.5rem;}
  .page-heading {align-items:flex-start;flex-direction:column;gap:16px;margin-bottom:22px;}
  .page-heading p {font-size:.9rem;line-height:1.7;}
  .heading-divider {display:none;}
  .page-heading p strong {display:block;}
  .today-grid,.today-aside {display:flex;flex-direction:column;}
  .next-body {flex-wrap:wrap;padding:21px 18px;gap:13px;}
  .next-body>.avatar {width:54px;height:54px;font-size:1.2rem;}
  .next-info h3 {font-size:1.55rem;}
  .next-actions {flex-basis:100%;flex-direction:row;border-left:0;border-top:1px solid var(--line-soft);padding:14px 0 0;gap:7px;flex-wrap:wrap;}
  .next-actions .button {font-size:.8rem;padding:8px 10px;}
  .next-actions .button:first-child {flex-basis:100%;}
  .panel-heading {padding:18px;flex-wrap:wrap;}
  .panel-heading h2 {font-size:1.35rem;}
  .next-appointment .panel-heading>.small {font-size:.8rem;}
  .appointment-row {display:grid;grid-template-columns:65px 1fr auto;gap:8px;margin:0 10px;padding:17px 8px;}
  .appointment-time {min-width:0;font-size:.82rem;grid-row:1 / span 2;align-self:start;padding-top:5px;}
  .appointment-time small {font-size:.8rem;}
  .appointment-row .schedule-dot {display:none;}
  .appointment-client {grid-column:2;}
  .appointment-client strong {font-size:.94rem;}
  .appointment-client span {font-size:.8rem;}
  .appointment-row>.badge {grid-column:2;grid-row:2;justify-self:start;}
  .appointment-row>.icon-button {grid-column:3;grid-row:1 / span 2;}
  .agenda .panel-heading {margin:0 18px;}
  .agenda .text-button {font-size:.8rem;}
  .attention-row {margin:0 18px;}
  .weekly-panel {width:100%;}
  .chart-layout {grid-template-columns:1fr;}
  .client-heading {gap:12px;}
  .client-heading>.avatar {width:52px;height:52px;font-size:1.2rem;}
  .client-heading>div:not(.button-group) {flex:1;min-width:0;}
  .client-heading h1 {font-size:2rem;}
  .client-heading p {font-size:.8rem;}
  .client-details {padding:20px;}
  .client-details dl {display:grid;grid-template-columns:75px 1fr;gap:10px;}
  .client-details dd {margin:0;font-size:.88rem;}
  .client-details h3 {margin-top:14px;}
  .list-toolbar {flex-wrap:wrap;gap:12px;padding:16px;}
  .search-field {flex-basis:100%;max-width:none;}
  .list-toolbar>select {width:150px;}
  th,td {padding:14px;font-size:.85rem;}
  table {min-width:620px;}
  .note-workspace {grid-template-columns:1fr;}
  .identity-strip {padding:15px;gap:11px;position:sticky;top:var(--header-height);border-radius:6px;}
  .identity-strip>.avatar {display:none;}
  .identity-strip h2 {font-size:1.28rem;}
  .identity-strip p {font-size:.8rem;}
  .identity-strip .identity-secondary {font-size:.8rem;}
  .identity-strip>.button-group {margin:0;}
  .identity-strip>.button-group .button {min-height:31px;padding:6px 9px;font-size:.8rem;}
  .identity-strip .name-line .badge {font-size:.8rem;}
  .identity-strip p>span {margin:0 5px;}
  .note-content {padding:17px 15px;gap:17px;}
  .soap-jumps {gap:0;justify-content:space-between;}
  .soap-jumps button {font-size:.8rem;padding:8px 5px;}
  .soap-section h2 {font-size:1.5rem;}
  .soap-section {scroll-margin-top:calc(var(--identity-height) + 12px);}
  .soap-section textarea {font-size:16px;line-height:1.7;padding:13px;}
  .editor-actions {padding:13px 15px;gap:11px;}
  .editor-actions>.button-group {margin-left:0;justify-content:space-between;width:100%;}
  .editor-actions .button {font-size:.85rem;padding:9px 12px;}
  .client-context {position:static;max-height:none;}
  .forms-workspace {display:flex;flex-direction:column;}
  .template-library,.form-editor,.preview-column {width:100%;}
  .template-library {max-height:295px;overflow:auto;}
  .template-library .panel-heading {position:sticky;top:0;z-index:1;background:var(--surface);}
  .template-item {padding:13px;}
  .template-item p {display:none;}
  .template-item small {display:inline-block;margin-right:10px;}
  .template-item .badge {margin-top:5px;}
  .forms-tabs>a {min-width:0;flex:1;font-size:.86rem;padding:11px;}
  .phone-frame {height:500px;}
  .preview-column {margin-top:5px;}
  .question-summary>span {font-size:.94rem;}
  .question-summary>small {font-size:.8rem;}
  .question-editor input,.question-editor select {font-size:16px;}
  .tabs {padding:0 10px;gap:4px;}
  .tabs>button,.tabs>a {font-size:.83rem;padding:12px 10px;}
  .history-row {gap:10px;padding:18px 15px;flex-wrap:wrap;}
  .history-row .document-symbol {display:none;}
  .history-row>.badge {align-self:start;}
  .record-row {padding:16px;gap:10px;flex-wrap:wrap;}
  .record-row>div,.record-row>span:not(.document-symbol):not(.badge):not(.avatar) {flex-basis:50%;}
  .record-row>.badge {font-size:.8rem;}
  .reference-section .record-row {flex-wrap:nowrap;}
  .filter-bar {flex-wrap:wrap;}
  .schedule-week {grid-template-columns:1fr;}
  .setup-grid>aside {display:flex;}
  .progress-panel {padding:20px;gap:18px;align-items:flex-start;}
  .progress-ring {width:97px;height:97px;padding:10px;}
  .progress-ring strong {font-size:1.3rem;}
  .progress-ring span {font-size:.8rem;}
  .progress-panel h2 {font-size:1.3rem;}
  .progress-panel p {font-size:.83rem;}
  .setup-row {padding:16px;}
  .settings-panel {padding:21px;}
  .settings-panel .record-row {flex-wrap:wrap;}
  .app-footer {margin:0 18px;flex-direction:column;gap:4px;font-size:.8rem;}
  dialog {max-height:calc(100dvh - 28px);}
  .dialog-body {padding:19px;}
  .dialog-heading,.dialog-footer {padding:15px 19px;}
  .dialog-heading h2 {font-size:1.35rem;}
  .dialog-footer .button {font-size:.84rem;padding:9px 12px;}
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after {scroll-behavior:auto !important;transition:none !important;animation:none !important;}
}

/* ===== Dashboard additions (frontend module). Same tokens; no inline styles anywhere (CSP). ===== */
:root {--focus:oklch(.43 .04 158);--warn:oklch(.43 .085 70);--warn-soft:oklch(.965 .03 85);}
.hint {font-weight:400;color:var(--muted);font-size:.8rem;}
.optional {font-weight:400;color:var(--muted);font-size:.8rem;}
.text-link {color:var(--primary);text-decoration:underline;text-underline-offset:3px;text-decoration-thickness:1px;}
.text-link:hover {text-decoration-thickness:2px;}
.error-text {color:var(--red);}
.error-text .icon,.field-error .icon {width:15px;height:15px;margin-right:4px;}
.danger-text {color:var(--red);}
.plain-list {list-style:none;padding:0;}
.plain-list.bullets {list-style:disc;padding-left:20px;}
.plain-list.bullets li {margin:6px 0;}
code {font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.9em;}

/* Interaction states */
.button:active,.small-button:active {transform:translateY(1px);}
.button.primary:active,.small-button.primary:active {background:oklch(.32 .04 158);}
.button.danger:hover {background:oklch(.93 .03 25);border-color:var(--red);}
.primary-soft:hover {background:var(--sage-mid);border-color:var(--sage-mid);}
.icon-button:active {background:var(--sage-mid);}
.practice-tab:hover:not(.active):not([aria-pressed=true]) {border-color:var(--sage-mid);color:var(--ink);background:var(--surface);}
.practice-tab[aria-pressed=true] {color:white;background:var(--primary);border-color:var(--primary);box-shadow:0 0 0 3px var(--sage);}
.text-button:active {opacity:.75;}
input:hover:not(:disabled):not(:focus),select:hover:not(:disabled):not(:focus),textarea:hover:not(:disabled):not(:focus):not([readonly]) {border-color:oklch(.5 .015 265);}
input:focus-visible,select:focus-visible,textarea:focus-visible {outline:2px solid var(--focus);outline-offset:1px;}
input:disabled,select:disabled,textarea:disabled {background:var(--soft);color:var(--muted);cursor:not-allowed;}
textarea[readonly] {background:var(--soft);}
[aria-invalid=true] {border-color:var(--red) !important;}
[aria-invalid=true]:focus-visible {outline-color:var(--red);}
.field-error {display:flex;align-items:center;color:var(--red);font-size:.82rem;font-weight:500;}
[aria-busy=true].button,[aria-busy=true].small-button {position:relative;color:transparent !important;}
[aria-busy=true].button::after,[aria-busy=true].small-button::after {content:'';position:absolute;inset:0;margin:auto;width:16px;height:16px;border-radius:50%;border:2px solid currentColor;border-color:var(--muted) transparent var(--muted) transparent;animation:spin .8s linear infinite;}
[aria-busy=true].button.primary::after,[aria-busy=true].small-button.primary::after {border-color:white transparent white transparent;}
@keyframes spin {to {transform:rotate(360deg);}}
.icon.spin {animation:spin 1s linear infinite;}
.checkbox-label {display:flex;flex-direction:row;align-items:center;gap:9px;font-weight:400;cursor:pointer;}
.checkbox-label input {margin:0;}
.confirm-check {margin-top:16px;padding:12px 14px;border:1px solid var(--line);border-radius:6px;background:var(--soft);font-weight:500;align-items:flex-start;}
.confirm-check input {margin-top:2px;}
fieldset {border:0;padding:0;margin:0;min-width:0;}
legend {font-size:.9rem;font-weight:500;padding:0;margin-bottom:8px;}
.checkbox-group {display:flex;flex-direction:column;gap:8px;}
.form-three-columns {display:grid;grid-template-columns:repeat(3,1fr);gap:10px;}
.inline-select select {width:170px;}

/* Notices, loading, errors */
.inline-notice.warn {color:var(--warn);background:var(--warn-soft);}
.inline-notice>div p {margin-top:4px;}
.inline-notice ul {margin:6px 0;}
.loading-state {display:flex;align-items:center;justify-content:center;gap:10px;padding:60px 20px;color:var(--muted);}
.loading-inline {display:flex;align-items:center;gap:8px;color:var(--muted);margin:10px 0;}
.error-state {text-align:center;padding:50px 20px;}
.error-state>.icon {width:30px;height:30px;color:var(--red);}
.error-state h2 {margin:8px 0;}
.error-state p {color:var(--muted);margin-bottom:18px;}
.form-alert {display:flex;gap:10px;align-items:flex-start;border-radius:6px;padding:12px 14px;margin-bottom:18px;font-size:.9rem;}
.form-alert[hidden] {display:none;}
.form-alert.error {background:var(--red-soft);color:var(--red);}
.form-alert.warn {background:var(--warn-soft);color:var(--warn);}
.form-alert.info {background:var(--sage);color:var(--primary);}
.form-alert .icon {width:18px;height:18px;margin-top:1px;}
.toast[data-tone=error] {background:var(--red);}
.panel-actions {display:flex;gap:10px;flex-wrap:wrap;padding:14px 22px 20px;}
.quiet-message .icon,.panel-footnote .icon,.setup-context .icon {width:16px;height:16px;margin-right:6px;}

/* Sign-in screens */
.auth-screen {min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;padding:40px 18px;background:linear-gradient(180deg,var(--sage) 0,var(--bg) 60%);max-width:none;}
.auth-card {width:min(440px,100%);background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:32px 30px;box-shadow:0 10px 30px oklch(.25 .03 265 / .06);}
.auth-card h1 {font-size:2rem;margin-bottom:10px;}
.auth-brand {display:flex;align-items:center;gap:8px;margin-bottom:26px;font:500 1.25rem/1.2 Georgia,serif;}
.auth-brand small {display:block;font:500 .6rem/1.4 -apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;letter-spacing:.07em;color:var(--muted);margin-top:3px;}
.auth-brand .brand-leaves .icon {width:28px;height:34px;}
.auth-lead {color:var(--muted);margin-bottom:18px;line-height:1.6;}
.auth-form {display:flex;flex-direction:column;gap:16px;}
.auth-form .button {margin-top:4px;}
.auth-links {display:flex;justify-content:space-between;flex-wrap:wrap;gap:10px;margin-top:18px;}
.auth-links .text-button {min-height:32px;}
.auth-footnote {display:flex;align-items:center;gap:7px;color:var(--muted);font-size:.8rem;text-align:center;}
.auth-footnote .icon {width:15px;height:15px;}
.password-field {position:relative;display:flex;}
.password-field input {padding-right:66px;}
.password-field .reveal {position:absolute;right:6px;top:50%;transform:translateY(-50%);min-height:30px;padding:0 8px;border-radius:4px;}
.password-field .reveal:hover {background:var(--sage);text-decoration:none;}
.code-input {font-size:1.3rem;letter-spacing:.3em;font-variant-numeric:tabular-nums;max-width:220px;}
.enroll-steps {padding-left:20px;display:flex;flex-direction:column;gap:20px;}
.enroll-steps li>p {color:var(--muted);font-size:.88rem;margin:6px 0 10px;}
.enroll-steps form {margin-top:10px;}
.qr {display:block;width:184px;height:184px;border:1px solid var(--line);border-radius:8px;padding:6px;background:white;image-rendering:pixelated;}
.secret-key {display:flex;align-items:center;flex-wrap:wrap;gap:10px;}
.secret-key code {background:var(--soft);border:1px solid var(--line);padding:6px 9px;border-radius:5px;word-break:break-all;}
.recovery-codes {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:14px 14px 14px 34px;margin:0 0 14px;background:var(--soft);border:1px solid var(--line);border-radius:8px;}
.recovery-codes code {font-size:.95rem;}

/* Shell */
.signed-in {margin:18px 8px 22px;border-top:1px solid var(--line);padding-top:16px;display:flex;flex-direction:column;gap:3px;font-size:.8rem;overflow-wrap:anywhere;}
.signed-in strong {font-weight:500;}
.signed-in .text-button {justify-content:flex-start;margin-top:8px;min-height:32px;color:var(--muted);}
.signed-in .text-button:hover {color:var(--red);}
.sidebar-scrim[hidden] {display:none;}
.notification-button span[hidden] {display:none;}
.profile:hover strong {color:var(--primary);}
.profile:focus-visible {border-radius:6px;}
#main:focus {outline:none;}

/* Today */
.heading-tools {display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end;}
.sync-line {display:inline-flex;align-items:center;gap:6px;color:var(--muted);font-size:.8rem;}
.sync-line .icon {width:15px;height:15px;}
.sync-line.is-failed {color:var(--red);font-weight:500;}
.appointment-row.is-inactive .appointment-time,.appointment-row.is-inactive .appointment-client strong {color:var(--muted);text-decoration:line-through;text-decoration-thickness:1px;}
.appointment-row:hover:not(.is-next) {background:var(--soft);border-radius:6px;}
.attention-panel:focus-visible {outline:2px solid var(--focus);outline-offset:2px;}
.setup-teaser .quiet-message {padding:16px 22px 0;}
.setup-teaser .panel-heading {flex-wrap:wrap;}
.setup-teaser h2 {white-space:nowrap;}
/* Today renders the teaser twice: side column on wider screens, after the schedule on phones. */
.today-grid>.setup-teaser {display:none;}
@media (max-width:760px) {.today-aside>.setup-teaser {display:none;} .today-grid>.setup-teaser {display:block;}}
.appointment-client .overlap-note,.calendar-appointment>.overlap-note {display:flex;align-items:flex-start;gap:5px;color:var(--gold);font-size:.8rem;font-weight:500;}
.overlap-note .icon {width:14px;height:14px;margin-top:2px;}
.review-list {margin-top:14px;border-top:1px solid var(--line-soft);}
.review-list .record-row {padding:12px 0;}
.date-controls a[aria-current] {border-color:var(--primary);color:var(--primary);}

/* Lists and rows */
.row-actions {display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end;}
.badge-stack {display:flex;flex-direction:column;gap:6px;align-items:flex-end;}
.badge-row {display:flex;gap:6px;flex-wrap:wrap;margin:5px 0;}
.record-row:focus-visible,.history-row:focus-visible,.calendar-appointment:focus-visible {outline-offset:-2px;}
.submission-row {cursor:pointer;}
.message-body {white-space:pre-wrap;overflow-wrap:anywhere;font-size:.88rem;}
.message-row>div {min-width:0;}
.results-count {padding:12px 20px 0;}
#client-results[aria-busy=true] {opacity:.6;}
.tab-count {display:inline-grid;place-items:center;min-width:20px;height:20px;border-radius:10px;background:var(--gold-soft);color:var(--gold);font-size:.8rem;padding:0 5px;}
.tab-panel[hidden] {display:none;}
.calendar-appointment {transition:background .15s;}
.calendar-appointment:hover {background:var(--sage-mid);}
.calendar-appointment.is-inactive {background:var(--soft);}
.calendar-appointment.is-inactive:hover {background:var(--line-soft);}
.calendar-appointment.is-inactive>strong,.calendar-appointment.is-inactive>span:not(.badge) {text-decoration:line-through;color:var(--muted);}
.schedule-day.is-today {border-color:var(--primary);}
.schedule-week {grid-template-columns:minmax(0,1fr);gap:14px;}
.schedule-day {display:grid;grid-template-columns:170px minmax(0,1fr);}
.schedule-day>.panel-heading {flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:8px;border-bottom:0;border-right:1px solid var(--line-soft);}
.schedule-items {display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px;padding:14px;align-items:start;}
.schedule-items .calendar-appointment {width:auto;margin:0;}
.schedule-items>.quiet-message {padding:6px 4px;}
@media (max-width:760px) {
  .schedule-day {grid-template-columns:minmax(0,1fr);}
  .schedule-day>.panel-heading {flex-direction:row;align-items:center;justify-content:space-between;border-right:0;border-bottom:1px solid var(--line-soft);}
}
.setup-context {display:flex;align-items:center;}

/* Chart */
.details-heading {display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:20px;}
.details-heading h2 {margin:0;}
.client-heading .name-line h1 {overflow-wrap:anywhere;}
.match-body {padding:18px 22px;}
.match-body h3 {margin:16px 0 4px;}
.match-body .record-row {padding:14px 0;}
.match-card {margin-bottom:18px;}
.inline-dl {display:grid;grid-template-columns:auto 1fr;gap:6px 16px;margin:12px 0;}
.inline-dl dt {margin:0;}
.inline-dl dd {margin:0;}

/* Visit workspace */
.soap-section h2 label {display:inline;font:inherit;cursor:text;}
.signed-content {white-space:pre-wrap;overflow-wrap:anywhere;}
.signed-banner .hash {font-size:.8rem;color:var(--muted);}
.lock-line {display:flex;align-items:center;gap:7px;color:var(--primary);font-size:.86rem;font-weight:500;}
.lock-line .icon {width:16px;height:16px;}
.addendum {margin-top:16px;padding:15px;background:var(--sage);border-radius:6px;}
.addendum p {white-space:pre-wrap;margin-top:8px;overflow-wrap:anywhere;}
.addendum-meta {display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.addendum-meta .icon {width:15px;height:15px;color:var(--primary);}
.addendum-meta small {color:var(--muted);}
.addendum-editor {margin-top:18px;border:1px solid var(--line);border-radius:6px;padding:15px;display:flex;flex-direction:column;gap:10px;}
.addendum-editor textarea {min-height:120px;line-height:1.7;}
.addendum-actions {display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;}
.reference-item {display:flex;justify-content:space-between;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid var(--line-soft);}
.reference-item strong,.reference-item small {display:block;}
.reference-item strong {font-size:.85rem;}
.reference-item small {font-size:.8rem;color:var(--muted);}
.reference-section>.text-button {margin-top:10px;}
.reference-section summary:hover {background:var(--sage);border-radius:6px;}
.reference-section details[open] summary>.icon {transform:rotate(180deg);}
.reference-excerpt strong {color:var(--ink);font-weight:600;}
.review-note .muted,.signed-content .muted {font-style:italic;}
.editor-actions .text-button {min-height:36px;padding:0 6px;}

/* Forms */
.forms-tabs>a {display:flex;align-items:center;justify-content:center;gap:9px;min-height:48px;padding:13px 15px;color:var(--muted);}
.template-grid {display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));}
.template-grid .template-item {border-right:1px solid var(--line-soft);}
.template-item>a:hover strong {color:var(--primary);text-decoration:underline;text-underline-offset:3px;}
.template-item>a {padding:4px;border-radius:5px;}
.question-item.is-section {border-color:var(--sage-mid);background:var(--sage);}
.question-item.has-error {border-color:var(--red);}
.question-item .error-icon {color:var(--red);width:15px;height:15px;}
.question-summary[aria-expanded=true]>.icon:last-child {transform:rotate(180deg);}
.question-editor textarea {font-size:.83rem;min-height:0;}
.question-editor .field-error {margin-top:2px;}
.add-row {display:flex;gap:0;}
.add-row .add-question {flex:1;margin-right:8px;}
.add-row .add-question:last-child {margin-left:0;}
.form-settings fieldset,.form-settings .checkbox-label {margin-bottom:17px;}
.form-publish .text-button {margin-top:8px;}
.form-publish .save-status {font-size:.8rem;}
.client-form legend,.client-form label>span {font-size:.8rem;font-weight:500;}
.client-form fieldset {margin:11px 0;}
.pv-item {margin:4px 0;}
.pv-item>label {margin:11px 0 6px;}
.pv-choice {flex-direction:row !important;align-items:center;gap:8px !important;margin:6px 0 !important;font-weight:400;}
.pv-choice input {width:16px;min-height:16px;height:16px;padding:0;accent-color:var(--primary);}
.pv-help {display:block;font-size:.8rem;color:var(--muted);font-weight:400;}
.pv-info h4,.pv-consent h4 {font-size:.8rem;margin:12px 0 4px;}
.pv-info p,.pv-consent p {font-size:.8rem;white-space:pre-wrap;color:var(--muted);}
.pv-consent p {max-height:120px;overflow:auto;border:1px solid var(--line);border-radius:4px;padding:6px;}
.pv-pager {display:flex;justify-content:space-between;align-items:center;gap:6px;margin:16px 0 8px;}
.pv-pager .small-button {margin:0;min-height:32px;}
.form-answers .answers-section {font:500 1.15rem/1.4 Georgia,serif;margin:22px 0 10px;border-bottom:1px solid var(--line-soft);padding-bottom:6px;}
.form-answers .answer {margin-bottom:18px;}
.form-answers h4 {font-size:.9rem;margin-bottom:5px;}
.form-answers .answer p {color:var(--ink);white-space:pre-wrap;}
.form-answers .answer .icon {width:16px;height:16px;color:var(--primary);margin-right:4px;}
.consent-text {white-space:pre-wrap;font-size:.84rem;color:var(--muted);max-height:220px;overflow:auto;}
.signature-block {display:flex;gap:12px;align-items:flex-start;border:1px solid var(--line);border-radius:6px;padding:14px;background:var(--soft);margin-top:10px;}
.signature-block strong,.signature-block small {display:block;}
.signature-block small {color:var(--muted);margin-top:3px;overflow-wrap:anywhere;}
.request-meta {font-size:.88rem;margin-bottom:18px;}
.request-meta dt {color:var(--muted);}

/* Jane import */
.import-grid {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:22px;align-items:start;}
.import-main {display:flex;flex-direction:column;gap:22px;}
.import-intro {margin:0;}
.import-intro h2,.import-history>h2,.settings-panel h2 {display:flex;align-items:center;gap:10px;}
.upload-form,.dry-run-form {display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end;}
.upload-form label,.dry-run-form label {flex:1 1 200px;}
.upload-form label {align-self:flex-start;}
.dry-run-form {padding:16px 22px 0;}
input[type=file] {padding:7px;cursor:pointer;}
input[type=file]::file-selector-button {font:inherit;border:1px solid var(--line);border-radius:5px;background:var(--soft);padding:5px 10px;margin-right:10px;cursor:pointer;}
.upload-progress {display:flex;flex-direction:column;gap:6px;margin-top:16px;}
.upload-progress[hidden] {display:none;}
progress {width:100%;height:10px;accent-color:var(--primary);}
.upload-row input[type=checkbox] {flex:0 0 auto;}
.checkbox-spacer {visibility:hidden;}
.file-checklist {display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:8px;margin:4px 0 18px;}
.file-checklist li {display:flex;justify-content:space-between;align-items:center;gap:10px;border:1px solid var(--line);border-radius:6px;padding:8px 10px;}
.file-checklist li>span {min-width:0;}
.file-checklist strong,.file-checklist small {display:block;}
.file-checklist strong {font-size:.86rem;font-weight:500;}
.file-checklist small {color:var(--muted);font-size:.8rem;overflow-wrap:anywhere;}
.upload-form .drop-zone {flex-basis:100%;}
.drop-box {position:relative;display:flex;align-items:center;justify-content:center;gap:10px;min-height:88px;padding:16px;border:1.5px dashed var(--field-line);border-radius:6px;background:var(--surface);color:var(--muted);font-weight:400;text-align:center;overflow-wrap:anywhere;transition:border-color .16s,background .16s;}
.drop-box:hover,.drop-box.dragging {border-color:var(--primary);background:var(--sage);}
.drop-box:has(input:focus-visible) {outline:2px solid var(--focus);outline-offset:1px;}
.drop-box:has([aria-invalid=true]) {border-color:var(--red);}
.drop-box:has(input:disabled) {opacity:.6;}
.drop-box input[type=file] {position:absolute;inset:0;width:100%;height:100%;min-height:0;padding:0;opacity:0;cursor:pointer;}
.drop-box input[type=file]:disabled {cursor:not-allowed;}
.drop-link {color:var(--primary);text-decoration:underline;text-underline-offset:3px;}
.upload-progress-head {display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;}
.import-history {display:flex;flex-direction:column;gap:16px;}
.import-history>h2 {margin-bottom:2px;}
.import-run .panel-heading {flex-wrap:wrap;}
.import-run h3 {font:500 1.2rem/1.3 Georgia,serif;}
.run-body {padding:16px 22px;}
.report-note {display:flex;gap:8px;align-items:center;color:var(--primary);background:var(--sage);border-radius:6px;padding:10px 12px;font-size:.86rem;margin:10px 0;}
.report-note .icon {width:16px;height:16px;}
.report-section {margin-top:16px;}
.report-section h4 {font-size:.95rem;margin-bottom:8px;}
.report-counts {display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:8px;}
.report-counts>div {border:1px solid var(--line);border-radius:6px;padding:8px 10px;}
.report-counts dt {margin:0;font-size:.8rem;}
.report-counts dd {margin:0;font:500 1.3rem Georgia,serif;}
.report-section details {margin-top:8px;}
.report-section summary {cursor:pointer;font-size:.88rem;padding:6px 0;}
.row-issues {font-size:.82rem;color:var(--muted);padding:6px 0;}
.row-issues li {overflow-wrap:anywhere;}
.row-issues strong {color:var(--ink);font-weight:500;}
.warnings li {display:flex;gap:6px;align-items:center;color:var(--warn);font-size:.86rem;margin-top:6px;}
.warnings .icon {width:15px;height:15px;}

/* Settings */
.settings-column {display:flex;flex-direction:column;gap:22px;}
.settings-panel form {display:flex;flex-direction:column;gap:15px;margin:16px 0 10px;}
.settings-panel>p .badge {margin-right:6px;}
.settings-panel h3 {margin-bottom:6px;}
.practice-settings {border:1px solid var(--line);border-radius:7px;margin-top:14px;}
.practice-settings summary {display:flex;justify-content:space-between;align-items:center;gap:10px;padding:14px 16px;cursor:pointer;}
.practice-settings summary:hover {background:var(--soft);}
.practice-settings summary strong,.practice-settings summary small {display:block;}
.practice-settings summary small {color:var(--muted);font-size:.8rem;}
.practice-settings[open] summary>.icon {transform:rotate(180deg);}
.practice-settings form {padding:0 16px 16px;margin:0;}
.sms-settings {display:flex;flex-direction:column;gap:12px;border-top:1px solid var(--line-soft);padding-top:14px;}
.sms-preview {margin:0;font-size:.88rem;line-height:1.6;}
.sms-preview small {display:flex;align-items:center;margin-top:6px;}
.sms-count {color:var(--muted);}

/* Dialogs */
.idle-dialog {width:min(460px,calc(100vw - 32px));}
.countdown {font-variant-numeric:tabular-nums;color:var(--ink);}
.dialog-body .dialog-person .text-link {font-weight:600;}
.dialog-body>.inline-notice:first-child {margin-top:0;}
.reminder-details {display:grid;grid-template-columns:auto 1fr;gap:6px 16px;}
.reminder-details dt {margin:0;}
.reminder-details dd {margin:0;overflow-wrap:anywhere;}
.message-preview {white-space:pre-wrap;overflow-wrap:anywhere;}
.reading-dialog .dialog-body p .icon {width:15px;height:15px;}

@media (max-width:1100px) {
  .import-grid {grid-template-columns:1fr;}
}
@media (max-width:760px) {
  .heading-tools {justify-content:flex-start;}
  .row-actions {justify-content:flex-start;flex-basis:100%;}
  .badge-stack {flex-direction:row;align-items:center;}
  .recovery-codes {grid-template-columns:1fr;}
  .auth-card {padding:24px 20px;}
  .auth-card h1 {font-size:1.7rem;}
  .form-two-columns,.form-three-columns {grid-template-columns:1fr;}
  .row-issues {columns:1;}
  .template-grid {grid-template-columns:1fr;}
  .add-row {flex-direction:column;}
  .add-row .add-question {margin:6px 16px;width:calc(100% - 32px);}
  .inline-select select {width:100%;}
  .inline-select {flex:1 1 140px;}
  .signed-in {margin:14px 8px;}
  .identity-strip p>span {margin:0 4px;}
}
@media (max-width:420px) {
  h1 {font-size:2.05rem;}
  .client-heading h1 {font-size:1.7rem;}
  .practice-tab span {font-size:.8rem;}
  .practice-tab {padding:7px 6px;gap:6px;}
  .practice-tab .icon {display:none;}
  .topbar {padding:10px 12px;}
  #main {padding:20px 12px 28px;}
  .app-footer {margin:0 12px;}
  .next-actions .button {flex:1 1 100%;}
  .editor-actions>.button-group .button {flex:1 1 auto;}
  .identity-strip>.button-group {flex-wrap:wrap;}
  .dialog-footer .button {flex:1 1 auto;}
  .code-input {max-width:none;}
}
.message-details summary {cursor:pointer;color:var(--primary);font-size:.84rem;margin-top:6px;width:max-content;min-height:24px;}
.message-details summary:hover {text-decoration:underline;text-underline-offset:3px;}
.message-details[open] .message-body {background:var(--soft);border:1px solid var(--line-soft);border-radius:6px;padding:12px;}
input[type=file] {padding:4px 6px;min-height:39px;}
input[type=file]::file-selector-button {padding:4px 10px;}
.reference-section .document-row {flex-wrap:wrap;}
.reference-section .document-row>div {flex:1 1 140px;}
.reference-section .document-row .row-actions {flex-basis:100%;justify-content:flex-start;padding-left:37px;}
.chart-main .tabs {flex-wrap:wrap;column-gap:4px;}
/* Phones: the top bar scrolls away so the sticky identity strip and the save bar keep the writing space. */
@media (max-width:760px) {
  :root {--header-height:0px;}
  .topbar {position:relative;}
  .identity-strip {top:0;}
}
@media (max-width:760px) {
  .import-intro,.run-body {padding:18px;}
  .dry-run-form {padding:16px 18px 0;}
}
/* Long dialogs scroll their body; heading and actions stay in view. */
dialog[open] {display:flex;flex-direction:column;overflow:hidden;}
dialog .dialog-heading,dialog .dialog-footer {flex:0 0 auto;}
dialog .dialog-body {flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;}

/* ===== Shell accessibility (UX-122, 125, 132, 133, 135) ===== */
.sidebar-close {display:none;}
.empty-state h1 {font-size:1.55rem;}
.empty-state .button-group {justify-content:center;}
.discard-check {align-items:center;flex-wrap:wrap;}
.discard-check>span:first-of-type {flex:1;}
/* Standalone text controls get at least a 24px target (WCAG 2.5.8). */
.text-button,.back-link,.message-details summary {min-height:24px;}
/* Empty WebKit date fields show today's date as grey placeholder text, which reads as a real date. */
@supports (font:-apple-system-body) { /* WebKit only: Chromium shows a useful mm/dd/yyyy hint instead */
  input[type=date][data-empty] {-webkit-text-fill-color:transparent;}
}
input[type=date]:focus {outline:2px solid var(--focus);outline-offset:1px;border-color:var(--primary);}
@media (max-width:760px) {
  .heading-tools .sync-line {flex-basis:100%;} /* Sync now and Week share the next row instead of Week wrapping alone */
}
@media (max-width:1000px) {
  .sidebar-close {display:inline-flex;align-self:flex-end;margin:-20px -4px 6px 0;}
}
/* Touch screens: 44px targets and no hover state left behind after a tap; rows answer the tap instead. */
@media (pointer:coarse) {
  .icon-button {width:44px !important;height:44px !important;}
  .button,.small-button,.practice-tab,.segmented button,.tabs>button,.tabs>a,.soap-jumps button,.text-button,.back-link,summary,
  input:not([type=checkbox]):not([type=radio]),select,.profile,.person-cell {min-height:44px !important;}
  .profile {min-width:44px;justify-content:center;}
  .text-button,.back-link {padding-inline:4px;}
  input[type=checkbox],input[type=radio] {width:24px !important;height:24px !important;min-height:24px !important;}
  .soap-jumps button,.text-button {min-width:44px;}
  .question-summary {min-height:44px;}
  /* Standalone text links (document titles, client names, email): a 44px tap area without changing the layout. */
  .text-link {position:relative;}
  .text-link::after {content:'';position:absolute;left:-4px;right:-4px;top:50%;height:44px;transform:translateY(-50%);}
}
@media (hover:none) {
  .icon-button:hover:not(:active),.history-row:hover,.record-row:hover,.appointment-row:hover:not(.is-next),.nav-item:hover:not(.active),
  .tabs>button:hover:not(.active),.tabs>a:hover:not(.active),.segmented button:hover:not(.active) {background:none;}
  .button:hover:not(.primary):not(.danger),.small-button:hover:not(.primary) {background:var(--surface);border-color:var(--line);}
  .reference-section summary:hover:not(:active),.setup-row:hover:not(:active),.question-summary:hover:not(:active),.practice-settings summary:hover:not(:active) {background:none;}
  .soap-jumps button:hover:not(:focus-visible):not(:active) {background:none;color:var(--muted);}
  .primary-soft:hover:not(:active) {background:var(--sage);border-color:var(--sage);}
  .button.danger:hover:not(:active) {background:var(--red-soft);border-color:oklch(.77 .07 25);}
  .practice-tab:hover:not(.active):not([aria-pressed=true]) {border-color:var(--line);color:var(--muted);background:var(--soft);}
  .calendar-appointment:hover:not(:active) {background:var(--sage);}
  .calendar-appointment.is-inactive:hover:not(:active) {background:var(--soft);}
  .history-row:active,.record-row:active,.appointment-row:active,.calendar-appointment:active,.icon-button:active,
  .soap-jumps button:active,.reference-section summary:active,.setup-row:active,.question-summary:active,.practice-settings summary:active {background:var(--sage-mid);}
}
/* Forced colors: keep the selected practice, filter, tab and section visible. */
@media (forced-colors:active) {
  .practice-tab[aria-pressed=true],.segmented button[aria-pressed=true],.tabs>button[aria-pressed=true],.tabs>a.active,.nav-item.active,.date-controls a[aria-current] {
    forced-color-adjust:none;background:Highlight;color:HighlightText;border-color:Highlight;}
  .tabs>button:not([aria-pressed=true]),.tabs>a:not(.active) {border-bottom-color:Canvas;}
  .toast,.dialog-toast.visible {border:1px solid CanvasText;}
}
/* Form requests and messages */
.segmented button {white-space:nowrap;}
.message-row>.badge-stack {flex:none;}
.message-details summary {display:flex;align-items:center;gap:4px;list-style:none;}
.message-details summary::-webkit-details-marker {display:none;}
.message-details summary .icon {width:15px;height:15px;transition:transform .15s;}
.message-details[open] summary .icon {transform:rotate(180deg);}
.record-row .reminder-state {display:flex;align-items:flex-start;gap:5px;}
.reminder-state .icon {width:14px;height:14px;margin-top:1px;}
.answers-so-far {display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:22px;}
.answers-so-far h3 {font:500 1.15rem/1.4 Georgia,serif;}
.scheduled-reminders {margin-bottom:22px;}
.message-row small,.scheduled-reminders small {overflow-wrap:anywhere;}
.toast-action {pointer-events:auto;margin-left:12px;padding:5px 12px;border:1px solid currentColor;border-radius:6px;background:none;color:inherit;font:inherit;font-weight:600;cursor:pointer;}
.toast-action:focus-visible {outline:2px solid white;outline-offset:2px;}
@media (pointer:coarse) {
  .message-row small .text-link,.scheduled-reminders small .text-link,.toast-action {display:inline-flex;align-items:center;min-height:44px;}
}
@media (max-width:760px) {
  .submission-row {display:grid;grid-template-columns:auto minmax(0,1fr) auto;column-gap:10px;row-gap:6px;}
  .submission-row>.document-symbol {grid-row:span 2;align-self:start;}
  .submission-row>.badge {grid-column:2;justify-self:start;}
  .submission-row>.icon {grid-column:3;grid-row:1 / span 2;align-self:center;}
}
@media (max-width:420px) {
  .filter-bar .segmented {width:100%;}
  .filter-bar .segmented button {flex:1 1 auto;padding:7px 8px;}
}
/* Visit workspace: sticky chrome uses measured heights (visit.js sets --identity-height and --actions-height),
   shrinks on short or narrow screens and stops being sticky when there is no room (UX-001, UX-003, UX-010). */
html:has(.note-workspace) {scroll-padding:calc(var(--header-height) + var(--identity-height) + 12px) 0 calc(var(--actions-height, 0px) + 12px);}
.note-workspace .soap-section {scroll-margin-top:0;}
.identity-strip {top:var(--header-height);}
.soap-section textarea {field-sizing:content;}
.soap-jumps,.client-context {top:calc(var(--header-height) + var(--identity-height) + 20px);}
.client-context {max-height:calc(100dvh - var(--header-height) - var(--identity-height) - 116px);}
.client-context>.panel-heading {position:sticky;top:0;z-index:1;background:var(--surface);flex-wrap:wrap;gap:4px 12px;}
.reference-jumps {display:flex;flex-wrap:wrap;gap:0 12px;flex-basis:100%;}
.reference-jumps .text-button {font-size:.8rem;min-height:28px;}
.reference-subheading {font-size:.8rem;font-weight:600;color:var(--muted);margin:16px 0 8px;}
.reference-excerpt p {white-space:pre-wrap;overflow-wrap:anywhere;}
.reference-answers {padding:6px 0 12px;border-bottom:1px solid var(--line-soft);}
.reference-answers .form-answers .answers-section {font-size:1rem;}
.reference-answers .form-answers .answer {margin-bottom:12px;}
.reference-answers .form-answers h4 {font-size:.82rem;}
.reference-answers .form-answers .answer p {font-size:.86rem;margin-bottom:0;}
/* Form answers: section jumps and the full-page view (UX-002). */
.answers-jumps {display:flex;flex-wrap:wrap;gap:0 12px;margin-bottom:8px;}
.answers-jumps .text-button {font-size:.8rem;min-height:28px;text-align:left;}
.answers-links {display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px;margin-top:10px;}
.answers-links .text-button .icon {width:14px;height:14px;margin-left:4px;}
:is(.reference-answers,.responses-page) .chart-diff .small-button {white-space:normal;text-align:left;}
.responses-page {padding:20px 24px;max-width:860px;}
.responses-page .answers-section {scroll-margin-top:12px;}
@media print {
  body:has(.responses-page) :is(.sidebar,.topbar,.app-footer,.answers-jumps,.chart-diff .small-button) {display:none;}
  body:has(.responses-page) .workspace {margin-left:0;}
  .responses-page {border:0;padding:0;max-width:none;}
}
/* The save bar stays one row when the status fits beside the buttons, else the status takes its own row. */
.editor-actions>.save-status {flex:1 1 180px;min-width:0;}
.editor-actions>.button-group {flex-wrap:nowrap;}
@media (max-width:1340px) {
  /* "Discard draft" keeps its accessible name (and tooltip) but shows only the icon. */
  .editor-actions .button-label {position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;}
  .editor-actions .text-button {min-width:44px;justify-content:center;}
}
@media (min-width:761px) and (max-width:1000px) {
  .editor-actions>.button-group {width:auto;margin-left:auto;}
}
@media (min-width:761px) and (max-width:1340px) and (min-height:481px) {
  .soap-jumps {position:sticky;z-index:2;top:calc(var(--header-height) + var(--identity-height));background:var(--surface);}
  /* The stuck jump row is also covered space: focus and caret scrolling keep the line below it (UX-001). */
  html:has(.note-workspace) {scroll-padding-top:calc(var(--header-height) + var(--identity-height) + var(--jumps-height, 45px) + 12px);}
}
@media (max-width:1000px), (max-height:820px) {
  .identity-strip {padding:9px 14px;gap:6px 14px;margin-bottom:14px;}
  .identity-strip>.avatar,.identity-strip .name-line .badge {display:none;}
  .identity-strip h2 {font-size:1.2rem;}
  .identity-strip p {margin-top:1px;}
  .identity-strip>.button-group {flex-direction:row;gap:7px;}
  .identity-strip>.button-group .button {min-height:32px;padding:5px 10px;font-size:.8rem;}
  .editor-actions {padding-top:10px;padding-bottom:10px;row-gap:6px;}
}
@media (min-width:761px) and (max-width:1000px), (min-width:761px) and (max-width:1100px) and (max-height:820px) {
  .identity-strip {flex-wrap:nowrap;}
  .identity-strip>.button-group {margin-left:auto;}
}
@media (min-width:1001px) and (max-height:820px) {
  .identity-strip>div>p:not(.identity-alert) {display:inline;}
  .identity-strip>div>p:not(.identity-alert)+p:not(.identity-alert)::before {content:'·' / '';margin:0 8px;}
}
@media (max-width:760px) {
  /* Name and buttons share the first row. When the name's longest word does not fit beside the buttons, they wrap under it,
     so a long name breaks at spaces and hyphens, not mid-word. */
  .identity-strip {display:flex;flex-wrap:wrap;align-items:center;}
  .identity-strip>div:not(.button-group) {display:contents;}
  .identity-strip .name-line {flex:1 1 0;max-width:100%;}
  .identity-strip>.button-group {margin-left:auto;}
  .identity-strip p {order:1;flex-basis:100%;}
  .identity-strip h2 {overflow-wrap:break-word;}
  .identity-strip .identity-secondary {display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;} /* clips a long legal name only */
  .client-context {max-height:none;} /* stacked under the editor: no inner scroll */
  /* "View client" keeps its accessible name but shows only the icon. */
  .identity-strip .button-label {position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;}
  .identity-strip .button {min-width:40px;justify-content:center;}
  .editor-actions>.button-group {gap:8px;}
}
@media (max-width:420px) {
  .editor-actions .button .icon {display:none;}
}
@media (max-height:480px) {
  html:has(.note-workspace) {scroll-padding:calc(var(--identity-height) + 12px) 0 12px;}
  html:has(.note-workspace) .topbar {position:relative;}
  .identity-strip {top:0;}
  .editor-actions,.soap-jumps,.client-context {position:static;}
  .client-context {max-height:none;}
}
@media (max-height:480px) and (max-width:760px) {
  .identity-strip {position:static;}
  html:has(.note-workspace) {scroll-padding-top:12px;}
}
/* Forms editor: sticky save/publish bar, builder tools, version history (UX-054, UX-067, UX-068, UX-072). */
.template-actions {position:sticky;top:var(--header-height);z-index:2;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 12px;padding:10px 18px;background:var(--surface);border-bottom:1px solid var(--line-soft);}
.template-actions .save-status {flex:1 1 190px;flex-wrap:nowrap;align-items:flex-start;font-size:.8rem;}
.template-actions .save-status>span {min-width:0;}
.template-actions .save-status .icon {margin-top:2px;}
.template-actions .button-group {gap:8px;margin-left:auto;}
.template-actions .button {font-size:.82rem;padding:9px 12px;min-height:38px;}
.form-editor>.form-alert {margin:0 18px 10px;font-size:.84rem;}
.builder-tools {display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:10px 16px 6px;}
.builder-tools>label {flex:1 1 180px;}
.builder-tools select {font-size:.82rem;min-height:34px;padding:6px 28px 6px 9px;}
.builder-tools .small-button .icon {width:15px;height:15px;}
.question-controls>div {display:flex;align-items:center;flex-wrap:wrap;justify-content:flex-end;gap:2px;}
.question-controls .move-to select {font-size:.8rem;min-height:29px;padding:4px 26px 4px 8px;max-width:132px;margin-right:4px;}
.icon-button.is-danger:hover {background:var(--red-soft);color:var(--red);}
.question-editor .hint {margin:6px 0 13px;}
.form-editor :is(.question-summary,.question-editor input,.question-editor select,.question-editor textarea) {scroll-margin-top:110px;}
.version-list {list-style:none;margin:0;padding:8px 16px;}
.version-list>li {display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 12px;padding:12px 0;border-bottom:1px solid var(--line-soft);}
.version-list small {display:block;color:var(--muted);font-size:.8rem;margin-top:3px;}
.version-items {padding-left:22px;}
.version-items li {margin:8px 0;}
.version-items small {display:block;}
.client-form .pv-body>p {font-size:.8rem;color:var(--muted);margin:6px 0 18px;line-height:1.5;}
@media (min-width:1341px) {
  .preview-column {max-height:calc(100vh - var(--header-height) - 40px);overflow:auto;}
}
@media (max-width:760px), (max-height:480px) {
  .template-actions {position:static;padding:10px 14px;}
}
/* Clients, chart, settings and launch checklist (UX-177, UX-183, UX-184, UX-186, UX-202, UX-203). */
.client-alert {margin:-10px 0 24px;}
.identity-alert {display:flex;align-items:flex-start;gap:6px;color:var(--gold);font-size:.82rem;font-weight:500;margin-top:4px;}
.identity-alert .icon {width:15px;height:15px;flex:none;margin-top:2px;}
.chart-diff>div {flex:1;min-width:0;}
.chart-diff .inline-dl {font-size:.84rem;color:var(--ink);}
.chart-diff-done {margin-bottom:12px;}
.chart-diff-done .small-button {margin-top:8px;}
.chart-main .tabs {flex-wrap:nowrap;overflow-x:auto;scrollbar-width:thin;
  /* Scroll cue: an edge shadow shows on whichever side more tabs are hidden (white covers scroll with the tabs). */
  background:linear-gradient(to right,var(--surface) 40%,transparent) left / 32px 100% no-repeat local,
    linear-gradient(to left,var(--surface) 40%,transparent) right / 32px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%,oklch(.25 .033 265 / .28),transparent) left / 16px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%,oklch(.25 .033 265 / .28),transparent) right / 16px 100% no-repeat scroll;}
.clients-table .person-cell>span {min-width:0;overflow-wrap:anywhere;} /* long names and emails wrap, the table never outgrows the panel */
.record-row>.row-actions {flex:none;}
.chart-main :is(.history-row,.record-row) {align-items:center;}
.chart-main :is(.history-row,.record-row)>.icon {width:36px;flex:none;} /* the chevron sits in the same column as the download button */
@media (min-width:761px) and (max-width:1100px) {
  .chart-layout {grid-template-columns:minmax(0,1fr);}
  .client-details dl {display:grid;grid-template-columns:max-content minmax(0,1fr) max-content minmax(0,1fr);gap:12px 18px;}
  .client-details dd {margin:0;}
  .chart-main .panel-heading {flex-wrap:wrap;row-gap:4px;}
}
@media (max-width:760px) {
  .chart-main .document-symbol {display:none;}
  .chart-main .row-actions {flex-basis:auto;margin-left:auto;}
  .chart-main .history-row>.badge {align-self:center;}
  /* The form symbol is hidden here, so title and badge share the first column (no badge past the panel edge). */
  .chart-main .submission-row {grid-template-columns:minmax(0,1fr) auto;}
  .chart-main .submission-row>.badge {grid-column:1;}
  .chart-main .submission-row>.icon {grid-column:2;}
  .clients-table {min-width:0;}
  .clients-table thead {display:none;}
  .clients-table tr {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 14px;padding:14px 16px;border-top:1px solid var(--line-soft);}
  .clients-table td {display:block;padding:0;border:0;min-width:0;overflow-wrap:anywhere;}
  .clients-table td:first-child {grid-column:1 / -1;}
  .clients-table td[data-label]::before {content:attr(data-label);display:block;color:var(--muted);font-size:.8rem;margin-bottom:2px;}
}
.setup-grid {grid-template-columns:minmax(0,1fr);max-width:920px;}
.setup-row:hover {background:var(--soft);}
.setup-row label {cursor:pointer;}
.setup-row label:has(input:disabled) {cursor:default;}
.setup-row small.setup-status {display:flex;align-items:flex-start;gap:5px;color:var(--ink);}
.setup-status.warn {color:var(--gold);font-weight:500;}
.setup-status .icon {width:14px;height:14px;flex:none;margin-top:2px;}
