:root {
  /* Paleta: neutros cálidos ("piedra"), acento azul marino profundo y estados semánticos sobrios */
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --text: #1c1917;
  --text-2: #3f3a36;
  --muted: #736c67;
  --subtle: #a39c97;
  --accent: #24557a;
  --accent-2: #3d7bab;
  --accent-hover: #1b4262;
  --accent-soft: #eef3f8;
  --accent-ring: rgba(36, 85, 122, .2);
  --ink: #17181c;
  --ink-2: #23252b;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --ok: #2f7a55;
  --ok-soft: #eef7f1;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(28, 25, 23, .04), 0 1px 1px rgba(28, 25, 23, .02);
  --shadow-md: 0 6px 16px -4px rgba(28, 25, 23, .1), 0 2px 4px -2px rgba(28, 25, 23, .05);
  --shadow-lg: 0 24px 48px -12px rgba(28, 25, 23, .22);
  font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin: 0 0 4px; line-height: 1.25; }
h2 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
h3 { font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; margin: 0; }
code { font-size: 12px; background: #f1f0ee; padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
::selection { background: var(--accent-ring); }
.icono { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icono.sm { width: 15px; height: 15px; }
.icono.lg { width: 22px; height: 22px; }

/* ---------- barra superior ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.brand .muted { font-weight: 400; }
.logo {
  width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff;
  display: inline-grid; place-items: center; font-size: 15px;
}
.patient { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.patient-name { font-weight: 600; }

/* ---------- pestañas de plantillas ---------- */
.tabs { display: flex; gap: 4px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  border: 0; background: none; padding: 12px 14px; font: inherit; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap; display: flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 99px; background: #f1f0ee; color: var(--muted); font-weight: 500; }
.tab[aria-selected="true"] .badge { background: var(--accent-soft); color: var(--accent); }

/* ---------- layout ---------- */
.layout[hidden] { display: none; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; padding: 24px 28px 60px; max-width: 1280px; margin: 0 auto; }
.form-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.form-head p { margin: 0; }
.form-actions { display: flex; gap: 8px; flex-shrink: 0; }
.panel-col { position: relative; }
.panel { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 14px; }
.panel-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .panel { position: static; }
  .topbar, .tabs { padding-left: 16px; padding-right: 16px; }
  .form-head { flex-direction: column; }
}

/* ---------- botones ---------- */
.btn {
  font: inherit; font-size: 14px; border-radius: 8px; padding: 8px 14px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn:hover { border-color: #c8d1d5; }
.btn.ghost { background: transparent; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; padding: 11px 14px; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.block { width: 100%; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.icon { padding: 4px 9px; color: var(--muted); }

/* ---------- secciones y campos ---------- */
.section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
.section-head { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.section-head p { margin: 4px 0 0; }
.section-body { padding: 16px 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field[hidden] { display: none; }
.field.appear { animation: appear .25s ease; }
@keyframes appear { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.label { font-weight: 600; font-size: 14px; }
.req { color: var(--danger); margin-left: 2px; }
.help { font-size: 12.5px; color: var(--muted); }
.field-error { font-size: 12.5px; color: var(--danger); }
.field.has-error .input, .field.has-error .seg { border-color: var(--danger); }
@media (max-width: 640px) { .section-body { grid-template-columns: 1fr; } }

.input {
  font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text);
}
.input:focus, .seg button:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
textarea.input { min-height: 72px; resize: vertical; }
.with-unit { display: flex; align-items: center; gap: 8px; }
.with-unit .input { max-width: 140px; }
.unit { color: var(--muted); font-size: 13px; }

/* control segmentado (select corto, sí/no) */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex-wrap: wrap; align-self: flex-start; }
.seg button { font: inherit; font-size: 14px; border: 0; background: #fff; padding: 7px 14px; cursor: pointer; color: var(--text); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: #f4f3f1; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* chips (multiselección, mapa corporal) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 13px; border: 1px solid var(--border); background: #fff; border-radius: 99px; padding: 5px 12px; cursor: pointer; color: var(--text); }
.chip:hover { border-color: #c8d1d5; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* escala 0-10 */
.scale { display: flex; gap: 4px; flex-wrap: wrap; }
.scale button {
  font: inherit; font-size: 14px; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; color: var(--text); font-variant-numeric: tabular-nums;
}
.scale button:hover { border-color: #b9c4c9; }
.scale button[aria-pressed="true"] { color: #fff; border-color: transparent; font-weight: 700; }
.scale-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); max-width: 440px; }

/* tablas: bilateral y cuestionario */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 6px 8px; border-bottom: 1px solid #efedea; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { width: 92px; }
.table .num .input { padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.table .normal { color: var(--muted); font-variant-numeric: tabular-nums; width: 70px; }
.table-wrap { overflow-x: auto; }
.pct { display: flex; align-items: center; gap: 6px; min-width: 110px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.bar { flex: 1; height: 6px; background: #efedeb; border-radius: 99px; overflow: hidden; min-width: 40px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.low > i { background: var(--danger); }
.bar.mid > i { background: var(--warn); }
.q-opt { text-align: center; width: 64px; }
.q-opt input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.q-head { text-align: center !important; font-size: 11px !important; line-height: 1.2; }

/* mapa corporal */
.bodymap { display: flex; flex-direction: column; gap: 8px; }
.bodymap-sel { display: flex; flex-wrap: wrap; gap: 8px; }
.bodymap-item { display: flex; align-items: center; gap: 6px; background: var(--accent-soft); border-radius: 8px; padding: 4px 6px 4px 10px; font-size: 13px; }
.bodymap-item select { font: inherit; font-size: 12.5px; border: 1px solid var(--border); border-radius: 6px; padding: 2px 4px; background: #fff; }

/* lista repetible */
.list-rows { display: flex; flex-direction: column; gap: 8px; }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; background: #faf9f8; border: 1px solid #efedeb; border-radius: 8px; padding: 10px; }
.list-row-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.list-row .field { gap: 4px; }
.list-row .label { font-size: 12.5px; color: var(--muted); }

/* ---------- panel lateral ---------- */
.progress-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; font-weight: 600; }
.progress { height: 8px; background: #efedeb; border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); transition: width .25s; }
.scores { display: flex; flex-direction: column; gap: 10px; }
.score { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.score-label { font-size: 13.5px; }
.score-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.score-value .unit { font-size: 12px; font-weight: 500; }
.score-value.empty { color: #b5c0c5; font-weight: 500; font-size: 16px; }
.pill { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 99px; font-weight: 600; margin-top: 3px; }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.mid { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.count { background: #f1f0ee; color: var(--muted); border-radius: 99px; padding: 1px 7px; font-size: 11px; margin-left: 4px; }
.obs { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; font-size: 12.5px; }
.obs-row { display: flex; justify-content: space-between; gap: 8px; }
.obs-row code { background: none; padding: 0; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obs-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.errors { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.errors li { font-size: 13px; color: var(--danger); cursor: pointer; padding: 6px 8px; background: var(--danger-soft); border-radius: 6px; }
.errors li:hover { text-decoration: underline; }
.empty-note { font-size: 13px; color: var(--muted); }

/* ---------- diálogo ---------- */
dialog { border: 0; border-radius: 12px; padding: 18px 20px; width: min(720px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(20, 35, 40, .45); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; }
.dlg-head h2 { font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0; }
dialog pre { background: #0f1e24; color: #d5e6ea; padding: 14px; border-radius: 8px; font-size: 12px; max-height: 60vh; overflow: auto; }

.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px rgba(194, 65, 45, .35); border-radius: 8px; } 100% { box-shadow: none; } }

/* =====================================================================
   Evolución (gráficos)
   Paleta validada: derecho = slot 1 azul, izquierdo = slot 2 naranja.
   ===================================================================== */
.evo {
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-accent: var(--accent);
  --grid: #e9eded;
  --ref: #8c979c;
  --status-good: #0ca30c;
  --status-critical: #d03b3b;
  --surface-1: #ffffff;
  max-width: 1280px; margin: 0 auto; padding: 24px 28px 60px;
}
.evo[hidden] { display: none; }
.evo-head { margin-bottom: 16px; }
.evo-head p { margin: 0; }
.evo-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.evo-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.evo-tile-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.evo-tile-value { font-size: 28px; font-weight: 700; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.evo-tile-sub { font-size: 13px; font-weight: 500; color: var(--muted); }
.evo-tile-foot { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.evo-delta { display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-weight: 600; }
.evo-delta-icon { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 700; }
.evo-delta-icon.good { background: var(--status-good); }
.evo-delta-icon.bad { background: var(--status-critical); }

.evo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.evo-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 10px; box-shadow: var(--shadow); min-width: 0; }
.evo-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.evo-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.evo-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.evo-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.evo-key { flex-shrink: 0; }
.evo-plot { position: relative; margin-top: 6px; }
.evo-svg { display: block; width: 100%; height: auto; overflow: visible; }
.evo-svg:focus { outline: none; }
.evo-svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.evo-grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.evo-axis { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.evo-ref { stroke: var(--ref); stroke-width: 1; shape-rendering: crispEdges; }
.evo-ref-label { font-size: 11px; fill: var(--muted); }
.evo-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.evo-dot { stroke: var(--surface-1); stroke-width: 2; transition: r .1s; }
.evo-end { font-size: 12px; font-weight: 700; fill: var(--text); font-variant-numeric: tabular-nums; }
.evo-end-sub { font-weight: 500; fill: var(--muted); }
.evo-cross { stroke: #9aa5aa; stroke-width: 1; pointer-events: none; }
.evo-tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 4px 16px rgba(16, 40, 48, .12); padding: 8px 10px; font-size: 12.5px; min-width: 150px; z-index: 2;
}
.evo-tip-date { color: var(--muted); margin-bottom: 4px; }
.evo-tip-date::first-letter { text-transform: uppercase; }
.evo-tip-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.evo-tip-row strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.evo-tip-row span { color: var(--muted); }
.evo-table { margin-top: 8px; max-height: 240px; overflow: auto; }
.evo-table[hidden] { display: none; }
.num-cell { font-variant-numeric: tabular-nums; }

@media (max-width: 1000px) { .evo-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .evo { padding: 16px; } .evo-grid { grid-template-columns: 1fr; } }

/* aviso al firmar */
.dlg-note { display: flex; align-items: center; gap: 10px; background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; margin: 12px 0; font-size: 14px; }
.dlg-note .btn { margin-left: auto; padding: 6px 12px; white-space: nowrap; }
.dlg-note .btn[hidden] { display: none; }
.dlg-check { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--status-good, #0ca30c); color: #fff; font-size: 12px; font-weight: 700; flex-shrink: 0; }
details summary { cursor: pointer; }

/* puntos de la ficha firmada hoy */
.evo-dot-halo { fill: none; stroke-width: 1.5; stroke-opacity: .45; }
.evo-new-note { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12.5px; color: var(--text); background: var(--accent-soft); border-radius: 99px; padding: 3px 10px 3px 6px; }
.evo-new-swatch { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-opacity: .6; }
.evo-tip-new { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 99px; padding: 0 6px; }

/* barra superior conectada a la API */
.topbar-right { display: flex; align-items: center; gap: 24px; }
.as-member { display: flex; flex-direction: column; gap: 2px; }
.as-member .input { padding: 5px 8px; font-size: 13px; max-width: 240px; }
.patient-select { font: inherit; font-weight: 600; border: 0; background: transparent; padding: 0; color: var(--text); cursor: pointer; }
.btn:disabled { opacity: .6; cursor: progress; }
.dlg-note.error { background: var(--danger-soft); }
.dlg-note.error .dlg-check { background: var(--danger); }
.empty-state { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 24px; text-align: center; color: var(--muted); }
.empty-state h2 { text-transform: none; letter-spacing: 0; font-size: 17px; color: var(--text); }
@media (max-width: 900px) { .topbar { flex-direction: column; align-items: flex-start; gap: 10px; } .topbar-right { flex-wrap: wrap; gap: 12px; } }

/* login */
.topbar[hidden], .tabs[hidden], .login[hidden] { display: none; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { margin: 0 0 4px; }
.login-brand { margin-bottom: 6px; }
.login-error { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; }
.login-error[hidden] { display: none; }
.user-box { display: flex; align-items: center; gap: 8px; padding-left: 16px; border-left: 1px solid var(--border); }
.as-member[hidden] { display: none; }

/* recuperación de contraseña */
.login-card[hidden] { display: none; }
.login-ok { background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; }
.login-ok[hidden] { display: none; }
.link-btn { font: inherit; font-size: 13.5px; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 2px; align-self: center; }
.link-btn:hover { text-decoration: underline; }
.login .field { gap: 6px; }

/* verificación en dos pasos */
.code-input { font-size: 22px; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; max-width: 240px; }
#dlg-seg { width: min(520px, 94vw); }
#dlg-seg > div:not(.dlg-head), #dlg-seg > form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
#dlg-seg [hidden] { display: none !important; }
#dlg-seg p { margin: 0; line-height: 1.5; }
#dlg-seg .btn { align-self: flex-start; }
.seg-aviso { background: var(--warn-soft); color: #7a4f12; border-radius: 8px; padding: 10px 12px; font-size: 14px; margin-top: 12px; }
.seg-pasos { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 14px; }
.seg-pasos li { display: flex; flex-direction: column; gap: 8px; }
.seg-qr { width: 200px; height: 200px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px; }
.seg-qr svg { width: 100%; height: 100%; display: block; }
.seg-secreto { display: inline-block; margin-top: 6px; font-size: 14px; letter-spacing: .08em; word-break: break-all; }
.seg-codigos { list-style: none; margin: 0; padding: 12px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; background: #f4f3f1; border-radius: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 15px; }
.seg-acciones { display: flex; gap: 8px; }
.seg-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* panel de administración */
.tab-admin { margin-left: auto; }
.adm-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.adm-total { display: flex; flex-direction: column; align-items: flex-end; }
.adm-total strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.adm-sec { margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.adm-sec h3 { font-size: 17px; }
.adm-sec .evo-sub { margin: 0; }
.adm-aviso { position: sticky; top: 8px; z-index: 5; background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.adm-aviso.error { background: var(--danger-soft); color: var(--danger); }
.adm-aviso[hidden] { display: none; }
.adm-invitar { display: grid; grid-template-columns: 1.2fr 1.4fr 1fr 1fr auto auto; gap: 8px; align-items: center; padding: 12px; background: #f7f6f4; border-radius: 8px; }
.adm-invitar select[hidden] { display: block; visibility: hidden; }
@media (max-width: 1000px) { .adm-invitar { grid-template-columns: 1fr 1fr; } }
.adm-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; white-space: nowrap; }
.adm-seg { font-size: 15px; white-space: normal; align-items: flex-start; }
.adm-seg input { margin-top: 3px; }
.adm-tabla .input { padding: 5px 8px; font-size: 13px; min-width: 130px; }
.adm-tabla select[hidden] { display: none; }
.adm-tabla td { vertical-align: middle; }
.adm-nombre { font-weight: 600; display: flex; gap: 6px; align-items: center; }
.adm-inactivo td { opacity: .55; }
.adm-inactivo td:last-child { opacity: 1; }
.adm-ok { color: var(--accent); font-weight: 600; font-size: 13px; }
.center { text-align: center; }
.adm-mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.adm-mod { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.adm-mod.activo { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 4%, white); }
.adm-mod-head { display: flex; justify-content: space-between; gap: 10px; }
.adm-mod-nombre { font-weight: 700; margin-bottom: 2px; }
.adm-mod-precio { text-align: right; white-space: nowrap; display: flex; flex-direction: column; }
.adm-mod-pie { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adm-asignar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.adm-actividad { max-height: 320px; overflow: auto; }

/* agenda */
.ag[hidden] { display: none; }
.ag-barra { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ag-nav { display: flex; align-items: center; gap: 6px; }
.ag-nav .btn { min-width: 34px; }
.ag-titulo { font-size: 20px; margin: 0 0 0 8px; text-transform: none; }
.ag-acciones { display: flex; align-items: center; gap: 8px; }
.ag-acciones .input { width: auto; min-width: 200px; padding: 6px 8px; font-size: 13.5px; }
.ag-leyenda { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; }
.ag-leyenda-item { display: inline-flex; align-items: center; gap: 6px; }
.ag-leyenda-item i, .ag-punto { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }
.ag-grilla { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.ag-cab, .ag-cuerpo { display: grid; min-width: 720px; }
.ag-grilla { overflow-x: auto; }
.ag-cab { border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.ag-dia { padding: 8px; text-align: center; display: flex; flex-direction: column; font-size: 12px; color: var(--muted); border-left: 1px solid #efedea; }
.ag-dia strong { font-size: 18px; color: var(--text); }
.ag-dia.hoy strong { color: #fff; background: var(--accent); border-radius: 99px; width: 30px; height: 30px; display: inline-grid; place-items: center; align-self: center; font-size: 15px; }
.ag-scroll { max-height: 640px; overflow-y: auto; min-width: 720px; }
.ag-horas { position: relative; }
.ag-hora { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ag-hora:first-child { transform: none; }
.ag-col { position: relative; border-left: 1px solid #efedea; cursor: copy; }
.ag-col.hoy { background: color-mix(in srgb, var(--accent) 3%, white); }
.ag-linea { position: absolute; left: 0; right: 0; border-top: 1px solid #efedeb; pointer-events: none; }
.ag-disp { position: absolute; left: 0; right: 0; background: rgba(15, 124, 110, .07); }
.ag-ahora { position: absolute; left: 0; right: 0; border-top: 2px solid var(--danger); z-index: 1; pointer-events: none; }
.ag-ahora::before { content: ''; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.ag-cita {
  position: absolute; z-index: 1; text-align: left; font: inherit; cursor: pointer; overflow: hidden;
  border: 1px solid var(--border); border-left: 4px solid; border-radius: 6px; padding: 3px 6px;
  background: color-mix(in srgb, var(--c) 12%, white); display: flex; flex-direction: column; gap: 1px; line-height: 1.2;
}
.ag-cita:hover, .ag-cita:focus-visible { box-shadow: 0 2px 8px rgba(16, 40, 48, .18); z-index: 2; outline: none; }
.ag-cita-hora { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ag-cita-pac { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-cita-svc { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-cita.estado-atendida { opacity: .6; }
.ag-cita.estado-cancelada { opacity: .45; background: repeating-linear-gradient(135deg, #fff, #fff 5px, #f1f3f4 5px, #f1f3f4 10px); }
.ag-cita.estado-cancelada .ag-cita-pac { text-decoration: line-through; }
.ag-cita.estado-no_asistio { border-color: var(--danger); }
.ag-dlg { width: min(560px, 94vw); }
.ag-dlg > * + * { margin-top: 12px; }
.ag-detalle { display: grid; gap: 10px; }
.ag-detalle > div { display: grid; grid-template-columns: 110px 1fr; align-items: center; }
.ag-botones { display: flex; flex-wrap: wrap; gap: 8px; }
.ag-form { display: flex; flex-direction: column; gap: 12px; }
.ag-form > .btn { align-self: flex-start; }
.ag-fila { display: flex; gap: 10px; align-items: flex-end; }
.ag-fila > * { flex: 1; }
.ag-fila > .btn { flex: 0 0 auto; }
.ag-nuevo-pac { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; background: #f7f6f4; border-radius: 8px; }
.ag-nuevo-pac[hidden] { display: none; }
.ag-nuevo-pac .btn { justify-self: start; }
.ag-slots { display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow-y: auto; }
.ag-slots .chip { font-variant-numeric: tabular-nums; }
.ag-chip-fuera { border-style: dashed; }
.ag-horario { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.ag-hdia { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #efedea; }
.ag-hbloques { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ag-hbloque { display: inline-flex; align-items: center; gap: 4px; }
.ag-hbloque .input { width: 96px; padding: 4px 6px; }
.login-error[hidden] { display: none; }
@media (max-width: 900px) { .ag-acciones { flex-wrap: wrap; } .ag-titulo { font-size: 16px; } }

.adm-num { width: 90px !important; min-width: 0 !important; }
.adm-servicio { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.adm-servicio > .input { flex: 1; min-width: 200px; }

.adm-reserva { display: flex; flex-direction: column; gap: 12px; }
.adm-reserva-url { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.adm-reserva-url .input { max-width: 260px; }
.adm-reserva-num { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.adm-reserva-num label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.adm-reserva-num .adm-num { width: 70px !important; padding: 4px 6px; }
.adm-reserva-pie { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.adm-reserva-pie a { color: var(--accent); }

/* caja */
.cj-tiles { margin-bottom: 12px; }
.cj-metodos { display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; margin-top: 6px; }
.cj-metodos div { display: flex; justify-content: space-between; gap: 8px; }
.cj-metodos strong { font-variant-numeric: tabular-nums; }
.cj-boletas-cfg { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.cj-filtros { margin-bottom: 4px; }
.cj-tabla td { white-space: nowrap; }
.cj-tabla td:nth-child(3) { white-space: normal; min-width: 180px; }
.cj-acciones { display: flex; gap: 6px; justify-content: flex-end; }
.cj-resumen { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.cj-sub { font-size: 14px; margin: 4px 0 0; }
.cj-pagos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cj-pagos li { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 6px 8px; background: #f7f6f4; border-radius: 6px; font-size: 13.5px; }
.ag-cobro { display: grid !important; grid-template-columns: 110px 1fr auto !important; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.ag-cobro[hidden] { display: none !important; }
.adm-prov { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: #f7f6f4; border-radius: 8px; }
.cj-boleta { position: relative; border: 1px solid var(--border); border-radius: 8px; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: #fff; overflow: hidden; }
.cj-marca { position: absolute; top: 46%; left: -10%; right: -10%; text-align: center; transform: rotate(-18deg); font-size: 20px; font-weight: 800; color: rgba(194, 65, 45, .16); pointer-events: none; letter-spacing: .05em; }
.cj-boleta-head { display: flex; justify-content: space-between; gap: 16px; }
.cj-emisor { font-size: 17px; }
.cj-folio { border: 2px solid var(--danger); color: var(--danger); padding: 8px 12px; text-align: center; font-weight: 700; font-size: 13px; border-radius: 4px; }
.cj-tipo { font-size: 11.5px; margin: 2px 0; }
.cj-boleta-datos { display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; }
.cj-total { display: flex; justify-content: space-between; border-top: 2px solid var(--text); padding-top: 8px; font-size: 16px; }
@media print {
  body * { visibility: hidden !important; }
  #cj-imprimible, #cj-imprimible * { visibility: visible !important; }
  #cj-imprimible { position: fixed; left: 0; top: 0; width: 100%; border: 0; }
}

.ag-paquete { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--accent-soft); border-radius: 8px; font-size: 14px; color: var(--accent); font-weight: 600; }
.ag-paquete[hidden] { display: none; }
.ag-paquete input { width: 18px; height: 18px; accent-color: var(--accent); }

/* =====================================================================
   Pantalla de inicio (pública)
   ===================================================================== */
.inicio[hidden] { display: none; }
.inicio { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 6%, white) 0, var(--bg) 520px); min-height: 100vh; }
.inicio-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 40px; max-width: 1200px; margin: 0 auto; }
.inicio-acciones { display: flex; gap: 10px; }
.btn.grande { padding: 12px 22px; font-size: 16px; font-weight: 600; border-radius: 10px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 48px; align-items: center; max-width: 1200px; margin: 0 auto; padding: 48px 40px 64px; }
.hero-eyebrow { color: var(--accent); font-weight: 600; font-size: 14px; margin: 0 0 12px; }
.hero h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.12; letter-spacing: -.02em; margin: 0 0 18px; }
.hero-sub { font-size: 18px; line-height: 1.55; color: var(--muted); margin: 0 0 26px; max-width: 560px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.hero-visual { position: relative; min-height: 340px; }
.hv-card { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 30px rgba(16, 40, 48, .10); padding: 16px 18px; }
.hv-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.hv-agenda { top: 0; left: 0; width: 70%; }
.hv-cita { border-left: 4px solid; border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; font-size: 14px; background: #f7fafa; }
.hv-cita b { margin-right: 6px; }
.hv-cita.c1 { border-color: #2a78d6; } .hv-cita.c2 { border-color: var(--accent); } .hv-cita.c3 { border-color: #eb6834; }
.hv-score { top: 40px; right: 0; width: 38%; }
.hv-num { font-size: 34px; font-weight: 700; margin-bottom: 6px; }
.hv-num span { font-size: 15px; color: var(--muted); font-weight: 500; }
.hv-chart { bottom: 0; right: 6%; width: 52%; color: var(--accent); }
.hv-chart svg { width: 100%; height: 70px; }
.inicio-bloque { max-width: 1200px; margin: 0 auto; padding: 40px; }
.inicio-h2 { font-size: 28px; text-transform: none; letter-spacing: -.01em; color: var(--text); margin: 0 0 8px; text-align: center; }
.inicio-intro { text-align: center; color: var(--muted); margin: 0 0 26px; font-size: 16px; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 26px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); }
.feature h3 { margin: 10px 0 6px; }
.feature p { margin: 0; color: var(--muted); line-height: 1.5; }
.feature-icono { font-size: 26px; }
.especialidades { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.especialidad { background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--accent); border-radius: 14px; padding: 20px 22px; box-shadow: var(--shadow); }
.especialidad h3 { margin-bottom: 10px; }
.especialidad ul { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.6; font-size: 14.5px; }
.inicio-cta-final { text-align: center; padding: 56px 24px; margin: 24px auto 0; max-width: 900px; }
.inicio-cta-final h2 { font-size: 28px; text-transform: none; letter-spacing: -.01em; color: var(--text); }
.inicio-cta-final p { color: var(--muted); font-size: 16px; margin: 0 0 22px; }
.inicio-pie { text-align: center; padding: 24px; border-top: 1px solid var(--border); }

/* registro */
.login-card.ancha { width: min(620px, 100%); }
.reg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin-bottom: 12px; }
.reg-ancho { grid-column: 1 / -1; }
#registro-campos { display: flex; flex-direction: column; gap: 12px; }
#registro-campos[hidden] { display: none; }
#reg-tipo { display: flex; }
#reg-tipo button { flex: 1; }
.trampa { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.link-btn.inline { padding: 0; font-size: inherit; }
.seg-check { align-items: flex-start; line-height: 1.4; }
.seg-check input { margin-top: 3px; }

/* =====================================================================
   Aplicación: menú lateral + contenido
   ===================================================================== */
.app[hidden] { display: none; }
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; background: var(--surface); border-right: 1px solid var(--border); padding: 18px 14px; }
.sidebar-brand { padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; font: inherit; font-size: 15px; text-align: left; background: none; border: 0; border-radius: 9px; padding: 10px 12px; color: var(--text); cursor: pointer; }
.nav-item:hover { background: #f1f0ee; }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item[hidden] { display: none; }
.nav-icono { width: 22px; text-align: center; }
.sidebar-pie { margin-top: auto; display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--border); padding-top: 14px; }
.sidebar-pie .as-member { display: flex; flex-direction: column; gap: 4px; }
.sidebar-pie .as-member select { width: 100%; font-size: 13px; padding: 6px 8px; }
.sidebar-usuario { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar-usuario-texto { min-width: 0; }
.sidebar-usuario-texto div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-botones { display: flex; gap: 6px; }
.sidebar-botones .btn { flex: 1; }
.app-main { min-width: 0; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; flex-shrink: 0; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; flex-shrink: 0; }

/* bienvenida / primeros pasos */
.bienvenida[hidden] { display: none; }
.bienvenida { max-width: 1280px; margin: 20px auto 0; padding: 18px 22px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow); width: calc(100% - 56px); }
.bienvenida-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.bienvenida h2 { text-transform: none; letter-spacing: 0; font-size: 18px; color: var(--text); margin: 0; }
.bienvenida p { margin: 2px 0 0; }
.pasos { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pasos li { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; background: #f7fafa; border-radius: 10px; padding: 12px; }
.pasos li > div { flex: 1; min-width: 140px; }
.pasos li.hecho { opacity: .65; }
.paso-marca { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; flex-shrink: 0; }
.pasos li.hecho .paso-marca { background: var(--accent); }

/* pacientes */
.vista-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.vista-head h1 { margin: 0; }
.buscador { margin-bottom: 14px; max-width: 520px; }
.tabla-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 16px 14px; margin-bottom: 16px; overflow-x: auto; }
.card-titulo { margin: 12px 0 10px; }
.tabla-pacientes td, .tabla-registros td { vertical-align: middle; }
.fila-click { cursor: pointer; }
.fila-click:hover td, .fila-click:focus td { background: #f5f9f9; }
.fila-click:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.pac-celda { display: flex; align-items: center; gap: 10px; }
.pac-nombre { font-weight: 600; }
.vacio { text-align: center; color: var(--muted); padding: 28px 0 !important; }

/* ficha del paciente */
.pac-detalle[hidden] { display: none; }
.pac-detalle { max-width: 1280px; margin: 0 auto; padding: 18px 28px 0; }
.pac-cabecera .volver, .form-col .volver { margin-bottom: 8px; padding: 0; align-self: flex-start; }
.pac-cab-fila { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.pac-cab-texto { flex: 1; min-width: 0; }
.pac-cab-texto h1 { margin: 0; }
.pac-contacto { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 4px; }
.pac-contacto a { color: var(--accent); text-decoration: none; }
.pac-detalle .tabs { padding: 0; background: none; margin-bottom: 18px; }
.pac-cuerpo { padding-bottom: 60px; }
.pac-cuerpo[hidden] { display: none; }
.pac-detalle .layout { padding: 0 0 60px; }
.pac-detalle .evo { padding: 0 0 60px; }
.resumen-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.evo-tile-value.chico { font-size: 18px; }
.lista-simple { list-style: none; margin: 0 0 12px; padding: 0; }
.lista-simple li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lista-simple li:last-child { border-bottom: 0; }
.datos-form { padding: 6px 20px 18px; display: flex; flex-direction: column; gap: 4px; }
.datos-form .btn { align-self: flex-start; }
.conf { color: var(--warn); }

/* elegir ficha */
.grupo-fichas { margin-bottom: 22px; }
.fichas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.ficha-card { font: inherit; text-align: left; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; cursor: pointer; box-shadow: var(--shadow); color: var(--text); }
.ficha-card:hover, .ficha-card:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.ficha-card strong { font-size: 15.5px; }
.ficha-tipo { align-self: flex-start; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #f1f0ee; color: var(--muted); }
.ficha-tipo.t-evaluacion { background: #e7f0fb; color: #2462ae; }
.ficha-tipo.t-evolucion { background: var(--accent-soft); color: var(--accent); }
.ficha-tipo.t-escala { background: #fdf0e8; color: #b5521f; }
.aviso-confidencial { background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 13.5px; }
.aviso-confidencial[hidden] { display: none; }

/* ver un registro */
#dlg-registro { width: min(820px, 96vw); }
.lectura-meta { margin-bottom: 12px; }
.lectura-puntajes { margin-bottom: 14px; }
.lectura-seccion { border-top: 1px solid var(--border); padding: 12px 0; }
.lectura-seccion h3 { font-size: 15px; margin-bottom: 8px; }
.lectura-seccion dl { display: grid; grid-template-columns: minmax(160px, 32%) 1fr; gap: 6px 16px; margin: 0; }
.lectura-seccion dt { color: var(--muted); font-size: 13.5px; }
.lectura-seccion dd { margin: 0; font-size: 14px; }
.lectura-texto { white-space: pre-wrap; }
.lectura-tabla { font-size: 13px; }
.lectura-lista { margin: 0; padding-left: 18px; font-size: 13.5px; }
.lectura-acciones { display: flex; justify-content: flex-end; margin-top: 10px; }
#dlg-paciente { width: min(620px, 96vw); }

/* =====================================================================
   Pantallas angostas (teléfono y tablet)
   ===================================================================== */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 24px 20px 40px; gap: 28px; }
  .hero-visual { min-height: 300px; }
  .inicio-top { padding: 14px 20px; }
  .inicio-bloque { padding: 28px 20px; }
  .features, .especialidades { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 8px; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .sidebar-brand .logo + * { display: none; }
  .nav { flex-direction: row; }
  .nav-item { padding: 8px 10px; white-space: nowrap; }
  .sidebar-pie { margin: 0 0 0 auto; flex-direction: row; align-items: center; border-top: 0; padding-top: 0; }
  .sidebar-usuario-texto, .sidebar-pie .as-member { display: none; }
  .pasos, .resumen-tiles { grid-template-columns: 1fr; }
  .pac-detalle { padding: 14px 16px 0; }
  .bienvenida { width: calc(100% - 32px); }
  .reg-grid { grid-template-columns: 1fr; }
  .pac-cab-fila { flex-wrap: wrap; }
  .lectura-seccion dl { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .features, .especialidades { grid-template-columns: 1fr; }
  .inicio-acciones .btn.ghost { display: none; }
  .nav-item { font-size: 0; gap: 0; }
  .nav-icono { font-size: 18px; }
  #reg-tipo { flex-direction: column; }
  #reg-tipo button + button { border-left: 0; border-top: 1px solid var(--border); }
}
@media print {
  .app, .inicio, .login { display: none !important; }
  #dlg-registro { position: static; width: auto; box-shadow: none; border: 0; }
  #dlg-registro .dlg-head .btn, .lectura-acciones { display: none; }
}
/* el menú lateral ocupa todo el alto aunque la página sea larga */
@media (min-width: 901px) {
  .app { background: linear-gradient(90deg, var(--surface) 235px, var(--border) 235px, var(--border) 236px, var(--bg) 236px); }
  .sidebar { border-right: 0; }
}
@media (max-width: 900px) {
  .app { grid-template-rows: auto 1fr; align-content: start; }
  .pac-cab-fila > .btn { flex-basis: 100%; }
  .sidebar-botones .btn { padding: 6px 10px; }
}
@media (max-width: 560px) {
  .tabla-pacientes th:nth-child(n+3), .tabla-pacientes td:nth-child(n+3) { display: none; }
  .tabla-registros th:nth-child(3), .tabla-registros td:nth-child(3) { display: none; }
  .pac-contacto { flex-direction: column; gap: 2px; }
}

/* =====================================================================
   Agenda interactiva
   ===================================================================== */
:root {
  --st-agendada: #2a6fd6;     --st-agendada-bg: #e8f0fc;
  --st-confirmada: #13854a;   --st-confirmada-bg: #e3f5ea;
  --st-atendida: #56656e;     --st-atendida-bg: #efedea;
  --st-no_asistio: #c7620f;   --st-no_asistio-bg: #fdefe2;
  --st-cancelada: #b8402c;    --st-cancelada-bg: #fbeeeb;
}
.ag-barra { row-gap: 10px; }
.ag-acciones { flex-wrap: wrap; justify-content: flex-end; }
.ag-seg { display: inline-flex; }
.ag-seg button { padding: 6px 12px; font-size: 13.5px; }
.ag-ir { width: auto; padding: 5px 8px; font-size: 13px; margin-left: 6px; }

/* selector de profesionales */
.ag-profs { position: relative; }
.ag-profs > summary { list-style: none; cursor: pointer; user-select: none; }
.ag-profs > summary::-webkit-details-marker { display: none; }
.ag-profs > summary::after { content: ' ▾'; color: var(--muted); }
.ag-profs-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 40, 48, .14); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.ag-profs-atajos { display: flex; gap: 12px; padding: 2px 6px 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.ag-profs-item { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.ag-profs-item:hover { background: #f4f3f1; }

/* leyenda de estados */
.ag-leyenda { gap: 8px; }
.ag-estado-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 99px; color: var(--st); background: var(--st-bg); white-space: nowrap; }
.ag-estado-chip b { font-weight: 700; background: rgba(255, 255, 255, .7); border-radius: 99px; padding: 0 6px; margin-left: 2px; }
.ag-estado-icono { font-size: 11px; }
.estado-agendada { --st: var(--st-agendada); --st-bg: var(--st-agendada-bg); }
.estado-confirmada { --st: var(--st-confirmada); --st-bg: var(--st-confirmada-bg); }
.estado-atendida { --st: var(--st-atendida); --st-bg: var(--st-atendida-bg); }
.estado-no_asistio { --st: var(--st-no_asistio); --st-bg: var(--st-no_asistio-bg); }
.estado-cancelada { --st: var(--st-cancelada); --st-bg: var(--st-cancelada-bg); }
.ag-chip-bloqueo { --st: #4b5960; --st-bg: #eceff1; }
.ag-ver-canceladas { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); }

/* tarjeta de cita: fondo y borde según el estado, franja izquierda con el color del profesional */
.ag-cita { background: var(--st-bg); border: 1px solid color-mix(in srgb, var(--st) 35%, transparent); border-left: 5px solid var(--prof, var(--st)); }
.ag-cita .ag-cita-hora { color: var(--st); font-weight: 600; }
.ag-cita.estado-atendida { opacity: 1; }
.ag-cita.estado-cancelada { opacity: .75; background: repeating-linear-gradient(135deg, var(--st-bg), var(--st-bg) 5px, #fff 5px, #fff 10px); }
.ag-cita.estado-no_asistio { border-color: color-mix(in srgb, var(--st) 50%, transparent); border-left-color: var(--prof, var(--st)); }
.ag-cita.estado-no_asistio .ag-cita-pac { text-decoration: underline wavy color-mix(in srgb, var(--st) 60%, transparent); }
.ag-cita.movible { cursor: grab; }
.ag-cita.arrastrando { cursor: grabbing; z-index: 20; box-shadow: 0 10px 24px rgba(16, 40, 48, .28); opacity: .95; transition: none; outline: 2px dashed var(--st); }
.ag-cita-prof { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 3px; white-space: nowrap; overflow: hidden; }
.ag-cita-prof .ag-punto { width: 7px; height: 7px; margin: 0; }

/* bloqueos */
.ag-bloqueo { position: absolute; left: 0; right: 0; z-index: 0; font: inherit; text-align: left; border: 0; border-top: 1px solid #c7cfd3; border-bottom: 1px solid #c7cfd3; cursor: pointer; padding: 4px 8px; display: flex; flex-direction: column; gap: 1px; color: #4b5960; font-size: 12px; font-weight: 600; overflow: hidden;
  background: repeating-linear-gradient(45deg, #efedea, #efedea 6px, #e2e7ea 6px, #e2e7ea 12px); }
.ag-bloqueo:hover { filter: brightness(.97); }
.ag-bloqueo-prof { font-weight: 400; font-size: 11px; }

/* grilla con intervalos */
.ag-linea.menor { border-top: 1px dashed #f1f3f4; }
.ag-hora.menor { font-size: 10px; color: #a0abb1; }
button.ag-dia { font: inherit; background: none; border: 0; border-left: 1px solid #efedea; cursor: pointer; }
button.ag-dia:hover strong { color: var(--accent); }
.ag-dia-prof { gap: 2px; padding: 10px 6px; }
.ag-dia-prof strong { font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.ag-scroll { max-height: calc(100vh - 230px); min-height: 420px; }
.ag-deshacer { margin-left: 8px; font-weight: 700; text-decoration: underline; }

/* lista */
.ag-lista-cont { display: flex; flex-direction: column; gap: 14px; }
.ag-lista-dia { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; }
.ag-lista-dia.hoy { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.ag-lista-dia h2 { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--text); display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ag-lista-dia h2::first-letter { text-transform: uppercase; }
.ag-lista { list-style: none; margin: 0; padding: 0; }
.ag-lista-fila { display: grid; grid-template-columns: 96px 130px minmax(0, 1fr) minmax(0, 200px) auto; align-items: center; gap: 12px; padding: 9px 8px; border-top: 1px solid var(--border); border-left: 4px solid var(--st, #c7cfd3); cursor: pointer; border-radius: 4px; }
.ag-lista-fila:hover, .ag-lista-fila:focus { background: #f6f9f9; outline: none; }
.ag-lista-fila.estado-cancelada .ag-lista-pac strong { text-decoration: line-through; }
.ag-lista-hora { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }
.ag-lista-pac { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-lista-prof { font-size: 13.5px; display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; white-space: nowrap; }
.ag-lista-acciones { display: flex; gap: 6px; justify-content: flex-end; }
.ag-lista-bloqueo { --st: #9aa6ac; color: #4b5960; }
.ag-lista-vacia { margin: 4px 0; }

@media (max-width: 900px) {
  .ag-acciones { justify-content: flex-start; }
  .ag-ver-canceladas { margin-left: 0; }
  .ag-lista-fila { grid-template-columns: 84px minmax(0, 1fr); grid-template-areas: "hora pac" "estado prof" "acc acc"; row-gap: 6px; }
  .ag-lista-fila > :nth-child(1) { grid-area: hora; }
  .ag-lista-fila > :nth-child(2) { grid-area: estado; justify-self: start; }
  .ag-lista-fila > :nth-child(3) { grid-area: pac; }
  .ag-lista-fila > :nth-child(4) { grid-area: prof; }
  .ag-lista-fila > :nth-child(5) { grid-area: acc; justify-content: flex-start; }
  .ag-profs-panel { left: 0; right: auto; }
  .ag-scroll { max-height: calc(100vh - 300px); }
}
@media (max-width: 700px) {
  .ag-titulo { font-size: 16px; margin-left: 4px; }
  .ag-nav { flex-wrap: wrap; row-gap: 6px; }
  .ag-ir { margin-left: 0; }
  .ag-acciones .btn.primary { order: -1; }
}

/* =====================================================================
   Sistema de diseño v2: componentes refinados
   (va al final para reemplazar los estilos anteriores de cada componente)
   ===================================================================== */

/* ---------- marca ---------- */
.brand { font-weight: 650; letter-spacing: -.02em; }
.logo { background: linear-gradient(140deg, var(--accent-2) 0%, var(--accent) 70%); border-radius: 8px; font-weight: 700; font-size: 14px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px color-mix(in srgb, var(--accent) 30%, transparent); }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); box-shadow: var(--shadow);
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
}
.btn:hover { background: #f8f7f5; border-color: #cbc6c1; color: var(--text); }
.btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; padding: 0 16px; box-shadow: 0 1px 2px rgba(16, 24, 40, .1), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; filter: none; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: #f1f0ee; border-color: transparent; }
.btn.small { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.small.primary { padding: 0 12px; }
.btn.grande { height: 46px; padding: 0 22px; font-size: 15.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.icon { height: 30px; padding: 0 8px; }
.link-btn { font-weight: 500; border-radius: 4px; }
.link-btn:focus-visible { outline: 2px solid var(--accent-ring); }

/* ---------- campos ---------- */
.input { height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 14.5px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.input:hover { border-color: #cbc6c1; }
.input:focus, .input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; line-height: 1.5; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 34px; background-repeat: no-repeat; background-position: right 11px center; background-size: 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23736c67' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.label { font-size: 13.5px; font-weight: 550; color: var(--text-2); }
.field { gap: 6px; }
.table .num .input { height: 32px; padding: 0 8px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

/* control segmentado: estilo "pastilla" para filtros y vistas */
.seg { background: #f1f0ee; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; gap: 2px; overflow: visible; }
.seg button { border-radius: 6px; background: transparent; padding: 6px 12px; font-size: 13.5px; font-weight: 500; color: var(--muted); transition: background .15s, color .15s, box-shadow .15s; }
.seg button + button { border-left: 0; }
.seg button:hover { background: rgba(255, 255, 255, .7); color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .1), 0 0 0 1px rgba(16, 24, 40, .04); }
/* en las fichas clínicas la opción elegida debe verse inequívoca */
.section .seg button[aria-pressed="true"] { background: var(--accent); color: #fff; box-shadow: none; }
.chip { border-color: var(--border-strong); font-weight: 500; transition: background .15s, border-color .15s; }
.chip:hover { border-color: #b8b2ac; background: #f8f7f5; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }
.scale button { border-color: var(--border-strong); border-radius: 8px; transition: border-color .15s, transform .1s; }
.scale button:hover { border-color: #9ca3af; }

/* ---------- tarjetas ---------- */
.section, .panel-block, .evo-card, .evo-tile, .tabla-card, .empty-state, .ag-lista-dia, .bienvenida, .feature, .especialidad, .ficha-card {
  border-color: var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.section-head { padding: 16px 20px; background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.section-head h3 { font-size: 15px; }
.section-body { padding: 20px; gap: 18px 22px; }
.evo-tile { padding: 16px 18px; }
.evo-tile-label { color: var(--muted); font-weight: 500; }
.evo-tile-value { letter-spacing: -.02em; }
.empty-state { padding: 48px 24px; }
.empty-state h2 { font-size: 16px; font-weight: 600; }

/* ---------- avisos y etiquetas ---------- */
.adm-aviso { background: var(--accent-soft); color: var(--accent-hover); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); border-radius: 10px; font-weight: 500; padding: 10px 14px; box-shadow: var(--shadow); }
.adm-aviso.error { background: var(--danger-soft); color: var(--danger); border-color: rgba(180, 35, 24, .2); }
.login-error { border: 1px solid rgba(180, 35, 24, .15); border-radius: var(--radius-sm); }
.login-ok { border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent); border-radius: var(--radius-sm); }
.pill { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.pill.ok { background: #ecfdf3; color: #067647; }
.pill.mid { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.badge { background: #f1f0ee; color: var(--muted); font-weight: 500; }
.avatar { background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 18%, white), color-mix(in srgb, var(--accent) 8%, white)); color: var(--accent-hover); font-weight: 650; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent); }

/* ---------- tablas ---------- */
.table th { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 10px; border-bottom-color: var(--border); }
.table td { padding: 10px 10px; border-bottom-color: #efedeb; color: var(--text-2); }
.tabla-card { padding: 4px 6px 6px; }
.tabla-card > .card-titulo { padding: 0 10px; }
.tabla-pacientes td, .tabla-registros td { padding-top: 12px; padding-bottom: 12px; }
.fila-click:hover td, .fila-click:focus td { background: #f8f7f5; }
.pac-nombre { color: var(--text); }

/* ---------- pestañas ---------- */
.tabs { gap: 24px; }
.tab { padding: 10px 0; font-weight: 500; color: var(--muted); border-bottom-width: 2px; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.pac-detalle .tabs { border-bottom: 1px solid var(--border); }

/* ---------- diálogos ---------- */
dialog { border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px; box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(17, 24, 39, .42); backdrop-filter: blur(2px); }
.dlg-head { margin-bottom: 4px; }
.dlg-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }

/* ---------- menú lateral ---------- */
@media (min-width: 901px) {
  .app { background: linear-gradient(90deg, var(--surface-2) 235px, var(--border) 235px, var(--border) 236px, var(--bg) 236px); }
}
.sidebar { background: var(--surface-2); padding: 16px 12px; gap: 22px; }
.sidebar-brand { padding: 4px 10px; font-size: 16px; }
.nav { gap: 2px; }
.nav-item { height: 38px; padding: 0 10px; gap: 10px; font-size: 14px; font-weight: 500; color: var(--text-2); border-radius: 8px; transition: background .15s, color .15s; }
.nav-item .icono { color: var(--subtle); transition: color .15s; }
.nav-item:hover { background: #efedea; color: var(--text); }
.nav-item:hover .icono { color: var(--muted); }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow), 0 0 0 1px var(--border); }
.nav-item[aria-current="page"] .icono { color: var(--accent); }
.nav-item:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.sidebar-pie { gap: 12px; }
.sidebar-botones .btn { justify-content: flex-start; }
.sidebar-usuario-texto .small:first-child { font-weight: 600; color: var(--text); }

/* ---------- encabezados de vista ---------- */
.vista-head h1, .evo-head h1 { font-size: 24px; }
.pac-cab-texto h1 { font-size: 22px; }
.pac-contacto a { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }
.pac-contacto a:hover { color: var(--accent); }
.buscador { height: 40px; padding-left: 38px; background-repeat: no-repeat; background-position: 12px center; background-size: 17px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a39c97' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20.5 20.5-4.5-4.5'/%3E%3C/svg%3E"); }
.ficha-card { transition: border-color .15s, box-shadow .15s, transform .15s; }
.ficha-card:hover, .ficha-card:focus { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.ficha-tipo { border-radius: 6px; }
.conf { display: inline-flex; align-items: center; gap: 3px; }
.aviso-confidencial { display: flex; align-items: center; gap: 8px; }

/* ---------- inicio de sesión y registro ---------- */
.login { background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--accent) 7%, var(--bg)) 0%, var(--bg) 60%); }
.login-card { border-radius: 16px; padding: 32px; box-shadow: var(--shadow-md); gap: 16px; }
.login-card h1 { font-size: 24px; }

/* ---------- pantalla de inicio ---------- */
.inicio { background: radial-gradient(1400px 600px at 70% -10%, color-mix(in srgb, var(--accent) 8%, var(--bg)) 0%, var(--bg) 55%); }
.inicio-top { position: sticky; top: 0; z-index: 10; max-width: none; padding: 14px max(40px, calc((100% - 1200px) / 2)); background: rgba(246, 247, 249, .78); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid rgba(229, 231, 235, .6); }
.hero h1 { font-weight: 700; letter-spacing: -.035em; }
.hero-eyebrow { display: inline-block; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 4px 12px; font-size: 13px; box-shadow: var(--shadow); }
.hv-card { border-radius: 14px; box-shadow: var(--shadow-lg); border-color: var(--border); }
.feature { padding: 24px; transition: box-shadow .2s, transform .2s; }
.feature:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.feature-icono { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent); }
.feature h3 { margin-top: 14px; }
.inicio-h2 { font-size: 30px; font-weight: 700; letter-spacing: -.03em; }
.especialidad { border-top: 0; position: relative; overflow: hidden; }
.especialidad::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.inicio-cta-final h2 { font-weight: 700; letter-spacing: -.03em; font-size: 30px; }

/* ---------- agenda ---------- */
.ag-titulo { font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.ag-grilla { border-radius: var(--radius); border-color: var(--border); box-shadow: var(--shadow); }
.ag-cab { background: var(--surface); }
.ag-dia { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); gap: 2px; padding: 10px 8px; }
.ag-dia strong { font-size: 19px; font-weight: 600; letter-spacing: -.02em; text-transform: none; }
.ag-dia.hoy strong { box-shadow: 0 1px 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.ag-dia-prof { text-transform: none; letter-spacing: 0; }
.ag-col { cursor: default; border-left-color: #efedeb; }
.ag-col.hoy { background: color-mix(in srgb, var(--accent) 3%, white); }
.ag-linea { border-top-color: #ebe9e6; }
.ag-linea.menor { border-top: 1px solid #f5f4f2; }
.ag-disp { background: color-mix(in srgb, var(--accent) 4500%, transparent); }
.ag-hora { font-size: 11px; font-weight: 500; color: var(--subtle); }
.ag-cita { border-radius: 7px; padding: 4px 7px; box-shadow: 0 1px 2px rgba(16, 24, 40, .06); transition: box-shadow .15s, transform .1s; }
.ag-cita:hover { box-shadow: var(--shadow-md); }
.ag-estado-chip { font-weight: 600; }
.ag-profs-panel { border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.ag-bloqueo { display: flex; flex-direction: column; }
.ag-bloqueo > span:first-child { display: inline-flex; align-items: center; gap: 4px; }
.ag-estado-chip .icono { width: 13px; height: 13px; }

/* hover y selección de espacios libres */
.ag-hover { position: absolute; left: 3px; right: 3px; z-index: 0; pointer-events: none; border-radius: 6px; background: var(--accent-soft); border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); display: flex; align-items: flex-start; }
.ag-hover[hidden] { display: none; }
.ag-hover span { font-size: 11.5px; font-weight: 600; color: var(--accent); padding: 1px 6px; line-height: 1.4; }
.ag-seleccion { position: absolute; left: 2px; right: 2px; z-index: 4; pointer-events: none; border-radius: 7px; background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1.5px solid var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.ag-seleccion span { display: inline-block; margin: 3px; font-size: 11.5px; font-weight: 600; color: #fff; background: var(--accent); border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.ag-menu { position: fixed; z-index: 1000; min-width: 270px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: aparecer-menu .12s ease-out; }
@keyframes aparecer-menu { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.ag-menu-cab { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.ag-menu-cab strong { font-size: 15px; letter-spacing: -.01em; }
.ag-menu-cab span { font-size: 12.5px; color: var(--muted); }
.ag-menu-cab span::first-letter { text-transform: uppercase; }
.ag-menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; font: inherit; text-align: left; background: none; border: 0; border-radius: 8px; cursor: pointer; color: var(--text); }
.ag-menu-item:hover, .ag-menu-item:focus-visible { background: #f1f0ee; outline: none; }
.ag-menu-item b { display: block; font-size: 14px; font-weight: 600; }
.ag-menu-item small { display: block; font-size: 12.5px; color: var(--muted); }
.ag-menu-icono { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.ag-menu-icono.bloqueo { background: #f1f0ee; color: #4b5563; }

/* lista de la agenda */
.ag-lista-dia { padding: 14px 18px; }
.ag-lista-fila { border-top-color: #efedeb; }
.ag-lista-fila:hover, .ag-lista-fila:focus { background: #f8f7f5; }

/* bienvenida */
.bienvenida { border-left: 1px solid var(--border); position: relative; overflow: hidden; }
.bienvenida::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.pasos li { background: var(--surface-2); border: 1px solid var(--border); }
@media (max-width: 900px) {
  .sidebar { background: var(--surface); }
  .nav-item[aria-current="page"] { box-shadow: none; background: var(--accent-soft); }
}
@media (max-width: 560px) {
  .nav-item { width: 42px; justify-content: center; padding: 0; font-size: 0; gap: 0; }
  .nav-item .icono { width: 20px; height: 20px; }
  .sidebar-botones .btn { font-size: 0; gap: 0; width: 34px; padding: 0; justify-content: center; }
  .sidebar-botones .btn .icono { width: 17px; height: 17px; }
}

/* =====================================================================
   Administración: página pública, equipo y opiniones
   ===================================================================== */
.adm-sec-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.adm-sec-cab .btn { text-decoration: none; }
.adm-portada { --marca: var(--accent); position: relative; height: 170px; border-radius: 12px; background: linear-gradient(135deg, color-mix(in srgb, var(--marca) 85%, white), color-mix(in srgb, var(--marca) 60%, black)); background-size: cover; background-position: center; }
.adm-portada-acciones { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; }
.adm-avatar-fila { display: flex; gap: 16px; align-items: center; margin-top: -40px; padding-left: 18px; position: relative; }
.adm-avatar { width: 88px; height: 88px; border-radius: 18px; border: 4px solid var(--surface); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; overflow: hidden; font-weight: 600; box-shadow: var(--shadow-md); flex-shrink: 0; }
.adm-avatar img, .adm-foto img { width: 100%; height: 100%; object-fit: cover; }
.adm-avatar-acciones { display: flex; flex-direction: column; gap: 4px; padding-top: 40px; }
.adm-fila { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.adm-perfil { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.adm-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.adm-sub { font-size: 13px; font-weight: 600; margin: 6px 0 -4px; color: var(--text-2); }
.adm-colores { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.adm-color { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; background: var(--c); box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.adm-color[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--c); }
.adm-colores input[type="color"] { width: 36px; height: 32px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }
.adm-equipo { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.adm-miembro-perfil { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.adm-miembro-perfil > .btn { align-self: flex-start; }
.adm-miembro-cab { display: flex; gap: 12px; align-items: center; }
.adm-miembro-cab strong { display: block; margin-bottom: 4px; }
.adm-foto { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; box-shadow: 0 0 0 1px var(--border); }
.adm-registro { align-items: flex-end; }
.adm-registro .field { flex: 1; }
.adm-opiniones { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.adm-opinion { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.adm-opinion.estado-pendiente { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); background: #fffdf5; }
.adm-opinion.estado-oculta { opacity: .65; }
.adm-opinion p { margin: 0; }
.adm-opinion-cab { display: flex; justify-content: space-between; align-items: center; }
.adm-estrellas { color: #f59e0b; letter-spacing: 1px; }
.adm-estrellas span { color: #d1d5db; }
.adm-pendientes { margin-left: 8px; vertical-align: middle; }
.adm-orden { white-space: nowrap; }
.adm-orden .btn { width: 28px; padding: 0; }
.adm-desc { margin-top: 6px; font-size: 13px !important; color: var(--muted); }
@media (max-width: 700px) { .adm-grid2 { grid-template-columns: 1fr; } }
.adm-tabla td:has(.adm-num) { white-space: nowrap; }
.adm-tabla td:has(.adm-desc) .input { min-width: 220px; }

/* =====================================================================
   Configuración: menú de secciones + contenido
   ===================================================================== */
.cfg-cab { margin-bottom: 18px; }
.cfg-cab h1 { font-size: 26px; }
.cfg-cab p { margin: 0; }
.cfg { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.cfg-menu { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 8px; box-shadow: var(--shadow); }
.cfg-grupo { display: flex; flex-direction: column; gap: 2px; }
.cfg-grupo-titulo { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--subtle); padding: 2px 10px 4px; }
.cfg-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; font: inherit; font-size: 14px; font-weight: 500; text-align: left; color: var(--text-2); background: none; border: 0; border-radius: 8px; cursor: pointer; transition: background .15s, color .15s; }
.cfg-item .icono { color: var(--subtle); }
.cfg-item:hover { background: #f1f0ee; color: var(--text); }
.cfg-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-hover); font-weight: 600; }
.cfg-item[aria-current="page"] .icono { color: var(--accent); }
.cfg-item:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.cfg-item span:not(.cfg-badge) { flex: 1; }
.cfg-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--warn); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.cfg-contenido { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cfg-titulo h2 { font-size: 20px; font-weight: 650; letter-spacing: -.02em; text-transform: none; color: var(--text); margin: 0; }
.cfg-titulo p { margin: 4px 0 0; }
.cfg-contenido .adm-sec { margin-bottom: 0; }
/* con una sola tarjeta, su título repite el de la sección */
.cfg-contenido.unica > .adm-sec > h3, .cfg-contenido.unica .adm-sec-cab > div:first-child { display: none; }
.cfg-contenido.unica .adm-sec-cab { justify-content: flex-end; }
.adm-total-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.adm-total-card strong { font-size: 20px; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .cfg { grid-template-columns: 1fr; gap: 14px; }
  .cfg-menu { position: static; flex-direction: row; overflow-x: auto; padding: 6px; gap: 4px; }
  .cfg-grupo { flex-direction: row; gap: 4px; }
  .cfg-grupo-titulo { display: none; }
  .cfg-item { width: auto; white-space: nowrap; }
}

/* =====================================================================
   Sistema de diseño v3: sobrio y elegante
   Neutros cálidos, acento azul marino, menú lateral en carbón.
   ===================================================================== */

/* ---------- menú lateral claro (tinte azul muy suave, sereno) ---------- */
:root { --nav-bg: #f2f6f9; --nav-borde: #e1e8ee; }
@media (min-width: 901px) {
  .app { background: linear-gradient(90deg, var(--nav-bg) 235px, var(--nav-borde) 235px, var(--nav-borde) 236px, var(--bg) 236px); }
}
.sidebar { background: var(--nav-bg); color: var(--text-2); border: 0; }
.sidebar .brand { color: var(--text); }
.nav-item { color: #4a5560; }
.nav-item .icono { color: #8a97a3; }
.nav-item:hover { background: rgba(36, 85, 122, .06); color: var(--text); }
.nav-item:hover .icono { color: var(--accent); }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--accent-hover); font-weight: 600; box-shadow: 0 1px 2px rgba(28, 25, 23, .05), 0 0 0 1px var(--nav-borde); }
.nav-item[aria-current="page"] .icono { color: var(--accent); }
.nav-item:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); }
.sidebar-pie { border-top-color: var(--nav-borde); }
.sidebar-pie .as-member .muted { color: var(--muted); }
.sidebar-pie .as-member select { background-color: var(--surface); border-color: var(--nav-borde); color: var(--text); }
.sidebar-usuario-texto .small:first-child { color: var(--text); }
.sidebar-usuario-texto .muted { color: var(--muted); }
.sidebar-botones .btn { color: #4a5560; }
.sidebar-botones .btn:hover { background: rgba(36, 85, 122, .06); color: var(--text); }
@media (max-width: 900px) {
  .sidebar { background: var(--surface); border-bottom: 1px solid var(--border); }
  .nav-item[aria-current="page"] { background: var(--accent-soft); box-shadow: none; }
}

/* ---------- tipografía y superficies ---------- */
h1 { font-weight: 650; letter-spacing: -.025em; }
.vista-head h1, .evo-head h1, .cfg-cab h1 { font-size: 26px; }
.section, .panel-block, .evo-card, .evo-tile, .tabla-card, .empty-state, .ag-lista-dia, .bienvenida, .ficha-card, .ag-grilla, .cfg-menu, .adm-total-card {
  border-color: var(--border); box-shadow: var(--shadow);
}
.evo-tile-value { font-weight: 650; }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.avatar { background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 16%, white), color-mix(in srgb, var(--accent) 7%, white)); color: var(--accent-hover); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent); }
.logo { background: linear-gradient(145deg, var(--accent-2), var(--accent) 65%, var(--accent-hover)); }

/* botones discretos dentro de tablas: que se reconozcan como acción */
.table .btn.ghost { color: var(--accent); font-weight: 600; }
.table .btn.ghost:hover { background: var(--accent-soft); }

/* ---------- correcciones de alineación ---------- */
/* Caja: la celda de acciones debe seguir siendo celda (las líneas de la fila calzan) */
.cj-tabla td.cj-acciones { display: table-cell; text-align: right; white-space: nowrap; }
.cj-tabla td.cj-acciones > * + * { margin-left: 6px; }
.ag-nav > .ag-titulo:first-child { margin-left: 0; margin-right: 8px; }
/* Equipo: formulario de invitación que se acomoda al ancho, y tabla sin cortes */
.adm-invitar { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: center; background: var(--surface-2); border: 1px solid var(--border); }
.adm-invitar > .btn, .adm-invitar > .adm-check { justify-self: start; }
.adm-tabla th { white-space: nowrap; }
.adm-tabla td:last-child { white-space: nowrap; }
/* Resumen del paciente: la lista con el mismo margen que su título */
.tabla-card > .lista-simple, .tabla-card > p, .tabla-card > .btn, .tabla-card > .empty-state { margin-left: 10px; margin-right: 10px; }
.tabla-card > .btn { margin-bottom: 8px; }
.lista-simple li { padding: 10px 0; }

/* ---------- campos de formulario más cómodos en pantallas táctiles ---------- */
@media (pointer: coarse) {
  .btn { min-height: 40px; }
  .btn.small { min-height: 36px; }
  .input { min-height: 42px; }
}

/* ---------- ajustes para teléfono y tablet ---------- */
.ag-dia-prof strong { font-size: 14px; }
.cj-metodos div { flex-wrap: wrap; column-gap: 8px; }
@media (max-width: 700px) {
  /* agenda: barra compacta */
  .ag-barra { gap: 8px; margin-bottom: 8px; }
  .ag-ir { display: none; }
  #agenda .ag-titulo { font-size: 17px; flex-basis: 100%; order: 5; margin: 4px 0 0; }
  .ag-acciones { gap: 6px; }
  .ag-acciones .btn.small { font-size: 0; gap: 0; width: 36px; padding: 0; }
  .ag-acciones .btn.small .icono { width: 17px; height: 17px; }
  .ag-acciones .ag-profs > summary.btn.small { font-size: 13px; width: auto; padding: 0 10px; }
  .ag-leyenda { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .ag-leyenda .ag-ver-canceladas { white-space: nowrap; }
  /* inicio: la ilustración no debe tapar el texto */
  .hv-score, .hv-chart { display: none; }
  .hv-agenda { position: static; width: 100%; }
  .hero-visual { min-height: 0; }
}
@media (max-width: 560px) {
  /* barra superior: solo íconos */
  .sidebar-brand { font-size: 0; gap: 0; }
  .sidebar-brand .logo { font-size: 14px; }
  .sidebar-usuario { display: none; }
  .sidebar { gap: 4px; padding: 8px 10px; }
  .nav-item { width: 40px; }
}
@media (max-width: 900px) {
  /* ficha: "Firmar ficha" siempre a mano, flotando abajo */
  #btn-firmar { position: fixed; left: 16px; right: 16px; bottom: 14px; width: auto; z-index: 30; height: 48px; box-shadow: var(--shadow-lg); }
  .pac-detalle .layout { padding-bottom: 96px; }
}

@media (max-width: 900px) {
  .ag-lista-fila { grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; }
  .ag-lista-hora { white-space: nowrap; font-size: 13.5px; }
  .ag-lista-fila > .ag-estado-chip { justify-self: start; }
}
.adm-tabla .input { min-width: 0; width: auto; max-width: 160px; }
.adm-tabla td { white-space: nowrap; }
.adm-tabla td:first-child { white-space: normal; }
.adm-tabla th, .adm-tabla td { padding-left: 8px; padding-right: 8px; }
.adm-tabla th:first-child, .adm-tabla td:first-child { padding-left: 10px; }
.adm-tabla .input { height: 32px; font-size: 13px; padding: 0 26px 0 8px; background-position: right 7px center; background-size: 13px; }
.adm-tabla td:first-child .muted, .adm-tabla td:first-child .small { font-size: 12px; }
@media (min-width: 901px) { .cfg { grid-template-columns: 220px minmax(0, 1fr); gap: 20px; } }
.adm-tabla select.input { max-width: 132px; }
.adm-tabla th { white-space: normal; line-height: 1.25; }

/* =====================================================================
   Ajustes v4: filas de configuración, servicios en lista, ficha de datos
   ===================================================================== */
.ajustes { padding: 4px 24px 0; display: flex; flex-direction: column; }
.ajuste { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 8px 32px; align-items: center; padding: 20px 0; border-top: 1px solid var(--border); }
.ajustes > .ajuste:first-child, .reserva-enlace + .ajuste, .reserva-estado + .ajuste { border-top: 0; }
.ajuste-titulo { font-weight: 600; font-size: 14.5px; color: var(--text); }
.ajuste-txt p, .reserva-estado-txt p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.ajuste-ctrl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.ajuste-ctrl .seg { flex-wrap: wrap; }
.ajuste-rango { display: flex; align-items: center; gap: 10px; }
.ajuste-hora { width: 112px; }
.ajustes-nota { margin: 0; padding: 14px 0 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.ajustes-pie { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 16px 24px; margin: 20px -24px 0; border-top: 1px solid var(--border); background: #fafaf9; border-radius: 0 0 var(--radius) var(--radius); }
.ajustes-nota + .ajustes-pie { margin-top: 14px; }

/* número con su unidad en el mismo recuadro */
.con-unidad { display: inline-flex; align-items: stretch; border: 1px solid var(--border-strong, #d6d3d1); border-radius: var(--radius-sm, 8px); background: var(--surface); overflow: hidden; max-width: 100%; }
.con-unidad:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.con-unidad .input { border: 0 !important; box-shadow: none !important; outline: 0 !important; border-radius: 0; width: 96px; min-width: 0; background: transparent; }
.con-unidad > span { display: flex; align-items: center; padding: 0 12px; background: #f5f5f4; color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.con-unidad > span:last-child { border-left: 1px solid var(--border); }
.con-unidad > span:first-child { border-right: 1px solid var(--border); }
.con-unidad.url { width: 100%; }
.con-unidad.url > span { max-width: 55%; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 38px; }
.con-unidad.url .input { flex: 1; width: auto; }

/* interruptor */
.switch { position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch > span { width: 40px; height: 23px; border-radius: 999px; background: #d6d3d1; transition: background .15s; position: relative; }
.switch > span::after { content: ''; position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .25); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(17px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* reserva online: estado y enlace */
.reserva-estado { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 20px 0 4px; padding: 16px 18px; border-radius: 10px; background: #f7f7f6; border: 1px solid var(--border); }
.reserva-estado.activa { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.reserva-enlace { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 0 8px; color: var(--accent); }
.reserva-enlace a:not(.btn) { color: var(--accent); font-weight: 500; overflow-wrap: anywhere; flex: 1; min-width: 200px; }
.reserva-enlace .btn { text-decoration: none; }

/* servicios en lista con editor desplegable */
.srv-cab { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 0 14px; }
.srv-cab p { margin: 0; font-size: 13.5px; max-width: 60ch; }
.srv-cab .btn { flex-shrink: 0; }
.srv-lista { display: flex; flex-direction: column; margin: 0 -24px; border-top: 1px solid var(--border); }
.srv { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 14px 24px; border-bottom: 1px solid var(--border); }
.srv:last-child { border-bottom: 0; }
.srv:hover { background: #fafaf9; }
.srv.editando { background: var(--accent-soft); }
.srv.inactivo .srv-info, .srv.inactivo .srv-precio { opacity: .55; }
.srv-orden { display: flex; flex-direction: column; gap: 2px; }
.srv-orden .btn.icon { width: 26px; height: 22px; min-height: 0; padding: 0; font-size: 12px; }
.srv-nombre { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.srv-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 13px; color: var(--muted); }
.srv-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.srv-meta .icono { width: 14px; height: 14px; }
.srv-tag { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--ok) 12%, white); color: var(--ok); }
.srv-tag.gris { background: #f1f0ee; color: var(--muted); }
.srv-precio { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.srv-editor { padding: 20px 24px 18px; border-bottom: 1px solid var(--border); background: #fbfbfa; display: flex; flex-direction: column; gap: 16px; }
.srv-lista > .srv-editor:first-child { border-top: 0; }
.srv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.srv-grid .field { margin: 0; }
.srv-ancho { grid-column: 1 / -1; }
.srv-grid .con-unidad { width: 100%; }
.srv-grid .con-unidad .input { flex: 1; width: auto; }
.srv-grid textarea.input { resize: vertical; min-height: 64px; }
.srv-online { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.srv-acciones { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.srv-espacio { flex: 1; }
.btn.peligro { color: var(--danger); }
.btn.peligro:hover { background: var(--danger-soft); }
.srv-lista > .empty-state { margin: 16px 24px; }
.ajustes > .srv-lista:last-child { margin-bottom: 0; }

/* ficha del paciente: datos personales con aire */
.tabla-card.datos-form { padding: 8px 28px 0; gap: 0; overflow: visible; }
.datos-form > .card-titulo { padding: 0; margin: 22px 0 14px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.datos-form > .card-titulo:not(:first-child) { padding-top: 22px; border-top: 1px solid var(--border); }
.datos-form .reg-grid { gap: 16px 24px; }
.datos-form .field { margin: 0; }
.datos-form > .adm-aviso { margin: 18px 0 0; }
.datos-form > .btn { align-self: stretch; }
.datos-pie { display: flex; justify-content: flex-end; padding: 16px 28px; margin: 24px -28px 0; border-top: 1px solid var(--border); background: #fafaf9; border-radius: 0 0 var(--radius) var(--radius); }

@media (max-width: 760px) {
  .ajustes { padding: 0 16px; }
  .ajuste { grid-template-columns: 1fr; gap: 10px; padding: 16px 0; }
  .ajustes-pie { margin: 16px -16px 0; padding: 14px 16px; }
  .ajustes-pie .btn { flex: 1; }
  .reserva-estado { align-items: flex-start; }
  .srv-lista { margin: 0 -16px; }
  .srv { grid-template-columns: auto minmax(0, 1fr) auto; padding: 12px 16px; gap: 12px; }
  .srv > .btn { grid-column: 2 / -1; justify-self: start; }
  .srv-editor { padding: 16px; }
  .srv-grid { grid-template-columns: 1fr; }
  .srv-cab { flex-direction: column; align-items: stretch; }
  .tabla-card.datos-form { padding: 4px 16px 0; }
  .datos-pie { margin: 20px -16px 0; padding: 14px 16px; }
  .datos-pie .btn { flex: 1; }
}
/* textos del gráfico con contorno del color del fondo: ninguna línea los tacha */
.evo-end, .evo-ref-label { paint-order: stroke; stroke: var(--surface, #fff); stroke-width: 4px; stroke-linejoin: round; }

/* =====================================================================
   Caja v2: indicadores, gráficos y movimientos
   ===================================================================== */
.cj-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.cj-kpi .evo-tile-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cj-var b { font-weight: 600; }
.cj-var.sube b { color: var(--ok); }
.cj-var.baja b { color: var(--danger); }
.cj-graficos { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
.cj-graficos.dos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cj-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cj-card-cab h3 { font-size: 15px; margin: 0; }
.cj-card-cab p { margin: 2px 0 0; font-size: 13px; }
.cj-vacio { flex: 1; display: grid; place-items: center; min-height: 120px; color: var(--muted); font-size: 13.5px; background: #fafaf9; border-radius: 8px; }
.cj-chart { position: relative; width: 100%; min-height: 220px; }
.cj-chart svg { display: block; overflow: visible; }
.cj-base { stroke: var(--border-strong); stroke-width: 1; }
.cj-hoy { font-weight: 700; fill: var(--text); }
.cj-zona.activa { fill: rgba(16, 24, 40, .04); }
.cj-tip { position: absolute; min-width: 170px; pointer-events: none; z-index: 3; }
.cj-tip .evo-tip-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.cj-tip-total { grid-template-columns: 1fr auto !important; border-top: 1px solid var(--border); padding-top: 4px; margin-top: 2px; }
.cj-leyenda { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--text-2, var(--muted)); margin-bottom: 6px; }
.cj-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.cj-leyenda i, .cj-sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.cj-medios { display: flex; flex-direction: column; gap: 14px; }
.cj-barra100 { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; }
.cj-barra100 i { min-width: 3px; }
.cj-medios ul, .cj-ranking { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cj-medios li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 44px; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); font-size: 14px; }
.cj-medios li:first-child { border-top: 0; }
.cj-medio-nombre { display: flex; flex-direction: column; line-height: 1.25; }
.cj-medio-nombre small { color: var(--muted); font-size: 12px; }
.cj-medios strong, .cj-rank-txt strong { font-variant-numeric: tabular-nums; }
.cj-pct { text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.cj-ranking { gap: 12px; }
.cj-rank-txt { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 5px; }
.cj-rank-txt > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cj-rank-txt small { color: var(--muted); font-weight: 500; font-size: 12px; }
.cj-rank-barra { height: 8px; background: #f1f0ee; border-radius: 4px; overflow: hidden; }
.cj-rank-barra i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.cj-lista-cab { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cj-boletas-estado { text-align: right; }
.cj-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.cj-chips { display: flex; flex-direction: column; gap: 2px; }
.cj-ref { margin-top: 2px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.cj-sin { margin: 8px 4px; }
.cj-tabla th.num-cell, .cj-tabla td.num-cell { text-align: right; }
@media (max-width: 1100px) {
  .cj-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cj-graficos, .cj-graficos.dos { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .cj-kpis { gap: 8px; }
  .cj-kpi .evo-tile-value { font-size: 22px; }
  .cj-card { padding: 14px; }
  .cj-boletas-estado { text-align: left; }
}
/* en el teléfono cada pago es una tarjeta: fecha y monto arriba, medio de pago visible */
@media (max-width: 640px) {
  .cj-mov thead { display: none; }
  .cj-mov, .cj-mov tbody { display: block; }
  .cj-mov tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
  .cj-mov td { display: block; padding: 0 !important; border: 0 !important; white-space: normal !important; min-width: 0 !important; }
  .cj-mov td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .cj-mov td:nth-child(6) { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .cj-mov td:nth-child(2) { grid-column: 1; grid-row: 2; }
  .cj-mov td:nth-child(3) { grid-column: 1 / -1; font-size: 13.5px; color: var(--muted); }
  .cj-mov td:nth-child(4) { grid-column: 1; margin-top: 4px; }
  .cj-mov td:nth-child(5) { grid-column: 2; margin-top: 4px; text-align: right; align-self: end; }
  .cj-mov .cj-ref { max-width: none; }
}

/* =====================================================================
   Detalle de la cita (diálogo)
   ===================================================================== */
dialog.cd { padding: 0; width: min(560px, 94vw); overflow: hidden; }
dialog.cd > * + * { margin-top: 0; }
.cd-cab { position: relative; display: flex; align-items: center; gap: 14px; padding: 22px 56px 20px 24px;
  background: linear-gradient(135deg, var(--st-bg), color-mix(in srgb, var(--st-bg) 40%, white)); border-bottom: 1px solid color-mix(in srgb, var(--st) 18%, transparent); }
.cd-cab::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--prof, var(--st)); }
.cd-avatar { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex-shrink: 0; font-weight: 700; font-size: 18px;
  background: var(--surface); color: var(--st); box-shadow: 0 1px 2px rgba(16, 24, 40, .08), inset 0 0 0 1px color-mix(in srgb, var(--st) 22%, transparent); }
.cd-titulo { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.cd-titulo h2 { margin: 0; font-size: 20px; line-height: 1.2; letter-spacing: -.01em; overflow-wrap: anywhere; }
.cd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cd-chips .ag-estado-chip { background: var(--surface); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st) 30%, transparent); }
.cd-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 99px; background: rgba(255, 255, 255, .75); color: var(--text-2, var(--muted)); box-shadow: inset 0 0 0 1px var(--border); }
.cd-chip .icono { width: 13px; height: 13px; }
.cd-cerrar { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; }
.cd-cerrar:hover { background: rgba(255, 255, 255, .8); color: var(--text); }
.cd-cuerpo { padding: 20px 24px 6px; display: flex; flex-direction: column; gap: 16px; }
.cd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.cd-fila { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.cd-fila:last-child:nth-child(odd) { grid-column: 1 / -1; }
.cd-ic { width: 34px; height: 34px; border-radius: 10px; background: #f3f4f3; color: var(--text-2, var(--muted)); display: grid; place-items: center; flex-shrink: 0; }
.cd-ic .icono { width: 17px; height: 17px; }
.cd-etq { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.cd-val { font-size: 14.5px; min-width: 0; overflow-wrap: anywhere; }
.cd-val > a { color: var(--accent); font-weight: 500; text-decoration: none; }
.cd-sub { color: var(--muted); font-size: 13px; margin-top: 1px; }
.cd-prof { display: inline-flex; align-items: center; gap: 7px; }
.cd-prof .ag-punto { margin: 0; }
.cd-contacto { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cd-contacto .btn { text-decoration: none; }
.cd-wa { color: #11834a; border-color: color-mix(in srgb, #25d366 45%, var(--border)); background: #f1fbf5; }
.cd-wa:hover { background: #e3f7ea; }
.cd-notas { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: #fbf8f1; color: #5b4a24; font-size: 14px; border: 1px solid #f0e6cf; }
.cd-notas .icono { flex-shrink: 0; margin-top: 2px; }
.cd-cobro { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); }
.cd-cobro[hidden] { display: none; }
.cd-cobro.pagado { background: var(--ok-soft, #ecfdf3); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.cd-cobro.pendiente { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.cd-cobro-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--surface); }
.cd-cobro.pagado .cd-cobro-ic { color: var(--ok); }
.cd-cobro.pendiente .cd-cobro-ic { color: var(--warn); }
.cd-cobro-txt { flex: 1; display: flex; flex-direction: column; gap: 1px; font-size: 13px; color: var(--text-2, var(--muted)); min-width: 0; }
.cd-cobro-txt strong { font-size: 14.5px; color: var(--text); }
.cd-estados { padding-top: 14px; border-top: 1px solid var(--border); }
.cd-estados .cd-etq { margin-bottom: 8px; }
.cd-estados-bts { display: flex; flex-wrap: wrap; gap: 8px; }
.cd-estado { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13.5px; font-weight: 500; padding: 7px 12px; border-radius: 99px; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid color-mix(in srgb, var(--st) 35%, var(--border)); transition: background .15s, border-color .15s; }
.cd-estado .ag-estado-icono { color: var(--st); }
.cd-estado:hover { background: var(--st-bg); border-color: var(--st); }
.cd-estado:focus-visible { outline: 2px solid var(--st); outline-offset: 2px; }
.cd-pie { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 16px 24px; margin-top: 14px; border-top: 1px solid var(--border); background: #fafaf9; }
.cd-espacio { flex: 1; }
.cd-pie .btn .icono { width: 16px; height: 16px; }
.cd .login-error { margin: 0; }
@media (max-width: 560px) {
  .cd-cab { padding: 18px 48px 16px 18px; }
  .cd-cuerpo { padding: 16px 18px 4px; }
  .cd-grid { grid-template-columns: 1fr; }
  .cd-pie { padding: 14px 18px; }
  .cd-pie .btn { flex: 1 1 auto; justify-content: center; }
  .cd-espacio { display: none; }
}

/* teléfono con código de país */
.tel-campo { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); min-width: 0; }
.tel-campo:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tel-campo.invalido, .input.invalido { border-color: var(--danger) !important; box-shadow: 0 0 0 3px var(--danger-soft) !important; }
.tel-pais { border: 0; border-right: 1px solid var(--border); background: #f7f7f6; font: inherit; font-size: 14px; padding: 0 6px 0 10px; border-radius: var(--radius-sm) 0 0 var(--radius-sm); cursor: pointer; color: var(--text); max-width: 104px; }
.tel-pais:focus { outline: 0; }
.tel-numero { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 15px; padding: 9px 12px; color: var(--text); outline: 0; font-variant-numeric: tabular-nums; }
.pac-contacto .pac-wa { color: #11834a; }
dialog.cd .cd-titulo h2 { text-transform: none; letter-spacing: -.01em; color: var(--text); font-size: 20px; font-weight: 650; }
.cd-contacto { margin-top: -4px; padding-left: 46px; }
@media (max-width: 560px) { .cd-contacto { padding-left: 0; } .cd-contacto .btn { flex: 1; justify-content: center; } }
.tel-campo { height: 38px; box-shadow: var(--shadow); }
.tel-numero { padding: 0 12px; font-size: 14.5px; }

/* =====================================================================
   Revisión de diseño: detalles
   ===================================================================== */
/* indicadores: se reparten en una fila sin dejar uno huérfano */
.evo-tiles { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.evo-tile-value { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; row-gap: 0; }
.adm-total-card strong { white-space: nowrap; }
/* selector de organización del menú: el texto largo termina en "…" */
#org-select { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; padding-right: 30px; }
/* botón cerrar (✕) de los diálogos */
.dlg-head { position: relative; padding-right: 40px; min-height: 32px; }
.dlg-x { top: 50%; right: -6px; transform: translateY(-50%); }
.dlg-x:hover { background: #f1f0ee; }
/* ajustes: aviso, lista y cierre sin pie */
.ajustes-aviso { margin: 18px 0 0; }
.seg-lista { display: flex; flex-direction: column; gap: 6px; }
.ajustes-fin { height: 6px; }
/* registro de actividad: tarjetas en el teléfono */
@media (max-width: 640px) {
  .act-tabla thead { display: none; }
  .act-tabla, .act-tabla tbody { display: block; }
  .act-tabla tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
  .act-tabla td { display: block; padding: 0 !important; border: 0 !important; white-space: normal !important; }
  .act-tabla td:nth-child(1) { grid-column: 2; grid-row: 1; font-size: 12px; color: var(--muted); text-align: right; }
  .act-tabla td:nth-child(2) { grid-column: 1; grid-row: 1; font-weight: 600; }
  .act-tabla td:nth-child(3) { grid-column: 1 / -1; }
  .act-tabla td:nth-child(4) { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
  .act-tabla td:empty { display: none; }
}
/* módulos en desarrollo */
.adm-mod.pronto { background: repeating-linear-gradient(135deg, #fafafa, #fafafa 8px, #f4f5f7 8px, #f4f5f7 16px); border-style: dashed; }
.adm-mod.pronto .adm-mod-precio { opacity: .55; }
.adm-pronto { display: inline-block; margin-left: 8px; vertical-align: 2px; font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 2px 8px; border-radius: 99px; background: #fff4d6; color: #7a5300; }

/* =====================================================================
   Ejercicios en casa (profesional)
   ===================================================================== */
.ej { display: flex; flex-direction: column; gap: 14px; }
.ej-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.ej-cab h2 { margin: 0; font-size: 20px; text-transform: none; letter-spacing: -.01em; color: var(--text); }
.ej-cab p { margin: 4px 0 0; max-width: 62ch; }
.ej-vacio { text-align: center; }
.ej-rutina { padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.ej-rutina.finalizada { opacity: .8; }
.ej-rutina-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ej-rutina-cab h3 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ej-rutina-cab p { margin: 3px 0 0; }
.ej-acciones { display: flex; gap: 6px; flex-wrap: wrap; }
.ej-adherencia { display: grid; grid-template-columns: auto minmax(160px, 1fr) minmax(0, 1.4fr); gap: 16px 20px; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--surface-2, #f7f8fa); }
.ej-anillo { --c: var(--accent); width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(closest-side, var(--surface, #fff) 76%, transparent 78% 100%), conic-gradient(var(--c) var(--p), #e3e7ee 0); }
.ej-anillo.alta { --c: var(--ok, #2f7a55); }
.ej-anillo.media { --c: #b26b00; }
.ej-anillo.baja { --c: var(--danger, #b42318); }
.ej-anillo strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.ej-adherencia-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ej-tira { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; }
.ej-dia { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); text-transform: capitalize; }
.ej-dia b { width: 100%; max-width: 30px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 8px; background: #e9edf2; font-size: 11.5px; font-weight: 700; color: #fff; }
.ej-dia.hecho b { background: var(--accent); }
.ej-dia.hoy b { box-shadow: 0 0 0 2px var(--surface, #fff), 0 0 0 3.5px var(--accent); }
.ej-dia.antes b { background: transparent; border: 1px dashed #d5dbe3; }
.ej-comentario { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 10px; background: #fff8e6; color: #5b4a24; font-size: 14px; }
.ej-comentario .icono { flex-shrink: 0; margin-top: 2px; }
.ej-lista { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; counter-reset: ej; }
.ej-lista li { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.ej-lista img, .ej-ph { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.ej-nombre { display: flex; flex-direction: column; font-size: 14px; font-weight: 600; min-width: 0; }
.ej-nombre small { font-weight: 400; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ej-dosis { font-size: 12.5px; font-weight: 700; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ej-anteriores summary { cursor: pointer; font-weight: 600; color: var(--muted); padding: 6px 2px; }
.ej-anteriores[open] summary { margin-bottom: 10px; }
.ej-anteriores > .ej-rutina + .ej-rutina { margin-top: 12px; }

/* editor */
dialog.ej-editor { width: min(1080px, 96vw); max-height: 92vh; display: flex; flex-direction: column; }
dialog.ej-editor:not([open]) { display: none; }
dialog.ej-editor > * + * { margin-top: 14px; }
.ej-editor-datos { display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(0, .8fr); gap: 12px 16px; align-items: end; }
.ej-editor-datos .field { margin: 0; }
.ej-ancho { grid-column: 1 / -1; }
.ej-editor-datos textarea { min-height: 52px; resize: vertical; }
.ej-editor-cuerpo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; min-height: 0; flex: 1; overflow: hidden; }
.ej-lib, .ej-elegidos { display: flex; flex-direction: column; gap: 10px; min-height: 0; border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface-2, #fafafa); }
.ej-lib h3, .ej-elegidos h3 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ej-lib-cab { display: flex; justify-content: space-between; align-items: center; }
.ej-regiones { display: flex; flex-wrap: wrap; gap: 6px; }
.ej-regiones .chip { font-size: 12.5px; padding: 4px 10px; }
.ej-lib-lista { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 200px; max-height: 46vh; padding-right: 2px; }
.ej-lib-item { font: inherit; text-align: left; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface, #fff); cursor: pointer; transition: border-color .15s, background .15s; }
.ej-lib-item:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.ej-lib-item:disabled { opacity: .5; cursor: default; }
.ej-lib-item img, .ej-lib-item .ej-ph { width: 36px; height: 36px; }
.ej-lib-txt { display: flex; flex-direction: column; min-width: 0; }
.ej-lib-txt strong { font-size: 14px; }
.ej-lib-txt small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ej-lib-mas { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700; }
.ej-lib-item:disabled .ej-lib-mas { background: var(--ok, #2f7a55); }
.ej-sel { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 52vh; }
.ej-sel > li { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface, #fff); border: 1px solid var(--border); }
.ej-sel-vacio { border-style: dashed !important; text-align: center; padding: 28px 12px !important; }
.ej-sel-cab { display: flex; align-items: center; gap: 10px; }
.ej-sel-cab strong { flex: 1; font-size: 14.5px; min-width: 0; }
.ej-sel-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; flex-shrink: 0; }
.ej-sel-bts { display: flex; gap: 2px; }
.ej-sel-bts .btn.icon { width: 28px; height: 28px; min-height: 0; padding: 0; font-size: 12px; }
.ej-sel-dosis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ej-sel-dosis label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ej-sel-dosis .input { height: 34px; }
.ej-sel-nota { height: 34px; font-size: 13.5px; }
.ej-editor-pie { display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
dialog.ej-enlace { width: min(560px, 94vw); }
dialog.ej-enlace > * + * { margin-top: 12px; }
.cd-wa-solido { background: #1a8f4f !important; border-color: #1a8f4f !important; color: #fff !important; text-decoration: none; }
dialog.ej-propio { width: min(620px, 94vw); }
dialog.ej-propio > * + * { margin-top: 12px; }
.ej-propio-grid { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; }
.ej-propio-foto { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.ej-foto { width: 140px; height: 105px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; overflow: hidden; }
.ej-foto img { width: 100%; height: 100%; object-fit: cover; }
.ej-propio-campos { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 860px) {
  .ej-adherencia { grid-template-columns: auto minmax(0, 1fr); }
  .ej-tira { grid-column: 1 / -1; }
  .ej-editor-datos { grid-template-columns: 1fr; }
  .ej-editor-cuerpo { grid-template-columns: 1fr; overflow: visible; }
  dialog.ej-editor { overflow-y: auto; }
  .ej-lib-lista, .ej-sel { max-height: none; }
  .ej-lib-lista { max-height: 40vh; }
  .ej-propio-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  dialog.ej-editor { display: block; }
  dialog.ej-editor:not([open]) { display: none; }
  .ej-editor-cuerpo { flex: none; }
}

/* ---------------------------------------------------------------------
   Flujo de atención: banda, ficha sugerida, datos faltantes y cierre
   --------------------------------------------------------------------- */
.atencion-banda {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 16px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.atencion-banda.hecha { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.atencion-pulso {
  width: 12px; height: 12px; border-radius: 50%; background: var(--accent); flex: none;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); animation: pulso 1.8s infinite;
  display: grid; place-items: center; color: #fff;
}
.atencion-banda.hecha .atencion-pulso { width: 22px; height: 22px; background: var(--ok); animation: none; }
.atencion-banda.hecha .atencion-pulso .icono { width: 14px; height: 14px; }
@keyframes pulso { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .atencion-pulso { animation: none; } }
.atencion-txt { display: flex; flex-direction: column; min-width: 0; flex: 1 1 220px; }
.atencion-txt strong { font-size: 15px; }
.atencion-txt span { color: var(--text-2); font-size: 14px; }
.atencion-pasos { display: flex; gap: 6px; flex-wrap: wrap; }
.atencion-paso {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px;
  border-radius: 999px; background: var(--surface); font-size: 13px; color: var(--text-2);
}
.atencion-paso i {
  font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 700;
}
.atencion-paso.listo i { background: var(--ok); border-color: var(--ok); color: #fff; }

.ficha-sugerida {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 20px 22px; margin-bottom: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1.5px solid var(--accent); box-shadow: var(--shadow);
}
.ficha-sugerida-txt { min-width: 0; flex: 1 1 260px; }
.ficha-sugerida-txt h2 { margin: 4px 0 4px; font-size: 20px; }
.ficha-sugerida-txt p { margin: 0; }
.ficha-sugerida-etq { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.otras-fichas { font-size: 15px; color: var(--muted); font-weight: 650; margin: 8px 0 4px; }

.datos-faltan { margin-bottom: 18px; border-left: 4px solid var(--warn); }
.datos-faltan-cab { display: flex; gap: 12px; align-items: flex-start; }
.datos-faltan-cab .card-titulo { margin: 0; }
.datos-faltan-cab p { margin: 2px 0 0; }
.datos-faltan-ic {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--warn-soft); color: var(--warn);
}
.datos-faltan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 16px; margin-top: 14px; }
.datos-faltan-pie { display: flex; justify-content: flex-end; margin-top: 14px; }

dialog.cierre { width: min(520px, calc(100vw - 24px)); padding: 0; }
.cierre-cab { display: flex; gap: 14px; align-items: flex-start; padding: 22px 22px 16px; position: relative; }
.cierre-cab h2 { margin: 0 0 4px; font-size: 20px; }
.cierre-cab p { margin: 0; color: var(--text-2); font-size: 14px; padding-right: 26px; }
.cierre-cab .cd-cerrar { position: absolute; top: 14px; right: 14px; }
.cierre-check {
  width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--ok); color: #fff; font-size: 22px; font-weight: 800;
}
.cierre-cuerpo { padding: 4px 22px 18px; display: grid; gap: 8px; }
.cierre-cuerpo > .cd-etq { margin-bottom: 2px; }
.cierre-accion {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; cursor: pointer;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.cierre-accion:hover { border-color: var(--accent); background: var(--accent-soft); }
.cierre-accion.primaria { border-color: var(--accent); background: var(--accent-soft); }
.cierre-ic {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--surface-2); color: var(--accent);
}
.cierre-accion.primaria .cierre-ic { background: var(--accent); color: #fff; }
.cierre-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cierre-txt strong { font-size: 15px; }
.cierre-txt span { color: var(--muted); font-size: 13px; }
.cierre-flecha { color: var(--accent); font-size: 22px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000;
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px;
  background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); font-size: 14px;
}
.cd-chip.primera { background: var(--warn-soft); color: var(--warn); border-color: transparent; font-weight: 650; }

@media (max-width: 700px) {
  .atencion-pasos { order: 3; width: 100%; }
  .ficha-sugerida { padding: 16px; }
  .ficha-sugerida > .btn { width: 100%; justify-content: center; }
  .ficha-sugerida-opciones .btn { flex: 1 1 calc(50% - 4px); justify-content: center; }
}
.ficha-sugerida-opciones { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 100%; }
.ficha-sugerida-txt h2, .cierre-cab h2 { text-transform: none; letter-spacing: -0.01em; color: var(--text); font-weight: 750; }

/* Sedes */
.sedes { display: grid; gap: 10px; margin-bottom: 14px; }
.sede { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.sede.inactiva { opacity: .7; }
.sede-ver { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.sede.editando .sede-ver { display: none; }
.sede > .sede-form { display: none; padding: 14px; }
.sede.editando > .sede-form { display: block; }
.sede-ic { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.sede-txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.sede-txt strong { display: flex; align-items: center; gap: 8px; }
.sede-acciones { display: flex; gap: 6px; flex-wrap: wrap; }
.sede-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.sede-pie { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.sede-nueva > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.sede-nueva > summary::-webkit-details-marker { display: none; }
.sede-nueva[open] > summary { margin-bottom: 12px; }
.sede-nueva > .sede-form { border: 1px dashed var(--border-strong); border-radius: 14px; padding: 14px; }

/* Varias profesiones en Equipo */
.adm-profs { position: relative; min-width: 190px; }
.adm-profs > summary { list-style: none; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.adm-profs > summary::-webkit-details-marker { display: none; }
.adm-profs.deshabilitado { pointer-events: none; opacity: .6; }
.adm-profs-panel {
  position: fixed; z-index: 60; width: 300px; max-height: calc(100vh - 16px); overflow-y: auto; display: grid; gap: 6px;
  white-space: normal; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 12px;
}
.adm-profs-panel p { margin: 0 0 4px; }
.adm-profs-panel .btn { justify-self: end; margin-top: 4px; }
@media (max-width: 700px) { .sede-ver { flex-wrap: wrap; } .sede-acciones { width: 100%; } }
