 .care-case-header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: start; }
 .care-case { border-top: 1px solid var(--cp-border); padding-top: 24px; }
 .care-case details { margin: 16px 0; }
 .care-case summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
 .care-task { border-left: 3px solid var(--cp-border-strong); padding: 8px 16px; margin: 16px 0; }
 .care-form { max-width: 680px; margin: 16px 0; }
 .care-form fieldset { min-width: 0; border: 1px solid var(--cp-border); padding: 12px; }
 .care-text { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
 .care-profile { display: grid; gap: 12px; }
 .care-profile dd { margin: 4px 0; overflow-wrap: anywhere; }
 .care-profile dt { font-weight: 600; }
 .care-events { padding-left: 20px; overflow-wrap: anywhere; }
:root {
  color-scheme: light;
  --cp-bg: #f7f4ef;
  --cp-bg-elevated: #fcfbf8;
  --cp-surface: #ffffff;
  --cp-surface-soft: #f5f5f5;
  --cp-border: #dedede;
  --cp-border-strong: #919191;
  --cp-text: #242424;
  --cp-text-muted: #5c5c5c;
  --cp-text-soft: #6f6f6f;
  --cp-accent: #b11f4b;
  --cp-accent-hover: #9a1a41;
  --cp-accent-soft: rgba(177, 31, 75, 0.08);
  --cp-accent-fg: #ffffff;
  --cp-success: #16a34a;
  --cp-danger: #dc2626;
  --cp-warning: #f59e0b;
  --cp-link: #0078d4;
  --cp-shadow: 0 18px 48px rgba(0, 0, 0, 0.12);
  --cp-overlay: rgba(255, 255, 255, 0.8);
  --cp-panel: rgba(255, 255, 255, 0.86);
  --cp-panel-strong: rgba(255, 255, 255, 0.96);
  --cp-sheen: rgba(255, 255, 255, 0.55);
  --cp-highlight: rgba(177, 31, 75, 0.12);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --cp-bg: #3d3b3a;
  --cp-bg-elevated: #343231;
  --cp-surface: #292929;
  --cp-surface-soft: #2e2e2e;
  --cp-border: #474747;
  --cp-border-strong: #5f5f5f;
  --cp-text: #dedede;
  --cp-text-muted: #919191;
  --cp-text-soft: #b0b0b0;
  --cp-accent: #fd8ea1;
  --cp-accent-hover: #fb7b91;
  --cp-accent-soft: rgba(253, 142, 161, 0.14);
  --cp-accent-fg: #1a1a1a;
  --cp-success: #4ade80;
  --cp-danger: #f87171;
  --cp-warning: #fbbf24;
  --cp-link: #4da6ff;
  --cp-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  --cp-overlay: rgba(41, 41, 41, 0.88);
  --cp-panel: rgba(41, 41, 41, 0.72);
  --cp-panel-strong: rgba(41, 41, 41, 0.96);
  --cp-sheen: rgba(255, 255, 255, 0.04);
  --cp-highlight: rgba(253, 142, 161, 0.12);
}
/* Fuentes auto-alojadas (CSP font-src 'self'): mismas familias que la web publica de Privia. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url("/static/fonts/inter-var.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/poppins-400.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/poppins-500.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/poppins-600.woff2") format("woff2");
}

/* Sistema de diseno alineado con la web publica de Privia (elenagonzalezblanco.github.io/healthcare). */
:root {
  --cp-bg: #f3f5f2;
  --cp-bg-elevated: #fcfbf8;
  --cp-surface: #ffffff;
  --cp-surface-soft: #e8e2d8;
  --cp-border: #ded8ce;
  --cp-border-strong: #b6ac9c;
  --cp-text: #1d2528;
  --cp-text-muted: #5f6865;
  --cp-text-soft: #79817d;
  --cp-accent: #1f3d34;
  --cp-accent-hover: #0f2b23;
  --cp-accent-soft: #e4ece6;
  --cp-accent-fg: #ffffff;
  --cp-highlight: #a7bca4;
  --cp-premium: #c9a97a;
  --cp-tech: #3d5e8a;
  --cp-link: #3d5e8a;
  --cp-shadow: 0 12px 40px rgba(31, 61, 52, 0.08);
  --cp-shadow-card: 0 8px 24px rgba(31, 61, 52, 0.06);
  --cp-shadow-hover: 0 16px 48px rgba(31, 61, 52, 0.12);
  --cp-radius-sm: 12px;
  --cp-radius-md: 16px;
  --cp-radius-lg: 24px;
  --cp-radius-pill: 999px;
  --cp-font-heading: "Poppins", "Sora", "Segoe UI", sans-serif;
  --cp-font-body: "Inter", "Segoe UI", "Helvetica Neue", sans-serif;
}
html[data-theme="dark"] {
  --cp-surface-soft: #2e2e2e;
  --cp-border: #474747;
  --cp-border-strong: #5f5f5f;
  --cp-accent: #b8d2bd;
  --cp-accent-hover: #d0e8d4;
  --cp-accent-soft: #31443b;
  --cp-highlight: #738b78;
  --cp-premium: #d8bd94;
  --cp-tech: #7ea3d6;
  --cp-link: #7ea3d6;
}
* { box-sizing: border-box; letter-spacing: 0; }
body { margin: 0; background: var(--cp-bg); color: var(--cp-text); font: 15px/1.6 var(--cp-font-body); }
h1, h2, h3, h4, h5, h6 { font-family: var(--cp-font-heading); font-weight: 600; letter-spacing: 0; color: var(--cp-text); }
button, input, textarea, select { font: inherit; }
a { color: var(--cp-accent); }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--cp-accent); border-radius: var(--cp-radius-pill); padding: 10px 20px; background: var(--cp-accent); color: var(--cp-accent-fg); font-family: var(--cp-font-body); font-weight: 600; text-decoration: none; min-height: 44px; transition: background .15s ease, box-shadow .15s ease, transform .15s ease; }
button:hover, .button:hover { background: var(--cp-accent-hover); box-shadow: var(--cp-shadow-card); }
.secondary { background: var(--cp-surface); color: var(--cp-accent); border-color: var(--cp-border); }
.secondary:hover { background: var(--cp-accent-soft); }
.icon-button { width: 44px; height: 44px; padding: 10px; flex-shrink: 0; background: transparent; color: var(--cp-text); border-color: var(--cp-border); }
.icon-button:hover { background: var(--cp-surface-soft); }
svg { width: 20px; height: 20px; flex-shrink: 0; }
:focus-visible { outline: 3px solid var(--cp-link); outline-offset: 3px; }
[hidden] { display: none !important; }
.skip { position: absolute; top: -100px; }
.skip:focus { top: 0; padding: 10px; background: var(--cp-surface); z-index: 100; }
.demo-band { min-height: 34px; padding: 7px 24px; text-align: center; background: var(--cp-accent); color: var(--cp-accent-fg); font-size: 12px; }
.demo-band span { font-weight: 700; margin-right: 12px; }
.layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 34px); }
.sidebar { background: var(--cp-surface); border-right: 1px solid var(--cp-border); padding: 30px 18px 22px; display: flex; flex-direction: column; gap: 28px; }
.brand { color: var(--cp-accent); font: 500 26px/1 var(--cp-font-heading); letter-spacing: 0.28em; text-decoration: none; display: block; }
.brand small { display: block; font: 12px/2 var(--cp-font-body); letter-spacing: 0.18em; }
.sidebar .brand { padding-left: 14px; }
nav { display: flex; flex-direction: column; gap: 5px; }
nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; color: var(--cp-text-muted); text-decoration: none; border-radius: 10px; font-weight: 600; }
nav a:hover, nav a[aria-current="page"] { background: var(--cp-accent-soft); color: var(--cp-accent); }
.nav-label { margin: 22px 14px 8px; color: var(--cp-text-soft); font-size: 11px; text-transform: uppercase; }
.identity { margin-top: auto; padding: 14px; border-top: 1px solid var(--cp-border); font-size: 13px; overflow-wrap: anywhere; }
.identity strong { display: block; margin-bottom: 4px; }
.identity button { margin-top: 16px; width: 100%; }
.main { width: 100%; max-width: 1360px; padding: 40px 48px 64px; margin: 0 auto; min-width: 0; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 32px; }
.eyebrow { color: var(--cp-text-soft); font-size: 12px; margin: 0 0 8px; text-transform: uppercase; }
h1 { font-size: 30px; line-height: 1.2; font-weight: 600; margin: 0; }
h2 { font-size: 18px; line-height: 1.35; margin: 0 0 16px; }
h3 { font-size: 15px; margin: 0; }
p { margin: 0 0 16px; }
.muted { color: var(--cp-text-muted); font-size: 13px; }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; color: var(--cp-accent); background: var(--cp-accent-soft); font-size: 12px; border-radius: var(--cp-radius-pill); white-space: normal; }
.badge svg { width: 14px; height: 14px; }
.notice { background: var(--cp-surface-soft); border-left: 3px solid var(--cp-highlight); padding: 16px 20px; margin-bottom: 28px; font-size: 14px; }
.notice p:last-child { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--cp-border); margin: 0 0 36px; }
.stat { padding: 23px 20px; border-right: 1px solid var(--cp-border); min-width: 0; }
.stat:first-child { padding-left: 0; }
.stat:last-child { border-right: 0; }
.stat strong { display: block; color: var(--cp-accent); font-size: 30px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.stat span { font-size: 13px; color: var(--cp-text-muted); }
.columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; }
.section { padding: 25px 0; border-top: 1px solid var(--cp-border); }
.step { display: flex; gap: 14px; align-items: flex-start; margin: 0 0 24px; }
.step > svg { color: var(--cp-accent); margin-top: 3px; }
.step p { margin: 5px 0 0; }
.section a { font-size: 14px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.wide { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 7px; color: var(--cp-text); font-size: 14px; font-weight: 600; }
input, select, textarea { display: block; width: 100%; padding: 11px 12px; background: var(--cp-surface); color: var(--cp-text); border: 1px solid var(--cp-border-strong); border-radius: 12px; min-width: 0; font-weight: 400; }
.password-field { position: relative; display: block; width: 100%; min-width: 0; }
.password-field input { padding-right: 50px; }
.password-toggle { position: absolute; inset: 0 0 0 auto; width: 44px; min-height: 44px; padding: 10px; border: 0; border-radius: 0 12px 12px 0; background: transparent; color: var(--cp-text-muted); box-shadow: none; }
.password-toggle:hover { background: var(--cp-surface-soft); box-shadow: none; }
.text-button { min-height: auto; padding: 4px 0; border: 0; border-radius: 0; background: transparent; color: var(--cp-accent); justify-content: flex-start; box-shadow: none; }
.text-button:hover { background: transparent; box-shadow: none; text-decoration: underline; }
textarea { min-height: 92px; resize: vertical; }
.check { display: flex; flex-direction: row; align-items: flex-start; font-weight: 400; font-size: 13px; gap: 10px; }
.check input { width: 17px; height: 17px; margin: 3px 0 0; flex-shrink: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.auth-wrap { max-width: 480px; margin: 54px auto; padding: 0 24px; }
.auth-wrap .brand { margin-bottom: 32px; }
.auth-wrap h1 { margin-bottom: 24px; }
.auth-wrap form { display: flex; flex-direction: column; gap: 18px; }
.registration-form { display: flex; flex-direction: column; gap: 18px; max-width: 620px; }
.registration-steps { display: flex; gap: 20px; padding: 0; list-style: none; border-bottom: 1px solid var(--cp-border); margin: 0 0 24px; }
.registration-steps li { padding: 10px 0; color: var(--cp-text-muted); }
.registration-steps [aria-current="step"] { color: var(--cp-accent); font-weight: 600; border-bottom: 2px solid var(--cp-accent); }
.tabs { display: flex; border-bottom: 1px solid var(--cp-border); margin-bottom: 26px; }
.tabs button { flex: 1; background: transparent; color: var(--cp-text-muted); border: 0; border-radius: 0; }
.tabs button[aria-selected="true"] { color: var(--cp-accent); border-bottom: 2px solid var(--cp-accent); }
nav.tabs { flex-direction: row; flex-wrap: nowrap; }
.entry-heading { position: sticky; top: 0; background: var(--cp-bg); padding: 12px 0; z-index: 1; }
.entry-interview form { margin: 18px 0; }
.entry-interview fieldset { display: grid; gap: 12px; min-width: 0; }
.entry-proposal-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 180px); gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--cp-border); overflow-wrap: anywhere; }
.entry-proposal-row details { grid-column: 1 / -1; }
.entry-not-applicable { color: var(--cp-text-muted); opacity: .65; }
.entry-not-applicable label { color: var(--cp-text-muted); }
.entry-interview blockquote { margin: 12px 0; white-space: pre-line; }
@media (max-width: 600px) { .entry-proposal-row { grid-template-columns: minmax(0, 1fr); } }
.tabs button[data-profile-stage] { min-width: 0; flex-wrap: nowrap; gap: 8px; padding: 10px 8px; }
.tabs button[data-profile-stage] .agent-portrait { width: 32px; height: 32px; flex-basis: 32px; }
.tabs:has([data-profile-stage]) + .profile-conversation > .chat-thread-heading { display: none; }
.tabs button[data-profile-stage] span { overflow-wrap: anywhere; }
.tabs button[data-profile-stage][aria-pressed="true"] { color: var(--cp-accent); border-bottom: 2px solid var(--cp-accent); }
.empty { padding: 38px 20px; text-align: center; background: repeating-linear-gradient(135deg, var(--cp-surface), var(--cp-surface) 12px, var(--cp-surface-soft) 12px, var(--cp-surface-soft) 13px); border-block: 1px solid var(--cp-border); color: var(--cp-text-muted); }
.empty svg { width: 32px; height: 32px; color: var(--cp-text-soft); margin-bottom: 12px; }
.empty p { margin: 0; }
.upload { padding: 24px 0; border-block: 1px solid var(--cp-border); margin-bottom: 28px; }
.upload input { max-width: 650px; }
.document-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: start; gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--cp-border); }
.document-row > svg { color: var(--cp-accent); margin-top: 5px; }
.document-row strong { overflow-wrap: anywhere; }
.document-row p { margin: 5px 0; }
.actions { display: flex; gap: 8px; }
.message { border-bottom: 1px solid var(--cp-border); padding: 22px 0; }
.message .message-heading { display: flex; gap: 12px; justify-content: space-between; font-size: 12px; color: var(--cp-text-muted); margin-bottom: 8px; }
.message p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.message.patient { border-left: 3px solid var(--cp-highlight); padding-left: 18px; }
.composer { margin-top: 30px; border-top: 1px solid var(--cp-border); padding-top: 24px; }
.composer select { max-width: 360px; margin-bottom: 16px; }
.chat-main { padding-top: 20px; padding-bottom: 20px; }
.patient-context { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 16px; max-width: 980px; margin: 0 auto; }
.patient-context .private-space-title { flex: 1; min-width: 0; margin: 0; font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.managed-child { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--cp-border); }
.managed-child strong { overflow-wrap: anywhere; }
.managed-child p { margin: 5px 0 0; }
.conversation { display: flex; flex-direction: column; height: calc(100dvh - 165px); min-height: 570px; max-width: 980px; margin: 0 auto; }
.conversation-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0 20px; border-bottom: 1px solid var(--cp-border); }
.agent-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.agent-avatar { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--cp-accent-soft); color: var(--cp-accent); flex-shrink: 0; }
.agent-avatar svg { width: 24px; height: 24px; }
.agent-identity h1 { font-size: 22px; overflow-wrap: anywhere; }
.agent-identity p { margin: 4px 0 0; font-size: 13px; color: var(--cp-text-muted); }
.intake-progress { display: flex; align-items: center; gap: 12px; padding: 12px 0 6px; font-size: 12px; color: var(--cp-text-muted); flex-wrap: wrap; }
.intake-progress progress { width: 100px; height: 6px; accent-color: var(--cp-accent); }
.intake-progress span:last-child { margin-left: auto; }
.chat-safety { font-size: 12px; color: var(--cp-text-muted); margin: 0; padding-bottom: 10px; }
.conversation-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 14px 0 0; }
.conversation-choices button { font-size: 13px; padding: 10px; text-align: left; justify-content: flex-start; overflow-wrap: anywhere; }
.conversation-choices button[aria-pressed="true"] { background: var(--cp-accent-soft); border-color: var(--cp-accent); }
.chat-composer[aria-busy="true"] .send-answer { animation: waiting 1s ease-in-out infinite alternate; }
@keyframes waiting { to { opacity: .4; } }
.typing-dots { display: inline-flex; align-items: center; gap: 5px; height: 18px; margin-top: 6px; }
.typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--cp-text-muted); animation: typing-dot 1.2s ease-in-out infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typing-dot { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .chat-composer[aria-busy="true"] .send-answer { animation: none; } .typing-dots i { animation: none; opacity: .5; } }
.conversation-messages { flex: 1; min-height: 150px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 14px 12px 18px 0; }
.conversation .message { max-width: 90%; padding: 16px 18px; border: 1px solid var(--cp-border); background: var(--cp-surface); border-radius: var(--cp-radius-md); margin-bottom: 16px; }
.conversation .message.patient { margin-left: auto; border-color: var(--cp-highlight); background: var(--cp-accent-soft); }
.conversation .message-heading strong { display: inline-flex; gap: 6px; align-items: center; color: var(--cp-accent); }
.conversation .message-heading svg { width: 16px; height: 16px; }
.conversation .message-heading time { font-size: 11px; }
.chat-composer { flex-shrink: 0; margin-top: 0; padding-top: 12px; }
.chat-composer .check { margin-bottom: 12px; }
.answer-label { margin-bottom: 6px; }
.answer-row { display: flex; gap: 12px; align-items: flex-end; }
.answer-row textarea { min-height: 70px; max-height: 160px; }
.send-answer { background: var(--cp-accent); color: var(--cp-accent-fg); margin-bottom: 2px; }
.conversation-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 8px; }
.conversation-tools a:not(.icon-button) { font-size: 13px; margin-left: 6px; }
.conversation-tools .muted { margin-left: auto; font-size: 12px; }
.profile-summary { margin: 0 0 24px; }
section.profile-conversation { height: auto; min-height: 0; margin-bottom: 32px; }
.profile-conversation .conversation-messages { flex: 0 1 auto; min-height: 0; max-height: 45dvh; padding: 8px 8px 8px 0; }
.profile-conversation .profile-progress { margin: 0; font-size: 12px; }
.profile-conversation .coach-controls { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; min-width: 0; margin: 8px 0; }
.profile-conversation .coach-controls button { flex: 0 1 auto; max-width: 100%; min-width: 0; font-size: 13px; padding: 8px 12px; }
.profile-readonly > div { grid-template-columns: minmax(100px, 180px) minmax(0, 1fr); }
.patient-declaration p, .profile-conversation p { overflow-wrap: anywhere; white-space: pre-wrap; }
.profile-send-status { font-size: 12px; overflow-wrap: anywhere; }
.profile-summary > div { display: grid; grid-template-columns: 145px minmax(0, 1fr) 44px; align-items: start; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--cp-border); }
.profile-summary dt { font-weight: 600; }
.profile-summary dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 13px 12px 13px 0; border-bottom: 1px solid var(--cp-border); overflow-wrap: anywhere; }
th { color: var(--cp-text-muted); font-weight: 500; }
td code { font-size: 11px; }
.chart-row { margin: 18px 0; }
.chart-label { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; margin-bottom: 6px; }
meter { display: block; width: 100%; height: 13px; border: 0; }
meter::-webkit-meter-bar { background: var(--cp-surface-soft); border: 0; border-radius: 2px; }
meter::-webkit-meter-optimum-value { background: var(--cp-accent); }
meter::-moz-meter-bar { background: var(--cp-accent); }
.period { max-width: 165px; }
dialog { width: min(850px, calc(100% - 28px)); max-height: 85vh; padding: 28px; border: 1px solid var(--cp-border); border-radius: var(--cp-radius-lg); background: var(--cp-surface); color: var(--cp-text); box-shadow: var(--cp-shadow); }
dialog::backdrop { background: var(--cp-overlay); }
.dialog-heading { display: flex; align-items: flex-start; gap: 20px; justify-content: space-between; }
.dialog-heading h2 { overflow-wrap: anywhere; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.7 Consolas, monospace; max-height: 50vh; overflow-y: auto; padding: 18px; background: var(--cp-surface-soft); }
#notice { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 14px 22px; border: 1px solid var(--cp-border-strong); background: var(--cp-surface); box-shadow: var(--cp-shadow); z-index: 20; overflow-wrap: anywhere; }
#notice.error { border-left: 4px solid var(--cp-danger); }
.loading { padding: 60px; text-align: center; }
.token { overflow-wrap: anywhere; display: block; background: var(--cp-surface); padding: 18px; border: 1px solid var(--cp-border); margin: 16px 0; }
@media (max-width: 1000px) {
  .layout { grid-template-columns: 195px minmax(0, 1fr); }
  .main { padding: 30px 26px; }
  .columns { gap: 24px; }
  .stat { padding: 18px 12px; }
}
@media (max-width: 720px) {
  .patient-context { align-items: stretch; flex-direction: column; gap: 8px; }
  .conversation { height: 740px; min-height: 0; }
  .conversation-choices { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .conversation .message { max-width: 100%; padding: 12px; }
  .agent-identity h1 { font-size: 20px; }
  .intake-progress span:last-child { margin-left: 0; }
  .profile-summary > div { grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; }
  .profile-summary dt { grid-column: 1; }
  .profile-summary dd { grid-column: 1; }
  .profile-summary button { grid-column: 2; grid-row: span 2; }
  .demo-band { padding: 8px 12px; font-size: 11px; }
  .layout { display: block; }
  .sidebar { padding: 18px 16px 10px; border-right: 0; border-bottom: 1px solid var(--cp-border); gap: 14px; }
  .sidebar .brand { padding-left: 0; font-size: 28px; }
  .sidebar .brand small { display: inline; margin-left: 10px; }
  nav { flex-direction: row; flex-wrap: wrap; gap: 3px; }
  nav a { font-size: 12px; padding: 8px 10px; gap: 6px; }
  nav a svg { width: 16px; height: 16px; }
  .nav-label { display: none; }
  .identity { margin: 0; padding: 9px 0 0; display: flex; align-items: center; gap: 12px; justify-content: space-between; }
  .identity strong { margin: 0; }
  .identity button { margin: 0; width: auto; min-height: 36px; padding: 6px 9px; }
  .identity .muted { display: none; }
  .main { padding: 26px 18px 50px; }
  .page-heading { gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
  h1 { font-size: 25px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat, .stat:first-child { padding: 18px 12px; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--cp-border); }
  .columns, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .columns { gap: 8px; }
  .document-row { grid-template-columns: 24px minmax(0, 1fr); gap: 10px; }
  .document-row .actions { grid-column: 2; }
  .message .message-heading { flex-wrap: wrap; }
  .auth-wrap { margin-top: 32px; }
  .loading { padding: 40px 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .page-content { animation: appear 180ms ease-out; }
  @keyframes appear { from { opacity: .3; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.layout { background: var(--cp-surface); }
.sidebar { background: var(--cp-surface-soft); border-right: 0; gap: 20px; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mobile-menu { display: none; }
.new-chat-button { background: transparent; border: 0; color: var(--cp-text); justify-content: flex-start; font-weight: 500; }
.new-chat-button:hover { background: var(--cp-border); }
.chat-main { max-width: none; padding: 28px 40px 16px; }
.chat-main .patient-context { max-width: 800px; }
.chat-main .patient-context .private-space-title { font-size: 16px; }
.chat-main .patient-context .badge { display: none; }
.conversation { width: 100%; max-width: 800px; min-height: 0; height: var(--conversation-viewport-height, calc(100dvh - 100px)); margin: 0 auto; position: relative; }
.provisional-label { font-size: 12px; color: var(--cp-text-muted); margin: 0 0 8px; }
.provisional-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.stream-agent-transition { padding-top: 8px; }
.conversation .provisional-withdrawn { border-left: 3px solid var(--cp-warning); padding-left: 14px; }
.provisional-withdrawn p { color: var(--cp-text-muted); font-size: 14px; }
.stream-follow { position: absolute; right: 12px; bottom: 175px; z-index: 2; background: var(--cp-surface); border: 1px solid var(--cp-border); }
.chat-input-tools > .icon-button { flex: 0 0 40px; }
.chat-send-status, .profile-send-status { min-width: 0; overflow-wrap: anywhere; }
.chat-entry:has(.provisional-reply) { height: var(--conversation-viewport-height, calc(100dvh - 100px)); min-height: 0; padding-bottom: 0; justify-content: flex-start; }
.chat-entry:has(.provisional-reply) .chat-welcome, .chat-entry:has(.provisional-reply) .chat-suggestions { display: none; }
.chat-entry { height: auto; min-height: var(--conversation-viewport-height, calc(100dvh - 100px)); justify-content: center; padding-bottom: 12vh; }
.chat-welcome { font-size: 30px; font-weight: 400; text-align: center; margin: 0 0 34px; line-height: 1.3; }
.chat-composer { padding: 16px 16px 12px; border: 1px solid var(--cp-border); border-radius: 24px; box-shadow: 0 3px 12px var(--cp-accent-soft); background: var(--cp-surface); margin: 0; }
.chat-composer textarea { width: 100%; min-height: 66px; max-height: 220px; border: 0; border-radius: 0; padding: 4px 6px 12px; resize: vertical; font-size: 17px; line-height: 1.5; background: transparent; }
.chat-composer textarea:focus-visible { outline: none; }
.chat-composer:focus-within { border-color: var(--cp-border-strong); }
.chat-input-tools { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.chat-input-tools .icon-button { width: 40px; height: 40px; min-height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--cp-text); }
.chat-input-tools .send-answer { background: var(--cp-text); color: var(--cp-surface); margin: 0 0 0 auto; }
.chat-input-tools .send-answer:disabled { opacity: .3; cursor: default; }
.chat-route-label, .chat-send-status { color: var(--cp-text-muted); font-size: 12px; }
.chat-suggestions { display: flex; flex-direction: column; gap: 5px; margin: 24px 22px 0; }
.chat-suggestions button { justify-content: flex-start; text-align: left; border: 0; border-radius: 12px; background: transparent; color: var(--cp-text-muted); gap: 14px; font-weight: 400; font-size: 15px; padding: 9px 0; }
.chat-suggestions button:hover { background: var(--cp-surface-soft); color: var(--cp-text); }
.chat-suggestions svg { color: var(--cp-accent); }
.chat-footnote { text-align: center; font-size: 11px; color: var(--cp-text-soft); margin: 16px 0 0; }
.chat-thread-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 0 16px; }
.chat-thread-heading > span { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.chat-thread-heading small { color: var(--cp-text-muted); font-size: 11px; font-weight: 400; }
.agent-portrait { width: 56px; height: 56px; flex: 0 0 56px; object-fit: contain; }
.chat-suggestions .agent-portrait { width: 44px; height: 44px; flex-basis: 44px; }
.chat-suggestions button { min-height: 56px; padding: 6px 10px; }
.agent-section-heading { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; margin-bottom: 20px; }
.agent-section-heading .agent-portrait { width: 72px; height: 72px; flex-basis: 72px; }
.agent-section-heading h1 { font-size: 24px; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.agent-section-heading .icon-button { margin-left: auto; }
@media (max-width: 480px) {
  .agent-section-heading { gap: 10px; }
  .agent-section-heading .agent-portrait { width: 48px; height: 48px; }
  .agent-section-heading h1 { font-size: 20px; grid-column: 1 / -1; grid-row: 2; }
  .agent-section-heading .icon-button { grid-column: 3; grid-row: 1; }
}
.conversation .message-heading .agent-portrait { width: 40px; height: 40px; flex-basis: 40px; }
.conversation .message-heading strong { min-width: 0; gap: 10px; }
.chat-thread .conversation-messages { padding: 8px 8px 16px 0; }
.consultation-archive { max-width: 800px; margin: 0 auto; }
.consultation-archive h1 { font-size: 24px; overflow-wrap: anywhere; }
.consultation-archive .conversation { height: auto; min-height: 0; }
.consultation-archive .chat-thread-heading { display: none; }
.consultation-archive .conversation-messages { overflow: visible; }
.chat-thread .message { border: 0; padding: 18px 0; background: transparent; border-radius: 0; max-width: 100%; }
.chat-thread .message.patient { max-width: 85%; width: fit-content; background: var(--cp-surface-soft); border: 0; padding: 12px 18px; border-radius: 18px; }
.chat-thread .message.patient .message-heading { display: none; }
.chat-thread .message.agent .message-heading { margin-bottom: 12px; }
.chat-thread .message-heading time { color: var(--cp-text-soft); }
.conversation .message.agent { border: 0; border-radius: 0; background: transparent; padding: 16px 0; max-width: 100%; box-shadow: none; }
.conversation .message-heading.same-agent { display: none; }
.profile-conversation .message.agent { padding: 8px 0; margin-bottom: 0; }
.profile-conversation .chat-composer textarea { min-height: 54px; padding-bottom: 8px; }
.profile-conversation .message.patient { width: fit-content; max-width: 85%; border: 0; background: var(--cp-surface-soft); }
.profile-conversation .message.patient .message-heading { display: none; }
.external-permission { padding: 12px 6px; border-top: 1px solid var(--cp-border); }
.chat-markdown { overflow-wrap: anywhere; }
.chat-markdown p { margin: 0 0 16px; white-space: normal; }
.chat-markdown ul, .chat-markdown ol { padding-left: 24px; margin: 0 0 16px; }
.chat-markdown li { margin-bottom: 8px; }
.chat-markdown h1, .chat-markdown h2, .chat-markdown h3 { font-size: 18px; margin: 16px 0 10px; }
.chat-markdown blockquote { margin: 16px 0; padding-left: 16px; border-left: 2px solid var(--cp-border); color: var(--cp-text-muted); }
.chat-markdown table { display: block; overflow-x: auto; }
@media (max-width: 720px) {
  .sidebar { padding: 12px 16px; }
  .sidebar .brand { font-size: 24px; }
  .sidebar .brand small { display: none; }
  .sidebar nav, .sidebar .identity, .sidebar > .new-chat-button { display: none; }
  .sidebar.mobile-open nav, .sidebar.mobile-open .identity, .sidebar.mobile-open > .new-chat-button { display: flex; }
  .mobile-menu { display: inline-flex; }
  .chat-main { padding: 18px 16px 16px; }
  .conversation { height: var(--conversation-viewport-height, calc(100dvh - 162px)); min-height: 220px; }
  .conversation-messages { min-height: 64px; }
  .profile-conversation .conversation-messages { max-height: min(45dvh, max(64px, calc(var(--portal-visible-height, 100dvh) - 220px))); }
  .chat-entry { height: auto; min-height: 0; justify-content: flex-start; padding: 12px 0 5vh; }
  .chat-welcome { max-width: 100%; font-size: 26px; margin-bottom: 26px; }
  .chat-composer { padding: 14px 12px 10px; border-radius: 22px; }
  .chat-suggestions { margin: 20px 10px 0; }
  .chat-suggestions button { font-size: 14px; }
  .chat-footnote { font-size: 10px; }
  .chat-route-label { max-width: 130px; }
}
