/* Todeus Clínicas · paleta inspirada en twind.io */
:root {
  --primary: #0177b5;
  --primary-700: #015a9c;
  --primary-50: #e8f3fa;
  --primary-100: #cfe6f4;
  --accent: #ec162c;
  --accent-50: #fdeaec;
  --ink: #171716;
  --ink-2: #32373c;
  --muted: #6b7178;
  --bg: #f4f7fa;
  --surface: #ffffff;
  --border: #e3e8ee;
  --success: #0e9f6e;
  --success-50: #e7f6f0;
  --warning: #d98a00;
  --warning-50: #fdf3e1;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(23, 23, 22, .06), 0 4px 16px rgba(23, 23, 22, .05);
  --font-head: "Poppins", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 600; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* Marca */
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; font-size: 20px; color: var(--ink); }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-700) 100%);
  display: grid; place-items: center; color: #fff; font-size: 17px; position: relative;
}
.brand-mark::after { content: ""; position: absolute; right: -3px; top: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.brand small { display: block; font-family: var(--font-body); font-weight: 600; font-size: 11px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-top: -3px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 14px;
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-700); border-color: var(--primary-700); color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #c80f22; border-color: #c80f22; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--primary-50); border-color: transparent; }
.btn-danger { color: var(--accent); }
.btn-danger:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-50); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label, .label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  padding: 9px 11px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
textarea.input { min-height: 80px; resize: vertical; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; padding: 4px 0; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* Tarjetas y tablas */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.kpi { padding: 16px 18px; }
.kpi .label { margin-bottom: 6px; display: block; }
.kpi .value { font-family: var(--font-head); font-size: 26px; font-weight: 600; }
.kpi .sub { font-size: 13px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--primary-50); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--bg); color: var(--ink-2); white-space: nowrap; }
.badge-blue { background: var(--primary-50); color: var(--primary-700); }
.badge-green { background: var(--success-50); color: var(--success); }
.badge-orange { background: var(--warning-50); color: var(--warning); }
.badge-red { background: var(--accent-50); color: var(--accent); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 14px; border: 0; background: none; cursor: pointer; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 13px; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px; background: var(--primary-50); color: var(--primary-700); }
.alert-warn { background: var(--warning-50); color: #8a5800; }
.alert-red { background: var(--accent-50); color: #a30d1d; }
.alert-ok { background: var(--success-50); color: #0a6b4b; }

/* Layout del panel */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.sidebar .brand { padding: 2px 8px 6px; }
.clinic-switch { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); font-size: 13px; }
.clinic-switch .avatar { width: 28px; height: 28px; border-radius: 8px; font-size: 12px; }
.clinic-switch b { display: block; font-size: 13.5px; line-height: 1.2; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--ink-2); padding: 8px 10px; border-radius: 9px; font-weight: 600; font-size: 14.5px; }
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.active { background: var(--primary-50); color: var(--primary-700); }
.nav a.active svg { color: var(--primary); }
.nav svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 4px; font-weight: 700; }
.sidebar-foot { margin-top: auto; }
.plan-box { border-radius: 12px; padding: 14px; background: linear-gradient(135deg, var(--primary-50), #fff); border: 1px solid var(--primary-100); font-size: 13px; }
.plan-box b { font-family: var(--font-head); font-size: 14px; }
.plan-bar { height: 6px; border-radius: 6px; background: var(--primary-100); margin: 8px 0; overflow: hidden; }
.plan-bar span { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
/* Barra lateral simplificada */
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.collapse-btn { width: 32px; height: 32px; color: var(--muted); }
.ia-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; font-weight: 700; color: #fff; background: linear-gradient(120deg, var(--primary) 0%, #4b5fd6 100%); box-shadow: 0 6px 18px rgba(1, 119, 181, .25); }
.ia-link svg { width: 19px; height: 19px; flex: none; }
.ia-link:hover { filter: brightness(1.06); color: #fff; }
.ia-link.active { outline: 3px solid var(--primary-100); }
.ia-kbd { margin-left: auto; font-size: 10.5px; background: rgba(255, 255, 255, .22); padding: 2px 7px; border-radius: 999px; }
.nav-fold { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: 0; cursor: pointer; font-family: inherit; text-align: left; }
.nav-fold:hover { color: var(--ink); } .nav-fold .chev { font-size: 15px; transition: transform .15s; } .nav-fold.open .chev { transform: rotate(90deg); }
.nav-group { display: none; } .nav-group.open, .app.collapsed .nav-group { display: block; }
.nav-line { display: none; height: 1px; background: var(--border); margin: 8px 10px; }
.trial-pill { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg); font-size: 12.5px; color: var(--muted); }
.trial-pill b { color: var(--primary); font-size: 13px; }
.sidebar-foot .nav { border-top: 1px solid var(--border); padding-top: 8px; }
.app.collapsed { grid-template-columns: 72px 1fr; }
.app.collapsed .sidebar { padding: 16px 10px; align-items: center; }
.app.collapsed .hide-c { display: none !important; }
.app.collapsed .side-top { flex-direction: column; }
.app.collapsed .nav a, .app.collapsed .ia-link { justify-content: center; padding: 10px; }
.app.collapsed .nav-line { display: block; }
.app.collapsed .sidebar-foot { width: 100%; }

/* Todeus IA */
.view.view-ia { max-width: none; padding: 0; height: calc(100vh - 59px); overflow: hidden; }
.ia-wrap { display: flex; flex-direction: column; height: 100%; max-width: 860px; margin: 0 auto; padding: 18px 24px 12px; }
.ia-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.ia-orb { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--primary), #4b5fd6); flex: none; }
.ia-orb svg { width: 20px; height: 20px; }
.ia-orb.sm { width: 30px; height: 30px; border-radius: 10px; }
.ia-orb.sm svg { width: 16px; height: 16px; }
.ia-orb.lg { width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 14px; }
.ia-orb.lg svg { width: 30px; height: 30px; }
.ia-log { flex: 1; overflow-y: auto; padding: 20px 2px; display: flex; flex-direction: column; gap: 12px; }
.ia-empty { margin: auto 0; text-align: center; padding: 20px 0; }
.ia-empty h2 { font-size: 24px; }
.ia-sugs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 22px; text-align: left; }
.ia-sug { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 12px 14px; cursor: pointer; font-weight: 600; color: var(--ink-2); text-align: left; }
.ia-sug:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.msg { display: flex; gap: 10px; align-items: flex-end; }
.msg.me { justify-content: flex-end; }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 16px; line-height: 1.5; }
.msg.me .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai .bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.err { background: var(--accent-50) !important; color: #a30d1d; border-color: transparent !important; }
.typing { display: flex; gap: 4px; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .4; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: 1; } }
.ia-tool { align-self: flex-start; margin-left: 40px; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 700; background: var(--bg); padding: 4px 10px; border-radius: 999px; }
.ia-tool.done svg { color: var(--success); }
.spin { width: 12px; height: 12px; border: 2px solid var(--primary-100); border-top-color: var(--primary); border-radius: 50%; animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.ia-confirm { margin-left: 40px; max-width: 520px; border: 1px solid var(--primary-100); background: var(--surface); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.ia-confirm.pending { border: 2px solid var(--primary); }
.ia-confirm.rejected { opacity: .6; }
.ia-confirm-head { font-family: var(--font-head); font-weight: 600; margin-bottom: 10px; display: flex; gap: 8px; align-items: center; }
.ia-confirm .kv { grid-template-columns: 110px 1fr; font-size: 14px; }
.ia-composer { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 16px; padding: 8px 8px 8px 14px; box-shadow: var(--shadow); }
.ia-composer:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.ia-composer textarea { flex: 1; border: 0; outline: none; resize: none; font: inherit; padding: 8px 0; max-height: 160px; background: transparent; }
.ia-composer .btn { border-radius: 12px; padding: 9px 12px; }
.icon-btn.rec { color: var(--accent); background: var(--accent-50); }
.ia-foot { text-align: center; padding-top: 8px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 24px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.search { position: relative; flex: 1; max-width: 420px; }
.search #searchIcon { display: contents; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; height: 17px; }
.search input { padding-left: 36px; background: var(--bg); border-color: transparent; border-radius: 10px; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); max-height: 360px; overflow-y: auto; z-index: 40; }
.search-results a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; color: var(--ink); border-bottom: 1px solid var(--border); }
.search-results a:hover { background: var(--primary-50); }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: none; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); position: relative; }
.icon-btn:hover { background: var(--bg); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .pip { position: absolute; top: 6px; right: 7px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid #fff; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); width: 300px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .12); z-index: 50; overflow: hidden; }
.dropdown .dd-head { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.dropdown a, .dropdown button.dd-item { display: flex; width: 100%; gap: 10px; align-items: center; padding: 10px 16px; color: var(--ink); background: none; border: 0; text-align: left; cursor: pointer; font-weight: 600; font-size: 14px; }
.dropdown a:hover, .dropdown button.dd-item:hover { background: var(--bg); }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 700; font-size: 13.5px; }
.trial-bar { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px; background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 600; }
.trial-bar a { color: #fff; text-decoration: underline; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.view { padding: 24px; max-width: 1400px; width: 100%; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: var(--primary); flex: none; }

/* Agenda */
.ag-wrap { overflow: auto; max-height: calc(100vh - 210px); border-radius: var(--radius); }
.ag-grid { display: grid; min-width: 100%; position: relative; }
.ag-head { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.ag-head.corner { left: 0; z-index: 6; }
.ag-times { position: sticky; left: 0; z-index: 4; background: var(--surface); border-right: 1px solid var(--border); }
.ag-time { font-size: 11px; color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-7px); }
.ag-col { position: relative; border-right: 1px solid var(--border); cursor: crosshair; }
.ag-col:last-child { border-right: 0; }
.ag-ev {
  position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 5px 8px; font-size: 12px; overflow: hidden; cursor: pointer;
  background: var(--primary-50); border-left: 4px solid var(--primary); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
.ag-ev:hover { filter: brightness(.97); z-index: 3; }
.ag-ev b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-ev .t { color: var(--muted); font-size: 11px; }
.ag-ev.completada { opacity: .65; }
.ag-ev.pendiente { border-left-style: dashed; }
.ag-ev.cancelada, .ag-ev.no-show { background: repeating-linear-gradient(45deg, #fafafa, #fafafa 6px, #f1f1f1 6px, #f1f1f1 12px); border-left-color: #b9bec4; color: var(--muted); text-decoration: line-through; }
.ag-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 2; pointer-events: none; }
.ag-now::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.ag-col ~ .ag-col .ag-now::before { display: none; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(23, 23, 22, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); animation: pop .18s; }
.modal.wide { max-width: 860px; }
.modal.full { max-width: 980px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

.toast-box { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 600; font-size: 14px; animation: pop .2s; max-width: 360px; }
.toast.err { background: var(--accent); }

/* Firma y fotos */
.sign-pad { width: 100%; height: 200px; border: 2px dashed var(--border); border-radius: var(--radius-sm); background: #fff; touch-action: none; cursor: crosshair; display: block; }
.consent-text { max-height: 260px; overflow-y: auto; background: var(--bg); border-radius: var(--radius-sm); padding: 14px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; margin-bottom: 14px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo { position: relative; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.photo img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo .cap { padding: 6px 8px; font-size: 12px; }
.photo.sel { outline: 3px solid var(--primary); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare img { width: 100%; border-radius: var(--radius-sm); }

.patient-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.patient-head .avatar { width: 56px; height: 56px; font-size: 20px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; }
.timeline { border-left: 2px solid var(--primary-100); margin-left: 8px; padding-left: 18px; }
.timeline .item { position: relative; padding-bottom: 18px; }
.timeline .item::before { content: ""; position: absolute; left: -25px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid var(--surface); }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: var(--ink); color: #e6e6e6; padding: 12px; border-radius: var(--radius-sm); white-space: pre-wrap; word-break: break-all; }
.stack > * + * { margin-top: 16px; }

/* Portal paciente */
.portal { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: 84px; }
.portal-top { display: flex; align-items: center; justify-content: space-between; padding: 16px; }
.portal-hero { margin: 0 16px 16px; padding: 20px; border-radius: 18px; color: #fff; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-700) 100%); position: relative; overflow: hidden; }
.portal-hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.portal-hero .btn { background: #fff; color: var(--primary); border-color: #fff; }
.portal-body { padding: 0 16px; }
.portal-body > * + * { margin-top: 14px; }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); display: flex; justify-content: center; z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav .inner { display: flex; max-width: 560px; width: 100%; }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 10px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.bottom-nav a.active { color: var(--primary); }
.bottom-nav svg { width: 22px; height: 22px; }
.choice { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; width: 100%; transition: border-color .15s; }
.choice:hover, .choice.active { border-color: var(--primary); background: var(--primary-50); }
.choice .grow { flex: 1; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip { flex: none; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 8px 12px; text-align: center; cursor: pointer; min-width: 62px; }
.chip b { display: block; font-family: var(--font-head); font-size: 17px; }
.chip span { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.active span { color: #dbeefa; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.slot { border: 1px solid var(--border); border-radius: 10px; padding: 9px 0; text-align: center; font-weight: 700; background: var(--surface); cursor: pointer; }
.slot:hover { border-color: var(--primary); color: var(--primary); }
.slot.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--border); }
.steps span.on { background: var(--primary); }

/* Acceso */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 10% -10%, var(--primary-100), transparent), var(--bg); }
.login-card { width: 100%; max-width: 980px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.login-side { background: var(--ink); color: #fff; padding: 36px; display: flex; flex-direction: column; gap: 18px; }
.login-side .brand { color: #fff; }
.login-side ul { margin: 0; padding-left: 18px; color: #c9ccd1; line-height: 1.8; }
.login-main { padding: 36px; }

/* Web pública */
.site { background: #fff; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.site-nav { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.site-nav .wrap { display: flex; align-items: center; gap: 28px; height: 68px; }
.site-nav nav { display: flex; gap: 22px; flex: 1; }
.site-nav nav a { color: var(--ink-2); font-weight: 700; font-size: 14.5px; }
.site-nav nav a:hover { color: var(--primary); }
.hero { padding: 72px 0 40px; text-align: center; background: radial-gradient(900px 420px at 50% -10%, var(--primary-50), transparent 70%); }
.hero h1 { font-size: clamp(34px, 7vw, 76px); line-height: 1.02; font-weight: 700; max-width: 920px; margin: 0 auto 32px; letter-spacing: -.02em; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero .cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
/* Titular con texto rotatorio: todas las frases en la misma celda (la altura no salta) y recortadas. */
.rotator { display: grid; color: var(--primary); clip-path: inset(0); padding-bottom: .1em; }
.rot-phrase { grid-area: 1 / 1; }
.rot-word { display: inline-block; opacity: 0; transform: translateY(150%); transition: transform .75s cubic-bezier(.86, 0, .07, 1), opacity .75s cubic-bezier(.86, 0, .07, 1); }
.rot-phrase.on .rot-word { opacity: 1; transform: none; }
.rot-phrase.out .rot-word { opacity: 0; transform: translateY(-150%); transition-duration: .6s; }
@media (prefers-reduced-motion: reduce) { .rot-word { transition: none; } }
/* Captación de email: una sola fila limpia, input y botón dentro de la misma caja. */
.trial-form { display: flex; gap: 6px; max-width: 460px; margin: 0 auto; padding: 4px; background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 10px 30px rgba(1, 90, 156, .12); position: relative; }
.trial-form .input { flex: 1; min-width: 0; height: 46px; border: 0; box-shadow: none; font-size: 14.5px; padding: 0 14px; background: transparent; }
.trial-form .input:focus { box-shadow: none; }
.trial-form:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100), 0 10px 30px rgba(1, 90, 156, .12); }
.trial-form .btn { height: 46px; border-radius: 13px; padding: 0 18px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.trial-note { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.trial-form.dark { margin-top: 18px; border-color: transparent; }
/* En móvil: una tarjeta blanca con el campo relleno en gris claro (con icono de sobre) y el botón debajo. */
@media (max-width: 480px) {
  .trial-form, .trial-form:focus-within { flex-direction: column; gap: 10px; padding: 12px; border-radius: 18px; border: 2px solid var(--primary-100); box-shadow: 0 18px 44px rgba(1, 90, 156, .22); }
  .trial-form .input { flex: none; width: 100%; height: 50px; font-size: 15.5px; background: #f3f6f9 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a939c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='m3 7 9 6 9-6'/%3E%3C/svg%3E") no-repeat 14px center / 18px; border: 1px solid #e3e8ee; border-radius: 12px; padding: 0 14px 0 42px; }
  .trial-form .input:focus { background-color: #fff; border-color: var(--primary); }
  .trial-form .btn { width: 100%; height: 50px; border-radius: 12px; font-size: 15.5px; font-weight: 800; box-shadow: 0 8px 20px rgba(1, 119, 181, .35); }
}
.btn-lg { padding: 13px 22px; font-size: 15.5px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border-radius: 999px; background: #fff; border: 1px solid var(--border); font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 22px; }
.eyebrow span { background: var(--accent); color: #fff; border-radius: 999px; padding: 2px 8px; font-size: 11.5px; }
.ia-spotlight h2 { font-size: 28px; }
.ia-card { background: #fff; border-radius: 20px; box-shadow: 0 24px 60px rgba(1, 90, 156, .16); border: 1px solid var(--border); overflow: hidden; }
.ia-card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.ia-card-chat { padding: 20px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); }
.ia-card-rows { padding: 6px 12px; }
.ia-row { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-top: 1px solid var(--border); }
.ia-row:first-child { border-top: 0; }
.ia-row-ic { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.ia-row-ic svg { width: 17px; height: 17px; }

.ia-card-confirm { padding: 0 20px 18px; background: var(--bg); }
@keyframes iaRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ia-card-chat .msg, .ia-card-confirm, .ia-card-rows .ia-row { opacity: 0; }
.ia-card.play .ia-card-chat .msg:nth-child(1) { animation: iaRise .5s ease forwards .1s; }
.ia-card.play .ia-card-chat .msg:nth-child(2) { animation: iaRise .5s ease forwards .7s; }
.ia-card.play .ia-card-confirm { animation: iaRise .5s ease forwards 1.3s; }
.ia-card.play .ia-card-rows .ia-row:nth-child(1) { animation: iaRise .45s ease forwards 1.8s; }
.ia-card.play .ia-card-rows .ia-row:nth-child(2) { animation: iaRise .45s ease forwards 2.05s; }
.ia-card.play .ia-card-rows .ia-row:nth-child(3) { animation: iaRise .45s ease forwards 2.3s; }
.section { padding: 84px 0; }
.section.alt { background: var(--bg); }
.section-head { text-align: center; max-width: 700px; margin: 0 auto 44px; }
.section-head h2 { font-size: clamp(26px, 3.4vw, 38px); line-height: 1.15; font-weight: 700; }
.section-head p { color: var(--muted); font-size: 17px; margin: 12px 0 0; }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.feat { padding: 24px; border-radius: 16px; border: 1px solid var(--border); background: #fff; }
.feat .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; margin-bottom: 14px; }
.feat .ic svg { width: 22px; height: 22px; }
.feat h3 { font-size: 17px; margin-bottom: 6px; }
.feat p { color: var(--muted); margin: 0; line-height: 1.5; }
.feat.is-new { position: relative; border: 2px solid var(--primary); box-shadow: 0 14px 36px rgba(1, 119, 181, .12); }
.new-tag { position: absolute; top: 16px; right: 16px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .06em; padding: 3px 9px; border-radius: 999px; }
a.eyebrow { text-decoration: none; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.split > * { min-width: 0; }
.split + .split { margin-top: 80px; }
.split h3 { font-size: 28px; line-height: 1.2; font-weight: 700; margin-bottom: 12px; }
.split p { color: var(--muted); font-size: 16.5px; line-height: 1.55; }
.ticks { list-style: none; padding: 0; margin: 18px 0 0; }
.ticks li { padding-left: 28px; position: relative; margin-bottom: 10px; font-weight: 600; }
.ticks li::before { content: ""; position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--primary-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230177b5' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center/12px no-repeat; }
.mock { border-radius: 18px; background: linear-gradient(135deg, var(--primary-50), #fff); border: 1px solid var(--border); padding: 22px; }
.mock .card { box-shadow: 0 10px 30px rgba(0, 0, 0, .06); }

/* Mockup de un chat de WhatsApp real (cabecera verde, fondo de chat, bocadillos con cola).
   Lo mío (quien escribe a Todeus) va a la derecha en verde, como en WhatsApp; la respuesta
   de Todeus va a la izquierda en blanco. */
.phone-frame { width: 210px; margin: 0 auto; background: #111; border-radius: 32px; padding: 7px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.phone-notch { width: 42px; height: 14px; background: #111; border-radius: 0 0 10px 10px; margin: 0 auto; position: relative; z-index: 2; }
.phone-screen { background: #0b141a; border-radius: 25px; overflow: hidden; margin-top: -14px; height: 400px; display: flex; flex-direction: column; }
.wa-head { background: #075e54; color: #fff; display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; flex: none; }
.wa-head .wa-avatar { width: 34px; height: 34px; border-radius: 50%; background: #0177b5; display: grid; place-items: center; font-size: 16px; flex: none; }
.wa-head b { font-size: 14.5px; display: block; }
.wa-head .wa-status { font-size: 12px; opacity: .8; }
.wa-body { background: #e5ddd3; padding: 16px 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; overflow: hidden; }
.wa-bubble { max-width: 82%; padding: 7px 9px 5px; border-radius: 8px; font-size: 13.5px; line-height: 1.45; box-shadow: 0 1px 1px rgba(0, 0, 0, .1); }
.wa-bubble.out { align-self: flex-end; background: #d9fdd3; border-bottom-right-radius: 2px; }
.wa-bubble.in { align-self: flex-start; background: #fff; border-bottom-left-radius: 2px; }
.wa-time { display: block; text-align: right; font-size: 10.5px; color: #8696a0; margin-top: 2px; }
.wa-foot { background: #f0f0f0; padding: 8px 10px; display: flex; align-items: center; gap: 8px; flex: none; }
.wa-foot .wa-input { flex: 1; background: #fff; border-radius: 20px; padding: 8px 14px; color: #8696a0; font-size: 13px; }
.wa-foot .wa-mic { width: 34px; height: 34px; border-radius: 50%; background: #075e54; color: #fff; display: grid; place-items: center; flex: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; text-align: center; }
.stats b { display: block; font-family: var(--font-head); font-size: 40px; color: var(--primary); }
.stats span { color: var(--muted); font-weight: 600; }
.price-toggle { display: flex; justify-content: center; margin-bottom: 30px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 18px; align-items: stretch; }
.plan { border: 1px solid var(--border); border-radius: 18px; padding: 28px; background: #fff; display: flex; flex-direction: column; position: relative; }
.plan.pop { border: 2px solid var(--primary); box-shadow: 0 20px 50px rgba(1, 119, 181, .15); }
.plans-single { grid-template-columns: minmax(0, 440px); justify-content: center; }
/* Dos planes (Lite y Pro) centrados; en móvil caen en una columna por el auto-fit de .plans. */
.plans-duo { max-width: 900px; margin: 0 auto; }
.plan.addon ul { columns: 2; }
@media (max-width: 640px) { .plan.addon ul { columns: 1; } }
.plan .tag { position: absolute; top: -12px; left: 28px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.plan h3 { font-size: 20px; }
.plan .desc { color: var(--muted); min-height: 44px; margin: 6px 0 16px; }
.plan .price { font-family: var(--font-head); font-size: 42px; font-weight: 700; }
.plan .price small { font-size: 15px; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 20px 0 24px; flex: 1; }
.plan li { padding: 6px 0 6px 26px; position: relative; font-size: 14.5px; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--primary); font-weight: 700; }
.faq details { border-bottom: 1px solid var(--border); padding: 18px 0; }
.faq summary { font-weight: 700; font-size: 16.5px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.faq summary::after { content: "+"; color: var(--primary); font-size: 22px; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq p { color: var(--muted); margin: 10px 0 0; line-height: 1.55; }
.cta-band { background: var(--ink); color: #fff; border-radius: 24px; padding: 56px 32px; text-align: center; position: relative; overflow: hidden; }
.cta-band::after { content: ""; position: absolute; width: 380px; height: 380px; border-radius: 50%; background: var(--primary); opacity: .25; right: -120px; top: -160px; }
.cta-band h2 { color: #fff; font-size: clamp(26px, 3.4vw, 38px); position: relative; }
.cta-band p { color: #c9ccd1; position: relative; }
.footer { padding: 48px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.footer .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* Acceso y alta */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(20px, 6vw, 80px); max-width: 560px; width: 100%; margin: 0 auto; }
.auth-side { background: linear-gradient(160deg, var(--primary) 0%, var(--primary-700) 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 22px; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%; background: rgba(255, 255, 255, .07); right: -80px; bottom: -80px; }
.auth-side h2 { color: #fff; font-size: 30px; line-height: 1.2; }
.auth-side blockquote { margin: 0; padding: 20px; background: rgba(255, 255, 255, .1); border-radius: 14px; line-height: 1.55; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.wizard { max-width: 720px; margin: 0 auto; padding: 32px 20px 60px; }
.wizard-steps { display: flex; gap: 8px; margin: 22px 0 26px; }
.wizard-steps div { flex: 1; }
.wizard-steps span { display: block; height: 5px; border-radius: 5px; background: var(--border); margin-bottom: 8px; }
.wizard-steps .on span { background: var(--primary); }
.wizard-steps small { font-weight: 700; color: var(--muted); font-size: 12px; }
.wizard-steps .on small { color: var(--primary); }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.pick label { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; background: #fff; }
.pick label:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.pick input { margin-top: 3px; accent-color: var(--primary); }

@media (max-width: 900px) {
  .site-nav nav { display: none; }
  .split { grid-template-columns: 1fr; gap: 28px; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .search { display: none; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 90; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .menu-btn { display: inline-flex; }
  .view { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .login-card { grid-template-columns: 1fr; }
  .login-side { padding: 24px; }
  .login-main { padding: 24px; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 6px; }
}

/* ---------- Facturas ---------- */
.invoice { color: var(--ink); font-size: 14px; line-height: 1.45; }
.inv-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.inv-kind { font-family: var(--font-head); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.inv-num { font-family: var(--font-head); font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.inv-dates { display: grid; grid-template-columns: auto auto; gap: 2px 12px; margin: 0; font-size: 13px; }
.inv-dates dt { color: var(--muted); } .inv-dates dd { margin: 0; text-align: right; }
.inv-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.inv-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.inv-note { background: var(--warning-50); color: #8a5800; padding: 8px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.inv-lines, .inv-tax { width: 100%; border-collapse: collapse; }
.inv-lines th, .inv-tax th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.inv-lines td, .inv-tax td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
.inv-lines th.num, .inv-tax th.num { text-align: right; }
.inv-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-top: 16px; }
.inv-tax { max-width: 340px; }
.inv-totals { display: grid; grid-template-columns: auto auto; gap: 4px 20px; margin: 0; min-width: 220px; }
.inv-totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.inv-totals .grand { font-family: var(--font-head); font-weight: 600; font-size: 17px; padding-top: 6px; border-top: 1px solid var(--border); }
.inv-legal { font-size: 12px; color: var(--muted); margin: 14px 0 0; }
.invoice-page { max-width: 820px; margin: 24px auto; background: var(--surface); padding: 36px; border-radius: var(--radius); box-shadow: var(--shadow); }
@media (max-width: 600px) { .invoice-page { margin: 0; padding: 20px 16px; border-radius: 0; } .inv-lines { font-size: 13px; } }
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .invoice-page { box-shadow: none; margin: 0; padding: 0; max-width: none; }
}
.inv-opt { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 4px 0 12px; display: flex; flex-direction: column; gap: 6px; }
.inv-opt [data-rcpt] { margin-top: 6px; }

/* Buscador de pacientes (cobro, bono y cita) */
.psearch { position: relative; }
.psearch-list { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 4px; }
.psearch-item { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.psearch-item:hover, .psearch-item.active { background: var(--bg); }
.psearch-empty { padding: 8px 10px; }

/* Respuesta al recordatorio de WhatsApp (agenda e inicio) */
.wa-mark { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 4px; border-radius: 50%; font-size: 10px; font-weight: 800; line-height: 1; vertical-align: 1px; color: #fff; }
.wa-mark.ok { background: var(--success); }
.wa-mark.warn { background: var(--accent); }

/* Conversación de WhatsApp */
.wa-chat { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow-y: auto; padding: 12px; background: var(--bg); border-radius: var(--radius-sm); }
.wa-msg { max-width: 80%; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); align-self: flex-start; }
.wa-msg.out { align-self: flex-end; background: #e7f6ee; border-color: #cdebd9; }
.wa-msg.tpl { background: #eef5fb; border-color: #d4e6f4; }
.wa-msg.sys { align-self: center; max-width: 95%; background: none; border: 1px dashed var(--border); font-size: 12px; color: var(--muted); }
.wa-msg.typing { opacity: .6; font-style: italic; }
.wa-tag { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
.wa-text { font-size: 14px; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.wa-meta { font-size: 11px; color: var(--muted); margin-top: 4px; text-align: right; }
.wa-sim { display: flex; gap: 8px; margin-top: 10px; }
.wa-sim .input { flex: 1; }

/* Horarios: zona fuera de horario en la agenda y editor semanal */
.ag-off { position: absolute; left: 0; right: 0; pointer-events: none; background: repeating-linear-gradient(135deg, rgba(23, 23, 22, .045) 0 6px, transparent 6px 12px); }
.wk { display: flex; flex-direction: column; gap: 6px; }
.wk-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 40px; }
.wk-day { width: 110px; margin: 0; }
.wk-t, .wk-2 { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wk-t.hidden, .wk-2.hidden { display: none; }

/* Informes: ingresos por mes */
.rep-bars { display: flex; align-items: flex-end; gap: 2px; height: 200px; padding: 16px 20px 8px; }
.rep-col { position: relative; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: 20px; outline: none; }
.rep-bar { position: relative; width: min(36px, 70%); background: var(--primary-100); border-radius: 4px 4px 0 0; transition: background .15s; }
.rep-bar.sel { background: var(--primary); }
.rep-col:hover .rep-bar, .rep-col:focus .rep-bar { background: var(--primary-700); }
.rep-lab { position: absolute; bottom: 0; font-size: 11.5px; color: var(--muted); }
.rep-tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 12px; padding: 5px 8px; border-radius: 6px; white-space: nowrap; z-index: 2; text-align: center; pointer-events: none; }
.rep-tip b { display: block; }
.rep-col:hover .rep-tip, .rep-col:focus .rep-tip { display: block; }
.rep-data { padding: 0 20px 14px; }
.rep-data summary { cursor: pointer; color: var(--muted); margin-bottom: 8px; }

/* Verifactu: QR al inicio de la factura (entre 30 y 40 mm al imprimir) */
.inv-vf { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.inv-qr { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink); text-decoration: none; }
.inv-qr svg { width: 120px; height: 120px; display: block; }
.inv-qr span { font-size: 11px; font-weight: 700; letter-spacing: .04em; }
@media print { .inv-qr svg { width: 35mm; height: 35mm; } }

/* Landing en móvil */
@media (max-width: 600px) {
  .site-nav .wrap { gap: 10px; height: 60px; }
  .site-nav .wrap > .btn { padding: 8px 12px; font-size: 14px; }
  .site-nav .brand small { display: none; }
  .hero { padding: 40px 0 28px; }
  .hero h1 { margin-bottom: 22px; }
  .cta-band { padding: 36px 18px; border-radius: 18px; }
  .plan { padding: 22px; }
}

/* Banner de cookies (landing) */
.cookie-banner { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 100; max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 14px 16px; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 40px rgba(23, 23, 22, .18); }
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink-2); flex: 1; }
.cookie-actions { display: flex; gap: 8px; flex: none; }
.cookie-actions .btn { min-width: 96px; justify-content: center; }
@media (max-width: 520px) { .cookie-banner { flex-direction: column; align-items: stretch; gap: 12px; } .cookie-actions .btn { flex: 1; } }

/* Superusuario: Todeus dentro del panel de una clínica (banner rojo fijo arriba, ver admin.js paintImpBar) */
.imp-bar { position: sticky; top: 0; z-index: 60; background: #ec162c; color: #fff; padding: 8px 16px; font-weight: 600; display: flex; gap: 12px; align-items: center; justify-content: center; }
.imp-bar button { background: #fff; color: #ec162c; border: 0; border-radius: 8px; padding: 4px 12px; font-weight: 700; cursor: pointer; font-family: inherit; }

/* Bandeja de WhatsApp (plan 6, assets/js/bandeja.js). Escritorio: lista 320 px + chat. Móvil (<768 px): lista y, al tocar,
   el chat a pantalla completa con «Atrás». Todo con prefijo .bdj- para no chocar con otros estilos. */
.bdj { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); height: calc(100vh - 230px); min-height: 460px; overflow: hidden; }
.bdj-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.bdj-search { padding: 12px 12px 6px; }
.bdj-chips { display: flex; gap: 6px; padding: 4px 12px 10px; overflow-x: auto; flex: none; }
.bdj-chip { border: 1px solid var(--border); background: var(--surface); border-radius: 16px; padding: 4px 10px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.bdj-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.bdj-n { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary-50); color: var(--primary-700); font-size: 11px; text-align: center; }
.bdj-chip.active .bdj-n { background: rgba(255,255,255,.25); color: #fff; }
.bdj-n.hot { background: var(--accent); color: #fff; }
.bdj-items { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; border-top: 1px solid var(--border); }
.bdj-item { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; align-items: flex-start; }
.bdj-item:hover, .bdj-item.active { background: var(--primary-50); }
.bdj-av { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-100); color: var(--primary-700); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.bdj-item-main { flex: 1; min-width: 0; }
.bdj-item-top { display: flex; justify-content: space-between; gap: 8px; }
.bdj-item-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bdj-time { font-size: 11.5px; color: var(--muted); flex: none; }
.bdj-item-prev { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bdj-item-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.bdj-item-tags:empty { display: none; }
.bdj-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); flex: none; margin-top: 6px; }
.bdj-simnew { padding: 10px 12px; border-top: 1px solid var(--border); }
.bdj-notif { padding: 0 12px 8px; }
.bdj-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.bdj-empty { flex: 1; display: grid; place-items: center; color: var(--muted); }
.bdj-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex: none; }
.bdj-head-main { flex: 1; min-width: 0; }
.bdj-head-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bdj-back { display: none; }
.bdj-msgs { flex: 1; max-height: none; border-radius: 0; min-height: 0; }
.bdj-compose { padding: 10px 14px; border-top: 1px solid var(--border); flex: none; max-height: 50%; overflow-y: auto; }
.bdj-read { color: var(--primary); }
.bdj-sim .input { flex: 1; min-width: 0; }
.bdj-sim .btn { flex: none; }
.wa-msg.agent { background: #e3f0fb; border-color: #c9e0f3; }
.bdj-ctl { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--bg); margin-bottom: 8px; }
.bdj-ctl.paused { background: var(--warning-50); color: #7a4d00; }
.bdj-win { font-size: 12px; font-weight: 700; color: var(--success); margin-bottom: 6px; }
.bdj-win.orange { color: var(--warning); } .bdj-win.red { color: var(--accent); } .bdj-win.closed { color: var(--muted); }
.bdj-reply textarea { width: 100%; resize: vertical; min-height: 44px; }
.bdj-reply { position: relative; }
.bdj-qr { margin-top: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 220px; overflow-y: auto; }
.bdj-qr-item { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: none; padding: 8px 10px; cursor: pointer; font: inherit; }
.bdj-qr-item:hover { background: var(--primary-50); }
.bdj-qr-item span { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bdj-qr-manage { display: block; width: 100%; border: 0; background: var(--bg); padding: 8px; cursor: pointer; font: inherit; font-size: 13px; color: var(--primary); }
.bdj-reply-foot .bdj-count { flex: 1; text-align: right; padding: 0 8px; }
.bdj-reply-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.bdj-simbox { margin-top: 8px; } .bdj-simbox summary { cursor: pointer; color: var(--muted); }
.bdj-pending { opacity: .65; }
.bdj-thumb { display: block; max-width: 220px; max-height: 220px; border-radius: 8px; margin: 2px 0 4px; object-fit: cover; }
.bdj-attprev .bdj-thumb { max-width: 60px; max-height: 60px; display: inline-block; vertical-align: middle; margin: 0 6px 0 0; }
.bdj-attprev { margin-top: 6px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.bdj-file { display: inline-block; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); margin-bottom: 4px; text-decoration: none; color: var(--ink); font-weight: 700; }
.bdj.with-side { grid-template-columns: 320px minmax(0, 1fr) 280px; }
.bdj-side { border-left: 1px solid var(--border); padding: 12px 14px; overflow-y: auto; min-height: 0; font-size: 13.5px; }
.bdj-side-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.bdj-kv { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.bdj-kv span { color: var(--muted); } .bdj-kv b { text-align: right; overflow-wrap: anywhere; }
.bdj-cita { display: block; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; color: var(--ink); text-decoration: none; font-weight: 700; }
.bdj-cita span { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.bdj-side-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.bdj-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--border); flex: none; }
.bdj-tools .bdj-assign { width: auto; max-width: 190px; padding: 5px 8px; font-size: 13px; }
.bdj-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; flex: 1; min-width: 0; }
.bdj-alert { display: flex; gap: 8px; align-items: center; justify-content: space-between; background: var(--warning-50); color: #7a4d00; font-size: 13px; padding: 6px 14px; border-bottom: 1px solid var(--border); flex: none; }
.wa-msg.bdj-notemsg { align-self: center; background: #fff7d6; border-color: #f1df9a; max-width: 90%; }
.bdj-notebox { margin-top: 8px; } .bdj-notebox summary { cursor: pointer; color: #8a6d00; }
.bdj-note { display: flex; gap: 8px; align-items: flex-end; margin-top: 6px; } .bdj-note textarea { flex: 1; background: #fffbea; }
.bdj-preview { background: #eef5fb; border: 1px solid #d4e6f4; border-radius: 10px; padding: 8px 12px; font-size: 13.5px; margin: 0 0 8px; }
.nav .nav-pip { margin-left: auto; min-width: 18px; height: 18px; border-radius: 9px; background: var(--success); color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; padding: 0 5px; }
.nav .nav-pip.hot { background: var(--accent); }
@media (max-width: 767px) {
  .bdj { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 200px); }
  .bdj .bdj-chat { display: none; }
  .bdj.show-chat .bdj-list { display: none; }
  .bdj.show-chat .bdj-chat { display: flex; }
  .bdj-back { display: inline-flex; }
  .bdj.with-side { grid-template-columns: minmax(0, 1fr); }
  .bdj.with-side .bdj-chat, .bdj.with-side .bdj-list { display: none; }
}
@media (min-width: 768px) and (max-width: 1100px) { .bdj.with-side { grid-template-columns: minmax(0, 1fr) 260px; } .bdj.with-side .bdj-list { display: none; } }

/* Menú «Más» en el pie de los modales (02/12/2026): se abre hacia arriba. */
.more { position: relative; margin-right: auto; }
.more > summary { list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
/* Clase propia (no .dropdown): el menú de usuario oculta todos los .dropdown al hacer clic fuera. */
.more-menu { position: absolute; bottom: calc(100% + 8px); left: 0; width: 250px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .12); z-index: 50; overflow: hidden; }
.more-menu a, .more-menu button.dd-item { display: flex; width: 100%; gap: 10px; align-items: center; padding: 10px 16px; color: var(--ink); background: none; border: 0; text-align: left; cursor: pointer; font-weight: 600; font-size: 14px; text-decoration: none; }
.more-menu a:hover, .more-menu button.dd-item:hover { background: var(--bg); }

/* Firma en tablet a pantalla completa (02/12/2026): letra grande, nada más en pantalla. */
.kiosk { position: fixed; inset: 0; z-index: 300; background: var(--surface); overflow-y: auto; }
.kiosk-box { max-width: 820px; margin: 0 auto; padding: 24px 20px 32px; min-height: 100%; display: flex; flex-direction: column; }
.kiosk-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.kiosk h1 { font-size: 26px; margin: 6px 0 12px; }
.kiosk-text { font-size: 17px; line-height: 1.55; max-height: 45vh; overflow-y: auto; }
.kiosk-pad { height: 200px; }
.kiosk-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }
.kiosk-foot .btn { font-size: 17px; padding: 12px 22px; }
body.kiosk-on > *:not(.kiosk) { display: none !important; }
