/* Studio-medico demo — self-contained styles */
:root {
  --sm-bg: #0f172a;
  --sm-surface: #ffffff;
  --sm-ink: #0f172a;
  --sm-muted: #64748b;
  --sm-line: #e2e8f0;
  --sm-teal: #0ea5a4;
  --sm-teal-d: #0b7d7c;
  --sm-blue: #2563eb;
  --sm-green: #16a34a;
  --sm-amber: #d97706;
  --sm-red: #dc2626;
  --sm-soft: #f1f5f9;
  --sm-radius: 14px;
  --sm-shadow: 0 10px 30px rgba(2,8,23,.08);
}
* { box-sizing: border-box; }
/* l'attributo hidden deve vincere sulle regole display: delle classi */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--sm-ink);
  /* Tema chiaro/clinico: sfondo chiaro con lieve tinta teal (più "camice bianco"). */
  background: linear-gradient(165deg, #eff6f5 0%, #e1edeb 100%);
  -webkit-font-smoothing: antialiased;
}
.sm-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.sm-app { max-width: 1180px; margin: 0 auto; height: 100dvh; display: flex; flex-direction: column; padding: 16px; overflow: hidden; }
/* Su sfondo chiaro le card bianche hanno un bordo sottile per definirsi */
.sm-choice, .sm-scheda-page, .sm-number-card, .sm-panel, .sm-recap-card { border: 1px solid var(--sm-line); }

/* Header */
.sm-header {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--sm-ink); padding: 6px 8px 14px; flex-shrink: 0;
}
.sm-brand { display: flex; align-items: center; gap: 12px; }
.sm-logo { font-size: 30px; line-height: 1; filter: drop-shadow(0 2px 6px rgba(0,0,0,.3)); display: inline-flex; align-items: center; }
.sm-logo-img { width: 40px; height: 40px; object-fit: contain; border-radius: 9px; background: #fff; padding: 3px; border: 1px solid var(--sm-line); box-shadow: 0 2px 6px rgba(0,0,0,.12); filter: none; }
.sm-studio-name { font-weight: 700; font-size: 19px; line-height: 1.1; }
.sm-studio-sub { font-size: 13px; color: var(--sm-muted); }
.sm-header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sm-home { flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--sm-line); background: #fff; color: var(--sm-teal-d); font-size: 19px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.sm-home:hover { background: #ecfeff; border-color: var(--sm-teal); }
.sm-badge { font-size: 12px; color: var(--sm-teal-d); background: #ecfeff; border: 1px solid #cffafe; padding: 6px 12px; border-radius: 999px; text-decoration: none; white-space: nowrap; }
.sm-badge:hover { background: #cffafe; }

/* Full-page screens (scelta / scheda / numero) — scrollabili, mai tagliate */
.sm-page { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: 8px 4px 24px; }
.sm-page > * { margin: auto; width: 100%; }

/* Choice screen (telefono primario) */
.sm-choice {
  background: var(--sm-surface); border-radius: 20px; box-shadow: var(--sm-shadow);
  padding: 40px 28px; text-align: center; max-width: 640px;
}
.sm-choice h1 { margin: 0 0 10px; font-size: 26px; }
.sm-choice h1 span { color: var(--sm-teal-d); }
.sm-choice-lead { color: var(--sm-muted); font-size: 15px; line-height: 1.6; margin: 0 auto 22px; max-width: 520px; }

/* CTA telefono grande */
.sm-call-cta {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; font: inherit;
  background: linear-gradient(135deg, var(--sm-teal) 0%, var(--sm-teal-d) 100%); color: #fff;
  border: 0; border-radius: 16px; padding: 20px 22px; cursor: pointer; transition: .15s;
  box-shadow: 0 8px 22px rgba(14,165,164,.28);
}
.sm-call-cta:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(14,165,164,.36); }
.sm-call-ico { font-size: 34px; line-height: 1; }
.sm-call-txt { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.sm-call-t { font-weight: 800; font-size: 18px; }
.sm-call-d { font-size: 13.5px; opacity: .92; }
.sm-call-go { font-size: 30px; opacity: .8; }

.sm-alt { display: flex; flex-direction: column; gap: 4px; margin: 16px 0 2px; }
.sm-linkbtn { background: none; border: 0; color: var(--sm-teal-d); font: inherit; font-size: 13.5px; cursor: pointer; padding: 5px; }
.sm-linkbtn:hover { text-decoration: underline; }
.sm-linkbtn b { font-weight: 700; }
.sm-choice-hint { margin-top: 18px; font-size: 13px; color: var(--sm-muted); }

/* Scheda a pagina intera */
.sm-scheda-page {
  background: var(--sm-surface); border-radius: 20px; box-shadow: var(--sm-shadow);
  padding: 28px 26px; max-width: 680px; text-align: left;
}
.sm-scheda-h { margin: 0 0 4px; font-size: 22px; text-align: center; }
.sm-scheda-sub { margin: 0 0 18px; text-align: center; color: var(--sm-muted); font-size: 14px; line-height: 1.5; }
.sm-scheda-rp { display: flex; flex-direction: column; }
.sm-rp-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--sm-line); font-size: 14px; }
.sm-rp-k { color: var(--sm-muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; padding-top: 3px; }
.sm-rp-v { color: var(--sm-ink); line-height: 1.5; }
.sm-rp-miss { color: #94a3b8; }
.sm-rp-docsum { font-size: 14px; color: var(--sm-ink); line-height: 1.6; }
.sm-rp-toggle { background: none; border: 0; color: var(--sm-teal-d); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; }
.sm-rp-toggle:hover { text-decoration: underline; }
.sm-rp-doclist { margin-top: 8px; }
.sm-scheda-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 22px; }
.sm-scheda-go { width: 100%; max-width: 360px; text-align: center; }
.sm-scheda-form { margin-top: 14px; border-top: 1px dashed var(--sm-line); padding-top: 8px; }
.sm-scheda-form-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; }

/* Conferma medici fittizi */
.sm-med-confirm-in { background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 14px 16px; font-size: 14px; color: #78350f; line-height: 1.5; }
.sm-med-confirm-btns { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }

/* Schermata numero (modalità telefono) */
.sm-number-card {
  background: var(--sm-surface); border-radius: 20px; box-shadow: var(--sm-shadow);
  padding: 40px 30px; max-width: 440px; text-align: center;
}
.sm-number-ico { font-size: 42px; display: block; }
.sm-number-card h2 { margin: 12px 0 6px; font-size: 20px; }
.sm-number-lead { color: var(--sm-muted); font-size: 13.5px; line-height: 1.55; margin: 0 auto 18px; }
.sm-number-in { text-align: center; font-size: 18px; letter-spacing: .04em; margin-bottom: 10px; }
.sm-number-err { color: var(--sm-red); font-size: 13px; margin-bottom: 8px; }
.sm-number-go { width: 100%; margin-bottom: 8px; }

/* Bottoni CTA piccoli */
.sm-cta-sm { background: var(--sm-teal); color: #fff; border: 0; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.sm-cta-sm:hover { background: var(--sm-teal-d); }

/* Split screen */
.sm-split { flex: 1; display: grid; grid-template-columns: 40fr 60fr; gap: 16px; min-height: 0; }
.sm-panel {
  background: var(--sm-surface); border-radius: 18px; box-shadow: var(--sm-shadow);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.sm-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--sm-line);
  background: #fff;
}
.sm-panel-patient .sm-panel-head { background: #f8fafc; }
.sm-panel-studio .sm-panel-head { background: #f0fdfa; color: var(--sm-teal-d); }
.sm-live { color: var(--sm-red); font-size: 12px; font-weight: 700; animation: sm-pulse 1.6s infinite; }
@keyframes sm-pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.sm-end { font: inherit; font-size: 12px; font-weight: 600; color: var(--sm-muted); background: none; border: 1px solid var(--sm-line); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.sm-end:hover { color: var(--sm-ink); border-color: var(--sm-muted); }

/* Chat */
.sm-chat { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.sm-msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.sm-msg-bot { align-self: flex-start; background: var(--sm-soft); border-bottom-left-radius: 4px; }
.sm-msg-user { align-self: flex-end; background: var(--sm-teal); color: #fff; border-bottom-right-radius: 4px; }
.sm-typing { align-self: flex-start; color: var(--sm-muted); font-size: 13px; font-style: italic; padding: 4px 8px; }
.sm-tool-status { align-self: flex-start; font-size: 12.5px; color: var(--sm-teal-d); background: #ecfeff; border: 1px solid #a5f3fc; border-radius: 10px; padding: 5px 10px; }

/* Riquadro "Ora chiama questo numero" (demo telefono inbound) */
.sm-callnow { align-self: stretch; text-align: center; background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 16px; padding: 20px 18px; margin: 6px 0; animation: sm-in .3s ease; }
.sm-callnow-ico { font-size: 34px; line-height: 1; }
.sm-callnow-t { font-size: 12px; color: var(--sm-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }
.sm-callnow-num { display: inline-block; margin: 8px 0; font-size: 26px; font-weight: 800; color: var(--sm-teal-d); text-decoration: none; letter-spacing: .02em; }
.sm-callnow-num:hover { text-decoration: underline; }
.sm-callnow-d { font-size: 13.5px; color: var(--sm-ink); line-height: 1.5; }

/* Scenarios */
.sm-scenarios { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 16px 8px; }
.sm-chip {
  font: inherit; font-size: 12.5px; background: #fff; border: 1px solid var(--sm-line);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; color: var(--sm-ink); transition: .12s;
}
.sm-chip:hover { border-color: var(--sm-teal); color: var(--sm-teal-d); }

/* Composer */
.sm-composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--sm-line); }
.sm-composer textarea {
  flex: 1; resize: none; border: 1px solid var(--sm-line); border-radius: 12px; padding: 10px 12px;
  font: inherit; font-size: 14.5px; max-height: 120px; outline: none;
}
.sm-composer textarea:focus { border-color: var(--sm-teal); }
.sm-composer button {
  width: 44px; border: none; border-radius: 12px; background: var(--sm-teal); color: #fff;
  font-size: 18px; cursor: pointer; flex-shrink: 0;
}
.sm-composer button:disabled { opacity: .5; cursor: default; }

/* Studio panel */
.sm-panel-studio { background: #fcfffe; }
.sm-section { padding: 12px 14px; border-bottom: 1px solid var(--sm-line); display: flex; flex-direction: column; min-height: 0; }
.sm-section-grow { flex: 1; overflow: hidden; }
.sm-section-log { flex: 0 0 auto; }
.sm-section-log .sm-log-list { max-height: 150px; }
.sm-sub-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--sm-muted); margin-bottom: 8px; }
.sm-agenda-list, .sm-log-list { display: flex; flex-direction: column; gap: 7px; overflow-y: auto; }
.sm-log-list { max-height: 100%; }
.sm-empty { color: #94a3b8; font-size: 13px; font-style: italic; padding: 8px 2px; }

.sm-agenda-item {
  display: flex; align-items: center; gap: 10px; background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 10px; padding: 9px 12px; font-size: 13.5px; animation: sm-in .3s ease;
}
.sm-agenda-when { font-weight: 700; color: var(--sm-green); white-space: nowrap; }
.sm-agenda-who { color: var(--sm-ink); }
.sm-agenda-meta { color: var(--sm-muted); font-size: 12px; margin-left: auto; text-align: right; }

.sm-log-item {
  display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--sm-line);
  border-left: 3px solid var(--sm-muted); border-radius: 8px; padding: 8px 11px; font-size: 13px; animation: sm-in .3s ease;
}
.sm-log-item .sm-log-ico { font-size: 15px; line-height: 1.3; }
.sm-log-item .sm-log-body { flex: 1; }
.sm-log-item .sm-log-title { font-weight: 600; }
.sm-log-item .sm-log-sub { color: var(--sm-muted); font-size: 12px; }
.sm-log-time { color: #94a3b8; font-size: 11px; white-space: nowrap; }
.sm-log-book { border-left-color: var(--sm-green); }
.sm-log-note { border-left-color: var(--sm-blue); }
.sm-log-call { border-left-color: var(--sm-amber); background: #fffbeb; }
.sm-log-urgent { border-left-color: var(--sm-red); background: #fef2f2; }
.sm-log-check { border-left-color: var(--sm-teal); }

/* Urgency banner */
.sm-urgency {
  margin: 12px 14px 0; background: #fef2f2; border: 1px solid #fecaca; color: var(--sm-red);
  border-radius: 10px; padding: 10px 12px; font-size: 13.5px; font-weight: 600; display: flex; gap: 8px; align-items: center;
  animation: sm-flash 1s ease 2;
}
@keyframes sm-flash { 0%,100%{background:#fef2f2} 50%{background:#fee2e2} }
@keyframes sm-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Recap */
.sm-recap-backdrop { position: fixed; inset: 0; background: rgba(2,8,23,.55); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.sm-recap-card { background: #fff; border-radius: 20px; box-shadow: var(--sm-shadow); padding: 32px 28px; max-width: 620px; width: 100%; text-align: center; max-height: 90vh; overflow: auto; }
.sm-recap-card h2 { margin: 0 0 6px; font-size: 22px; }
.sm-recap-card .sm-recap-lead { color: var(--sm-muted); margin: 0 0 20px; font-size: 14.5px; }
.sm-recap-stats { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.sm-stat { background: var(--sm-soft); border-radius: 12px; padding: 14px 16px; min-width: 88px; }
.sm-stat-n { font-size: 26px; font-weight: 800; color: var(--sm-teal-d); }
.sm-stat-l { font-size: 12px; color: var(--sm-muted); }
.sm-cta { display: inline-block; background: var(--sm-teal); color: #fff; text-decoration: none; font-weight: 700; padding: 13px 22px; border-radius: 12px; border: 0; cursor: pointer; font-family: inherit; font-size: 15px; }
.sm-cta:hover { background: var(--sm-teal-d); }
.sm-recap-close { display: block; margin: 14px auto 0; background: none; border: none; color: var(--sm-muted); font: inherit; font-size: 13px; cursor: pointer; }

/* Tabella chiamate nel recap */
.sm-recap-table-wrap { overflow-x: auto; margin: 6px 0 18px; border: 1px solid var(--sm-line); border-radius: 12px; }
.sm-recap-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.sm-recap-table th { background: var(--sm-soft); color: var(--sm-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; white-space: nowrap; }
.sm-recap-table td { padding: 8px 10px; border-top: 1px solid var(--sm-line); vertical-align: top; }
.sm-rt-time { color: var(--sm-muted); white-space: nowrap; }
.sm-rt-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sm-rt-ai { color: var(--sm-ink); }
.sm-rt-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.sm-rt-badge.book { background: #dcfce7; color: #166534; }
.sm-rt-badge.note { background: #e0e7ff; color: #3730a3; }
.sm-rt-badge.call { background: #fef9c3; color: #854d0e; }
.sm-rt-badge.urgent { background: #fee2e2; color: #991b1b; }

/* Popup "ricontattami" nel recap */
.sm-recap-cb { background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 14px; padding: 16px; margin: 4px 0 16px; text-align: center; }
.sm-recap-cb-t { font-weight: 800; font-size: 16px; color: var(--sm-ink); }
.sm-recap-cb-d { font-size: 13px; color: var(--sm-muted); margin: 4px 0 10px; }
.sm-recap-cb-row { display: flex; gap: 8px; }
.sm-recap-cb-row .sm-in { flex: 1; text-align: center; }
.sm-recap-cb-msg { font-size: 13px; color: var(--sm-teal-d); margin-top: 8px; min-height: 16px; }

/* Knowledge panel (cosa so di questo studio) */
.sm-know { margin-top: 18px; text-align: left; background: #f8fafc; border: 1px solid var(--sm-line); border-radius: 12px; padding: 14px 16px; }
.sm-know h4 { margin: 0 0 8px; font-size: 12px; color: var(--sm-teal-d); text-transform: uppercase; letter-spacing: .04em; }
.sm-know-row { margin: 4px 0; font-size: 13.5px; }
.sm-know-row b { color: var(--sm-muted); font-weight: 600; }
.sm-chips2 { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.sm-chip2 { background: #ecfeff; border: 1px solid #a5f3fc; color: var(--sm-teal-d); border-radius: 999px; padding: 2px 9px; font-size: 12px; }
.sm-know details { margin-top: 8px; }
.sm-know summary { cursor: pointer; color: var(--sm-teal-d); font-weight: 600; font-size: 12.5px; }
.sm-doc-list { margin: 6px 0 0; padding-left: 16px; color: var(--sm-muted); font-size: 12.5px; max-height: 150px; overflow: auto; }

/* Agenda: pre-esistenti vs nuove */
.sm-agenda-item.pre { background: #f8fafc; border-color: var(--sm-line); }
.sm-agenda-item.pre .sm-agenda-when { color: var(--sm-muted); }
.sm-agenda-item.neu { box-shadow: 0 0 0 2px rgba(34,197,94,.18); }
.sm-agenda-doc { color: var(--sm-muted); font-size: 12px; display: block; }
.sm-cal-day { font-size: 11px; font-weight: 700; color: var(--sm-muted); text-transform: uppercase; letter-spacing: .03em; margin: 6px 0 2px; }

/* Wizard textarea */
.sm-wz-area { width: 100%; min-height: 90px; padding: 10px 12px; border: 1px solid var(--sm-line); border-radius: 10px; font: inherit; font-size: 14px; resize: vertical; margin-top: 6px; }

/* Calendario SETTIMANALE con tab per medico (vista studio) */
.sm-week { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sm-week-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; flex-shrink: 0; }
.sm-week-tab { font: inherit; font-size: 11.5px; font-weight: 600; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--sm-line); background: #fff; color: var(--sm-muted); cursor: pointer; white-space: nowrap; }
.sm-week-tab.on { background: var(--sm-teal); border-color: var(--sm-teal); color: #fff; }
.sm-week-tab:hover { border-color: var(--sm-teal); }
.sm-week-grid { display: grid; gap: 3px; overflow: auto; flex: 1; min-height: 0; align-content: start; }
.sm-week-cell { font-size: 10.5px; border-radius: 6px; padding: 4px 5px; min-height: 30px; display: flex; align-items: center; justify-content: center; text-align: center; }
.sm-week-th { color: var(--sm-muted); font-weight: 700; flex-direction: column; gap: 0; padding: 2px; position: sticky; top: 0; background: #fcfffe; z-index: 1; }
.sm-week-th .wd { text-transform: uppercase; font-size: 10px; }
.sm-week-th .dm { font-size: 10.5px; color: var(--sm-ink); }
.sm-week-time { color: var(--sm-muted); font-weight: 700; font-size: 10.5px; justify-content: flex-end; padding-right: 6px; }
.sm-week-cell.free { background: #f8fafc; border: 1px dashed var(--sm-line); color: #cbd5e1; font-style: italic; }
.sm-week-cell.busy { background: #ecfeff; border: 1px solid #a5f3fc; color: var(--sm-teal-d); }
.sm-week-cell.busy .p, .sm-week-cell.booked .p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.sm-week-cell.booked { background: #dcfce7; border: 1px solid #86efac; color: #166534; font-weight: 700; }
.sm-week-cell.closed { background: repeating-linear-gradient(45deg, #f1f5f9, #f1f5f9 4px, #e9eef3 4px, #e9eef3 8px); border: 1px solid var(--sm-line); color: #94a3b8; font-style: italic; }
.sm-week-cell.sm-week-new { animation: sm-week-blink .7s ease-in-out 0s 6; }
@keyframes sm-week-blink {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34,197,94,.7); }
  50% { box-shadow: 0 0 0 5px rgba(34,197,94,.15); background: #86efac; }
}

/* Inventario farmacia */
.sm-inv { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.sm-inv-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--sm-line); border-radius: 8px; background: #fff; font-size: 12.5px; transition: background .2s, box-shadow .2s; }
.sm-inv-n { flex: 1; color: var(--sm-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-inv-p { color: var(--sm-muted); font-variant-numeric: tabular-nums; }
.sm-inv-st { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.sm-inv-st.ok { background: #dcfce7; color: #166534; }
.sm-inv-st.low { background: #fef9c3; color: #854d0e; }
.sm-inv-st.out { background: #fee2e2; color: #991b1b; }
.sm-inv-row.hit { box-shadow: 0 0 0 2px var(--sm-teal); background: #ecfeff; }
.sm-inv-row.neu { box-shadow: 0 0 0 2px rgba(34,197,94,.5); background: #dcfce7; }

/* Scheda struttura editabile (form KB) */
.sm-recap-card.sm-scheda { max-width: 640px; max-height: 90vh; overflow: auto; text-align: left; }
.sm-form { display: block; }
.sm-fl { display: block; font-weight: 600; font-size: 12.5px; color: var(--sm-ink); margin: 12px 0 4px; }
.sm-fh { font-weight: 400; font-size: 11.5px; color: #94a3b8; }
.sm-in { width: 100%; padding: 9px 11px; border: 1px solid var(--sm-line); border-radius: 9px; font: inherit; font-size: 14px; background: #fff; color: var(--sm-ink); }
.sm-in:focus { outline: 0; border-color: var(--sm-teal); box-shadow: 0 0 0 3px rgba(13,148,136,.12); }
textarea.sm-in { resize: vertical; }
.sm-form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sm-med { display: flex; flex-direction: column; gap: 6px; }
.sm-med-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: center; }
.sm-med-x { border: 1px solid var(--sm-line); background: #fff; color: #ef4444; border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 13px; line-height: 1; }
.sm-med-x:hover { background: #fef2f2; }
.sm-add { display: inline-block; margin-top: 6px; background: #fff; border: 1px dashed var(--sm-teal); color: var(--sm-teal-d); border-radius: 9px; padding: 8px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.sm-add:hover { background: #f0fdfa; }
@media (max-width: 560px) {
  .sm-form-2 { grid-template-columns: 1fr; }
  .sm-med-row { grid-template-columns: 1fr auto; }
  .sm-med-row .sm-med-s { grid-column: 1 / 3; }
}

/* Responsive */
@media (max-width: 880px) {
  .sm-split { grid-template-columns: 1fr; }
  .sm-panel-patient { min-height: 55vh; }
  .sm-app { padding: 10px; height: auto; overflow: visible; }
  html, body { overflow: auto; }
  .sm-page { display: block; overflow: visible; flex: none; }
  .sm-page > * { margin: 12px auto; }
}
