/* =====================================================================
   DoctorFirm · sistema de diseño con la marca ESSALUDNET
   Aqua de la cruz del logo (#00C8D0) + azul marino del texto (#00477A),
   con un degradado aqua → verde menta. Temas: día, noche y automático.
   ===================================================================== */
:root {
  /* Marca (fija en ambos temas) */
  --brand: #00C8D0;
  --brand-mint: #19D3A2;
  --brand-navy: #00477A;
  --grad: linear-gradient(135deg, #00C8D0 0%, #13CFB0 55%, #2AD69A 100%);
  --grad-deep: linear-gradient(135deg, #00A9B3 0%, #0FB394 100%);

  /* Día */
  --bg: #F1F9FA;
  --bg-glow: radial-gradient(1200px 500px at 85% -10%, rgba(0, 200, 208, .14), transparent 60%),
             radial-gradient(900px 420px at -10% 110%, rgba(25, 211, 162, .10), transparent 60%);
  --surface: #FFFFFF;
  --surface-2: #E9F6F7;
  --surface-3: #F6FBFC;
  --border: #D6E8EC;
  --text: #0A2540;
  --text-2: #476175;
  --text-3: #8BA2B0;
  --accent: #00838F;          /* texto/enlaces sobre blanco (AA) */
  --accent-strong: #006D77;
  --accent-soft: #DDF7F7;
  --on-brand: #00303F;        /* texto sobre aqua (contraste ~7:1) */
  --ok: #0E9F6E;   --ok-soft: #DCF7EC;
  --warn: #B45309; --warn-soft: #FEF3C7;
  --bad: #C2302F;  --bad-soft: #FDE7E7;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(10, 37, 64, .05);
  --shadow: 0 1px 2px rgba(10, 37, 64, .04), 0 8px 24px -8px rgba(10, 37, 64, .10);
  --shadow-brand: 0 10px 30px -10px rgba(0, 168, 179, .55);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", monospace;
  color-scheme: light;
}

/* Noche: definido una vez y aplicado por preferencia del sistema o por elección del usuario */
:root[data-theme="dark"] {
  --bg: #061823;
  --bg-glow: radial-gradient(1100px 520px at 85% -10%, rgba(0, 200, 208, .16), transparent 60%),
             radial-gradient(900px 420px at -10% 110%, rgba(25, 211, 162, .10), transparent 60%);
  --surface: #0B2230;
  --surface-2: #10303F;
  --surface-3: #0D2735;
  --border: #1A3D4E;
  --text: #E4F4F7;
  --text-2: #9CB8C6;
  --text-3: #6A8898;
  --accent: #3FDDE3;
  --accent-strong: #7CE9ED;
  --accent-soft: #0E3B47;
  --on-brand: #00262F;
  --ok: #34D399;   --ok-soft: #0B3B2E;
  --warn: #FBBF24; --warn-soft: #3A2A07;
  --bad: #F87171;  --bad-soft: #3D1414;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -12px rgba(0, 0, 0, .6);
  --shadow-brand: 0 10px 30px -10px rgba(0, 200, 208, .45);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #061823;
    --bg-glow: radial-gradient(1100px 520px at 85% -10%, rgba(0, 200, 208, .16), transparent 60%),
               radial-gradient(900px 420px at -10% 110%, rgba(25, 211, 162, .10), transparent 60%);
    --surface: #0B2230; --surface-2: #10303F; --surface-3: #0D2735; --border: #1A3D4E;
    --text: #E4F4F7; --text-2: #9CB8C6; --text-3: #6A8898;
    --accent: #3FDDE3; --accent-strong: #7CE9ED; --accent-soft: #0E3B47; --on-brand: #00262F;
    --ok: #34D399; --ok-soft: #0B3B2E; --warn: #FBBF24; --warn-soft: #3A2A07; --bad: #F87171; --bad-soft: #3D1414;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -12px rgba(0, 0, 0, .6);
    --shadow-brand: 0 10px 30px -10px rgba(0, 200, 208, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); background-image: var(--bg-glow); background-attachment: fixed; color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; transition: background-color .25s, color .25s; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-family: var(--font-display); letter-spacing: -.015em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.12rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); }
h1:focus { outline: none; }
.muted { color: var(--text-2); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); letter-spacing: .04em; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
::selection { background: color-mix(in srgb, var(--brand) 35%, transparent); }

/* Iconos: tamaño fijo y discreto */
svg.i { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.verdict svg.i { width: 26px; height: 26px; }
.drop svg.icon { width: 30px; height: 30px; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(14px); border-right: 1px solid var(--border); padding: 20px 14px; display: flex; flex-direction: column; gap: 3px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 22px; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: var(--grad); display: grid; place-items: center; box-shadow: var(--shadow-brand); flex: none; }
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-family: var(--font-display); font-weight: 750; font-size: 1.12rem; letter-spacing: -.02em; line-height: 1.1; }
.brand-name small { display: block; font-size: .68rem; font-weight: 600; color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; }
.nav-label { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); padding: 14px 12px 6px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none; font-weight: 550; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--grad); }
.side-foot { margin-top: auto; padding: 12px 12px 2px; display: flex; flex-direction: column; gap: 2px; font-size: .74rem; color: var(--text-3); }
.side-foot a { color: var(--text-2); text-decoration: none; }
.side-foot a.side-ver { color: inherit; text-decoration: none; cursor: default; }
.side-foot a.side-ver:hover { color: inherit; text-decoration: none; }
.side-place { display: inline-flex; align-items: center; gap: 4px; }
.side-place svg { width: 12px; height: 12px; }
.side-foot a:hover { color: var(--accent); text-decoration: underline; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 32px; position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.topbar .spacer { flex: 1; }
.content { padding: 28px 32px 48px; max-width: 1120px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin-top: 6px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }

/* Selector de tema (Día / Noche / Auto) */
.theme-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.theme-switch button { border: 0; background: transparent; color: var(--text-2); width: 34px; height: 30px; border-radius: 999px; display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button.on { background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-sm); }
.theme-switch svg.i { width: 16px; height: 16px; }

/* Píldora de sesión */
.session { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; font-size: .86rem; font-weight: 550; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); text-decoration: none; box-shadow: var(--shadow-sm); }
.session .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.session.on { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.session.on .dot { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); animation: pulse 2s infinite; }
.session .first { font-weight: 650; }
.session .rest { display: inline-block; max-width: 0; overflow: hidden; white-space: nowrap; vertical-align: bottom; opacity: 0; transition: max-width .3s ease, opacity .25s ease; }
.session:hover .rest, .session:focus .rest { max-width: 260px; opacity: 1; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--ok) 0%, transparent); } }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .grid > .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { display: flex; align-items: center; gap: 10px; }
.chip-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); flex: none; }
.chip-ico.grad { background: var(--grad); color: var(--on-brand); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Héroe de bienvenida */
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 28px 30px; background: var(--grad); color: var(--on-brand); box-shadow: var(--shadow-brand); }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.hero::before { content: ""; position: absolute; right: 90px; bottom: -90px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.hero h1 { font-size: 1.9rem; }
.hero p { opacity: .85; margin-top: 6px; max-width: 520px; }
.hero .row { position: relative; z-index: 1; margin-top: 18px; }
.hero .btn { background: #FFFFFF; color: #00303F; border-color: transparent; }
.hero .btn.ghost-light { background: rgba(255, 255, 255, .22); color: #00303F; }

/* Estadísticas */
.stat-card { display: flex; align-items: center; gap: 14px; padding: 18px; }
.stat { display: flex; flex-direction: column; gap: 1px; }
.stat b { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: .8rem; color: var(--text-2); }

/* Accesos rápidos */
.quick { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; transition: transform .15s, border-color .15s, box-shadow .15s; }
.quick:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); box-shadow: var(--shadow), var(--shadow-brand); }
.quick .go { margin-top: auto; font-size: .85rem; font-weight: 650; color: var(--accent); display: inline-flex; gap: 6px; align-items: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 9px 16px; border-radius: var(--radius-sm); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .06s, box-shadow .15s, filter .15s; min-height: 40px; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--grad); border-color: transparent; color: var(--on-brand); box-shadow: var(--shadow-brand); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.05) saturate(1.1); }
.btn.big { padding: 14px 28px; font-size: 1.04rem; border-radius: 14px; min-height: 54px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn svg.i { width: 17px; height: 17px; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: .84rem; font-weight: 600; color: var(--text-2); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 42px; width: 100%; transition: border-color .15s, box-shadow .15s, background .15s; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
input:focus, select:focus, textarea:focus { outline: none; background: var(--surface); border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 550; color: var(--text); cursor: pointer; }
textarea { min-height: 84px; resize: vertical; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 650; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.brand { background: var(--accent-soft); color: var(--accent-strong); }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: .9rem; display: flex; gap: 10px; align-items: flex-start; }
.alert.info { background: var(--accent-soft); color: var(--accent-strong); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }

/* Zona para soltar PDFs */
.drop { position: relative; border: 2px dashed color-mix(in srgb, var(--brand) 45%, var(--border)); border-radius: var(--radius); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); padding: 34px 20px; text-align: center; transition: border-color .15s, background .15s, transform .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--accent-soft) 80%, var(--surface)); transform: scale(1.005); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop .drop-ico { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 18px; background: var(--grad); color: var(--on-brand); display: grid; place-items: center; box-shadow: var(--shadow-brand); }
.drop strong { display: block; font-size: 1.08rem; margin-bottom: 4px; }

.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.doc-list li:last-child { border-bottom: none; }
.doc-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.doc-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); display: grid; place-items: center; font-size: .62rem; font-weight: 800; flex: none; }

.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--grad); transition: width .2s; border-radius: 999px; }

.rx-item { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-3); position: relative; }
.rx-item .num { position: absolute; left: -10px; top: -10px; width: 24px; height: 24px; border-radius: 50%; background: var(--grad); color: var(--on-brand); font-size: .75rem; font-weight: 800; display: grid; place-items: center; }
.rx-item .rm { position: absolute; top: 6px; right: 6px; }

/* Barra de acción fija (formularios largos) */
.action-bar { position: sticky; bottom: 16px; z-index: 4; margin-top: 18px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(12px); border: 1px solid var(--border); box-shadow: var(--shadow); }

.verdict { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: var(--radius); }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.warn { background: var(--warn-soft); color: var(--warn); }
.verdict.bad { background: var(--bad-soft); color: var(--bad); }
.verdict p, .verdict h2 { color: inherit; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: .9rem; margin-top: 14px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; word-break: break-word; }

.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); margin-bottom: 18px; overflow-x: auto; max-width: 100%; }
.tab { padding: 8px 14px; border: none; background: none; font: inherit; font-weight: 600; color: var(--text-2); border-radius: 10px; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-sm); }

.key-option { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; cursor: pointer; background: var(--surface-3); text-align: left; width: 100%; font: inherit; color: inherit; transition: border-color .15s, transform .1s, box-shadow .15s; }
.key-option:hover:not(:disabled) { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.key-option:disabled { opacity: .55; cursor: not-allowed; }
.key-option .grow { flex: 1; min-width: 0; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity li:last-child { border-bottom: 0; }
.activity .what { flex: 1; min-width: 0; }
.activity .what b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.activity li { flex-wrap: wrap; }
.activity .act-btns { display: flex; gap: 6px; flex: none; }
@media (max-width: 640px) { .activity .act-btns { width: 100%; justify-content: flex-end; } }

.empty { text-align: center; padding: 26px; color: var(--text-2); }
.fade-in { animation: fade .25s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* ---------- Celular: la barra lateral pasa a pestañas inferiores ---------- */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); gap: 8px; }
  .topbar .mobile-brand .label { display: none; }
  .theme-switch button { width: 30px; height: 28px; }
  .session { padding: 6px 10px; }
  .topbar .mobile-brand { display: flex; }
  .content { padding: 16px 16px 100px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3.cols-1-mobile, .grid-2.cols-1-mobile { grid-template-columns: 1fr; }
  .rx-item { grid-template-columns: 1fr 1fr; }
  .rx-item > :first-of-type { grid-column: 1 / -1; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 6px; }
  .btn.big { width: 100%; }
  .hero { padding: 22px; }
  .hero h1 { font-size: 1.45rem; }
  .session .when { display: none; }
  .action-bar { bottom: 84px; }
}
.mobile-brand { display: none; align-items: center; gap: 8px; font-weight: 750; min-width: 0; }
@media (min-width: 421px) and (max-width: 760px) { .topbar .mobile-brand .label { display: inline; } }
.mobile-brand .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
.mobile-brand .brand-mark svg { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

#blazor-error-ui { background: var(--warn-soft); color: var(--warn); bottom: 0; display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.status-bar-safe-area { display: none; }

/* ---------- Dictation (voice / photo → prescription) ---------- */
.dictation { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 55%, var(--surface)) 0%, var(--surface) 70%); }
.dictation-text { width: 100%; min-height: 84px; font-size: 1.02rem; line-height: 1.5; resize: vertical; }
.btn.rec { background: var(--bad); color: #fff; border-color: transparent; animation: rec-pulse 1.4s infinite; }
@keyframes rec-pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--bad) 18%, transparent); } }
.btn.small { min-height: 32px; padding: 5px 12px; font-size: .86rem; }
label.btn.disabled { opacity: .5; pointer-events: none; }
.understood { margin-top: 12px; display: grid; gap: 8px; }
.understood-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); }
.understood-item .muted { margin-right: 2px; }
.ai-answer { white-space: pre-wrap; margin-top: 10px; padding: 12px; border-radius: 12px; background: var(--surface-2); font-size: .95rem; }
.progress > .indeterminate { width: 35%; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

/* ---------- Medical data search ---------- */
.search { width: 100%; font-size: 1.02rem; }
.results { display: grid; gap: 8px; margin-top: 12px; }
.result { display: block; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: inherit; text-decoration: none; }
a.result:hover { background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface-2)); }
.result .badge { margin-left: 4px; }
@media (max-width: 640px) { .grid-4.cols-2-mobile { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Guided forms: collapsible steps, progressive fields, soft neon ---------- */
:root { --neon: rgba(0, 200, 208, .38); --neon-soft: rgba(0, 200, 208, .16); }
:root[data-theme="dark"] { --neon: rgba(63, 221, 227, .32); --neon-soft: rgba(63, 221, 227, .12); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) { --neon: rgba(63, 221, 227, .32); --neon-soft: rgba(63, 221, 227, .12); }
}

/* Soft neon on action buttons: a faint halo, never a strong glow */
.btn.primary { box-shadow: var(--shadow-brand), 0 0 0 1px var(--neon-soft), 0 0 14px var(--neon-soft); }
.btn.primary:hover:not(:disabled) { box-shadow: var(--shadow-brand), 0 0 0 1px var(--neon), 0 0 18px var(--neon); }
.btn.glow { box-shadow: var(--shadow-brand), 0 0 0 1px var(--neon), 0 0 16px var(--neon); }
.btn.pulse { animation: neon-breathe 2.6s ease-in-out infinite; }
@keyframes neon-breathe {
  0%, 100% { box-shadow: var(--shadow-brand), 0 0 0 1px var(--neon-soft), 0 0 10px var(--neon-soft); }
  50%      { box-shadow: var(--shadow-brand), 0 0 0 1px var(--neon), 0 0 22px var(--neon); }
}
@media (prefers-reduced-motion: reduce) { .btn.pulse { animation: none; } }

/* Progress */
.form-progress { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.form-progress-track { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.form-progress-fill { height: 100%; border-radius: 999px; background: var(--grad); box-shadow: 0 0 10px var(--neon); transition: width .35s cubic-bezier(.2, .8, .2, 1); }
.form-progress .small { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Steps */
.step { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); margin-bottom: 10px; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.step.open { border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); box-shadow: var(--shadow), 0 0 0 3px var(--neon-soft); }
.step-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.step-head:hover { background: var(--surface-3); }
.step-num { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .9rem; background: var(--surface-2); color: var(--text-2); transition: background .2s, color .2s, box-shadow .2s; }
.step.open .step-num { background: var(--grad); color: var(--on-brand); box-shadow: 0 0 12px var(--neon); }
.step.done:not(.open) .step-num { background: var(--ok-soft); color: var(--ok); }
.step-num .i { width: 16px; height: 16px; }
.step-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.step-title b { font-size: 1rem; }
.step-summary { font-size: .84rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.done:not(.open) .step-summary { color: var(--text); }
.step-chevron { color: var(--text-3); transition: transform .2s; display: grid; }
.step-chevron .i { transform: rotate(90deg); }
.step.open .step-chevron { transform: rotate(180deg); }
.step-body { padding: 4px 16px 16px; animation: step-open .28s cubic-bezier(.2, .8, .2, 1) both; }
.step-foot { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
@keyframes step-open { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Fields appear one after another */
.reveal { animation: reveal .3s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .reveal, .step-body { animation: none; } }

/* A value the app filled for you (e.g. computed quantity) */
input.auto { border-color: color-mix(in srgb, var(--brand) 60%, var(--border)); background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); }

/* ---------- Game-like start: signed / unsigned, then voice · photo · text ---------- */
.mode-chooser { text-align: center; padding: 8px 0 4px; }
.mode-q { font-family: var(--font-display); font-size: 1.45rem; margin: 6px 0 16px; }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.mode-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 18px 20px; border-radius: 22px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: center; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s, box-shadow .2s, border-color .2s; }
.mode-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); box-shadow: var(--shadow), 0 0 0 3px var(--neon-soft), 0 0 22px var(--neon-soft); }
.mode-card:active { transform: translateY(0) scale(.99); }
.mode-card.signed { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); box-shadow: var(--shadow), 0 0 0 1px var(--neon-soft), 0 0 16px var(--neon-soft); }
.mode-ico { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent-strong); }
.mode-ico.grad { background: var(--grad); color: var(--on-brand); box-shadow: 0 0 18px var(--neon); }
.mode-ico .i { width: 30px; height: 30px; }
.mode-text { display: flex; flex-direction: column; gap: 4px; }
.mode-text b { font-size: 1.12rem; }
.mode-text span { color: var(--text-2); font-size: .9rem; line-height: 1.35; }
.mode-card .badge { position: absolute; top: 12px; right: 12px; }
.mode-pill { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.link-btn { background: none; border: 0; padding: 4px 6px; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.demo-note { margin-bottom: 14px; }

.input-chooser { text-align: center; padding: 6px 0 2px; }
.input-q { font-weight: 700; font-size: 1.05rem; margin: 0 0 14px; }
.input-row { display: grid; grid-template-columns: repeat(3, minmax(0, 132px)); justify-content: center; align-items: start; gap: 18px; }
.input-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; }
.input-btn .input-ico { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--accent-strong); border: 1px solid var(--border); transition: transform .15s, box-shadow .2s; }
.input-btn:hover .input-ico { transform: translateY(-2px); box-shadow: 0 0 0 3px var(--neon-soft), 0 0 16px var(--neon-soft); }
.input-btn.voice .input-ico { width: 74px; height: 74px; background: var(--grad); color: var(--on-brand); border: 0; animation: neon-breathe-ring 2.8s ease-in-out infinite; }
.input-btn .input-ico .i { width: 30px; height: 30px; }
.input-btn b { font-size: .95rem; }
.input-btn.disabled { opacity: .5; pointer-events: none; }
@keyframes neon-breathe-ring { 0%, 100% { box-shadow: 0 0 0 0 var(--neon-soft), 0 0 12px var(--neon-soft); } 50% { box-shadow: 0 0 0 8px var(--neon-soft), 0 0 24px var(--neon); } }
@media (prefers-reduced-motion: reduce) { .input-btn.voice .input-ico { animation: none; } }

.step-kicker { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.step.done:not(.open) .step-num { animation: pop .35s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { from { transform: scale(.6); } to { transform: scale(1); } }
.speed-badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; box-shadow: 0 0 12px var(--neon-soft); }

@media (max-width: 640px) {
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { flex-direction: row; text-align: left; padding: 16px; }
  .mode-ico { width: 52px; height: 52px; flex: none; }
  .mode-card .badge { position: static; margin-left: auto; align-self: flex-start; }
}

/* ---------- Receta wizard: one question at a time, background shifts per question ---------- */
.wizard { --h: 180; position: relative; min-height: calc(100vh - 140px); margin: -8px -8px 0; padding: 18px 18px 28px; border-radius: 24px;
  background:
    radial-gradient(900px 420px at 85% -10%, color-mix(in srgb, hsl(var(--h) 85% 50%) 16%, transparent), transparent 65%),
    radial-gradient(700px 380px at -10% 110%, color-mix(in srgb, hsl(calc(var(--h) + 40) 80% 50%) 12%, transparent), transparent 65%),
    color-mix(in srgb, hsl(var(--h) 70% 50%) 5%, var(--bg));
  transition: background .7s ease; }
.wz-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wz-top .spacer { flex: 1; }
.wz-count { font-variant-numeric: tabular-nums; font-weight: 700; }
.wz-bar { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--surface-2) 80%, transparent); margin: 10px 0 6px; overflow: hidden; }
.wz-bar > div { height: 100%; border-radius: 999px; background: var(--grad); box-shadow: 0 0 10px var(--neon); transition: width .45s cubic-bezier(.2, .8, .2, 1); }
.wz-recap { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; margin: 8px 0 4px; }
.wz-chip { border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 75%, transparent); color: var(--text-2); font: inherit; font-size: .78rem; padding: 4px 10px; border-radius: 999px; cursor: pointer; animation: reveal .3s both; }
.wz-chip:hover { color: var(--text); border-color: color-mix(in srgb, var(--brand) 50%, var(--border)); }
.wz-card { max-width: 680px; margin: 22px auto 0; padding: 26px 24px; border-radius: 24px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); box-shadow: var(--shadow), 0 0 0 1px var(--neon-soft); }
.wz-slide { animation: wz-in .38s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes wz-in { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wz-slide, .wizard { animation: none; transition: none; } }
.wz-kicker { display: inline-block; font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.wz-q { font-family: var(--font-display); font-size: clamp(1.45rem, 4.2vw, 2rem); line-height: 1.2; margin: 6px 0 18px; }
.wz-input { width: 100%; font-size: 1.25rem; padding: 14px 16px; border-radius: 16px; min-height: 58px; }
textarea.wz-input { min-height: 110px; }
.wz-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.wz-opt { border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 14px; cursor: pointer; transition: transform .12s, box-shadow .2s, border-color .2s; }
.wz-opt:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); box-shadow: 0 0 0 3px var(--neon-soft); }
.wz-opt.on { background: var(--grad); color: var(--on-brand); border-color: transparent; box-shadow: 0 0 14px var(--neon); }
.wz-help { margin: 12px 0 0; color: var(--accent-strong); font-weight: 600; font-size: .92rem; display: flex; gap: 6px; align-items: center; }
.wz-error { margin: 10px 0 0; color: var(--bad); font-size: .9rem; display: flex; gap: 6px; align-items: center; }
.wz-nav { display: flex; align-items: center; gap: 10px; margin-top: 22px; }
.wz-nav .btn.primary { margin-left: auto; }
.wz-hint { margin: 8px 0 0; text-align: right; }
.i.flip { transform: rotate(180deg); }
.review { display: grid; gap: 8px; }
.review-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); cursor: pointer; transition: box-shadow .2s; }
.review-row:hover { box-shadow: 0 0 0 2px var(--neon-soft); }
.review-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.review-row .i { color: var(--accent); flex: none; margin-top: 2px; }
.result-card { text-align: center; }
.result-ico { width: 74px; height: 74px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: var(--on-brand); box-shadow: 0 0 26px var(--neon); animation: pop .45s cubic-bezier(.2, 1.6, .4, 1) both; }
.result-ico .i { width: 36px; height: 36px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, #00141d 55%, transparent); backdrop-filter: blur(6px); }
.modal-card { position: relative; width: min(640px, 100%); padding: 26px 22px 22px; border-radius: 26px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow), 0 0 0 1px var(--neon-soft), 0 0 40px var(--neon-soft); }
.modal-x { position: absolute; top: 10px; right: 10px; }
.dictation .input-chooser + * { margin-top: 0; }
@media (max-width: 640px) {
  .wizard { margin: -4px -4px 0; padding: 12px 10px 90px; border-radius: 18px; }
  .wz-card { padding: 20px 16px; margin-top: 12px; }
  .wz-input { font-size: 1.1rem; }
  .desk-only { display: none !important; }
}

/* ---------- Signed / unsigned: black stage, faint white neon frames (same in day and night) ---------- */
.modal-backdrop { background: rgba(0, 0, 0, .82); backdrop-filter: blur(16px) saturate(1.1); -webkit-backdrop-filter: blur(16px) saturate(1.1); }
.modal-card { background: #000; border: 1px solid rgba(255, 255, 255, .55); box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 0 28px rgba(255, 255, 255, .14), inset 0 0 22px rgba(255, 255, 255, .04); color: #fff; }
.modal-card .modal-x { color: rgba(255, 255, 255, .7); }
.modal-card .modal-x:hover { background: rgba(255, 255, 255, .08); }
.modal-card .alert { background: rgba(255, 255, 255, .06); color: rgba(255, 255, 255, .85); border: 1px solid rgba(255, 255, 255, .2); }
.mode-chooser { text-align: center; padding: 10px 0 4px; }
.mode-q { font-family: var(--font-display); font-weight: 300; letter-spacing: .02em; font-size: clamp(1.3rem, 4vw, 1.75rem); margin: 4px 0 22px; color: #fff; }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.mode-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 170px; padding: 22px 14px; border-radius: 20px;
  background: #000; color: #fff; font: inherit; cursor: pointer; border: 1px solid rgba(255, 255, 255, .5);
  box-shadow: 0 0 10px rgba(255, 255, 255, .12), inset 0 0 14px rgba(255, 255, 255, .04);
  transition: transform .15s, box-shadow .25s, border-color .25s; }
.mode-card:hover, .mode-card:focus-visible { outline: none; transform: translateY(-3px); border-color: rgba(255, 255, 255, .9);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .25), 0 0 26px rgba(255, 255, 255, .28), inset 0 0 18px rgba(255, 255, 255, .07); }
.mode-card:active { transform: scale(.98); }
.mode-card b { font-size: 1.15rem; font-weight: 600; letter-spacing: .03em; }
.mode-ico { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; background: transparent; color: #fff;
  border: 1px solid rgba(255, 255, 255, .45); box-shadow: 0 0 14px rgba(255, 255, 255, .18); }
.mode-ico .i { width: 28px; height: 28px; }
@media (max-width: 640px) {
  .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .mode-card { flex-direction: column; text-align: center; min-height: 140px; padding: 18px 10px; }
  .mode-ico { width: 54px; height: 54px; }
}

/* =====================================================================
   Immersive shell: ambient background, glass frame, page transitions,
   one reusable overlay (.immersive-backdrop + .immersive-sheet) and
   "stage" building blocks for every module. Later rules override above.
   ===================================================================== */
:root {
  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .86);
  --glass-border: rgba(255, 255, 255, .8);
  --glass-line: rgba(10, 37, 64, .08);
  --sheet: #FFFFFF;
  --sheet-text: #0A2540;
  --scrim: rgba(240, 249, 250, .30);
  --amb-1: rgba(0, 200, 208, .30);
  --amb-2: rgba(25, 211, 162, .24);
  --amb-3: rgba(0, 71, 122, .14);
  --note: #E9F2F5; --note-text: #24435A;
}
:root[data-theme="dark"] {
  --glass: rgba(11, 34, 48, .58);
  --glass-strong: rgba(11, 34, 48, .86);
  --glass-border: rgba(124, 233, 237, .14);
  --glass-line: rgba(124, 233, 237, .10);
  --sheet: #0A1F2B;
  --sheet-text: #E4F4F7;
  --scrim: rgba(2, 12, 18, .45);
  --amb-1: rgba(0, 200, 208, .20);
  --amb-2: rgba(25, 211, 162, .13);
  --amb-3: rgba(0, 95, 160, .30);
  --note: #10303F; --note-text: #CFE6EE;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --glass: rgba(11, 34, 48, .58); --glass-strong: rgba(11, 34, 48, .86); --glass-border: rgba(124, 233, 237, .14); --glass-line: rgba(124, 233, 237, .10);
    --sheet: #0A1F2B; --sheet-text: #E4F4F7; --scrim: rgba(2, 12, 18, .45);
    --amb-1: rgba(0, 200, 208, .20); --amb-2: rgba(25, 211, 162, .13); --amb-3: rgba(0, 95, 160, .30);
    --note: #10303F; --note-text: #CFE6EE;
  }
}

/* Ambient: three soft blobs drifting slowly behind everything (aqua → mint → navy) */
body { background-image: none; }
.ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background: var(--bg); }
.ambient i { position: absolute; width: 75vmax; height: 75vmax; border-radius: 50%; }
.ambient i:nth-child(1) { top: -38vmax; right: -26vmax; background: radial-gradient(closest-side, var(--amb-1), transparent); animation: amb-a 42s ease-in-out infinite alternate; }
.ambient i:nth-child(2) { bottom: -40vmax; left: -28vmax; background: radial-gradient(closest-side, var(--amb-2), transparent); animation: amb-b 54s ease-in-out infinite alternate; }
.ambient i:nth-child(3) { top: 20vh; left: 30vw; width: 60vmax; height: 60vmax; background: radial-gradient(closest-side, var(--amb-3), transparent); animation: amb-c 66s ease-in-out infinite alternate; }
@keyframes amb-a { to { transform: translate(-14vmax, 12vmax) scale(1.12); } }
@keyframes amb-b { to { transform: translate(16vmax, -10vmax) scale(1.08); } }
@keyframes amb-c { to { transform: translate(-18vmax, -14vmax) scale(.9); } }

/* Glass frame */
.side { background: var(--glass); backdrop-filter: blur(22px) saturate(1.35); -webkit-backdrop-filter: blur(22px) saturate(1.35); border-right: 1px solid var(--glass-border); transition: opacity .35s ease, filter .35s ease; }
.topbar { background: color-mix(in srgb, var(--glass) 70%, transparent); backdrop-filter: blur(22px) saturate(1.35); -webkit-backdrop-filter: blur(22px) saturate(1.35); border-bottom: 1px solid var(--glass-line); }
.nav-item:hover { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.nav-item.active { background: color-mix(in srgb, var(--accent-soft) 85%, transparent); box-shadow: 0 0 0 1px var(--neon-soft), 0 0 16px var(--neon-soft); }

/* Focus mode: while a one-question card is on screen, the sidebar steps back (hover brings it back) */
@media (min-width: 761px) {
  .shell:has(.wz-slide) .side { opacity: .42; filter: saturate(.5); }
  .shell:has(.wz-slide) .side:hover, .shell:has(.wz-slide) .side:focus-within { opacity: 1; filter: none; }
}

/* Page transition, keyed by route in MainLayout */
.page-enter { animation: page-in .42s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(12px); } }

/* Cards read as glass over the ambient background */
.card { background: var(--glass-strong); border-color: var(--glass-border); }
.glass { background: var(--glass); border: 1px solid var(--glass-border); border-radius: 22px; box-shadow: var(--shadow); }
.glass.strong { background: var(--glass-strong); }

/* Informational notes: neutral, never amber. Real errors stay red. */
.alert.warn, .alert.note { background: var(--note); color: var(--note-text); border: 1px solid var(--glass-line); }
.alert.warn svg.i, .alert.note svg.i { color: var(--accent); }
.badge.warn { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
#blazor-error-ui { background: var(--bad-soft); color: var(--bad); }

/* ---------- One reusable immersive overlay ---------- */
.immersive-backdrop { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; padding: 16px;
  background: var(--scrim); backdrop-filter: blur(18px) saturate(1.15); -webkit-backdrop-filter: blur(18px) saturate(1.15);
  animation: im-fade .25s ease-out both; }
.immersive-sheet { position: relative; width: min(560px, 100%); max-height: min(92vh, 940px); overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 14px; padding: 26px 24px 22px; border-radius: 28px;
  background: var(--sheet); color: var(--sheet-text); border: 1px solid var(--border);
  box-shadow: 0 30px 80px -20px rgba(10, 37, 64, .38), 0 0 0 1px var(--neon-soft), 0 0 40px var(--neon-soft);
  animation: im-rise .38s cubic-bezier(.2, .8, .2, 1) both; }
.immersive-sheet:focus { outline: none; }
.immersive-sheet.wide { width: min(760px, 100%); }
.immersive-x { position: absolute; top: 10px; right: 10px; min-height: 36px; padding: 6px; color: var(--text-2); }
.immersive-kicker { font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.immersive-title { font-family: var(--font-display); font-size: clamp(1.3rem, 3.6vw, 1.7rem); line-height: 1.2; margin: 0 40px 0 0; }
.immersive-grab { display: none; }
@keyframes im-fade { from { opacity: 0; } }
@keyframes im-rise { from { opacity: 0; transform: translateY(22px) scale(.98); } }

/* ---------- Stage: one focused module, title + big action ---------- */
.stage { max-width: 920px; margin: 0 auto; }
.stage-head { text-align: center; margin: 6px auto 22px; max-width: 640px; }
.stage-head h1 { font-size: clamp(1.7rem, 4.6vw, 2.4rem); letter-spacing: -.025em; }
.stage-head .eyebrow { justify-content: center; }
.stage-sub { margin-top: 8px; color: var(--text-2); }
.stage-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* Big choice cards (Mi firma, etc.) */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.choice { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 196px; padding: 26px 18px;
  border-radius: 26px; border: 1px solid var(--glass-border); background: var(--glass-strong); color: var(--text); font: inherit; text-align: center; cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow); transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .25s, border-color .25s; animation: reveal .4s cubic-bezier(.2, .8, .2, 1) both; }
.choice:nth-child(2) { animation-delay: .06s; } .choice:nth-child(3) { animation-delay: .12s; } .choice:nth-child(4) { animation-delay: .18s; }
.choice:hover, .choice:focus-visible { outline: none; transform: translateY(-4px); border-color: color-mix(in srgb, var(--brand) 60%, transparent); box-shadow: var(--shadow), 0 0 0 1px var(--neon), 0 0 28px var(--neon-soft); }
.choice:active { transform: scale(.985); }
.choice:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.choice b { font-size: 1.15rem; font-weight: 650; }
.choice small { color: var(--text-2); font-size: .85rem; margin-top: -8px; }
.choice-ico { width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; background: var(--grad); color: var(--on-brand); box-shadow: 0 0 22px var(--neon); }
.choice-ico .i { width: 34px; height: 34px; }
.choice .badge { position: absolute; top: 12px; right: 12px; }
.choice-text { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

/* Collapsible drawer (<details>) */
.drawer { border-radius: 20px; background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: var(--shadow-sm); overflow: hidden; }
.drawer + .drawer { margin-top: 12px; }
.drawer > summary { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; list-style: none; font-weight: 650; }
.drawer > summary::-webkit-details-marker { display: none; }
.drawer > summary::after { content: ""; width: 9px; height: 9px; margin-left: auto; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); transition: transform .2s; flex: none; }
.drawer[open] > summary::after { transform: rotate(225deg); }
.drawer > summary:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.drawer > summary .muted { font-weight: 500; }
.drawer > summary .chip-ico { width: 34px; height: 34px; }
.drawer-body { padding: 4px 16px 16px; animation: step-open .28s cubic-bezier(.2, .8, .2, 1) both; }

/* Pill chips (tabs) */
.pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--glass-border); background: var(--glass-strong);
  color: var(--text-2); font: inherit; font-weight: 600; cursor: pointer; transition: color .15s, box-shadow .2s, background .2s, transform .12s; }
.pill:hover { color: var(--text); transform: translateY(-1px); }
.pill.on { background: var(--grad); color: var(--on-brand); border-color: transparent; box-shadow: 0 0 0 1px var(--neon-soft), 0 0 16px var(--neon); }
.pill svg.i { width: 16px; height: 16px; }
.pills.small .pill { padding: 6px 12px; font-size: .86rem; }

/* Big field (CAN, search…) */
.big-field { width: 100%; font-size: 1.3rem; padding: 16px 18px; min-height: 62px; border-radius: 18px; background: var(--glass-strong); border-color: var(--glass-border); box-shadow: var(--shadow-sm); }
.big-field:focus { box-shadow: 0 0 0 4px var(--neon-soft), 0 0 22px var(--neon-soft); }
.slide-in { animation: slide-in .38s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes slide-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Phones: the "Más" sheet and choice cards ---------- */
@media (max-width: 760px) {
  .immersive-backdrop { padding: 0; place-items: end stretch; }
  .immersive-sheet, .immersive-sheet.wide { width: 100%; max-height: 92vh; border-radius: 26px 26px 0 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); animation-name: im-up; }
  .immersive-grab { display: block; width: 44px; height: 5px; border-radius: 999px; background: var(--border); margin: 0 auto 2px; flex: none; }
  .choice-grid { grid-template-columns: 1fr; gap: 12px; }
  .choice { flex-direction: row; justify-content: flex-start; text-align: left; min-height: 0; padding: 16px; gap: 14px; border-radius: 22px; }
  .choice-ico { width: 56px; height: 56px; border-radius: 18px; flex: none; }
  .choice-ico .i { width: 28px; height: 28px; }
  .choice small { margin-top: 0; }
  .choice-text { gap: 2px; }
  .choice .badge { position: static; margin-left: auto; }
  .stage-head { margin-bottom: 16px; }
}
@keyframes im-up { from { transform: translateY(100%); } }
.more-head { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.more-head svg.i { width: 16px; height: 16px; color: var(--accent); }
.more-foot { margin: 0; text-align: center; font-size: .85rem; color: var(--text-3); }
.more-foot a { color: var(--text-2); }
.more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.more-tile { display: flex; flex-direction: row; align-items: center; gap: 10px; min-width: 0; padding: 10px 12px; border-radius: 16px; font-size: .92rem; line-height: 1.15; text-decoration: none; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); font-weight: 650; transition: box-shadow .2s, transform .12s; }
.more-tile:hover, .more-tile.active { box-shadow: 0 0 0 1px var(--neon), 0 0 18px var(--neon-soft); }
.more-tile .chip-ico { width: 36px; height: 36px; border-radius: 12px; }

@media (prefers-reduced-motion: reduce) {
  .ambient i, .page-enter, .immersive-backdrop, .immersive-sheet, .choice, .slide-in, .drawer-body { animation: none !important; }
}

/* =====================================================================
   Navigation: four calm entries (Emitir · Verificar · Mi consultorio · Herramientas).
   Desktop folds groups (one open at a time); phones get 4 tabs + the "Más" sheet.
   ===================================================================== */
.nav-groups { display: flex; flex-direction: column; gap: 4px; }
.nav-item:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.nav-head { width: 100%; border: 0; background: none; font: inherit; font-weight: 650; line-height: inherit; cursor: pointer; text-align: left; }
.nav-top { font-weight: 650; }
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
svg.i.nav-chev { width: 16px; height: 16px; color: var(--text-3); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.nav-group.open svg.i.nav-chev { transform: rotate(180deg); }
.nav-group.has-active > .nav-head { color: var(--accent-strong); }
.nav-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--brand); box-shadow: 0 0 8px var(--neon), 0 0 0 3px var(--neon-soft); opacity: 0; transform: scale(.4); transition: opacity .2s, transform .2s; }
.nav-group.has-active:not(.open) .nav-dot { opacity: 1; transform: none; }

/* Fold: the grid row animates from 0fr to 1fr, so the height follows the content */
.nav-sub { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .3s cubic-bezier(.2, .8, .2, 1), opacity .22s ease; }
.nav-group.open .nav-sub { grid-template-rows: 1fr; opacity: 1; }
.nav-sub-in { min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 2px; margin-left: 21px; padding: 2px 6px 6px 12px; border-left: 1px solid var(--glass-line, var(--border)); }
.nav-child { padding: 8px 10px; font-size: .93rem; }
.nav-child svg.i { width: 16px; height: 16px; }
.nav-item.nav-child.active { box-shadow: 0 0 0 1px var(--neon-soft), 0 0 10px var(--neon-soft); }
.nav-item.nav-child.active::before { left: -13px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; box-shadow: 0 0 8px var(--neon); }

/* Phones: bottom tab bar (hidden on desktop) */
.tabbar { display: none; }
@media (max-width: 760px) {
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-around; gap: 2px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--glass-strong); backdrop-filter: blur(22px) saturate(1.35); -webkit-backdrop-filter: blur(22px) saturate(1.35); border-top: 1px solid var(--glass-border); }
  .tb-item { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 4px 6px; border: 0; border-radius: 14px; background: none;
    font: inherit; font-size: .7rem; font-weight: 650; line-height: 1.1; color: var(--text-2); text-decoration: none; cursor: pointer; transition: color .15s, background .15s; }
  .tb-item svg.i { width: 22px; height: 22px; }
  .tb-item:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
  .tb-item.active { color: var(--accent-strong); background: color-mix(in srgb, var(--accent-soft) 70%, transparent); }
  .tb-item.active::before { content: ""; position: absolute; left: 30%; right: 30%; top: -6px; height: 3px; border-radius: 0 0 4px 4px; background: var(--grad); box-shadow: 0 0 10px var(--neon); }
  .tb-item.active svg.i { filter: drop-shadow(0 0 6px var(--neon)); }
}

/* "Receta | Descanso" segmented switch: phones only (desktop has both under Emitir) */
.emit-bar { display: none; }
@media (max-width: 760px) {
  .emit-bar { display: flex; justify-content: center; padding: 12px 16px 0; }
  .emit-switch { position: relative; display: grid; grid-template-columns: 1fr 1fr; width: min(100%, 320px); padding: 4px; border-radius: 999px;
    background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: var(--shadow-sm); }
  .emit-switch a { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 10px; border-radius: 999px;
    font-weight: 700; font-size: .9rem; color: var(--text-2); text-decoration: none; transition: color .2s; }
  .emit-switch a svg.i { width: 16px; height: 16px; }
  .emit-switch a.on { color: var(--on-brand); }
  .emit-switch a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
  .emit-pill { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: var(--grad); box-shadow: 0 0 0 1px var(--neon-soft), 0 0 14px var(--neon);
    transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
  .emit-switch.right .emit-pill { transform: translateX(100%); }
  .emit-bar + .content { padding-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-sub, .nav-chev, .nav-dot, .emit-pill { transition: none !important; }
}

/* =====================================================================
   Receta: sections, doctor identity, medicine search and the one-window table
   ===================================================================== */
.wz-nav { flex-wrap: wrap; }
.wz-kicker svg.i { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
.rx-sections { display: flex; gap: 4px; margin: 4px 0 0; overflow-x: auto; scrollbar-width: none; }
.rx-sections::-webkit-scrollbar { display: none; }
.rx-sec { display: inline-flex; align-items: center; gap: 6px; flex: none; border: 0; background: none; font: inherit; font-size: .8rem; font-weight: 650; color: var(--text-3);
  padding: 4px 9px 4px 5px; border-radius: 999px; white-space: nowrap; min-height: 0; }
.rx-sec:disabled { cursor: default; }
.rx-sec.on { color: var(--accent-strong); background: color-mix(in srgb, var(--accent-soft) 85%, transparent); box-shadow: 0 0 0 1px var(--neon-soft); }
.rx-sec.done { color: var(--text-2); cursor: pointer; }
.rx-sec.done:hover { color: var(--text); }
.rx-sec-dot { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; }
.rx-sec.on .rx-sec-dot { background: currentColor; box-shadow: 0 0 8px var(--neon); }
.rx-sec.done .rx-sec-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.rx-sec-dot svg.i { width: 12px; height: 12px; }
.rx-sec.done .rx-sec-dot svg.i circle { display: none; }

.rx-avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--grad); color: var(--on-brand); display: grid; place-items: center; font-weight: 800; font-size: .9rem; box-shadow: 0 0 12px var(--neon-soft); }
.rx-avatar.big { width: 60px; height: 60px; font-size: 1.2rem; }
.rx-doctor-bar { display: flex; align-items: center; gap: 12px; width: 100%; margin: 0 0 18px; padding: 10px 14px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  border: 1px solid var(--border); border-radius: 18px; background: color-mix(in srgb, var(--accent-soft) 40%, var(--surface)); transition: box-shadow .2s, border-color .2s; }
.rx-doctor-bar:hover, .rx-doctor-bar:focus-visible { outline: none; border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); box-shadow: 0 0 0 3px var(--neon-soft); }
.rx-doctor-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.rx-doctor-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-doctor-edit { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: .85rem; font-weight: 650; color: var(--accent-strong); }
.rx-doctor-edit svg.i { width: 16px; height: 16px; }
.rx-doctor-card { display: flex; gap: 16px; align-items: center; padding: 16px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border); }
.rx-doctor-card > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rx-doctor-card svg.i { width: 15px; height: 15px; vertical-align: -2px; }
.rx-doctor-name { font-size: 1.2rem; }

.rx-search { position: relative; }
.rx-search .wz-input { padding-left: 50px; }
svg.i.rx-lens { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: var(--text-3); pointer-events: none; }
.rx-search-meta { margin: 8px 2px 0; }
.rx-hits { display: grid; gap: 6px; margin-top: 10px; max-height: min(46vh, 460px); overflow-y: auto; padding: 2px; overscroll-behavior: contain; }
.rx-hit { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); transition: border-color .15s, box-shadow .2s, transform .12s; animation: reveal .25s both; }
.rx-hit:hover:not(:disabled), .rx-hit:focus-visible { outline: none; border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); box-shadow: 0 0 0 3px var(--neon-soft); }
.rx-hit:active:not(:disabled) { transform: scale(.99); }
.rx-hit.added { opacity: .62; cursor: default; }
.rx-hit.free { border-style: dashed; background: transparent; }
.rx-hit-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rx-hit-main > * { overflow: hidden; text-overflow: ellipsis; }
.rx-hit-badges { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.rx-hit-add { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); }
.rx-hit-add svg.i { width: 18px; height: 18px; }
.rx-hit.added .rx-hit-add { background: var(--ok-soft); color: var(--ok); }
.rx-hits-head { margin: 6px 4px 0; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.rx-hits-head:first-child { margin-top: 0; }
.rx-hit.brand { border-color: color-mix(in srgb, var(--brand) 28%, var(--border)); }
.rx-hit-brand { font-size: 1.05rem; letter-spacing: .01em; }
.rx-hit-dci { font-size: .9rem; color: var(--text-2); }

.rx-picked { display: grid; gap: 6px; margin-top: 18px; }
.rx-picked-head { font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.rx-picked-row { display: grid; gap: 8px; padding: 8px 8px 10px 10px; border-radius: 14px; background: var(--surface-2); animation: reveal .3s both; }
.rx-picked-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rx-picked-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rx-picked-opts { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-start; padding-left: 38px; }
.rx-opt { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 260px; }
.rx-opt.rx-opt-form { flex: 0 1 200px; }
.rx-opt-lbl { font-size: .74rem; font-weight: 650; color: var(--text-2); }
.rx-opt select, .rx-opt input { min-height: 36px; padding: 6px 10px; font-size: .9rem; background: var(--surface); }
.rx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rx-chip { min-height: 34px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
  font-size: .88rem; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .2s; }
.rx-chip:hover, .rx-chip:focus-visible { outline: none; border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); box-shadow: 0 0 0 3px var(--neon-soft); }
.rx-chip.on { background: var(--accent-soft); border-color: var(--accent-strong); color: var(--accent-strong); }
.rx-chip.ghost { border-style: dashed; background: transparent; color: var(--text-2); }
.rx-chip-input { width: 130px; min-height: 34px; border-radius: 999px; padding: 5px 12px; }
.rx-chip-input.wide { width: 100%; max-width: 260px; border-radius: var(--radius-sm); }
.rx-brand-tag { display: flex; align-items: flex-start; gap: 4px; font-size: .8rem; line-height: 1.3; color: var(--text-2); text-align: left; padding: 0 2px; }
.rx-brand-tag b { flex: 1; min-width: 0; color: var(--text); }
.rx-brand-tag .link-btn { flex: none; display: inline-grid; place-items: center; padding: 1px; color: var(--text-3); }
.rx-brand-tag svg.i { width: 14px; height: 14px; }
.dp-note { margin: 6px 2px 0; }
.rx-num { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: var(--on-brand); font-weight: 800; font-size: .85rem; }
.rx-num svg.i { width: 18px; height: 18px; }
.rx-num svg.i circle { display: none; }
.rx-remove { min-height: 34px; padding: 5px; color: var(--text-3); flex: none; }
.rx-remove:hover { color: var(--bad); }

.immersive-sheet.rx-sheet { width: min(1220px, 100%); }
.rx-sheet-sub { margin: -6px 0 0; }
.rx-table { display: grid; gap: 10px; }
.rx-tr { display: grid; grid-template-columns: minmax(230px, 1.7fr) repeat(5, minmax(0, 1fr)) minmax(118px, 1fr); gap: 8px; align-items: start;
  padding: 10px; border-radius: 16px; background: var(--surface-2); border: 1px solid transparent; transition: border-color .2s, box-shadow .2s; }
.rx-tr.ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.rx-tr.ok .rx-num { background: var(--ok); }
.rx-tr.bad { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.rx-th { padding: 0 10px; background: none; font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.rx-td { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rx-td select, .rx-td input { min-height: 40px; padding: 8px 10px; font-size: .92rem; background: var(--surface); }
.rx-td-name { flex-direction: row; align-items: flex-start; gap: 8px; }
.rx-td-name .rx-num { margin-top: 6px; }
.rx-name-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rx-td input.rx-dci { font-weight: 700; font-size: 1rem; }
.rx-lbl { display: none; font-size: .76rem; font-weight: 650; color: var(--text-2); }
.rx-qty-note { font-size: .74rem; font-weight: 650; color: var(--accent-strong); text-align: left; }
.rx-qty-hint { display: block; font-size: .72rem; color: var(--text-2); text-align: left; line-height: 1.25; margin-top: 2px; }
.rx-missing { grid-column: 1 / -1; margin: 0; display: flex; gap: 6px; align-items: center; font-size: .82rem; color: var(--text-2); }
.rx-missing svg.i { width: 15px; height: 15px; flex: none; }
.rx-missing.bad { color: var(--bad); font-weight: 650; }
.rx-sheet-nav { position: sticky; bottom: -22px; z-index: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 -4px -6px; padding: 12px 4px 8px; background: var(--sheet); }
.rx-sheet-nav .btn.primary { margin-left: auto; }
@media (max-width: 1040px) {
  .rx-th { display: none; }
  .rx-tr { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 12px; gap: 10px; }
  .rx-td-name { grid-column: 1 / -1; }
  .rx-lbl { display: block; }
}
@media (max-width: 640px) {
  .rx-tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rx-sec:not(.on) .rx-sec-name { display: none; }
  .rx-doctor-edit span { display: none; }
  .rx-hit { padding: 9px 10px; gap: 10px; }
  .rx-hit-badges { flex-direction: column; align-items: flex-end; }
  .rx-picked-opts { padding-left: 0; }
  .rx-opt, .rx-opt.rx-opt-form { flex-basis: 100%; }
}
@media (max-width: 760px) {
  .rx-sheet-nav { bottom: calc(-18px - env(safe-area-inset-bottom)); }
}

/* ---------- Agenda: week list, appointment sheet, messages, consent (page + components share these) ---------- */
.agenda { max-width: 860px; }
.ag-gap { margin-top: 12px; align-items: center; }
.ag-gap > div { flex: 1; }
.ag-pending { display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 14px; padding: 14px 16px; border-radius: 20px; font: inherit; color: inherit; text-align: left; cursor: pointer;
  box-shadow: var(--shadow), 0 0 0 1px var(--neon-soft); transition: box-shadow .2s, transform .12s; }
.ag-pending:hover { transform: translateY(-1px); box-shadow: var(--shadow), 0 0 0 1px var(--neon), 0 0 22px var(--neon-soft); }
.ag-pending-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ag-pending-text b { font-size: 1.04rem; }
.ag-pending-go { flex: none; pointer-events: none; }

.ag-nav { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; }
.ag-range { min-width: 0; text-align: center; font-family: var(--font-display); font-size: 1.12rem; }
.ag-arrow { min-width: 44px; }
.ag-nav-sub { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.ag-nav-sub .pill { padding: 6px 12px; font-size: .86rem; }
.ag-date { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; font-weight: 600; color: var(--text-2); }
.ag-date input { width: auto; min-height: 36px; padding: 5px 10px; }
.ag-today-empty { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 16px 0 0; }

.ag-day { margin-top: 18px; }
.ag-day-head { font-size: .82rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); margin: 0 4px 8px; }
.ag-day-head.today { color: var(--accent); }
.ag-list { display: grid; gap: 10px; }
.ag-item { border-radius: 18px; background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: var(--shadow-sm); overflow: hidden;
  animation: hist-in-g .4s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(min(var(--i, 0), 12) * 30ms); }
@keyframes hist-in-g { from { opacity: 0; transform: translateY(10px); } }
.ag-item.past { opacity: .75; }
.ag-item.cancelled .ag-name { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text-2) 60%, transparent); }
.ag-open { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 14px; width: 100%; padding: 14px 16px; border: 0; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ag-open:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.ag-open:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.ag-time { display: flex; flex-direction: column; align-items: center; min-width: 54px; padding-right: 12px; border-right: 1px solid var(--glass-line); font-variant-numeric: tabular-nums; }
.ag-time b { font-family: var(--font-display); font-size: 1.2rem; line-height: 1.1; }
.ag-time span { font-size: .74rem; color: var(--text-2); }
.ag-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ag-name { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-meta, .ag-line { display: flex; align-items: center; gap: 5px; font-size: .86rem; color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.ag-meta svg.i, .ag-line svg.i { width: 14px; height: 14px; color: var(--accent); }
.ag-line.due { color: var(--accent-strong); font-weight: 650; }
.ag-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ag-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px 86px; }

/* Appointment sheet */
.ag-when { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; color: var(--text-2); }
.ag-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .92rem; }
.ag-facts li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.ag-facts svg.i { width: 16px; height: 16px; color: var(--accent); }
.ag-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--note); color: var(--note-text); font-size: .9rem; }
.ag-note svg.i { width: 16px; height: 16px; margin-top: 2px; flex: none; color: var(--accent); }
.ag-sec { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--glass-line); }
.ag-sec-head { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.ag-sec-head svg.i { width: 16px; height: 16px; color: var(--accent); }
.ag-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ag-pills { justify-content: flex-start; }
/* flex-shrink 0: inside the sheet's flex column a scrollable box would otherwise be squeezed to a couple of lines */
.ag-msg { flex-shrink: 0; white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); font-size: .93rem; line-height: 1.5; max-height: 320px; overflow-y: auto; }
.ag-hint, .ag-other { margin: 0; align-self: flex-start; }
.ag-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .86rem; color: var(--text-2); }
.ag-log li { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 6px; }
.ag-log li > span { flex: 1 1 0; min-width: 0; }
.ag-log svg.i { width: 15px; height: 15px; margin-top: 3px; color: var(--accent); }
.ag-linkline { display: flex; align-items: center; gap: 8px; margin: 0; min-width: 0; }
.ag-linkline .mono { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
.ag-link-row { display: flex; gap: 8px; }
.ag-link-row input { flex: 1; min-width: 0; }
.ag-confirm { margin-top: 2px; }
.ag-confirm > div { flex: 1; }
.ag-confirm-row { margin-top: 8px; }
.ag-optin .check { margin-top: 8px; font-size: .9rem; }
.ag-notes { font-size: .88rem; color: var(--text-2); }
.ag-notes > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 650; color: var(--accent); list-style: none; }
.ag-notes > summary::-webkit-details-marker { display: none; }
.ag-notes svg.i { width: 15px; height: 15px; }
.ag-notes ul { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.ag-notes .ag-msg { margin-top: 8px; }
.ag-warn { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-strong); font-weight: 600; font-size: .86rem; }
.ag-ok { display: flex; align-items: center; gap: 6px; color: var(--ok); margin: 0; }
.ag-err { color: var(--bad); font-size: .84rem; font-weight: 600; }
.ag-help { color: var(--text-3); font-size: .8rem; font-weight: 500; }
.ag-gate-emergency { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding-top: 10px; border-top: 1px solid var(--glass-line); }

/* Consent box */
.ag-consent-box { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-3); }
.ag-consent-box.pending { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.ag-consent-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ag-consent-box p { margin: 0; }
.ag-proof { overflow-wrap: anywhere; }
.ag-register { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.ag-register .check { font-size: .9rem; align-items: flex-start; }
.ag-register textarea { min-height: 60px; }

/* Editor */
.ag-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.ag-form .field { display: flex; flex-direction: column; gap: 6px; font-size: .84rem; font-weight: 600; color: var(--text-2); min-width: 0; }
.ag-full { grid-column: 1 / -1; }
.ag-optins { gap: 8px; }
.ag-optins .check { font-size: .92rem; align-items: flex-start; }
.ag-past { display: flex; align-items: center; gap: 6px; margin: 0; }
.ag-form-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* Pending reminders */
.ag-plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ag-plist li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 14px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.ag-plist li.sent { opacity: .8; }
.ag-plist-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

/* Templates */
.ag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ag-chip { padding: 2px 8px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-strong); font-size: .82rem; }
.ag-tpl { flex-shrink: 0; min-height: 170px; font-size: .93rem; line-height: 1.5; }
.ag-price { display: flex; flex-direction: column; gap: 6px; font-size: .84rem; font-weight: 600; color: var(--text-2); }

/* Home card (its own component: Home.razor.css does not reach it) and the follow-up after signing */
.ag-card { padding: 18px; animation: slide-in .45s .1s cubic-bezier(.2, .8, .2, 1) both; }
.ag-card .card-head { margin-bottom: 12px; }
.ag-card .ag-card-time { min-width: 46px; font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; }
.ag-card .what svg.i { width: 13px; height: 13px; vertical-align: -2px; }
.ag-card li.past { opacity: .7; }
.ag-card-next { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); color: var(--text); text-decoration: none; font-size: .9rem; }
.ag-card-next.due { background: var(--accent-soft); color: var(--accent-strong); }
.ag-card-next b { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.ag-card-next svg.i { width: 16px; height: 16px; }
.ag-follow { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 16px; padding: 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); text-align: center; }
.ag-follow p { margin: 0; }
.ag-follow-q { font-weight: 650; margin-top: 4px !important; }
.ag-follow-row { justify-content: center; }
.ag-follow-optin { justify-content: center; font-size: .86rem; }
.ag-docnote { display: flex; gap: 6px; align-items: flex-start; margin: 10px 0 0; }
.ag-docnote svg.i { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--accent); }

@media (max-width: 640px) {
  .ag-open { grid-template-columns: auto minmax(0, 1fr); padding: 12px; gap: 6px 12px; }
  .ag-badges { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; }
  .ag-time { min-width: 48px; padding-right: 10px; }
  .ag-quick { padding: 0 12px 12px; }
  .ag-quick .btn { flex: 1 1 100%; }
  .ag-form { grid-template-columns: 1fr; }
  .ag-plist li { grid-template-columns: auto minmax(0, 1fr); }
  .ag-plist-btns { grid-column: 1 / -1; justify-content: flex-start; }
  .ag-pending { flex-wrap: wrap; }
  .ag-pending-go { width: 100%; }
  .ag-link-row { flex-direction: column; }
  .ag-btns .btn { flex: 1 1 calc(50% - 8px); }
}
@media (prefers-reduced-motion: reduce) { .ag-item { animation: none; } }

/* =====================================================================
   Telesalud (beta): the call dock in two modes, room page, fast prescription
   · modo sala (/telesalud): the patient fills the stage, the own camera is a small picture in a corner, a toolbar below
     and a rail on the right (a bottom sheet on phones) with the room info, the chat, the files and the notes. The page
     itself ("Cómo funciona") sits below the stage: .main gets one viewport of padding and the dock scrolls with the page.
   · modo acompañante (any other screen): a column on the right on wide screens, a strip on top on phones (the page below
     works as a bottom sheet); "Achicar" leaves a small floating preview.
   The <video> elements exist once; CSS grid areas place the same children differently in each mode.
   ===================================================================== */
.call-dock[hidden] { display: none !important; }
.call-dock {
  z-index: 30; display: grid; gap: 10px; padding: 10px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  box-shadow: var(--shadow), 0 0 0 1px var(--neon-soft, transparent);
}
.cd-stage { position: relative; min-width: 0; min-height: 0; background: #000; border-radius: 16px; overflow: hidden; }
.cd-remote { display: block; width: 100%; height: 100%; object-fit: cover; background: #000; }
.cd-local {
  position: absolute; right: 8px; bottom: 8px; width: 30%; max-width: 240px; aspect-ratio: 4 / 3; object-fit: cover; z-index: 1;
  border-radius: 10px; border: 2px solid rgba(255, 255, 255, .85); background: #111; transform: scaleX(-1); box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
}
.call-dock.sharing .cd-local { transform: none; } /* a shared screen is not mirrored */
.cd-note {
  position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 6px; padding: 16px;
  color: #fff; text-align: center; font-weight: 600; background: rgba(0, 0, 0, .5);
}
.cd-note svg.i { width: 26px; height: 26px; opacity: .85; }
.cd-quality {
  position: absolute; left: 8px; top: 8px; z-index: 1; display: inline-flex; align-items: flex-end; gap: 2px; padding: 4px 9px;
  border-radius: 99px; background: rgba(0, 0, 0, .58); color: #fff; font-size: .74rem; font-weight: 600;
}
.cd-quality i { width: 3px; border-radius: 2px; background: rgba(255, 255, 255, .35); }
.cd-quality i:nth-child(1) { height: 5px; } .cd-quality i:nth-child(2) { height: 8px; } .cd-quality i:nth-child(3) { height: 11px; margin-right: 4px; }
.cd-quality.q-good i { background: #34D399; }
.cd-quality.q-fair i:nth-child(-n+2) { background: #FBBF24; }
.cd-quality.q-poor i:nth-child(1) { background: #F87171; }
.cd-size {
  position: absolute; right: 8px; top: 8px; z-index: 1; width: 34px; height: 34px; display: grid; place-items: center; border: 0; cursor: pointer;
  border-radius: 50%; background: rgba(0, 0, 0, .5); color: #fff;
}
/* closer / farther / full screen, on the patient's picture */
.cd-zoom { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 2; display: inline-flex; gap: 4px; padding: 4px; border-radius: 99px; background: rgba(0, 0, 0, .58); opacity: .78; transition: opacity .15s; }
.cd-stage:hover .cd-zoom, .cd-zoom:focus-within { opacity: 1; }
.cd-zbtn { min-width: 34px; height: 34px; padding: 0 8px; display: grid; place-items: center; border: 0; border-radius: 99px; background: transparent; color: #fff; font: inherit; font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer; transition: background .15s, transform .08s; }
.cd-zbtn:hover:not(:disabled) { background: rgba(255, 255, 255, .22); }
.cd-zbtn:active:not(:disabled) { transform: scale(.92); }
.cd-zbtn:disabled { opacity: .45; cursor: default; }
.cd-zbtn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.cd-zbtn svg.i { width: 18px; height: 18px; }
.cd-remote { transform-origin: 50% 50%; will-change: transform; }
.cd-stage:fullscreen { border-radius: 0; width: 100vw; height: 100vh; }
.cd-stage:fullscreen .cd-remote { object-fit: contain; }
.cd-stage:fullscreen .cd-zoom { bottom: 18px; opacity: 1; }
.cd-stage::backdrop { background: #000; }
/* the call's buttons answer to the hand */
.cd-btn { transition: background .15s, border-color .15s, transform .08s, box-shadow .15s; }
.cd-btn:hover:not(:disabled):not(.disabled) { transform: translateY(-1px); box-shadow: var(--shadow); }
.cd-btn:active:not(:disabled):not(.disabled) { transform: translateY(0) scale(.97); box-shadow: none; }
/* the clock: on the stage (modo sala) and big in the rail; amber in the last 5 minutes of the plan, red when over */
.cd-timer { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.cd-timer-stage { position: absolute; right: 8px; top: 8px; z-index: 1; padding: 4px 10px; border-radius: 99px; background: rgba(0, 0, 0, .58); color: #fff; font-size: .8rem; }
.cd-timer.late .cd-timer-left { color: #FBBF24; }
.cd-timer.over .cd-timer-left, .cd-timer.over .cd-timer-text { color: #F87171; }
.cd-timer.big { font-size: 1.7rem; font-family: var(--font-display); letter-spacing: -.02em; flex-wrap: wrap; row-gap: 0; }
.cd-timer.big svg.i { width: 24px; height: 24px; color: var(--accent); }
.cd-timer.big .cd-timer-left { font-size: .95rem; font-weight: 650; color: var(--text-2); }
.cd-timer.big.late .cd-timer-left { color: var(--warn); }
.cd-timer.big.over .cd-timer-left, .cd-timer.big.over .cd-timer-text { color: var(--bad); }
.cd-who { position: absolute; left: 8px; bottom: 8px; z-index: 1; max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 4px 10px; border-radius: 99px; background: rgba(0, 0, 0, .58); color: #fff; font-size: .8rem; font-weight: 600; }
.cd-sharing { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); z-index: 1; display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 99px; background: var(--brand); color: var(--on-brand); font-size: .78rem; font-weight: 700; white-space: nowrap; }
.cd-sharing svg.i { width: 15px; height: 15px; }

.cd-head { display: grid; gap: 6px; min-width: 0; align-content: start; }
.cd-status { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; }
.cd-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); display: inline-block; }
.cd-dot.on { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.cd-patient { margin: 0; display: flex; gap: 6px; align-items: flex-start; font-size: .86rem; color: var(--text-2); }
.cd-patient svg.i { color: var(--ok); flex: none; margin-top: 2px; }
.cd-consent-web:empty { display: none; }
.cd-consent-web { font-size: .86rem; display: grid; gap: 6px; padding: 8px 10px; border-radius: 12px; background: var(--ok-soft); color: var(--text); }
.cd-consent-web p { margin: 0; }
.cd-consent-web .btn { justify-self: start; text-decoration: none; }
.cd-error { margin: 0; color: var(--warn); display: flex; gap: 6px; }

/* toolbar: the same buttons in both modes; .room-only / .companion-only hide per mode */
.cd-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; }
.cd-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; min-width: 58px; flex: 1 1 58px; padding: 6px 4px;
  font: inherit; font-size: .7rem; font-weight: 600; line-height: 1.1; cursor: pointer; color: var(--text); text-align: center; text-decoration: none;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; transition: background .15s, border-color .15s;
}
.cd-btn:hover:not(:disabled):not(.disabled) { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.cd-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.cd-btn:disabled, .cd-btn.disabled { opacity: .45; cursor: not-allowed; }
.cd-btn.off { background: var(--bad-soft); color: var(--bad); }
.cd-btn.on { background: var(--accent-soft); color: var(--accent-strong); }
.cd-btn.end { background: var(--bad); border-color: var(--bad); color: #fff; }
.cd-btn.rx { background: var(--grad); border-color: transparent; color: var(--on-brand); box-shadow: var(--shadow-brand); }
.cd-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: .68rem; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface); }
.cd-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--surface); color: var(--accent-strong); font-size: .68rem; font-weight: 800; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--border); }

/* rail: tabs + four panels (always in the DOM, one shown) */
.cd-rail { display: none; min-width: 0; min-height: 0; flex-direction: column; gap: 10px; }
.cd-grab { display: none; }
.cd-rail-top { display: flex; gap: 6px; align-items: center; }
.cd-tabs { flex: 1; min-width: 0; display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: color-mix(in srgb, var(--accent-strong) 14%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--accent-strong) 28%, var(--border)); }
.cd-tab { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 4px; border: 0; border-radius: 10px; background: none; font: inherit; font-size: .8rem; font-weight: 700; color: var(--text); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.cd-tab:hover:not(.on) { background: color-mix(in srgb, var(--accent-strong) 16%, transparent); }
.cd-tab svg.i { width: 15px; height: 15px; flex: none; }
.cd-tab.on { background: var(--accent-strong); color: var(--surface); box-shadow: var(--shadow-sm); }
.cd-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.cd-tab .cd-badge { position: static; box-shadow: none; }
.cd-rail-x { display: none; min-height: 34px; padding: 4px 6px; flex: none; }
.cd-panel { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.cd-panel[hidden] { display: none !important; }
.cd-block { display: grid; gap: 4px; padding: 10px 12px; border-radius: 14px; background: var(--surface-3); border: 1px solid var(--border); }
.cd-block h4 { margin: 0 0 2px; display: flex; gap: 6px; align-items: center; font-size: .74rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.cd-block h4 svg.i { width: 15px; height: 15px; color: var(--accent); }
.cd-block p { margin: 0; }
.cd-warn { color: var(--warn); }
.cd-weak { display: flex; gap: 6px; align-items: flex-start; margin: 0; padding: 8px 10px; border-radius: 12px; background: var(--warn-soft); }
.cd-weak svg.i { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.cd-log summary { display: flex; gap: 6px; align-items: center; cursor: pointer; font-size: .86rem; font-weight: 700; color: var(--text); }
.cd-log summary svg.i { width: 15px; height: 15px; color: var(--accent); }
.cd-log ul { list-style: none; margin: 8px 0 4px; padding: 0; display: grid; gap: 4px; max-height: 220px; overflow-y: auto; font-size: .84rem; }
.cd-log time { font-family: var(--mono); font-size: .76rem; color: var(--text-2); margin-right: 4px; }
.cd-ok { color: var(--ok); }
.cd-qdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); vertical-align: -1px; margin-right: 2px; }
.cd-qdot.q-good { background: var(--ok); } .cd-qdot.q-fair { background: #FBBF24; } .cd-qdot.q-poor { background: var(--bad); }
.tele-link.compact { margin-top: 0; padding: 10px 12px; border-radius: 14px; background: var(--surface-3); border: 1px solid var(--border); }
.tele-link.compact .btn { min-height: 36px; padding: 6px 10px; font-size: .86rem; }
.tele-link.compact input { min-height: 36px; padding: 6px 10px; font-size: .78rem; }
.tele-say { display: flex; gap: 6px; align-items: flex-start; margin: 0; color: var(--text-2); }
.tele-say.ok { color: var(--ok); }
/* the green button that opens the professional's own WhatsApp: the glyph alone, named in aria-label and title */
.btn.wa { flex: none; padding: 6px 10px; min-width: 42px; background: #1DAA61; border-color: #17904F; color: #fff; }
.btn.wa:hover:not(:disabled) { background: #17904F; }
.btn.wa svg.i { width: 22px; height: 22px; }
.ag-linked { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; padding: 8px 12px; border-radius: 12px; background: var(--ok-soft); color: var(--text); font-size: .92rem; }
.ag-linked svg.i { width: 16px; height: 16px; color: var(--ok); flex: none; }
.ag-linked span { flex: 1; min-width: 0; }
.ag-with { display: flex; gap: 6px; align-items: center; margin: 0; }
.ag-with svg.i { width: 15px; height: 15px; color: var(--accent); flex: none; }
/* chat: newest first in the DOM, column-reverse keeps the list pinned to the latest message without script */
.cd-chat-list { flex: 1; min-height: 140px; overflow-y: auto; display: flex; flex-direction: column-reverse; gap: 6px; padding: 2px; }
.cd-chat-empty { text-align: center; margin: auto 0; padding: 12px; }
.cd-msg { max-width: 86%; padding: 7px 11px; border-radius: 14px; border-bottom-left-radius: 4px; font-size: .9rem; line-height: 1.35; background: var(--surface-2); align-self: flex-start; overflow-wrap: anywhere; }
.cd-msg.mine { align-self: flex-end; background: var(--accent-soft); color: var(--accent-strong); border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.cd-msg time { display: block; margin-top: 2px; font-size: .68rem; opacity: .7; text-align: right; }
.cd-chat-form { display: flex; gap: 6px; }
.cd-chat-form input { flex: 1; min-width: 0; }
.cd-chat-form .btn { flex: none; padding: 9px 12px; }
/* files */
.cd-ask { display: grid; gap: 6px; padding: 10px 12px; border-radius: 14px; background: var(--surface-3); border: 1px solid var(--border); transition: border-color .2s, box-shadow .2s; }
.cd-ask.open { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.cd-ask p { margin: 0; }
.cd-ask-row { display: flex; gap: 6px; }
.cd-ask-row input { flex: 1; min-width: 0; }
.cd-ask-row .btn { flex: none; }
.cd-upload { display: flex; gap: 8px; align-items: center; margin: 0; }
.cd-file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cd-file { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.cd-file.theirs { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.cd-file-ico { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--bad-soft); color: var(--bad); }
.cd-file-ico.img { background: var(--accent-soft); color: var(--accent-strong); }
.cd-file-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.cd-file-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .9rem; }
.cd-file-text small { color: var(--text-2); font-size: .78rem; }
.cd-file-btns { display: flex; gap: 4px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.cd-files-web:empty { display: none; }
.cd-files-web { display: grid; gap: 6px; }
.cd-lightbox { width: min(960px, 100%); padding: 12px; }
.cd-lightbox img { display: block; width: 100%; max-height: 78vh; object-fit: contain; border-radius: 14px; background: #000; }
.cd-lightbox-foot { margin-top: 10px; }
/* notes */
.cd-notes textarea { flex: 1; min-height: 180px; resize: none; }
.cd-notes-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 0; }
.cd-scrim { display: none; }

/* ---------- modo acompañante: a column on the right (wide screens) ---------- */
.call-dock.companion {
  position: fixed; right: 16px; top: 16px; bottom: 16px; width: 360px; overflow: auto;
  grid-template-columns: 1fr; grid-template-areas: "stage" "head" "tools"; align-content: start;
}
.call-dock.companion .cd-stage { grid-area: stage; aspect-ratio: 4 / 3; }
.call-dock.companion .cd-head { grid-area: head; }
.call-dock.companion .cd-tools { grid-area: tools; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.call-dock.companion .room-only, .call-dock.companion .cd-timer-stage, .call-dock.companion .cd-who, .call-dock.companion .cd-rail, .call-dock.companion .cd-scrim { display: none !important; }
.call-dock.companion .cd-btn.end { order: 1; }
.call-dock.companion .cd-btn.rx, .call-dock.companion .cd-btn.leave { order: 2; grid-column: span 2; flex-direction: row; gap: 8px; min-height: 44px; font-size: .9rem; }
.call-dock.companion .cd-btn.link { order: 3; grid-column: 1 / -1; flex-direction: row; gap: 6px; min-height: 36px; background: none; border-color: transparent; color: var(--accent); font-size: .85rem; }
.call-dock.companion .cd-btn.link .cd-badge { position: static; box-shadow: none; }
.call-dock.companion .cd-btn.close { grid-column: 1 / -1; flex-direction: row; gap: 6px; min-height: 40px; }
.shell.in-call.companion { padding-right: 392px; }
.call-dock.companion.small { top: auto; width: 260px; }
.call-dock.companion.small .cd-head, .call-dock.companion.small .cd-btn:not(.basic):not(.end) { display: none; }
.shell.in-call.companion:has(~ .call-dock.small) { padding-right: 0; }

/* ---------- modo sala: stage + toolbar on the left, head + rail on the right (wide screens) ---------- */
.call-dock.room {
  position: absolute; top: 12px; left: 266px; right: 14px; height: calc(100vh - 24px); height: calc(100dvh - 24px); overflow: hidden;
  grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "stage head" "stage rail" "tools rail"; gap: 10px 12px;
}
.call-dock.room .cd-stage { grid-area: stage; }
.call-dock.room .cd-head { grid-area: head; }
.call-dock.room .cd-tools { grid-area: tools; justify-content: center; }
.call-dock.room .cd-rail { grid-area: rail; display: flex; }
.call-dock.room .cd-size, .call-dock.room .companion-only { display: none !important; }
.call-dock.room .cd-tools { gap: 5px; }
.call-dock.room .cd-btn { flex: 1 1 52px; min-width: 52px; max-width: 112px; font-size: .68rem; padding: 6px 3px; }
.call-dock.room .cd-btn.end { order: 9; }
.call-dock.room .cd-local { width: 22%; }
.shell.in-call.room .main { padding-top: 100vh; padding-top: 100dvh; }
.shell.in-call.room .topbar { position: static; }
.shell.in-call.room ~ .rg-bubble { display: none !important; } /* the renewal reminder waits until the call ends */
/* The same two modes inside the HCE (zone Clínica): its rail is 248 px wide. */
.cz-shell.in-call.companion { padding-right: 392px; }
.cz-shell.in-call.companion:has(~ .call-dock.small) { padding-right: 0; }
.cz-shell.in-call.room ~ .call-dock.room { left: 260px; }
.cz-shell.in-call.room .cz-main { padding-top: 100vh; padding-top: 100dvh; }
.cz-shell.in-call.room ~ .rg-bubble { display: none !important; }
.cz-live { width: 9px; height: 9px; border-radius: 50%; background: #34D399; margin-left: auto; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: cz-live 1.6s ease-out infinite; }
@keyframes cz-live { to { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); } }
@media (prefers-reduced-motion: reduce) { .cz-live { animation: none; } }
.cz-tele-hits { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.cz-tele-hits li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.cz-tele-hits li > span:first-child { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cz-tele-now { border: 1px solid var(--border); border-left: 4px solid #34D399; }
.cz-tele-steps { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }

@media (max-width: 1100px) {
  .shell.in-call { padding-right: 0; }
  .cz-shell.in-call.companion { padding-right: 0; }
  .cz-shell.in-call.companion .cz-main { padding-top: calc(44vh + 6px); }
  .cz-shell.in-call.room ~ .call-dock.room { left: 0; }
  .shell.in-call .topbar { display: none; }
  /* modo acompañante: a strip on top; the page under it works as a bottom sheet */
  .call-dock.companion {
    left: 0; right: 0; top: 0; bottom: auto; width: auto; height: 44vh; border-radius: 0 0 22px 22px; overflow: hidden;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "stage head" "stage tools"; align-items: stretch; align-content: stretch;
  }
  .call-dock.companion .cd-stage { aspect-ratio: auto; height: 100%; }
  .call-dock.companion .cd-head { overflow: auto; }
  .call-dock.companion .cd-tools { align-content: end; }
  .shell.in-call.companion .main { padding-top: calc(44vh + 6px); }
  .shell.in-call.companion .content { background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 30px -16px rgba(0, 0, 0, .35); min-height: 56vh; }
  .call-dock.companion.small { left: auto; right: 12px; top: auto; bottom: 84px; width: 170px; height: auto; display: block; border-radius: 16px; padding: 6px; }
  .call-dock.companion.small .cd-stage { aspect-ratio: 3 / 4; height: auto; }
  .call-dock.companion.small .cd-head, .call-dock.companion.small .cd-tools { display: none; }
  .shell.in-call.companion:has(~ .call-dock.small) .main { padding-top: 0; }
  .shell.in-call.companion:has(~ .call-dock.small) .content { background: none; box-shadow: none; }
  .shell.in-call.companion:has(~ .call-dock.small) .topbar { display: flex; }

  /* modo sala: the stage fills the screen (fixed: a swipe never scrolls it away), the toolbar sits at the bottom and the
     rail rises as a bottom sheet; the page underneath is not shown on a phone */
  .call-dock.room {
    position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100dvh; border-radius: 0; border: 0; padding: 0; gap: 0; background: #000; box-shadow: none;
    grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "head" "stage" "tools";
  }
  .shell.in-call.room .main { display: none; }
  .call-dock.room .cd-stage { border-radius: 0; }
  .call-dock.room .cd-head { padding: calc(8px + env(safe-area-inset-top)) 12px 6px; background: #000; color: #fff; max-height: 32vh; overflow: auto; }
  .call-dock.room .cd-head .cd-status { color: #fff; font-size: .86rem; }
  .call-dock.room .cd-head .cd-patient { color: rgba(255, 255, 255, .8); }
  .call-dock.room .cd-head .cd-patient svg.i { color: #34D399; }
  .call-dock.room .cd-head .cd-consent-web { background: rgba(255, 255, 255, .12); color: #fff; }
  .call-dock.room .cd-head .cd-error { color: #FBBF24; }
  .call-dock.room .cd-tools { padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); background: #000; }
  .call-dock.room .cd-btn { flex: 1 1 calc(16.6% - 6px); min-width: 0; margin: 0; background: rgba(255, 255, 255, .12); border-color: transparent; color: #fff; }
  .call-dock.room .cd-btn.on { background: var(--brand); color: var(--on-brand); }
  .call-dock.room .cd-btn.off { background: var(--bad); color: #fff; }
  .call-dock.room .cd-btn.rx { background: var(--grad); color: var(--on-brand); }
  .call-dock.room .cd-btn.end { background: var(--bad); }
  .call-dock.room .cd-badge { box-shadow: 0 0 0 2px #000; }
  .call-dock.room .cd-local { width: 26%; max-width: 130px; }
  .call-dock.room .cd-rail {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 78vh; max-height: 78dvh;
    border-radius: 24px 24px 0 0; padding: 8px 14px calc(14px + env(safe-area-inset-bottom)); background: var(--surface); color: var(--text);
    box-shadow: 0 -20px 60px rgba(0, 0, 0, .45); animation: im-up .3s cubic-bezier(.2, .8, .2, 1) both;
  }
  .call-dock.room.rail-open .cd-rail { display: flex; }
  .call-dock.room .cd-grab { display: block; width: 44px; height: 5px; border-radius: 999px; background: var(--border); margin: 0 auto 2px; flex: none; }
  .call-dock.room .cd-rail-x { display: inline-flex; }
  .call-dock.room .cd-scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .45); }
  .shell.in-call.room ~ .tabbar { display: none; }
}
@media (max-width: 640px) {
  .call-dock.companion { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto auto; grid-template-areas: "stage" "head" "tools"; height: 48vh; padding: 6px 6px 8px; gap: 6px; }
  .shell.in-call.companion .main { padding-top: calc(48vh + 4px); }
  .call-dock.companion .cd-tools { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
  .call-dock.companion .cd-btn { grid-column: span 2; min-height: 40px; min-width: 0; }
  .call-dock.companion .cd-btn span:not(.cd-badge) { display: none; }
  .call-dock.companion .cd-btn .cd-badge { top: 2px; right: 4px; }
  .call-dock.companion .cd-btn.link { order: 0; grid-column: span 2; background: var(--surface-2); border-color: var(--border); color: var(--accent); min-height: 40px; }
  .call-dock.companion .cd-btn.link .cd-badge { position: absolute; }
  .call-dock.companion .cd-btn.rx, .call-dock.companion .cd-btn.leave { grid-column: span 5; min-height: 40px; }
  .call-dock.companion .cd-btn.close { grid-column: span 8; }
  .call-dock.companion .cd-patient, .call-dock.companion .cd-consent-web .small, .call-dock.companion .cd-error { display: none; }
  .call-dock.companion .cd-status { font-size: .84rem; }
  .call-dock.room .cd-btn span:not(.cd-badge) { display: none; }
  .call-dock.room .cd-btn { min-height: 46px; }
  .call-dock.room .cd-btn .cd-badge { top: 2px; right: 4px; }
  .call-dock.room .cd-who { max-width: 56%; }
  .cd-tab { font-size: .76rem; gap: 4px; padding: 7px 2px; }
  .cd-send-text { display: none; }
}
@media (prefers-reduced-motion: reduce) { .cd-spin { animation: none; } .call-dock.room .cd-rail { animation: none; } }

/* Telesalud page while a room is open: one line; the dock above shows everything */
.tele-open .tele-status { flex-wrap: wrap; }
.tele-open .tele-status .muted { font-weight: 500; }
.tele-open p + p { margin-top: 8px; }
.tele-open .btn { margin-top: 12px; }

/* Telesalud page */
.tele .card { padding: 18px 20px; margin-top: 14px; }
.tele h2 { font-size: 1.08rem; display: flex; gap: 8px; align-items: center; margin: 0 0 8px; }
.tele h3 { font-size: .98rem; display: flex; gap: 8px; align-items: center; margin: 14px 0 6px; }
.tele-status { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.tele-link { display: grid; gap: 6px; margin-top: 10px; }
.tele-link-row { display: flex; gap: 8px; }
.tele-link-row input { flex: 1; min-width: 0; font-family: var(--mono); font-size: .85rem; }
.tele-send { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tele-send p { flex-basis: 100%; margin: 0; }
.tele-quota { display: flex; gap: 8px; align-items: center; font-weight: 600; color: var(--accent-strong); }
.tele-list { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; gap: 8px; }
.tele-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; }
.tele-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; }
.tele-how summary { cursor: pointer; font-weight: 700; display: flex; gap: 8px; align-items: center; }
.tele-how ol { padding-left: 20px; display: grid; gap: 8px; margin: 12px 0; }

/* Fast prescription */
.rx-quick { display: grid; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.rx-quick-last {
  display: flex; gap: 10px; align-items: center; text-align: left; font: inherit; cursor: pointer; color: var(--text);
  padding: 12px 14px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--brand) 45%, var(--border)); background: var(--accent-soft);
}
.rx-quick-last span { display: grid; }
.rx-quick-last small { color: var(--text-2); }
.rx-quick-head { margin-top: 4px; }
.rx-quick-list { margin-top: 0; }
.rx-repeat { margin-top: 10px; display: inline-flex; gap: 6px; align-items: center; }
.rx-save-tpl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.rx-save-tpl input { flex: 1; min-width: 180px; }
.elapsed-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: .82rem; background: var(--ok-soft); color: var(--ok);
}
.elapsed-chip.late { background: var(--warn-soft); color: var(--warn); }
.call-send { margin: 12px auto 4px; max-width: 460px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); text-align: left; }
.call-send p { margin: 4px 0; display: flex; gap: 8px; align-items: center; }
.call-send.ok { background: var(--ok-soft); }
.call-send.bad { background: var(--bad-soft); }
.call-send-big { font-size: 1.15rem; font-weight: 800; color: var(--ok); }
.call-send .row { display: flex; flex-wrap: wrap; gap: 8px; }
.cd-spin { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--brand); animation: cd-spin 1s linear infinite; display: inline-block; }
@keyframes cd-spin { to { transform: rotate(360deg); } }
.pf-professions .wz-opt small { margin-left: 4px; font-weight: 600; }

/* ---------------------------------------------------------------- Superadministrador (/superadmin, docs/13) */
.sa-login form { display: grid; gap: 12px; max-width: 420px; margin: 10px 0; }
.sa-login .field span { display: block; font-size: .82rem; color: var(--text-2); margin-bottom: 4px; }
.sa-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.sa-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 4px; color: var(--text-2); }
.sa-group { margin: 18px 0 6px; font-size: .9rem; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.ca-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.ca-tile { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-3); }
.ca-tile b { font-size: 1.6rem; line-height: 1.1; }
.ca-tile span { font-size: .82rem; color: var(--text-2); }
.ca-tile.ok b { color: var(--ok); }
.ca-tile.warn b { color: var(--warn, #b45309); }
.ca-note { margin-top: 12px; }
.sa-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sa-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.sa-row.changed { border-color: var(--brand); box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 35%, transparent); }
.sa-text { display: grid; gap: 2px; min-width: 220px; flex: 1 1 280px; }
.sa-states { display: flex; flex-wrap: wrap; gap: 6px; }
.sa-states .pill { padding: 6px 12px; font-size: .82rem; }
.sa-states .pill.sa-solo.on, .sa-states .pill.sa-soloyo.on { background: color-mix(in srgb, var(--accent) 70%, var(--surface)); }
.sa-states .pill.sa-apagada.on { background: var(--bad); color: #fff; box-shadow: none; }
.sa-states .pill:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.sa-save { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }

/* Download page: the Microsoft Store is the only public way to get the app (31-10-2026). */
.dl-store { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 22px; }

/* ═══════════════════════════════════════════════════════════════════════════════════════════════
   HCE · Clínica virtual (docs/14). Its own zone: indigo palette, a dark rail, its own spacing.
   Every token is redefined inside .zone-clinic, so the shared .btn/.card/.badge take the clinic's colors.
   ═══════════════════════════════════════════════════════════════════════════════════════════════ */
.zone-clinic {
  --brand: #6D5BF5; --brand-mint: #8B7CFF;
  --grad: linear-gradient(135deg, #5B47E0 0%, #7C5CF5 55%, #9B7BFF 100%);
  --grad-deep: linear-gradient(135deg, #4A35C9 0%, #6D5BF5 100%);
  --bg: #F4F3FB; --surface: #FFFFFF; --surface-2: #EEEBFB; --surface-3: #F9F8FE; --border: #DEDAF3;
  --text: #17123A; --text-2: #5A5480; --text-3: #9892BD;
  --accent: #5B47E0; --accent-strong: #4532C4; --accent-soft: #ECE8FF; --on-brand: #FFFFFF;
  --shadow-brand: 0 10px 30px -10px rgba(91, 71, 224, .55);
  --neon: rgba(124, 92, 245, .55); --neon-soft: rgba(124, 92, 245, .22);
  --glass: rgba(255, 255, 255, .86); --glass-strong: #FFFFFF; --glass-border: #E3DFF6; --glass-line: #E3DFF6;
  --cz-rail: linear-gradient(180deg, #1C1650 0%, #261B6B 60%, #2E1F7A 100%);
  --cz-wait: #B45309; --cz-live: #5B47E0; --cz-done: #0E9F6E;
  color: var(--text);
}
:root[data-theme="dark"] .zone-clinic {
  --bg: #0D0A22; --surface: #151137; --surface-2: #1E1950; --surface-3: #18143F; --border: #2C2563;
  --text: #ECEAFF; --text-2: #ABA5D6; --text-3: #7C76AA;
  --accent: #B4A9FF; --accent-strong: #D0C8FF; --accent-soft: #2A2365; --on-brand: #FFFFFF;
  --glass: rgba(21, 17, 55, .86); --glass-strong: #151137; --glass-border: #2C2563; --glass-line: #2C2563;
  --cz-rail: linear-gradient(180deg, #08061A 0%, #120D36 100%);
  --cz-wait: #FBBF24; --cz-live: #B4A9FF; --cz-done: #34D399;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .zone-clinic {
    --bg: #0D0A22; --surface: #151137; --surface-2: #1E1950; --surface-3: #18143F; --border: #2C2563;
    --text: #ECEAFF; --text-2: #ABA5D6; --text-3: #7C76AA;
    --accent: #B4A9FF; --accent-strong: #D0C8FF; --accent-soft: #2A2365; --on-brand: #FFFFFF;
    --glass: rgba(21, 17, 55, .86); --glass-strong: #151137; --glass-border: #2C2563; --glass-line: #2C2563;
    --cz-rail: linear-gradient(180deg, #08061A 0%, #120D36 100%);
    --cz-wait: #FBBF24; --cz-live: #B4A9FF; --cz-done: #34D399;
  }
}
.cz-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; background: var(--bg); position: relative; z-index: 1; }
.zone-enter { animation: zone-in .55s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes zone-in { from { opacity: 0; clip-path: circle(0% at 20% 40%); } to { opacity: 1; clip-path: circle(150% at 20% 40%); } }
.cz-rail { background: var(--cz-rail); color: #E8E4FF; padding: 18px 12px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.cz-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 4px 8px 14px; }
.cz-logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #7C5CF5, #B79BFF); color: #fff; box-shadow: 0 8px 22px -8px rgba(124, 92, 245, .9); }
.cz-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.cz-brand-text b { font-size: 1.15rem; letter-spacing: .04em; }
.cz-brand-text small { font-size: .74rem; opacity: .75; }
.cz-nav { display: flex; flex-direction: column; gap: 2px; }
.cz-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: rgba(232, 228, 255, .78); text-decoration: none; font-weight: 600; transition: background .15s, color .15s; }
.cz-item span { flex: 1; }
.cz-item kbd { font: 600 .66rem var(--mono); padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .65); }
.cz-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.cz-item.on { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: inset 3px 0 0 #A995FF; }
.cz-grow { flex: 1; }
.cz-me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .07); }
.cz-me-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.cz-me-text b { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cz-me-text small { font-size: .7rem; opacity: .7; }
.cz-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--accent-soft); color: var(--accent-strong); flex: none; }
.cz-rail .cz-avatar { background: rgba(169, 149, 255, .25); color: #fff; }
.cz-avatar.big { width: 52px; height: 52px; font-size: 1.15rem; }
.cz-icon-btn { border: 0; background: transparent; color: inherit; opacity: .75; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; flex: none; }
.cz-icon-btn:hover { opacity: 1; background: color-mix(in srgb, currentColor 12%, transparent); }
.cz-switch, .mode-switch { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 12px; border-radius: 12px; font-weight: 700; text-decoration: none; }
.cz-switch { background: linear-gradient(135deg, #00C8D0, #2AD69A); color: #00303F; box-shadow: 0 8px 22px -10px rgba(0, 200, 208, .9); }
.cz-switch:hover { filter: brightness(1.06); }
.mode-switch { margin: 6px 0 8px; background: linear-gradient(135deg, #5B47E0, #9B7BFF); color: #fff; box-shadow: 0 8px 22px -10px rgba(91, 71, 224, .9); }
.mode-switch:hover { filter: brightness(1.08); color: #fff; }
.mode-switch.top { margin: 0; padding: 7px 12px; border-radius: 999px; font-size: .84rem; }
@media (min-width: 900px) { .mode-switch.top { display: none; } }
.cz-sign { display: flex; align-items: center; gap: 8px; font-size: .74rem; color: rgba(232, 228, 255, .7); text-decoration: none; padding: 6px 10px; }
.cz-sign .dot { width: 8px; height: 8px; border-radius: 50%; background: #F87171; flex: none; }
.cz-sign.on .dot { background: #34D399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .2); }
.cz-main { min-width: 0; display: flex; flex-direction: column; }
.cz-top { display: flex; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 5; }
.cz-place { display: flex; flex-direction: column; line-height: 1.2; }
.cz-content { padding: 24px 28px 64px; max-width: 1180px; width: 100%; }
.cz-page h1 { font-family: var(--font-display); font-size: 1.6rem; margin: 0; letter-spacing: -.01em; }
.cz-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.cz-head kbd { font: 600 .66rem var(--mono); padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, .25); }
.cz-h2 { font-size: 1rem; margin: 0 0 12px; }
.cz-date { width: auto; min-height: 40px; }
.cz-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.cz-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); font: inherit; color: var(--text); cursor: pointer; text-align: left; transition: transform .12s, box-shadow .15s, border-color .15s; }
div.cz-stat { cursor: default; }
.cz-stat b { font-size: 1.7rem; font-family: var(--font-display); line-height: 1; }
.cz-stat span { font-size: .8rem; color: var(--text-2); font-weight: 600; }
.cz-stat.wait b { color: var(--cz-wait); } .cz-stat.live b { color: var(--cz-live); } .cz-stat.done b { color: var(--cz-done); }
button.cz-stat:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.cz-stat.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cz-queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cz-q { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border); animation: fade .25s ease both; }
.cz-q.wait { border-left-color: var(--cz-wait); } .cz-q.live { border-left-color: var(--cz-live); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.cz-q.done { border-left-color: var(--cz-done); opacity: .85; } .cz-q.void { opacity: .5; }
.cz-q.void .cz-q-who b { text-decoration: line-through; }
.cz-q-num { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.cz-q-num b { font: 700 1.1rem var(--mono); color: var(--accent-strong); }
.cz-q-num small { font-size: .74rem; color: var(--text-2); }
.cz-q-who { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.cz-q-who b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cz-q-who small { color: var(--text-2); }
.cz-q-reason { font-style: italic; }
.cz-q-state { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.cz-q-go { display: flex; gap: 6px; }
.cz-allergy { display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 700; color: var(--bad); background: var(--bad-soft); padding: 2px 8px; border-radius: 999px; }
.cz-allergy svg.i { width: 13px; height: 13px; }
.cz-allergy-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); margin-bottom: 12px; font-weight: 600; }
.cz-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 34px; }
.cz-empty > svg.i { width: 34px; height: 34px; color: var(--accent); }
.cz-search, .cz-finder { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 12px; }
.cz-search > svg.i, .cz-finder > svg.i { color: var(--accent); flex: none; }
.cz-search input, .cz-finder input { border: 0; background: transparent; box-shadow: none; font-size: 1.05rem; min-height: 46px; }
.cz-search input:focus, .cz-finder input:focus { box-shadow: none; background: transparent; }
.cz-search .btn { flex: none; }
.cz-finder { box-shadow: none; background: var(--surface-3); margin-bottom: 8px; }
.cz-finder select { width: auto; border: 0; background: var(--surface); }
.cz-finder input { font-size: .95rem; min-height: 40px; }
.cz-hits { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cz-hits li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: border-color .12s, background .12s; }
.cz-hits li:hover, .cz-hits li.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface)); }
.cz-hit-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cz-hit-text small { color: var(--text-2); }
.cz-pick { list-style: none; margin: 0 0 10px; padding: 4px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); max-height: 260px; overflow: auto; }
.cz-pick li { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.cz-pick li:hover { background: var(--accent-soft); }
.cz-form .grid, .cz-admit .grid { align-items: end; }
.cz-more { margin-top: 12px; }
.cz-more summary { cursor: pointer; font-weight: 600; color: var(--accent); margin-bottom: 10px; }
.cz-admit-who { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cz-admit-who > div { display: flex; flex-direction: column; }
.cz-patient { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 12px; }
.cz-patient-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cz-patient-main h1 { font-size: 1.35rem; }
.cz-enc-meta { font-size: .82rem; color: var(--text-2); }
.cz-enc-grid { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 16px; align-items: start; }
.cz-steps-nav { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; }
.cz-steps-nav button { padding: 7px 10px; border-radius: 9px; border: 0; background: transparent; text-align: left; color: var(--text-2); font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; }
.cz-steps-nav button:hover { background: var(--accent-soft); color: var(--accent-strong); }
.cz-sec:focus:not(:focus-visible) { outline: none; }
.cz-restore { margin-top: 18px; }
.cz-restore summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.cz-restore .card { margin-top: 10px; }
.cz-save { margin-top: 10px; padding: 6px 10px; font-size: .75rem; color: var(--text-3); }
.cz-sections { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cz-sec { scroll-margin-top: 80px; padding: 18px 20px; }
.cz-sec h2 { display: flex; align-items: center; gap: 10px; font-size: 1.02rem; margin: 0 0 12px; }
.cz-num { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--grad); color: #fff; font-size: .8rem; font-weight: 800; flex: none; }
.cz-vitals { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; align-items: end; }
.cz-vitals .field { position: relative; }
.cz-vitals .field small { position: absolute; right: 10px; bottom: 11px; font-size: .72rem; color: var(--text-3); pointer-events: none; }
.cz-vitals input { padding-right: 44px; }
.cz-wide { grid-column: span 2; }
.cz-bmi { display: flex; flex-direction: column; justify-content: center; padding: 6px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); min-height: 42px; }
.cz-bmi span { font-size: .7rem; font-weight: 700; } .cz-bmi b { font-size: 1.1rem; line-height: 1.1; } .cz-bmi small { font-size: .7rem; }
.cz-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.cz-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px dashed var(--border); background: var(--surface-3); color: var(--accent-strong); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.cz-chip:hover { border-style: solid; border-color: var(--accent); }
.cz-chip svg.i { width: 13px; height: 13px; }
.cz-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cz-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border); }
.cz-list select { width: auto; min-height: 34px; padding: 4px 8px; }
.cz-code { font-family: var(--mono); color: var(--accent-strong); }
.cz-grow-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cz-rx { padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-3); margin-bottom: 8px; display: flex; flex-direction: column; gap: 8px; }
.cz-rx-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 8px; align-items: end; }
.cz-rx-row:first-child { grid-template-columns: 2fr 1fr 1fr 1fr; }
.cz-leave { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.cz-leave .field { width: 150px; }
.cz-leave .cz-wide { width: 100%; }
.cz-final { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.cz-sign-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface)); margin: 8px 0; }
.cz-sign-box .btn.primary { background: linear-gradient(135deg, #00C8D0 0%, #13CFB0 55%, #2AD69A 100%); color: #00303F; box-shadow: 0 10px 30px -10px rgba(0, 168, 179, .55); }
.cz-close { margin-top: 8px; }
.cz-docs { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cz-docs li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
/* Doki's welcome: the terms come before everything in the apps (first use, new terms, every month) */
.rg-welcome { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 20px; overflow: auto; background: radial-gradient(1200px 700px at 50% 0%, #2B1F6B 0%, #120C33 55%, #0A0720 100%); color: #fff; animation: rg-welcome-in .45s ease both; }
.rg-welcome-glow { position: absolute; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(0, 200, 208, .30) 0%, rgba(124, 92, 255, .16) 45%, transparent 70%); filter: blur(10px); animation: rg-welcome-breathe 5s ease-in-out infinite; pointer-events: none; }
.rg-welcome-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; max-width: 560px; }
.rg-welcome-robot { animation: rg-welcome-drop .9s cubic-bezier(.2, 1.4, .4, 1) both, rg-welcome-bob 3.4s ease-in-out .9s infinite; }
.rg-welcome-kicker { font-size: .78rem; font-weight: 800; letter-spacing: .14em; color: rgba(255, 255, 255, .65); }
.rg-welcome h1 { font-family: var(--font-display); font-size: clamp(1.9rem, 4.6vw, 2.8rem); margin: 0; letter-spacing: -.02em; color: #fff; }
.rg-welcome p { margin: 0; font-size: 1.08rem; line-height: 1.5; color: rgba(255, 255, 255, .86); }
.rg-welcome-go { margin-top: 14px; min-width: 220px; justify-content: center; font-size: 1.1rem; }
.rg-welcome-foot { margin-top: 6px; font-size: .85rem; color: rgba(255, 255, 255, .6); }
.rg-welcome-card { max-width: 760px; }
.rg-welcome-card > p, .rg-welcome-card > h1 { max-width: 560px; }
.rg-about { margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .14); display: flex; flex-direction: column; align-items: center; gap: 12px; animation: rg-welcome-in .6s ease .5s both; }
.rg-about p { font-size: .95rem; color: rgba(255, 255, 255, .8); }
.rg-about-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; }
.rg-about-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 12px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); }
.rg-about-card b { font-size: 1rem; color: #fff; }
.rg-about-card > span:last-child { font-size: .84rem; line-height: 1.35; color: rgba(255, 255, 255, .75); }
.rg-about-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #00C8D0 0%, #13CFB0 55%, #2AD69A 100%); color: #00303F; }
.rg-about-ico.hce { background: linear-gradient(135deg, #7C5CFF 0%, #5B3FE0 100%); color: #fff; }
.rg-about-ico.pc { background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%); color: #3B2600; }
.rg-about-ico svg.i { width: 21px; height: 21px; }
.rg-about-link { color: #fff; border-color: rgba(255, 255, 255, .3); }
@media (max-width: 700px) { .rg-about-grid { grid-template-columns: 1fr; } .rg-welcome { place-items: start center; } }
.rg-backdrop.rg-must { z-index: 901; }
@keyframes rg-welcome-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rg-welcome-drop { from { opacity: 0; transform: translateY(-70px) scale(.7) rotate(-8deg); } to { opacity: 1; transform: none; } }
@keyframes rg-welcome-bob { 50% { transform: translateY(-10px) rotate(2deg); } }
@keyframes rg-welcome-breathe { 50% { transform: scale(1.12); opacity: .8; } }
@media (prefers-reduced-motion: reduce) { .rg-welcome, .rg-welcome-robot, .rg-welcome-glow { animation: none; } }
/* The three big modules of an attention (they unfold) and «Atención rápida» */
.cz-group { border-radius: 22px; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 55%, transparent); }
.cz-group.open { border-color: color-mix(in srgb, var(--accent) 38%, var(--border)); }
.cz-group-head { width: 100%; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 0; border-radius: 22px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.cz-group-head:hover, .cz-group-head:focus-visible { background: color-mix(in srgb, var(--accent-soft) 70%, transparent); outline: none; }
.cz-group-ico { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: var(--grad); color: #fff; flex: none; }
.cz-group-ico svg.i { width: 25px; height: 25px; }
#g-firmar .cz-group-ico { background: linear-gradient(135deg, #00C8D0 0%, #13CFB0 55%, #2AD69A 100%); color: #00303F; }
.cz-group-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cz-group-title b { font-family: var(--font-display); font-size: 1.2rem; letter-spacing: -.01em; }
.cz-group-title small { color: var(--text-2); font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cz-group-chev { color: var(--text-3); transition: transform .2s; display: grid; }
.cz-group-chev svg.i { width: 22px; height: 22px; }
.cz-group.open .cz-group-chev { transform: rotate(180deg); }
.cz-group-body { padding: 2px 12px 12px; display: flex; flex-direction: column; gap: 12px; }
.cz-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 18px; border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--border)); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.cz-quick > .muted { flex: 1; min-width: 220px; }
.cz-quick-vitals .cz-vitals { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cz-quick-vitals .cz-num svg.i { width: 15px; height: 15px; }
.cz-steps-nav .cz-nav-group { margin-top: 8px; font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.cz-steps-nav .cz-nav-group:first-child { margin-top: 0; }
@media (max-width: 760px) { .cz-quick-vitals .cz-vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cz-group-body { padding: 2px 6px 8px; } }
@media (prefers-reduced-motion: reduce) { .cz-group-chev { transition: none; } }
/* Where the person is working: a pale yellow light on the index and on the page (never the strong glow of the practice) */
.cz-steps-nav button.on { background: color-mix(in srgb, #FDE68A 16%, transparent); color: var(--text); box-shadow: inset 3px 0 0 color-mix(in srgb, #FCD34D 85%, transparent); }
.cz-steps-nav .cz-nav-group.on { color: var(--text); background: color-mix(in srgb, #FDE68A 22%, transparent); box-shadow: inset 3px 0 0 #FCD34D, 0 0 18px -8px #FDE68A; }
.cz-group.active { border-color: color-mix(in srgb, #FCD34D 50%, var(--border)); box-shadow: 0 0 0 1px color-mix(in srgb, #FDE68A 22%, transparent), 0 0 30px -16px #FDE68A; }
.cz-group .cz-sec.on { border-color: color-mix(in srgb, #FCD34D 42%, var(--border)); }
.cz-docs-modal { width: min(620px, 100%); max-height: 86vh; overflow: auto; }
.cz-docs-modal h3 { margin: 14px 0 6px; font-size: .95rem; }
/* «Llenar» or «Subir PDF» at the top of each module of an attention */
.cz-sec-doors { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 4px; }
.cz-sec-door { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface-3); color: var(--text); cursor: pointer; font: inherit; text-align: left; transition: transform .15s, border-color .15s, box-shadow .15s; }
.cz-sec-door:hover, .cz-sec-door:focus-visible, .cz-sec-door:focus-within { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 12px 26px -18px color-mix(in srgb, var(--accent) 70%, transparent); outline: none; }
.cz-door-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--grad); color: #fff; flex: none; }
.cz-door-ico svg.i { width: 22px; height: 22px; }
.cz-sec-door.up .cz-door-ico { background: linear-gradient(135deg, #00C8D0 0%, #13CFB0 55%, #2AD69A 100%); color: #00303F; }
.cz-sec-door b { display: block; font-size: 1.02rem; }
.cz-sec-door small { color: var(--muted); }
.cz-sec-door input[type=file], .cz-pick input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.cz-pick { position: relative; overflow: hidden; }
.cz-sec-door.busy, .cz-pick.busy { opacity: .6; pointer-events: none; }
.cz-sec-note { grid-column: 1 / -1; margin: 0; }
.cz-sec-strip:empty { display: none; }
.cz-sec-strip .cz-docs { margin-bottom: 8px; }
.cz-sec-strip .cz-sec-note { margin-bottom: 8px; }
.cz-sec-up-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; margin-bottom: 10px; }
.cz-fill-all { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 8px; border: 1px dashed var(--border); border-radius: 10px; background: none; color: var(--muted); font: inherit; font-size: .82rem; cursor: pointer; text-align: left; }
.cz-fill-all:hover { color: var(--text); border-color: var(--accent); }
.cz-fill-all svg.i { width: 14px; height: 14px; }
@media (prefers-reduced-motion: reduce) { .cz-sec-door { transition: none; } .cz-sec-door:hover { transform: none; } }
.cz-addendum { padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--text); margin: 8px 0; }
.cz-addendum p { margin: 4px 0 0; white-space: pre-wrap; }
.cz-annul { display: flex; align-items: end; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cz-annul .field { flex: 1; min-width: 220px; }
.cz-modal-back { position: fixed; inset: 0; background: rgba(10, 8, 30, .55); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.cz-modal { background: var(--surface); color: var(--text); border-radius: 20px; padding: 22px; width: min(480px, 100%); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); animation: im-rise .25s ease both; }
.cz-modal h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.cz-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); margin-bottom: 14px; width: fit-content; max-width: 100%; overflow-x: auto; }
.cz-tabs button { border: 0; background: transparent; color: var(--text-2); font: inherit; font-weight: 650; padding: 8px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.cz-tabs button.on { background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-sm); }
.cz-timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.cz-timeline li { position: relative; }
.cz-timeline li::before { content: ""; position: absolute; left: -21px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--bg); }
.cz-timeline li.void { opacity: .55; }
.cz-timeline a { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); }
.cz-timeline a:hover { border-color: var(--accent); }
.cz-tl-date { display: flex; flex-direction: column; width: 96px; flex: none; }
.cz-tl-date small { font-family: var(--mono); font-size: .72rem; color: var(--text-2); }
.cz-tl-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cz-bg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }
.cz-bg p { margin: 2px 0 0; white-space: pre-wrap; }
.cz-users { display: flex; flex-direction: column; gap: 8px; }
.cz-user { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.cz-user.off { opacity: .55; }
.cz-roles { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 14px; }
.cz-log { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); max-height: 560px; overflow-y: auto; }
.cz-log-row { display: grid; grid-template-columns: 104px minmax(110px, 170px) minmax(110px, 160px) minmax(0, 1fr) auto; gap: 10px; padding: 7px 12px; font-size: .84rem; border-bottom: 1px solid var(--border); }
.cz-log-row:nth-child(odd) { background: var(--surface-3); }
.cz-bar { display: grid; grid-template-columns: minmax(0, 1fr) 90px 34px; align-items: center; gap: 8px; font-size: .86rem; margin: 6px 0; }
.cz-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cz-bar i { display: block; height: 8px; border-radius: 999px; background: var(--grad); }
.cz-setup { max-width: 860px; }
.cz-setup h1 { font-size: 1.8rem; margin: 0 0 6px; }
.cz-steps { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.cz-steps h2 { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; margin: 0 0 12px; }
.cz-signin { text-align: center; padding-top: 4vh; }
.cz-signin h1 { font-size: 2rem; margin: 0 0 20px; }
.cz-people { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.cz-person { width: 170px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 12px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; }
.cz-person:hover, .cz-person.on { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow), var(--shadow-brand); }
.cz-person small { font-size: .74rem; color: var(--text-2); }
.cz-pin { display: flex; align-items: end; justify-content: center; gap: 10px; margin: 20px auto 0; max-width: 420px; }
.cz-pin .field { flex: 1; text-align: left; }
.cz-pin input { font-size: 1.4rem; letter-spacing: .4em; text-align: center; }
@media (max-width: 1100px) { .cz-vitals { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cz-enc-grid { grid-template-columns: 1fr; } .cz-steps-nav { display: none; } }
@media (max-width: 760px) {
  .cz-shell { grid-template-columns: 1fr; }
  .cz-rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; }
  .cz-nav { flex-direction: row; flex-wrap: wrap; }
  .cz-item kbd, .cz-grow, .cz-sign { display: none; }
  .cz-content { padding: 16px; }
  .cz-top { padding: 10px 16px; }
  .cz-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cz-q { grid-template-columns: 48px minmax(0, 1fr); }
  .cz-q-state, .cz-q-go { grid-column: 2; align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
  .cz-vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cz-rx-row, .cz-rx-row:first-child { grid-template-columns: 1fr 1fr; }
  .cz-bg { grid-template-columns: 1fr; }
  .cz-log-row { grid-template-columns: 1fr; gap: 2px; }
}

/* ── The zone chooser (/modo): two doors; the chosen one fills the screen ────────────────────────── */
.zone-stage { min-height: 100vh; background: radial-gradient(1200px 700px at 15% 20%, rgba(124, 92, 245, .28), transparent 60%), radial-gradient(1100px 650px at 90% 85%, rgba(0, 200, 208, .26), transparent 60%), #070B1E; color: #F2F4FF; position: relative; z-index: 1; overflow: hidden; }
.zc { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 32px clamp(16px, 5vw, 64px); outline: none; max-width: 1280px; margin: 0 auto; }
.zc-head { display: flex; align-items: center; gap: 14px; }
.zc-kicker { font-size: .74rem; letter-spacing: .2em; font-weight: 700; opacity: .65; }
.zc-head h1 { margin: 2px 0 0; font-family: var(--font-display); font-size: clamp(1.8rem, 3.6vw, 2.8rem); letter-spacing: -.02em; }
.zc-doors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 2.4vw, 28px); }
.zc-door { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; text-align: left; min-height: clamp(260px, 44vh, 420px); padding: clamp(22px, 3vw, 38px); border-radius: 28px; border: 1px solid rgba(255, 255, 255, .14); color: #fff; font: inherit; cursor: pointer; transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s, border-color .25s; animation: door-in .6s cubic-bezier(.2, .8, .2, 1) both; }
.zc-door.firm { animation-delay: .08s; }
.zc-door.clinic { background: linear-gradient(150deg, #2B1F7A 0%, #5B47E0 55%, #8E73FF 100%); box-shadow: 0 30px 80px -30px rgba(109, 91, 245, .8); }
.zc-door.firm { background: linear-gradient(150deg, #003C57 0%, #00A3B1 55%, #2AD69A 100%); box-shadow: 0 30px 80px -30px rgba(0, 200, 208, .8); }
.zc-door:hover, .zc-door:focus-visible { transform: translateY(-6px) scale(1.012); border-color: rgba(255, 255, 255, .5); outline: none; }
.zc-door.last { border-color: rgba(255, 255, 255, .55); }
.zc-glow { position: absolute; inset: -40%; background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .28), transparent 40%); opacity: 0; transition: opacity .3s; pointer-events: none; }
.zc-door:hover .zc-glow { opacity: 1; }
.zc-ico { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: rgba(255, 255, 255, .18); }
.zc-ico svg.i { width: 32px; height: 32px; }
.zc-name { font-family: var(--font-display); font-size: clamp(1.8rem, 3.4vw, 2.8rem); font-weight: 800; line-height: 1; letter-spacing: -.02em; display: flex; flex-direction: column; gap: 6px; }
.zc-name em { font-style: normal; font-size: .5em; font-weight: 600; opacity: .85; letter-spacing: 0; }
.zc-what { font-size: 1.02rem; opacity: .92; max-width: 36ch; }
.zc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.zc-tags i { font-style: normal; font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .16); }
.zc-key { position: absolute; top: 18px; right: 20px; font: 700 .8rem var(--mono); width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(255, 255, 255, .16); }
.zc-beta { position: absolute; top: 18px; right: 58px; font-size: .72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #FBBF24; color: #3B2500; }
.zc-foot { margin: 0; font-size: .86rem; opacity: .7; }
@keyframes door-in { from { opacity: 0; transform: translateY(26px) scale(.97); } }
.zc.leaving .zc-door { pointer-events: none; }
.zc.leaving.to-clinica .zc-door.clinic, .zc.leaving.to-firma .zc-door.firm { animation: door-fill .56s cubic-bezier(.7, 0, .3, 1) forwards; z-index: 3; }
.zc.leaving.to-clinica .zc-door.firm, .zc.leaving.to-firma .zc-door.clinic, .zc.leaving .zc-head, .zc.leaving .zc-foot { animation: door-away .35s ease forwards; }
@keyframes door-fill { to { transform: scale(2.6); border-radius: 0; filter: brightness(1.1); } }
@keyframes door-away { to { opacity: 0; transform: scale(.94); } }
@media (max-width: 760px) { .zc-doors { grid-template-columns: 1fr; } .zc-door { min-height: 210px; } }
@media (prefers-reduced-motion: reduce) {
  .zone-enter, .zc-door, .zc.leaving .zc-door, .zc.leaving .zc-head, .zc.leaving .zc-foot { animation: none !important; transition: none !important; }
}

/* ── Guided practice of the HCE (docs/14 §9): the coach strip and the glow on the real control of each step ───── */
.cz-coach { position: sticky; top: 57px; z-index: 4; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 28px; background: linear-gradient(135deg, #FFF4D6, #FFE9B0); color: #3B2A00; border-bottom: 1px solid #F2D27A; }
.cz-coach-dots { display: flex; gap: 5px; flex: none; }
.cz-coach-dots i { width: 18px; height: 6px; border-radius: 999px; background: rgba(59, 42, 0, .18); }
.cz-coach-dots i.done { background: #0E9F6E; }
.cz-coach-dots i.now { background: #5B47E0; width: 28px; }
.cz-coach-text { display: flex; flex-direction: column; flex: 1; min-width: 240px; line-height: 1.3; }
.cz-coach-text span { font-size: .9rem; }
.cz-coach .link-btn { color: #5A4300; }
.cz-coach .btn.primary { background: linear-gradient(135deg, #5B47E0, #9B7BFF); color: #fff; }
.cz-help { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 12px; border-radius: 12px; border: 1px dashed rgba(255, 255, 255, .35); background: transparent; color: rgba(232, 228, 255, .9); font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; }
.cz-help:hover { background: rgba(255, 255, 255, .1); border-style: solid; }
.cz-plan { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cz-plan li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.cz-plan li b { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--grad); color: #fff; font-size: .8rem; flex: none; }
.cz-done { text-align: center; margin: 6vh auto 0; }
.cz-done-ico { width: 84px; height: 84px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--ok-soft); color: var(--ok); margin-bottom: 12px; animation: pop .35s ease both; }
.cz-done-ico svg.i { width: 44px; height: 44px; }
.practice.p-step-1 a[href="clinica/admision"],
.practice.p-step-2 #g-paciente:not(.open) > .cz-group-head,
.practice.p-step-3 #g-consulta:not(.open) > .cz-group-head,
.practice.p-step-4 #g-consulta:not(.open) > .cz-group-head,
.practice.p-step-5 #g-firmar:not(.open) > .cz-group-head,
.practice.p-step-6 #g-firmar:not(.open) > .cz-group-head,
.practice.p-step-2 #triaje,
.practice.p-step-3 #diagnostico,
.practice.p-step-4 #receta,
.practice.p-step-5 .p-emit,
.practice.p-step-6 .cz-close .btn,
.practice.p-step-7:not(.p-visited) a[href="clinica/pacientes"] { outline: 3px solid #FBBF24; outline-offset: 3px; animation: coach-glow 1.4s ease-in-out infinite; }
@keyframes coach-glow { 50% { outline-color: rgba(251, 191, 36, .35); box-shadow: 0 0 0 8px rgba(251, 191, 36, .18); } }
@media (max-width: 760px) { .cz-coach { position: static; padding: 10px 16px; } .cz-plan { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  .practice a[href], .practice .cz-group-head, .practice #triaje, .practice #diagnostico, .practice #receta, .practice .p-emit, .practice .cz-close .btn, .cz-done-ico { animation: none !important; }
}

/* HCE · "Celulares y tablets" (Administración): the clinic PC serving its own local network (docs/14 §10) */
.cz-lan-rules { margin: 6px 0 4px; padding-left: 20px; display: grid; gap: 2px; }
.cz-h3 { font-size: 1rem; margin: 20px 0 8px; }
.cz-lan-urls { display: grid; gap: 12px; }
.cz-lan-url { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.cz-lan-url img { background: #fff; padding: 6px; border-radius: 10px; image-rendering: pixelated; }
.cz-lan-url code { font-size: 1.15rem; font-weight: 700; user-select: all; word-break: break-all; }
.cz-lan-print { display: block; margin-top: 6px; font-family: ui-monospace, Consolas, monospace; font-size: .82rem; letter-spacing: .02em; user-select: all; word-break: break-all; }
.cz-lan-code { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 12px; }
.cz-lan-code span { font-size: 2.6rem; font-weight: 800; letter-spacing: .12em; font-variant-numeric: tabular-nums; line-height: 1.1; }
/* Planes (docs/15): what the client sees to choose, pay and activate; and the founder's side inside /superadmin. */
.pl-now { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.pl-now-main { display: flex; align-items: center; gap: 12px; }
.pl-now-main > div { display: grid; gap: 2px; }
.pl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin: 16px 0; align-items: stretch; }
.pl-grid > .card { margin-top: 0; }
.pl-plan { display: flex; flex-direction: column; gap: 8px; }
.pl-plan.current { border-color: var(--ok); }
.pl-plan.recommended { border-color: var(--accent); }
.pl-plan.chosen { border-color: var(--brand); box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 35%, transparent); }
.pl-plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pl-plan-head h2 { margin: 0; }
.pl-plan p { margin: 0; }
.pl-price b { font-size: 1.7rem; }
.pl-price span { color: var(--text-2); }
.pl-note { color: var(--accent-strong); }
.pl-old { color: var(--text-2); font-size: 1rem; margin-right: 4px; }
.pl-promo { margin-bottom: 14px; }
.pl-feats { list-style: none; margin: 6px 0 10px; padding: 0; display: grid; gap: 6px; flex: 1; align-content: start; }
.pl-feats li { display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; }
.pl-feats svg.i { width: 16px; height: 16px; flex: none; margin-top: 3px; color: var(--ok); }
.pl-steps { margin: 14px 0 0; padding-left: 22px; display: grid; gap: 18px; }
.pl-steps li { display: grid; gap: 6px; }
.pl-data { margin: 4px 0; display: grid; gap: 6px; }
.pl-data > div { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.pl-data dt { color: var(--text-2); font-size: .82rem; min-width: 130px; }
.pl-data dd { margin: 0; font-weight: 600; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; overflow-wrap: anywhere; }
.pl-device { margin: 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pl-device code, .pl-activate code { font-size: 1.05rem; letter-spacing: .06em; }
.pl-activate form { display: grid; gap: 10px; margin: 10px 0; }
.pl-activate textarea, .ba-code { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; overflow-wrap: anywhere; }
.pl-ok { color: var(--ok); }
.pl-warn { color: var(--warn); }
.pl .field span, .ba .field span { display: block; font-size: .82rem; color: var(--text-2); margin-bottom: 4px; }
.ba { margin-top: 16px; }
.ba-form { gap: 12px; margin: 8px 0; }
.ba-wide { grid-column: 1 / -1; }
.ba-plan { align-items: flex-start; }
.ba-prices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; flex: 2 1 380px; }
.ba-prices textarea { width: 100%; }
.ba-issued > div { display: grid; gap: 8px; flex: 1; min-width: 0; }

/* Doki en la atención (HCE): a floating button and a side panel; --role is the specialist's color. */
.dk-fab { position: fixed; right: 20px; bottom: 20px; z-index: 25; display: inline-flex; align-items: center; gap: 6px; padding: 6px 16px 6px 8px;
  border-radius: 999px; border: 1px solid color-mix(in srgb, var(--role, var(--accent)) 55%, var(--border)); background: #0A2540; color: #fff;
  font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 10px 26px -10px rgba(10, 37, 64, .7), 0 0 18px color-mix(in srgb, var(--role, var(--accent)) 35%, transparent);
  transition: transform .15s, box-shadow .15s; }
.dk-fab:hover { transform: translateY(-2px); }
.dk-fab.on { box-shadow: 0 0 0 3px color-mix(in srgb, var(--role, var(--accent)) 45%, transparent); }
.dk-panel { position: fixed; right: 20px; bottom: 84px; z-index: 25; width: min(400px, calc(100vw - 32px)); max-height: min(76vh, 720px); display: flex; flex-direction: column; gap: 10px;
  padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--role, var(--accent));
  box-shadow: 0 24px 60px -20px rgba(10, 8, 30, .55); overflow: hidden; }
/* During a video call the dock takes the right column (companion) or the whole stage (room). */
.cz-shell.in-call.companion .dk-fab, .cz-shell.in-call.companion .dk-panel { right: 412px; }
.cz-shell.in-call.companion:has(~ .call-dock.small) .dk-fab, .cz-shell.in-call.companion:has(~ .call-dock.small) .dk-panel { right: 20px; }
.cz-shell.in-call.room .dk-fab, .cz-shell.in-call.room .dk-panel { display: none; }
.dk-head { display: flex; align-items: center; gap: 10px; }
.dk-title { flex: 1; min-width: 0; display: grid; gap: 4px; }
.dk-role { width: 100%; min-height: 34px; padding: 4px 8px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-3); color: var(--text); font: inherit; font-size: .9rem; font-weight: 600; }
.dk-note { margin: 0; }
.dk-vip { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; font-size: .64rem; font-weight: 800; letter-spacing: .06em; vertical-align: middle; background: linear-gradient(135deg, #F7C948, #F59E0B); color: #3B2A00; }
.dk-lock { background: var(--accent-soft); }
.dk-lock b { color: var(--accent-strong); }
.dk-off { display: grid; gap: 6px; padding: 12px; border-radius: 12px; background: var(--warn-soft); color: var(--text); }
.dk-off b { display: inline-flex; align-items: center; gap: 6px; color: var(--warn); }
.dk-off p { margin: 0; }
.dk-off .btn { justify-self: start; }
/* "Activar a Doki" (AiSetup): the step that is missing, in plain words, with one button. */
.ais { display: grid; gap: 8px; padding: 14px; border-radius: 14px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); color: var(--text); }
.ais.ok { background: color-mix(in srgb, var(--ok) 10%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.ais-title { display: inline-flex; align-items: center; gap: 7px; font-size: 1rem; color: var(--accent-strong); }
.ais.ok .ais-title { color: var(--ok); }
.ais-line { margin: 0; font-size: .9rem; line-height: 1.45; }
.ais-steps { margin: 0; padding-left: 20px; font-size: .9rem; line-height: 1.6; }
.ais-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ais-bar { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); overflow: hidden; }
.ais-bar i { display: block; height: 100%; border-radius: 999px; background: var(--grad); transition: width .4s ease; }
.ais-err { margin: 0; color: var(--bad); display: flex; gap: 6px; align-items: flex-start; }
.ais-tech summary { cursor: pointer; font-size: .76rem; color: var(--text-3); }
.ais-tech p { margin: 4px 0 0; word-break: break-word; }
/* Where an answer of Doki came from (DokiSources) and the library card (DokiLibraryCard). */
.dks { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--ok) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ok) 28%, transparent); font-size: .78rem; line-height: 1.4; }
.dks b { color: var(--ok); }
.dks ul { margin: 2px 0 4px; padding-left: 18px; }
.dks a { color: var(--accent-strong); }
.dks-credit { display: block; color: var(--text-3); font-size: .72rem; }
.dks.none { display: flex; gap: 6px; align-items: flex-start; background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.dks.none svg.i { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.dkl { margin-top: 18px; max-width: 980px; }
.dkl h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 1.1rem; }
.dkl-empty { margin: 10px 0; color: var(--text-2); }
.dkl-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; }
.dkl-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-3); }
.dkl-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); flex: none; }
.dkl-item.own .dkl-ico { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); }
.dkl-text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.dkl-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dkl-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.dkl-actions label.btn { cursor: pointer; }
.dkl-actions label.btn.disabled { opacity: .6; pointer-events: none; }
.dkl-sub { margin: 16px 0 0; font-size: .95rem; }
.dkl-item.offer { background: transparent; }
.dkl-item.offer .dkl-text b { white-space: normal; }
.dkl-progress { color: var(--accent-strong); font-weight: 600; }
.dkl-note { margin: 8px 0 0; }
.dkl-msg { margin-top: 10px; }
.dkl-msg .btn { margin-left: auto; flex: none; }
.dk-case { font-size: .88rem; }
.dk-see { font-size: .82rem; }
.dk-see summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.dk-see pre { margin: 6px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border); white-space: pre-wrap; font: inherit; font-size: .8rem; color: var(--text-2); max-height: 150px; overflow: auto; }
.dk-chat { flex: 1; min-height: 60px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; }
.dk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dk-msg { max-width: 94%; padding: 9px 12px; border-radius: 14px; font-size: .9rem; line-height: 1.45; }
.dk-msg.me { align-self: flex-end; background: var(--grad); color: var(--on-brand); border-bottom-right-radius: 4px; font-weight: 550; }
.dk-msg.bot { align-self: flex-start; background: var(--surface-3); border: 1px solid var(--border); border-left: 3px solid var(--role, var(--accent)); border-bottom-left-radius: 4px; }
.dk-msg.bot.err { color: var(--bad); background: var(--bad-soft); border-color: transparent; display: flex; gap: 8px; align-items: flex-start; }
.dk-who { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; font-weight: 700; color: var(--text-2); margin-bottom: 4px; }
.dk-text { white-space: pre-wrap; }
.dk-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: .76rem; }
.dk-act { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .78rem; font-weight: 650; cursor: pointer; }
.dk-act:hover:not(:disabled) { border-color: var(--accent); }
.dk-act.strong { background: var(--accent); border-color: var(--accent); color: var(--on-brand); }
.dk-act:disabled { opacity: .65; cursor: default; }
.dk-act svg.i { width: 13px; height: 13px; }
.dk-dots { display: flex; gap: 5px; padding: 6px 0; }
.dk-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--role, var(--accent)); animation: dk-dot 1.2s infinite ease-in-out; }
.dk-dots i:nth-child(2) { animation-delay: .15s; } .dk-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dk-dot { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }
.dk-ask { display: grid; gap: 6px; }
.dk-ask textarea { width: 100%; resize: vertical; min-height: 54px; }
.dk-ask-row { display: flex; align-items: center; gap: 8px; }
.dk-mic { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-3); color: var(--accent-strong); display: grid; place-items: center; cursor: pointer; flex: none; }
.dk-mic.rec { background: var(--bad); border-color: var(--bad); color: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 25%, transparent); }
.dk-mic:disabled { opacity: .5; cursor: not-allowed; }
.dk-err { margin: 0; color: var(--bad); display: flex; gap: 6px; align-items: flex-start; }
.dk-foot { margin: 0; font-size: .72rem; line-height: 1.35; color: var(--text-3); }
/* Doki as a module of the HCE (/clinica/doki): the specialists' cards and the same panel, drawn in the page. */
.dk-panel.inline { position: static; width: auto; max-height: none; min-height: 0; box-shadow: var(--shadow-sm); z-index: auto; }
.dk-panel.inline .dk-chat { min-height: 200px; max-height: 52vh; }
.dkm-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; max-width: 980px; }
.dk-panel.inline .dk-role { min-height: 44px; font-size: 1rem; padding: 8px 12px; }
.dkm-stage { position: sticky; top: 84px; display: grid; justify-items: center; gap: 4px; padding: 22px 16px 18px; border-radius: 18px; text-align: center;
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--role) 22%, transparent) 0%, transparent 70%), var(--surface);
  border: 1px solid var(--border); border-top: 4px solid var(--role); transition: border-color .3s, background .3s; }
.dkm-stage b { font-size: 1.05rem; margin-top: 6px; }
.dkm-stage small { color: var(--text-2); font-size: .82rem; line-height: 1.35; }
@media (max-width: 900px) {
  .dkm-grid { grid-template-columns: 1fr; }
  .dkm-stage { position: static; order: -1; grid-template-columns: auto 1fr; justify-items: start; text-align: left; column-gap: 14px; padding: 12px 14px; }
  .dkm-stage svg.doki { width: 84px; height: auto; grid-row: span 2; }
  .dkm-stage b { align-self: end; margin: 0; }
}

/* The HCE menu folds to icons (.rail-min) and opens again. Phones keep their own row layout. */
.cz-brand-row { display: flex; align-items: flex-start; gap: 4px; }
.cz-brand-row .cz-brand { flex: 1; min-width: 0; }
.cz-fold { flex: none; width: 30px; height: 30px; margin-top: 8px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); color: #E8E4FF;
  display: grid; place-items: center; cursor: pointer; transition: background .15s; }
.cz-fold:hover { background: rgba(255, 255, 255, .16); }
.cz-fold svg.i { width: 16px; height: 16px; transform: rotate(90deg); transition: transform .2s; }
.cz-shell.rail-min .cz-fold svg.i { transform: rotate(-90deg); }
.cz-shell { transition: grid-template-columns .2s ease; }
@media (min-width: 761px) {
  .cz-shell.rail-min { grid-template-columns: 68px 1fr; }
  .cz-shell.rail-min .cz-rail { padding: 18px 8px; align-items: center; }
  .cz-shell.rail-min .cz-brand-row { flex-direction: column; align-items: center; gap: 8px; }
  .cz-shell.rail-min .cz-brand { padding: 4px 0 0; }
  .cz-shell.rail-min .cz-fold { margin-top: 0; }
  .cz-shell.rail-min .cz-brand-text, .cz-shell.rail-min .cz-item span, .cz-shell.rail-min .cz-item kbd, .cz-shell.rail-min .cz-me-text,
  .cz-shell.rail-min .cz-help span, .cz-shell.rail-min .cz-switch span, .cz-shell.rail-min .cz-sign span:not(.dot) { display: none; }
  .cz-shell.rail-min .cz-nav { align-items: center; margin-top: 8px; }
  .cz-shell.rail-min .cz-item { justify-content: center; padding: 11px; position: relative; }
  .cz-shell.rail-min .cz-item .cz-live { position: absolute; top: 6px; right: 6px; margin: 0; }
  .cz-shell.rail-min .cz-me { flex-direction: column; padding: 8px 6px; }
  .cz-shell.rail-min .cz-help, .cz-shell.rail-min .cz-switch { padding: 10px; width: 44px; }
  .cz-shell.rail-min .cz-sign { padding: 6px; justify-content: center; }
  .cz-shell.rail-min.in-call.room ~ .call-dock.room { left: 80px; }
}
@media (max-width: 760px) { .cz-fold { display: none; } }
@media (prefers-reduced-motion: reduce) { .cz-shell, .cz-fold svg.i { transition: none; } }

@media (max-width: 899px) {
  .dk-fab { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); right: 12px; }
  .dk-panel { right: 8px; left: 8px; width: auto; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); max-height: 76vh; }
}
@media (prefers-reduced-motion: reduce) { .dk-dots i { animation: none; } .dk-fab { transition: none; } }

/* Doki microphone: says exactly when to talk */
.dk-live { display: flex; align-items: center; gap: .6rem; margin: .4rem 0; padding: .55rem .8rem; border-radius: 10px; background: #fdecec; border: 1px solid #e5484d; color: #8f1d22; font-size: .95rem; }
.dk-live.wait { background: #fff6e0; border-color: #d9a400; color: #6b5200; }
.dk-live-dot { flex: none; width: .8rem; height: .8rem; border-radius: 50%; background: #e5484d; animation: dk-live-pulse 1s ease-in-out infinite; }
.dk-live.wait .dk-live-dot { background: #d9a400; }
@keyframes dk-live-pulse { 50% { opacity: .25; } }

/* HCE attention: the bar with sign / send / close stays on screen */
.cz-actbar { position: sticky; bottom: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; margin-top: 12px; background: var(--surface); border: 1px solid var(--line, #d5e3e6); border-radius: 14px 14px 0 0; box-shadow: 0 -8px 24px -12px rgba(0, 48, 63, .35); }
.cz-actbar-doc { display: inline-flex; align-items: center; gap: 4px; font-size: .86rem; color: var(--text-2); max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cz-actbar-msg { max-width: 40ch; }
.btn.wa-doc { color: #128c4b; }
.btn.wa-doc svg.i { width: 1em; height: 1em; }

/* Receta and descanso inside the video room's side panel */
.cp-kinds { display: flex; gap: 6px; }
.cp-finder { margin: 0; }
.cp-rx { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; border: 1px solid var(--line, #d5e3e6); border-radius: 12px; }
.cp-rx .cp-wide { grid-column: 1 / -1; margin: 0; }
.cp-rx .cp-del { align-self: end; justify-self: start; }
.cp-rx input { min-width: 0; width: 100%; }
.cp-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0 4px; background: var(--surface); }
.cp-actions p { margin: 0; flex-basis: 100%; }
.cp-docs { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
