﻿/* =========================================================
   MediPanel CRM – estilos
   Cambie los colores de marca en :root
   ========================================================= */
:root {
  --brand: #0e9f8e;
  --brand-dark: #0b7f72;
  --brand-soft: #e6f6f4;
  --header: #1f2d33;
  --header-2: #2a3b42;
  --link: #1a8fd6;
  --link-dark: #126fa8;
  --btn: #2a9fd8;
  --danger: #c62828;
  --warn: #e8a317;
  --ok: #7cb342;
  --text: #2b2f33;
  --muted: #6b7680;
  --line: #e3e7ea;
  --bg: #f0f3f5;
  --bg-soft: #e9eef1;
  --radius: 6px;
  --shadow: 0 6px 24px rgba(16, 24, 32, .12);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: var(--link); text-decoration: none; cursor: pointer; }
a:hover { color: var(--link-dark); text-decoration: underline; }
h1, h2, h3, h4 { font-weight: 400; margin: 0; }
h1 { font-size: 34px; }
h2 { font-size: 26px; }
h3 { font-size: 20px; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 1em; height: 1em; vertical-align: -0.125em; flex-shrink: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.upper { text-transform: uppercase; letter-spacing: .02em; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.container { max-width: 1440px; margin: 0 auto; padding: 0 32px; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; background: var(--btn); color: #fff;
  padding: 9px 16px; border-radius: 2px; cursor: pointer; font-size: 15px; white-space: nowrap; transition: filter .15s, background .15s; }
.btn:hover { filter: brightness(.94); text-decoration: none; color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.red { background: var(--danger); }
.btn.green { background: var(--brand); }
.btn.ghost { background: transparent; color: var(--link); border-color: transparent; }
.btn.ghost:hover { background: var(--bg-soft); color: var(--link-dark); }
.btn.outline { background: var(--surface); color: var(--link); border-color: var(--btn); }
.btn.outline:hover { background: #f0f8fd; color: var(--link-dark); }
.btn.white-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,.85); }
.btn.white-outline:hover { background: rgba(255,255,255,.14); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; }
.btn-group { display: inline-flex; }
.btn-group .btn + .btn { margin-left: -1px; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 6px; border-radius: 50%; color: var(--muted); display: inline-flex; }
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }

/* ---------- Formularios ---------- */
.input, select.input, textarea.input { width: 100%; border: 1px solid #cfd6db; background: var(--surface); padding: 9px 12px; border-radius: 3px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--btn); box-shadow: 0 0 0 3px rgba(42,159,216,.15); }
textarea.input { resize: vertical; min-height: 80px; }
label.f { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--link); padding: 4px 0; }
.check input { width: 16px; height: 16px; accent-color: var(--btn); }
.search-box { position: relative; }
.search-box .input { padding-right: 40px; height: 50px; font-size: 17px; }
.search-box svg { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* ---------- Header ---------- */
.topbar { background: var(--header); color: #fff; }
.topbar .container { display: flex; align-items: center; gap: 28px; height: 72px; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 22px; letter-spacing: -.3px; }
.logo:hover { text-decoration: none; color: #fff; }
.logo .mark { width: 38px; height: 38px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; }
.logo small { display: block; font-size: 11px; font-weight: 500; color: #9fd8d0; letter-spacing: .12em; text-transform: uppercase; margin-top: -3px; }
.top-search { flex: 1; max-width: 620px; position: relative; }
.top-search input { width: 100%; height: 44px; border: 0; border-radius: 3px; padding: 0 16px; font-size: 16px; outline: none; color: var(--text); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 14px; }
.license { line-height: 1.15; font-size: 13px; }
.license b { font-weight: 600; }
.license .sub { font-size: 11px; opacity: .8; }
.dropdown { position: relative; }
.dropdown > button { background: transparent; border: 0; color: inherit; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 6px 0; }
.dropdown .menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); color: var(--text); min-width: 220px; border-radius: 6px; box-shadow: var(--shadow); padding: 6px 0; z-index: 50; display: none; }
.dropdown.open .menu { display: block; }
.dropdown .menu a, .dropdown .menu .item { display: flex; gap: 10px; align-items: center; padding: 9px 16px; color: var(--text); }
.dropdown .menu a:hover { background: var(--bg-soft); text-decoration: none; }
.dropdown .menu .sep { border-top: 1px solid var(--line); margin: 6px 0; }
.bell { position: relative; color: #fff; }
.bell .dot { position: absolute; top: -4px; right: -6px; background: var(--danger); color: #fff; font-size: 10px; border-radius: 10px; padding: 0 5px; line-height: 16px; }

.subnav { background: var(--brand); }
.subnav .container { display: flex; align-items: flex-end; gap: 4px; height: 60px; }
.subnav .tab { color: #fff; padding: 10px 18px; font-size: 18px; display: flex; align-items: center; gap: 8px; border-radius: 4px 4px 0 0; height: 46px; }
.subnav .tab:hover { background: rgba(255,255,255,.12); text-decoration: none; color: #fff; }
.subnav .tab.active { background: var(--surface); color: var(--text); }
.subnav .tab.locked { opacity: .55; }
.subnav .actions { margin-left: auto; align-self: center; display: flex; gap: 6px; }
.badge { background: var(--danger); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; line-height: 18px; font-weight: 600; }

main.page { padding-top: 28px; padding-bottom: 60px; }
.page-title { margin: 6px 0 22px; }
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; margin-bottom: 22px; }
.toolbar .links { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.toolbar .links .dot { color: #b8c0c6; }
.subtabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.subtabs a { padding: 10px 2px; color: var(--link); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.subtabs a.active { color: var(--text); border-bottom-color: var(--text); }
.subtabs a:hover { text-decoration: none; }

/* ---------- Inicio ---------- */
.hero { background: var(--brand); position: relative; overflow: hidden; padding: 46px 0 54px; text-align: center; }
.hero::before { content: ""; position: absolute; inset: 0; opacity: .13;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M20 14h8v8h8v8h-8v8h-8v-8h-8v-8h8z'/%3E%3Ccircle cx='86' cy='30' r='12'/%3E%3Cpath d='M78 30h16M86 22v16'/%3E%3Crect x='14' y='72' width='26' height='30' rx='3'/%3E%3Cpath d='M20 82h14M20 90h10'/%3E%3Cpath d='M70 78c0 14 10 20 18 20s14-6 14-14M88 98v6M82 104h12'/%3E%3Ccircle cx='70' cy='74' r='4'/%3E%3C/svg%3E"); }
.hero h1 { color: #fff; font-weight: 700; font-size: 34px; position: relative; margin-bottom: 18px; }
.hero .hero-search { position: relative; max-width: 740px; margin: 0 auto; }
.hero .hero-search input { width: 100%; height: 52px; border: 0; border-radius: 3px; padding: 0 18px; font-size: 18px; outline: none; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border-radius: 6px; box-shadow: var(--shadow); z-index: 40; text-align: left; max-height: 380px; overflow: auto; }
.suggest a { display: flex; gap: 12px; align-items: center; padding: 10px 14px; color: var(--text); border-bottom: 1px solid var(--line); }
.suggest a:hover, .suggest a.hl { background: var(--bg-soft); text-decoration: none; }
.suggest .empty { padding: 14px; color: var(--muted); }

.news { border: 1px solid var(--line); padding: 20px 26px; margin: 36px 0 30px; display: flex; gap: 22px; align-items: center; color: var(--muted); }
.news svg { width: 52px; height: 52px; color: var(--brand); }
.news .stats { display: flex; gap: 34px; flex-wrap: wrap; }
.news .stat b { display: block; font-size: 26px; color: var(--text); font-weight: 500; }
.modules { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 2px dotted #c8ced3; border-bottom: 2px dotted #c8ced3; padding: 30px 0; }
.module { text-align: center; padding: 26px 30px 34px; border-right: 1px solid var(--line); position: relative; }
.module:last-child { border-right: 0; }
.module .ico { width: 64px; height: 64px; color: var(--brand); margin-bottom: 18px; }
.module h3 { font-size: 27px; margin-bottom: 10px; }
.module .links a { text-decoration: underline; font-size: 17px; }
.module p { margin: 6px 0 22px; color: #555; font-size: 16px; }
.module.locked { opacity: .9; }
.module.locked .ico, .module.locked h3 { opacity: .45; }
.module .lock { display: inline-flex; gap: 6px; align-items: center; background: var(--bg-soft); border: 1px solid var(--line); padding: 6px 12px; border-radius: 20px; font-size: 13px; color: var(--muted); }

/* ---------- Pacientes ---------- */
.plist { max-width: 1040px; border-top: 1px solid var(--line); }
.prow { display: flex; gap: 16px; padding: 20px 12px 20px 10px; border-bottom: 1px solid var(--line); border-left: 4px solid transparent; position: relative; }
.prow:hover { border-left-color: var(--btn); background: #fbfdfe; }
.avatar { width: 82px; height: 82px; flex-shrink: 0; background: #eef1f3; display: grid; place-items: center; overflow: hidden; color: #b8c1c7; border-radius: 3px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 40px; height: 40px; border-radius: 50%; font-size: 14px; }
.avatar.initials { color: #fff; font-weight: 600; font-size: 26px; }
.avatar.sm.initials { font-size: 15px; }
.prow .name { font-size: 20px; }
.prow .meta { margin-top: 2px; }
.prow .meta .sep, .dotsep { color: #9aa3a9; margin: 0 5px; }
.prow .acts { margin-top: 8px; visibility: hidden; font-size: 15px; }
.prow:hover .acts { visibility: visible; }
.prow .plus { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: var(--brand); color: #fff; font-size: 22px; cursor: pointer; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(14,159,142,.35); opacity: .0; transition: opacity .15s, transform .15s; }
.prow:hover .plus { opacity: 1; }
.prow .plus:hover { transform: translateY(-50%) scale(1.08); }
.tooltip { position: relative; }
.tooltip[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); right: 0; background: #222; color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 12px; white-space: nowrap; }
.empty-state { padding: 40px; text-align: center; color: var(--muted); background: var(--bg-soft); border-radius: 6px; }

/* ---------- Historia clínica ---------- */
.hc-head { display: flex; gap: 18px; align-items: flex-start; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.hc-head .avatar { width: 96px; height: 120px; }
.hc-head h1 { font-size: 40px; line-height: 1.1; }
.hc-head .sub { font-size: 20px; margin-top: 4px; }
.hc-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); margin-bottom: 30px; }
.hc-actions .dot { color: #b8c0c6; }
.hc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; }
.section-title { font-size: 34px; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 16px; }
.chip { border: 1px solid var(--btn); color: var(--link); background: var(--surface); border-radius: 16px; padding: 4px 10px; cursor: pointer; font-size: 15px; }
.chip.active { background: var(--btn); color: #fff; }
.evo { border-left: 3px solid #f6c77d; border-bottom: 3px solid #f6c77d; padding: 12px 18px 16px 20px; margin-bottom: 26px; }
.evo .evo-head { display: flex; align-items: flex-start; gap: 10px; }
.evo h3 { font-size: 23px; }
.evo h3 .ago { font-style: italic; color: #a7b0b6; font-size: 18px; }
.evo .by { color: var(--muted); font-size: 15px; }
.evo .sec { margin-top: 16px; }
.evo .sec h4 { font-weight: 700; font-size: 15px; text-transform: uppercase; border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-bottom: 6px; }
.evo .sec div { white-space: pre-wrap; text-transform: uppercase; }
.evo.collapsed .body { display: none; }
.evo mark { background: #fff3a8; }
.side-block { margin-bottom: 36px; }
.side-block h4 { font-size: 19px; text-transform: uppercase; color: #555; border-bottom: 1px solid #cfd6db; padding-bottom: 8px; margin-bottom: 10px; display: flex; gap: 8px; align-items: center; }
.side-block h5 { font-size: 16px; font-weight: 400; text-transform: uppercase; color: #9aa3a9; margin: 14px 0 6px; }
.reminder { display: flex; gap: 8px; border-bottom: 1px solid var(--line); padding: 8px 0; font-style: italic; }
.reminder .date { color: #9aa3a9; font-size: 14px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; display: grid; place-items: center; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .pdf { font-weight: 700; color: var(--danger); }
.thumb .cap { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 2px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evo-form { background: var(--bg-soft); border: 1px solid var(--line); padding: 18px 20px; margin-bottom: 28px; border-radius: 4px; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(20, 28, 34, .55); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; animation: fade .15s; }
.modal { background: var(--surface); width: 100%; max-width: 620px; border-radius: 4px; box-shadow: var(--shadow); position: relative; animation: pop .15s; }
.modal.wide { max-width: 1000px; }
.modal.xl { max-width: 1200px; }
.modal-head { padding: 26px 34px 6px; display: flex; align-items: flex-start; gap: 12px; }
.modal-head h2 { font-size: 30px; flex: 1; }
.modal-body { padding: 14px 34px 26px; }
.modal-foot { padding: 14px 34px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal .close { border: 0; background: #444; color: #fff; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }

/* Ficha administrativa */
.ficha-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 26px; flex-wrap: wrap; }
.ficha-tabs a { padding: 8px 0; border-bottom: 3px solid transparent; font-size: 17px; }
.ficha-tabs a.active { color: var(--text); border-bottom-color: var(--text); }
.ficha-tabs a:hover { text-decoration: none; }
.ficha-grid { display: grid; grid-template-columns: 210px minmax(0,1fr) 210px; gap: 36px; }
.ficha-photo { width: 100%; aspect-ratio: 4/5; background: #eef1f3; display: grid; place-items: center; overflow: hidden; margin-bottom: 18px; color: #b8c1c7; }
.ficha-photo img { width: 100%; height: 100%; object-fit: cover; }
.ficha-side-btns { display: flex; flex-direction: column; gap: 8px; }
.ficha-side-btns .btn { justify-content: center; text-transform: uppercase; font-size: 15px; padding: 10px; }
.ficha-side-btns .link-btn { text-align: center; text-transform: uppercase; color: var(--text); padding: 9px; cursor: pointer; background: none; border: 0; font-size: 15px; display: flex; justify-content: center; align-items: center; gap: 6px; }
.ficha-side-btns .link-btn:hover { background: var(--bg-soft); }
.kv p { margin: 0 0 18px; font-size: 16px; }
.kv b { font-weight: 600; }
.ficha-right h4 { text-align: center; font-weight: 600; font-size: 16px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 16px; }
.ficha-right .blk { border-bottom: 1px solid var(--line); padding: 14px 0; }
.ficha-right .blk .t { text-transform: uppercase; font-size: 15px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); border-bottom: 2px solid var(--line); padding: 8px; text-transform: uppercase; }
.table td { border-bottom: 1px solid var(--line); padding: 9px 8px; vertical-align: middle; }

/* ---------- Turnos ---------- */
.turnos-grid { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 38px; }
.waiting { background: #eef1f3; border: 1px solid #e0e5e8; padding: 18px 24px; color: #8a949b; font-style: italic; }
.waiting-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #fffbea; border: 1px solid #f5e3a3; margin-bottom: 6px; font-style: normal; color: var(--text); }
.slots { border-top: 1px solid var(--line); }
.slot { display: flex; align-items: center; gap: 14px; padding: 9px 6px; border-bottom: 1px solid var(--line); min-height: 54px; }
.slot:hover { background: #fbfdfe; }
.slot .time { width: 80px; text-align: center; color: #fff; background: var(--ok); border-radius: 2px; padding: 3px 0; font-size: 14px; flex-shrink: 0; }
.slot.turno .time { background: var(--btn); }
.slot.bloqueado .time { background: #9aa3a9; }
.slot.overbook .time { background: var(--warn); }
.slot .what { flex: 1; min-width: 0; }
.slot .what .pname { font-size: 16px; }
.slot .acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: inline-block; font-size: 12px; border-radius: 10px; padding: 1px 9px; font-weight: 600; text-transform: capitalize; }
.pill.pendiente { background: #eef3f7; color: #4a6072; }
.pill.recepcionado { background: #fff4cc; color: #8a6400; }
.pill.atendido { background: #e2f5e6; color: #217a35; }
.pill.ausente { background: #fde7e7; color: #a12222; }
.pill.cancelado { background: #ececec; color: #777; text-decoration: line-through; }
.pill.type { background: #e7f2fb; color: #19679a; }
.filters { border: 1px solid var(--line); }
.filters .fh { background: var(--btn); color: #fff; padding: 13px 16px; font-size: 17px; display: flex; gap: 10px; align-items: center; }
.filters .fb { padding: 10px 22px 18px; }
.filters h5 { font-size: 17px; font-weight: 600; margin: 12px 0 6px; display: flex; gap: 8px; align-items: center; }
.filters .check { padding: 3px 0 3px 4px; }
.novedades { border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 22px; }
.novedades h3 { display: flex; align-items: center; gap: 8px; font-size: 24px; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 12px; }
.mini-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.mini-stats div { background: var(--bg-soft); padding: 10px 12px; border-radius: 4px; }
.mini-stats b { font-size: 22px; display: block; font-weight: 500; }

/* Calendario */
.cal-legend { display: flex; justify-content: flex-end; gap: 26px; margin-bottom: 14px; font-size: 14px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 8px; }
.cal-legend i { width: 16px; height: 16px; display: inline-block; }
.cal-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cal-nav .range { margin-left: auto; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.cal { border: 1px solid #d7dde1; user-select: none; }
.cal-header { display: grid; background: #f0f2f3; border-bottom: 1px solid #d7dde1; }
.cal-header div { text-align: center; padding: 4px; font-size: 14px; text-transform: uppercase; border-left: 1px solid #d7dde1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-header div.today { background: #fff8de; font-weight: 600; }
.cal-header .doc-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.cal-body { display: grid; position: relative; max-height: 72vh; overflow-y: auto; }
.cal-times div { height: var(--row); font-size: 13px; text-align: right; padding-right: 6px; color: #444; border-bottom: 1px dotted transparent; line-height: var(--row); }
.cal-col { position: relative; border-left: 1px solid #e3e7ea; cursor: cell; }
.cal-col .line { height: var(--row); border-bottom: 1px dotted #e6e9eb; }
.cal-col .line.hour { border-bottom: 1px solid #e0e4e7; }
.cal-col .off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, #f7f8f9, #f7f8f9 6px, #f1f3f4 6px, #f1f3f4 12px); pointer-events: none; }
.cal-col.today { background: #fffdf3; }
.ev { position: absolute; border-radius: 3px; padding: 2px 6px; font-size: 12.5px; color: #fff; overflow: hidden; cursor: pointer; line-height: 1.25; border: 1px solid rgba(0,0,0,.08); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.ev:hover { filter: brightness(.95); z-index: 5; }
.ev.consultorio { background: #5b9bd5; }
.ev.online { background: #f39c12; }
.ev.teleconsulta { background: #333; }
.ev.block { background: #9b9b9b; cursor: pointer; }
.ev.atendido { opacity: .65; }
.ev.ausente, .ev.cancelado { opacity: .5; text-decoration: line-through; }
.ev.recepcionado { box-shadow: inset 4px 0 0 #ffd54a; }
.ev.overbook { outline: 2px dashed #e8a317; outline-offset: -2px; }
.now-line { position: absolute; left: 0; right: 0; border-top: 2px solid #e53935; z-index: 4; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: #e53935; }

/* Autocomplete */
.ac { position: relative; }
.ac .suggest { top: calc(100% + 2px); }
.picked { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid #cfd6db; border-radius: 3px; background: var(--bg-soft); }
.seg { display: inline-flex; border: 1px solid var(--btn); border-radius: 3px; overflow: hidden; margin-bottom: 18px; }
.seg button { border: 0; background: var(--surface); color: var(--link); padding: 7px 14px; cursor: pointer; }
.seg button.active { background: var(--btn); color: #fff; }

/* ---------- Chat ---------- */
.chat { display: grid; grid-template-columns: 340px minmax(0, 1fr) 320px; height: calc(100vh - 132px); border-top: 1px solid var(--line); }
.chat-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chat-list .head { padding: 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.chat-list .tabs { display: flex; gap: 4px; }
.chat-list .tabs button { flex: 1; border: 1px solid var(--line); background: var(--surface); padding: 5px; cursor: pointer; border-radius: 3px; font-size: 13px; }
.chat-list .tabs button.active { background: var(--header); color: #fff; border-color: var(--header); }
.chat-list .items { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; border-left: 3px solid transparent; }
.conv:hover { background: var(--bg-soft); }
.conv.active { background: #eef7fc; border-left-color: var(--btn); }
.conv .c-main { flex: 1; min-width: 0; }
.conv .c-top { display: flex; gap: 6px; align-items: baseline; }
.conv .c-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.conv .c-time { font-size: 12px; color: var(--muted); }
.conv .c-last { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .c-labels { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.lbl { font-size: 11px; border-radius: 3px; padding: 0 6px; color: #fff; line-height: 18px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.lbl button { border: 0; background: transparent; color: #fff; cursor: pointer; padding: 0; font-size: 13px; line-height: 1; opacity: .8; }
.chat-main { display: flex; flex-direction: column; min-height: 0; background: #f4f1ec; }
.chat-main .head { background: var(--surface); padding: 12px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.chat-main .msgs { flex: 1; overflow-y: auto; padding: 18px 8%; display: flex; flex-direction: column; gap: 6px;
  background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px); background-size: 18px 18px; }
.msg { max-width: 68%; padding: 7px 11px 5px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.08); position: relative; white-space: pre-wrap; word-wrap: break-word; }
.msg.in { background: var(--surface); align-self: flex-start; border-top-left-radius: 2px; }
.msg.out { background: #d9fdd3; align-self: flex-end; border-top-right-radius: 2px; }
.msg.out.ia { background: #e3f0ff; }
.msg.out.sistema { background: #f3e8ff; }
.msg .who { font-size: 11.5px; font-weight: 600; color: var(--brand-dark); margin-bottom: 1px; display: flex; gap: 4px; align-items: center; }
.msg.ia .who { color: #2457a5; }
.msg .meta { font-size: 11px; color: #7b8790; text-align: right; margin-top: 2px; display: flex; justify-content: flex-end; gap: 4px; align-items: center; }
.msg .meta .failed { color: var(--danger); }
.day-sep { align-self: center; background: var(--surface); font-size: 12px; padding: 3px 12px; border-radius: 8px; color: var(--muted); box-shadow: 0 1px 1px rgba(0,0,0,.06); margin: 8px 0; }
.composer { background: #f0f2f5; padding: 10px 14px; display: flex; gap: 10px; align-items: flex-end; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; border: 0; border-radius: 8px; padding: 10px 14px; resize: none; min-height: 42px; max-height: 160px; outline: none; }
.composer .send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; cursor: pointer; display: grid; place-items: center; font-size: 18px; }
.ai-banner { background: #e3f0ff; color: #2457a5; font-size: 13px; padding: 7px 14px; display: flex; align-items: center; gap: 8px; border-top: 1px solid #cfe1fb; }
.ai-banner.off { background: #fff4e5; color: #8a5300; border-color: #f7dfb8; }
.chat-side { border-left: 1px solid var(--line); overflow-y: auto; padding: 18px; }
.chat-side h4 { font-size: 13px; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 18px 0 8px; letter-spacing: .03em; }
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #c3cad0; border-radius: 22px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: var(--surface); border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(18px); }
.chat-empty { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 30px; }

/* ---------- Configuración ---------- */
.card { border: 1px solid var(--line); border-radius: 6px; padding: 20px 24px; margin-bottom: 22px; background: var(--surface); }
.card h3 { margin-bottom: 14px; display: flex; gap: 10px; align-items: center; }
.code { font-family: Consolas, "Courier New", monospace; background: #f3f5f7; border: 1px solid var(--line); padding: 8px 10px; border-radius: 4px; font-size: 13px; word-break: break-all; display: flex; gap: 8px; align-items: center; }
.code span { flex: 1; }
pre.code { white-space: pre-wrap; display: block; }
.plan-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.plan-card { border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.plan-card.current { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.plan-card ul { padding-left: 18px; margin: 8px 0 0; font-size: 14px; }
.sched-row { display: grid; grid-template-columns: 140px 120px 120px 130px 40px; gap: 10px; align-items: center; margin-bottom: 8px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .art { background: var(--brand); color: #fff; padding: 60px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.login .art::before { content: ""; position: absolute; inset: 0; opacity: .12; background-image: inherit; }
.login .art h1 { font-size: 40px; font-weight: 700; margin: 26px 0 12px; line-height: 1.15; }
.login .art p { font-size: 18px; opacity: .92; max-width: 460px; }
.login .art ul { padding: 0; list-style: none; margin-top: 26px; }
.login .art li { display: flex; gap: 10px; align-items: center; margin: 10px 0; font-size: 16px; }
.login .form { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg-soft); }
.login .box { width: 100%; max-width: 400px; background: var(--surface); padding: 36px; border-radius: 8px; box-shadow: var(--shadow); }
.login .box h2 { margin-bottom: 4px; }
.login .err { color: var(--danger); font-size: 14px; min-height: 20px; margin-bottom: 6px; }
.demo-users { margin-top: 18px; font-size: 13px; color: var(--muted); }
.demo-users button { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); padding: 7px 10px; margin-top: 6px; border-radius: 4px; cursor: pointer; }
.demo-users button:hover { border-color: var(--btn); }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #263238; color: #fff; padding: 12px 18px; border-radius: 6px; box-shadow: var(--shadow); max-width: 380px; animation: pop .2s; }
.toast.error { background: var(--danger); }
.toast.ok { background: #2e7d32; }

/* ---------- Upgrade ---------- */
.upgrade { max-width: 640px; margin: 50px auto; text-align: center; }
.upgrade svg { width: 60px; height: 60px; color: var(--brand); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .hc-grid, .turnos-grid { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 300px minmax(0, 1fr); }
  .chat-side { display: none; }
  .ficha-grid { grid-template-columns: 180px 1fr; }
  .ficha-right { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .container { padding: 0 16px; }
  .topbar .container { gap: 12px; }
  .top-search, .license { display: none; }
  .subnav .tab { font-size: 15px; padding: 8px 10px; }
  .subnav .actions { display: none; }
  .modules { grid-template-columns: 1fr; }
  .module { border-right: 0; border-bottom: 1px solid var(--line); }
  .login { grid-template-columns: 1fr; }
  .login .art { display: none; }
  .grid2, .grid3, .ficha-grid, .plan-cards { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 1fr; height: auto; }
  .chat-list { max-height: 40vh; }
  .chat-main { min-height: 70vh; }
  .hc-head h1 { font-size: 28px; }
  .prow .plus { opacity: 1; }
  .prow .acts { visibility: visible; }
}

@media print {
  .topbar, .subnav, .toolbar, .hc-actions, .subtabs, #toasts, .plus, .acts, .filters, .btn { display: none !important; }
  main.page { padding: 0; }
}


/* =========================================================
   v2: tema claro/oscuro, animaciones y componentes nuevos
   ========================================================= */
:root { --surface: #ffffff; --surface-2: #f6f8f9; --input-bg: #ffffff; --hover: #f2f7fa; --stripe-a: #f7f8f9; --stripe-b: #eef1f3; --ease: cubic-bezier(.2,.7,.2,1); }
:root[data-theme="dark"] {
  --bg: #121a1f; --bg-soft: #1b262d; --surface: #1a252c; --surface-2: #202d35; --input-bg: #14202 5; --hover: #223039;
  --text: #e4eaee; --muted: #93a2ad; --line: #2c3b45; --link: #5bb8ea; --link-dark: #8ccdf2; --btn: #2689bd; --brand-soft: #133a35; --stripe-a: #1c2830; --stripe-b: #17222a;
  --shadow: 0 8px 28px rgba(0,0,0,.45); color-scheme: dark;
}
:root[data-theme="dark"] { --input-bg: #14202a; }
:root[data-theme="dark"] .input, :root[data-theme="dark"] select.input, :root[data-theme="dark"] textarea.input, :root[data-theme="dark"] .top-search input, :root[data-theme="dark"] .hero .hero-search input { background: var(--input-bg); color: var(--text); border-color: var(--line); }
:root[data-theme="dark"] .hero .hero-search input { border: 1px solid var(--line); }
:root[data-theme="dark"] .btn.outline { background: transparent; }
:root[data-theme="dark"] .btn.outline:hover, :root[data-theme="dark"] .prow:hover, :root[data-theme="dark"] .slot:hover { background: var(--hover); }
:root[data-theme="dark"] .avatar, :root[data-theme="dark"] .ficha-photo, :root[data-theme="dark"] .waiting { background: var(--surface-2); border-color: var(--line); color: #7d8c97; }
:root[data-theme="dark"] .waiting-row { background: #3a3420; border-color: #5a4d22; }
:root[data-theme="dark"] .cal-header { background: var(--surface-2); border-color: var(--line); }
:root[data-theme="dark"] .cal-header div, :root[data-theme="dark"] .cal, :root[data-theme="dark"] .cal-col, :root[data-theme="dark"] .cal-col .line { border-color: var(--line); }
:root[data-theme="dark"] .cal-header div.today, :root[data-theme="dark"] .cal-col.today { background: #26301f; }
:root[data-theme="dark"] .cal-times div { color: var(--muted); }
:root[data-theme="dark"] .conv.active { background: #19303e; }
:root[data-theme="dark"] .chat-main { background: #151d22; }
:root[data-theme="dark"] .chat-main .msgs { background-image: radial-gradient(rgba(255,255,255,.035) 1px, transparent 1px); }
:root[data-theme="dark"] .msg.in { background: var(--surface-2); }
:root[data-theme="dark"] .msg.out { background: #1d4a3a; }
:root[data-theme="dark"] .msg.out.ia { background: #1d3a5c; }
:root[data-theme="dark"] .msg.out.sistema { background: #3b2a55; }
:root[data-theme="dark"] .composer { background: var(--surface-2); }
:root[data-theme="dark"] .composer textarea { background: var(--input-bg); color: var(--text); }
:root[data-theme="dark"] .ai-banner { background: #19304d; color: #9cc3f2; border-color: #26456c; }
:root[data-theme="dark"] .ai-banner.off { background: #3a2c16; color: #f0c177; border-color: #5a4422; }
:root[data-theme="dark"] .code { background: var(--surface-2); }
:root[data-theme="dark"] .pill.pendiente { background: #263642; color: #b6c7d3; }
:root[data-theme="dark"] .pill.recepcionado { background: #4a3d12; color: #f1cf63; }
:root[data-theme="dark"] .pill.atendido { background: #1d3d27; color: #7fd493; }
:root[data-theme="dark"] .pill.ausente { background: #4a2222; color: #f19a9a; }
:root[data-theme="dark"] .pill.cancelado { background: #2b3238; color: #8d98a0; }
:root[data-theme="dark"] .pill.type { background: #17344a; color: #78bde8; }
:root[data-theme="dark"] .evo { border-color: #8a6a2c; }
:root[data-theme="dark"] .evo mark { background: #6b5a12; color: #fff; }
:root[data-theme="dark"] .modal-back { background: rgba(0,0,0,.65); }
:root[data-theme="dark"] .toast { background: #2f4350; }
:root[data-theme="dark"] .hero::before { opacity: .08; }
:root[data-theme="dark"] .hero { background: #0b6f64; }
:root[data-theme="dark"] .subnav .tab.active { background: var(--bg); color: var(--text); }
:root[data-theme="dark"] .login .form { background: var(--bg); }
:root[data-theme="dark"] .switch span { background: #44535d; }

/* ---------- Fondo y superficies ---------- */
.subnav .tab.active { background: var(--bg); }
main.page { background: transparent; }
.card, .modal, .cal, .filters, .plan-card, .chat-list, .news, .module, .prow, .slot, .suggest, .evo-form { background-color: var(--surface); }
.plist { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: 0 1px 2px rgba(16,24,32,.04); }
.slots { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.chat-main .head, .chat-main .msgs ~ * { background-color: var(--surface); }
.news { border-radius: 10px; }
.modules { background: transparent; border: 0; padding: 0; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.module { border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgba(16,24,32,.05); padding: 26px 22px 28px; }
.module:last-child { border-right: 1px solid var(--line); }
.module h3 { font-size: 24px; }
.module p { font-size: 14.5px; margin: 6px 0 18px; }
.module .links a { font-size: 15.5px; }
.hero { background-image: linear-gradient(135deg, var(--brand), #0b7f72); }
.cal-col .off { background: repeating-linear-gradient(135deg, var(--stripe-a), var(--stripe-a) 6px, var(--stripe-b) 6px, var(--stripe-b) 12px); }
.cal-col .off.closed { background: repeating-linear-gradient(135deg, rgba(150,150,150,.32), rgba(150,150,150,.32) 6px, rgba(150,150,150,.2) 6px, rgba(150,150,150,.2) 12px); display: grid; place-items: start center; padding-top: 6px; font-size: 12px; color: var(--muted); text-align: center; }
.cal-col .off.special { box-shadow: inset 0 0 0 1px rgba(232,163,23,.35); }

/* ---------- Animaciones ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes pulseDot { 0%,100% { box-shadow: 0 0 0 0 rgba(198,40,40,.55); } 60% { box-shadow: 0 0 0 7px rgba(198,40,40,0); } }
@keyframes shimmer { 100% { transform: translateX(100%); } }
main > *, .hero > * { animation: rise .35s var(--ease) both; }
main > *:nth-child(2) { animation-delay: .04s; } main > *:nth-child(3) { animation-delay: .08s; } main > *:nth-child(4) { animation-delay: .12s; }
.modal-back { animation: fade .18s ease; backdrop-filter: blur(2px); }
.modal { animation: pop .22s var(--ease); }
.toast { animation: slideIn .28s var(--ease); }
.btn { transition: transform .12s var(--ease), box-shadow .15s, filter .15s, background .15s, color .15s, border-color .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,24,32,.18); }
.btn:active { transform: translateY(0) scale(.97); box-shadow: none; }
.btn.ghost:hover, .btn.outline:hover { box-shadow: none; }
.icon-btn { transition: background .15s, color .15s, transform .12s var(--ease); } .icon-btn:hover { transform: scale(1.1); } .icon-btn:active { transform: scale(.92); }
.input { transition: border-color .15s, box-shadow .15s, background .15s; }
a { transition: color .15s; }
.subnav .tab { transition: background .2s, color .2s, transform .15s var(--ease); } .subnav .tab:hover { transform: translateY(-1px); }
.subtabs a, .ficha-tabs a { position: relative; transition: color .2s, border-color .2s; }
.chip { transition: background .15s, color .15s, transform .12s var(--ease); } .chip:hover { transform: translateY(-1px); background: var(--hover); } .chip.active:hover { background: var(--btn); }
.prow { transition: background .2s, border-color .2s, transform .2s var(--ease), box-shadow .2s; animation: rise .35s var(--ease) both; }
.prow:hover { transform: translateX(4px); box-shadow: 0 4px 16px rgba(16,24,32,.07); background: var(--hover); }
.prow:nth-child(1) { animation-delay: .02s } .prow:nth-child(2) { animation-delay: .05s } .prow:nth-child(3) { animation-delay: .08s } .prow:nth-child(4) { animation-delay: .11s } .prow:nth-child(5) { animation-delay: .14s } .prow:nth-child(n+6) { animation-delay: .17s }
.prow .acts { visibility: visible; opacity: 0; transform: translateY(-3px); transition: opacity .2s, transform .2s var(--ease); }
.prow:hover .acts { opacity: 1; transform: none; }
.prow .plus { transform: translateY(-50%) scale(.6); transition: opacity .2s, transform .25s var(--ease), background .15s; }
.prow:hover .plus { transform: translateY(-50%) scale(1); }
.prow .plus:hover { transform: translateY(-50%) scale(1.12) rotate(90deg); }
.avatar { transition: transform .25s var(--ease), box-shadow .25s; } .prow:hover .avatar { transform: scale(1.05); box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.module { transition: transform .25s var(--ease), box-shadow .25s, border-color .25s; cursor: default; animation: rise .4s var(--ease) both; }
.module:nth-child(2) { animation-delay: .06s } .module:nth-child(3) { animation-delay: .12s } .module:nth-child(4) { animation-delay: .18s }
.module:not(.locked):hover { transform: translateY(-6px); box-shadow: 0 14px 32px rgba(16,24,32,.14); border-color: var(--brand); }
.module .ico { transition: transform .35s var(--ease); } .module:not(.locked):hover .ico { transform: scale(1.12) rotate(-4deg); }
.slot { transition: background .15s, transform .15s var(--ease), box-shadow .15s; animation: rise .3s var(--ease) both; }
.slot:hover { transform: translateX(3px); }
.slot .time { transition: transform .15s var(--ease); } .slot:hover .time { transform: scale(1.06); }
.conv { transition: background .15s, border-color .15s, transform .15s var(--ease), opacity .15s; }
.conv:hover { transform: translateX(2px); }
.conv.dragging { opacity: .45; transform: scale(.97); }
.chat-list .tabs button { transition: background .15s, color .15s, transform .15s var(--ease), box-shadow .15s; }
.chat-list .tabs button.drop-over { background: var(--brand); color: #fff; border-color: var(--brand); transform: scale(1.08); box-shadow: 0 0 0 3px rgba(14,159,142,.25); }
.chat-list .tabs.dragging-active button { outline: 2px dashed var(--brand); outline-offset: -2px; }
.msg { animation: rise .22s var(--ease) both; }
.ev { transition: filter .15s, transform .15s var(--ease), box-shadow .15s; }
.ev:hover { transform: scale(1.02); box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 6; }
.thumb { transition: transform .2s var(--ease), box-shadow .2s; } .thumb:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 6px 16px rgba(0,0,0,.2); }
.card { transition: box-shadow .2s; } .card:hover { box-shadow: 0 6px 20px rgba(16,24,32,.07); }
.bell .dot, .badge { animation: pulseDot 2.2s infinite; }
.evo { transition: background .2s; } .evo:hover { background: var(--hover); }
.suggest { animation: rise .15s var(--ease); }
.suggest a { transition: background .1s, padding-left .15s var(--ease); } .suggest a:hover { padding-left: 20px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- Header: tema y DigiMed ---------- */
.theme-btn { background: transparent; border: 0; color: #fff; cursor: pointer; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; transition: background .2s, transform .3s var(--ease); font-size: 19px; }
.theme-btn:hover { background: rgba(255,255,255,.14); transform: rotate(18deg); }
.kbd { font-size: 11px; border: 1px solid rgba(255,255,255,.35); border-radius: 4px; padding: 1px 6px; opacity: .85; }
.cmdk-back { position: fixed; inset: 0; z-index: 150; background: rgba(15,22,28,.55); display: flex; justify-content: center; padding-top: 12vh; animation: fade .15s; backdrop-filter: blur(3px); }
.cmdk { width: min(640px, 92vw); background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; align-self: flex-start; animation: pop .2s var(--ease); }
.cmdk input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 16px 20px; font-size: 18px; outline: none; background: transparent; color: var(--text); }
.cmdk .list { max-height: 50vh; overflow: auto; padding: 6px; }
.cmdk .it { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px; cursor: pointer; }
.cmdk .it.hl, .cmdk .it:hover { background: var(--hover); }
.cmdk .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 14px 4px; }

/* ---------- Calendario: confirmación ---------- */
.ev.c-sin_enviar { background: #5b9bd5; } .ev.c-enviado { background: #d99a1c; } .ev.c-confirmado { background: #3f9d4a; } .ev.c-cancelacion { background: #d9534f; }
.ev.atendido { filter: saturate(.55) brightness(1.05); opacity: .8; }
.ev .ti { float: right; margin-left: 4px; opacity: .9; }
.ev.warn::after { content: "!"; position: absolute; right: 4px; bottom: 2px; background: #fff; color: #d9534f; font-weight: 700; border-radius: 50%; width: 15px; height: 15px; font-size: 11px; display: grid; place-items: center; }
.cal-legend i { border-radius: 3px; }
.cal-header div.closed { color: var(--muted); }

/* ---------- Evolución ---------- */
.evo-toolbar { display: flex; border: 1px solid var(--line); border-radius: 6px 6px 0 0; background: var(--surface-2); }
.evo-toolbar button { background: transparent; border: 0; border-right: 1px solid var(--line); padding: 10px 18px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--text); min-width: 112px; transition: background .15s, transform .12s; }
.evo-toolbar button:hover { background: var(--hover); } .evo-toolbar button:active { transform: scale(.96); }
.evo-toolbar svg { width: 26px; height: 26px; color: var(--brand); }
.evo-sec { padding: 16px 20px 10px; border-bottom: 1px solid var(--line); }
.evo-sec .lab { display: flex; align-items: center; gap: 10px; font-size: 13.5px; text-transform: uppercase; font-weight: 600; margin-bottom: 6px; flex-wrap: wrap; }
.evo-sec .lab.red { color: #d9534f; }
.evo-sec .lab .tools { margin-left: auto; display: flex; gap: 14px; font-size: 13px; text-transform: none; font-weight: 400; }
.evo-sec textarea { width: 100%; border: 0; outline: none; resize: vertical; min-height: 56px; background: transparent; color: var(--text); font: inherit; padding: 4px 0; }
.evo-wrap { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 6px 6px; background: var(--surface); }
.med-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; background: var(--surface-2); animation: rise .2s var(--ease); }
.med-row .n b { display: block; } .med-row .n span { font-size: 12.5px; color: var(--muted); }
.attach-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.attach-grid .thumb { width: 84px; height: 84px; aspect-ratio: auto; }
.attach-grid .thumb button { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.65); color: #fff; border: 0; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 12px; }
.mic { border: 0; background: transparent; cursor: pointer; color: var(--link); border-radius: 50%; width: 28px; height: 28px; display: inline-grid; place-items: center; }
.mic.rec { background: var(--danger); color: #fff; animation: pulseDot 1.2s infinite; }
.draft-note { font-size: 13px; color: var(--ok); margin-right: 14px; }
.allergy-banner { display: inline-flex; gap: 8px; align-items: center; background: #fdeaea; color: #a12222; border: 1px solid #f3b9b9; border-radius: 20px; padding: 3px 12px; font-size: 14px; margin-top: 6px; font-weight: 600; }
:root[data-theme="dark"] .allergy-banner { background: #4a2222; color: #f3a3a3; border-color: #6b3030; }
.nego { display: grid; grid-template-columns: 1fr 260px; gap: 16px; background: #000; border-radius: 8px; overflow: hidden; min-height: 60vh; }
.nego .view { display: grid; place-items: center; overflow: hidden; position: relative; background: #000; cursor: grab; }
.nego .view img { max-width: 100%; max-height: 70vh; transition: filter .15s; user-select: none; -webkit-user-drag: none; }
.nego .ctl { background: #14191d; color: #ddd; padding: 14px; font-size: 13px; overflow: auto; }
.nego .ctl label { display: block; margin: 12px 0 4px; } .nego .ctl input[type=range] { width: 100%; }
.nego .ctl .th { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.nego .ctl .th img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 2px solid transparent; border-radius: 4px; cursor: pointer; }
.nego .ctl .th img.on { border-color: var(--brand); }

/* ---------- Estadísticas ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; transition: transform .2s var(--ease), box-shadow .2s; }
.kpi:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(16,24,32,.1); }
.kpi b { display: block; font-size: 30px; font-weight: 500; line-height: 1.1; } .kpi span { color: var(--muted); font-size: 13.5px; } .kpi small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; margin-bottom: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.panel h3 { font-size: 18px; margin-bottom: 4px; } .panel .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 70px; gap: 10px; align-items: center; margin: 7px 0; font-size: 14px; }
.bar-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 14px; background: var(--surface-2); border-radius: 7px; overflow: hidden; } .bar i { display: block; height: 100%; border-radius: 7px; background: var(--brand); width: 0; transition: width .7s var(--ease); }
.bar.alt i { background: var(--btn); } .bar.warn i { background: var(--warn); }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 110px; padding-top: 6px; }
.spark i { flex: 1; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; transition: opacity .15s, transform .15s; transform-origin: bottom; animation: grow .6s var(--ease) both; }
.spark i:hover { opacity: 1; transform: scaleY(1.04); }
@keyframes grow { from { transform: scaleY(0); } }
.period { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.period .chip.active { background: var(--brand); border-color: var(--brand); }

/* ---------- Agendas ---------- */
.day-card { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: start; }
.day-card:last-child { border: 0; }
.day-card.off .ranges { color: var(--muted); font-style: italic; padding-top: 8px; }
.range { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; animation: rise .2s var(--ease); }
.range .input { width: 118px; }
.override-row { display: flex; gap: 14px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: var(--surface-2); }
.lbl.virtual { background: var(--muted); }
.color-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); display: inline-block; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; } .swatches button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: transform .12s; } .swatches button:hover { transform: scale(1.18); } .swatches button.on { border-color: var(--text); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.conf-btn.ok { background: #3f9d4a; }
@media (max-width: 760px) { .nego { grid-template-columns: 1fr; } .day-card { grid-template-columns: 1fr; } .bar-row { grid-template-columns: 100px 1fr 56px; } .panels { grid-template-columns: 1fr; } .evo-toolbar { overflow-x: auto; } }

:root { color-scheme: light; }
.hero .hero-search input, .top-search input { background: var(--surface); color: var(--text); }
@media (max-width: 760px) { .prow .acts { opacity: 1; transform: none; } .prow .plus { opacity: 1; transform: translateY(-50%) scale(1); } }

/* ---------- v3: calendario (colores), buscador, switch oscuro, exportar ---------- */
.ev.c-enviado { background: #e0a526; color: #3b2a00; }
.ev.c-enviado b { color: #3b2a00; }
.ev.past { background: #a9c9e6; color: #2b4a63; border-color: rgba(43,74,99,.15); box-shadow: none; opacity: .9; }
.ev.past.ausente, .ev.past.cancelado { text-decoration: line-through; opacity: .6; }
.ev.block { background: #8d979e; }
:root[data-theme="dark"] .ev.past { background: #3a5a78; color: #d3e4f5; }
.cal-col .off { background: repeating-linear-gradient(135deg, #d3d8dc, #d3d8dc 6px, #c8ced3 6px, #c8ced3 12px); }
.cal-col .off.closed { background: repeating-linear-gradient(135deg, #bfc6cb, #bfc6cb 6px, #b4bcc2 6px, #b4bcc2 12px); color: #3d4850; }
:root[data-theme="dark"] .cal-col .off { background: repeating-linear-gradient(135deg, #2b363e, #2b363e 6px, #252f36 6px, #252f36 12px); }
:root[data-theme="dark"] .cal-col .off.closed { background: repeating-linear-gradient(135deg, #36434c, #36434c 6px, #2f3b43 6px, #2f3b43 12px); color: #aab6bf; }
.cal-legend i { width: 14px; height: 14px; }
.hero { overflow: visible; z-index: 20; }
.hero::before { border-radius: 0; }
:root[data-theme="dark"] .switch input:checked + span { background: var(--brand); }
.evo-exp { margin-right: 6px; }
.evo-exp .exp-btn { color: var(--link); font-size: 15px; padding: 0; }
.evo-exp .exp-btn:hover { color: var(--link-dark); }
.evo-exp .menu { min-width: 260px; }
.evo-exp .menu a { white-space: nowrap; }

/* =========================================================
   v4: rediseño de pacientes / evolución / inicio / hovers
   ========================================================= */

/* ---------- Botones: hover más notorio ---------- */
.btn { position: relative; }
.btn svg { transition: transform .2s var(--ease); }
.btn:hover svg { transform: scale(1.18) rotate(-4deg); }
.btn:not(.ghost):not(.outline):not(.white-outline):hover { filter: none; background-image: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,0)); box-shadow: 0 6px 16px rgba(16,24,32,.28), 0 0 0 3px rgba(255,255,255,.18); }
.btn.white-outline { border-width: 1.5px; font-weight: 600; transition: all .2s var(--ease); }
.btn.white-outline:hover { background: #fff; color: var(--brand-dark); border-color: #fff; transform: translateY(-2px) scale(1.04); box-shadow: 0 8px 20px rgba(0,0,0,.28); }
.btn.outline:hover { background: var(--btn); color: #fff; border-color: var(--btn); box-shadow: 0 6px 14px rgba(42,159,216,.35); }
.btn.green:hover { box-shadow: 0 6px 16px rgba(14,159,142,.45), 0 0 0 3px rgba(14,159,142,.2); }
.btn.red:hover { box-shadow: 0 6px 16px rgba(198,40,40,.45), 0 0 0 3px rgba(198,40,40,.18); }
.btn.lg { padding: 13px 24px; font-size: 17px; border-radius: 10px; font-weight: 600; }
.chip:hover { box-shadow: 0 3px 8px rgba(42,159,216,.25); }
.tab:hover, .subnav .tab:hover { transform: translateY(-2px); }
.tool:hover { box-shadow: 0 4px 12px rgba(16,24,32,.12); }

/* ---------- Pacientes: botón "+" sin giro ---------- */
.prow .plus:hover { transform: translateY(-50%) scale(1.12); box-shadow: 0 4px 14px rgba(14,159,142,.5); }
.prow .plus.tooltip[data-tip]:hover::after { content: attr(data-tip); position: absolute; right: calc(100% + 10px); bottom: auto; top: 50%; transform: translateY(-50%); background: #1f2d33; color: #fff; padding: 5px 10px; border-radius: 6px; font-size: 12.5px; white-space: nowrap; font-weight: 500; pointer-events: none; }
.gear-link { font-size: 20px; margin-left: 14px; text-decoration: none; display: inline-block; transition: transform .35s var(--ease); position: relative; }
.gear-link:hover { transform: rotate(60deg) scale(1.15); text-decoration: none; }
.gear-link[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%) rotate(-60deg) scale(.87); transform-origin: left center; background: #1f2d33; color: #fff; padding: 4px 9px; border-radius: 6px; font-size: 12.5px; white-space: nowrap; right: auto; bottom: auto; }

/* ---------- Pantalla principal ---------- */
.hero h1 { font-size: 38px; letter-spacing: -.5px; }
.modules { grid-template-columns: none; display: grid; gap: 22px; }
.main-modules { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-bottom: 22px; }
.sub-modules { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); max-width: 640px; margin: 0 auto; }
.module { cursor: pointer; text-align: center; border-radius: 18px; background: var(--surface); transition: transform .3s var(--ease), box-shadow .3s, border-color .3s, background .3s; }
.module.big { padding: 38px 24px 30px; min-height: 250px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.module.small { padding: 22px 20px; display: flex; flex-direction: column; align-items: center; }
.module .m-ico { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); transition: transform .35s var(--ease), background .3s, color .3s; margin-bottom: 14px; }
.module.small .m-ico { width: 54px; height: 54px; border-radius: 16px; margin-bottom: 8px; }
.module .m-ico svg { width: 42px; height: 42px; margin: 0; }
.module.small .m-ico svg { width: 28px; height: 28px; }
.module h3 { font-size: 26px; margin: 0; font-weight: 500; }
.module.small h3 { font-size: 19px; }
.module .reveal { max-height: 0; opacity: 0; overflow: hidden; transform: translateY(8px); transition: max-height .35s var(--ease), opacity .3s, transform .35s var(--ease), margin .3s; margin-top: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.module .reveal a:not(.btn) { text-decoration: underline; font-size: 16px; }
.module:hover .reveal, .module:focus-within .reveal, .module:focus .reveal { max-height: 170px; opacity: 1; transform: none; margin-top: 16px; }
.module:hover, .module:focus-visible { transform: translateY(-8px) scale(1.04); box-shadow: 0 22px 44px rgba(14,159,142,.22), 0 6px 14px rgba(16,24,32,.12); border-color: var(--brand); background: linear-gradient(180deg, var(--surface), var(--brand-soft)); outline: none; }
.module:hover .m-ico, .module:focus-visible .m-ico { background: var(--brand); color: #fff; transform: scale(1.12) rotate(-5deg); }
@media (hover: none) { .module .reveal { max-height: 170px; opacity: 1; transform: none; margin-top: 14px; } }
:root[data-theme="dark"] .module:hover { background: linear-gradient(180deg, var(--surface), #153b36); }

/* ---------- Calendario ---------- */
.sel-box { position: absolute; left: 2px; right: 2px; background: rgba(14,159,142,.22); border: 2px dashed var(--brand); border-radius: 6px; z-index: 8; pointer-events: none; font-size: 12px; font-weight: 600; color: var(--brand-dark); padding: 2px 6px; }
:root[data-theme="dark"] .sel-box { color: #7fe0d3; }
.cal-col { user-select: none; }

/* ---------- Paciente: tarjeta de identidad ---------- */
.avatar.xl { width: 104px; height: 104px; border-radius: 26px; font-size: 38px; flex-shrink: 0; box-shadow: 0 8px 22px rgba(16,24,32,.18); }
.pt-hero { display: flex; gap: 22px; align-items: center; padding: 22px 26px; border-radius: 20px; background: linear-gradient(120deg, var(--surface) 0%, var(--surface) 55%, var(--brand-soft) 100%); border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(16,24,32,.05); margin-bottom: 16px; }
.pt-hero h1 { font-size: 34px; font-weight: 500; line-height: 1.15; margin-bottom: 8px; }
.pt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--bg-soft); color: var(--text); font-size: 14px; border: 1px solid var(--line); }
.pchip.brand { background: var(--brand-soft); color: var(--brand-dark); border-color: transparent; font-weight: 600; }
.pchip.danger { background: #fdeaea; color: #a12222; border-color: #f3b9b9; font-weight: 600; }
:root[data-theme="dark"] .pchip.brand { color: #7fe0d3; }
:root[data-theme="dark"] .pchip.danger { background: #4a2222; color: #f3a3a3; border-color: #6b3030; }
a.pchip:hover { text-decoration: none; background: var(--hover); }
.pt-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.pt-actions .pay-dd { display: inline-block; }
.pt-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 26px; }
.tool { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--text); cursor: pointer; font-size: 14.5px; transition: all .2s var(--ease); }
.tool:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--btn); color: var(--link-dark); }
.tool b { background: var(--bg-soft); border-radius: 10px; padding: 0 8px; font-weight: 600; font-size: 12.5px; }
.pt-tools .dropdown .menu, .pay-dd .menu { left: 0; right: auto; min-width: 250px; }
.pt-tools .dropdown .menu a, .pay-dd .menu a { cursor: pointer; }
.hc-grid { grid-template-columns: minmax(0, 1fr) 340px; gap: 30px; align-items: start; }
.hc-side { position: sticky; top: 14px; align-self: start; max-height: calc(100vh - 28px); overflow-y: auto; padding-right: 2px; scrollbar-width: thin; display: flex; flex-direction: column; gap: 14px; }
.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; transition: box-shadow .2s; }
.side-card:hover { box-shadow: 0 6px 18px rgba(16,24,32,.08); }
.side-card h4 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; display: flex; gap: 8px; align-items: center; font-weight: 600; border: 0; padding: 0; }
.side-card a[data-add-rem], .side-card a[data-upload-pt], .side-card a[data-upload-hc] { font-size: 14px; display: inline-block; margin-top: 6px; }
.mini-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.mini-row:last-child { border: 0; }
.mini-row span { color: var(--muted); } .mini-row b { font-weight: 500; text-align: right; } .mini-row small { display: block; color: var(--muted); font-size: 12px; }

/* Perfil médico */
.profile-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 22px 20px; margin-bottom: 26px; }
.profile-card header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.profile-card h2, .tl-head h2 { font-size: 22px; font-weight: 600; }
.profile-card .icon-btn { font-size: 17px; background: var(--bg-soft); }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pf { background: var(--surface-2); border-radius: 12px; padding: 11px 14px; border-left: 4px solid var(--brand); }
.pf span { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.pf b { font-weight: 500; white-space: pre-wrap; }
.pf.empty { border-left-color: var(--line); } .pf.empty b { color: var(--muted); font-style: italic; font-weight: 400; }
.profile-grid.compact { gap: 8px; } .profile-grid.compact .pf { padding: 8px 12px; font-size: 14px; }
.draft-banner { display: flex; gap: 12px; align-items: center; background: #fff7e0; border: 1px solid #f1d98a; border-radius: 14px; padding: 12px 16px; margin-bottom: 22px; }
:root[data-theme="dark"] .draft-banner { background: #3a3318; border-color: #5a4d22; }
.tl-head { display: flex; align-items: baseline; gap: 12px; margin: 8px 0 12px; }

/* Línea de tiempo de evoluciones */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: linear-gradient(180deg, var(--brand), var(--line) 85%); }
.tl-item { position: relative; margin-bottom: 18px; animation: rise .35s var(--ease) both; }
.tl-dot { position: absolute; left: -29px; top: 18px; width: 17px; height: 17px; border-radius: 50%; background: var(--surface); border: 4px solid var(--btn); box-shadow: 0 0 0 4px var(--bg); }
.tl-item.latest .tl-dot { border-color: var(--brand); background: var(--brand); }
.evo-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: visible; transition: box-shadow .25s, transform .25s var(--ease); }
.evo-card:hover { box-shadow: 0 10px 26px rgba(16,24,32,.09); transform: translateY(-2px); }
.tl-item.latest .evo-card { border-color: rgba(14,159,142,.45); }
.evo-top { display: flex; align-items: center; gap: 16px; padding: 12px 18px; background: var(--surface-2); border-radius: 16px 16px 0 0; flex-wrap: wrap; }
.tl-item.collapsed .evo-top { border-radius: 16px; }
.evo-date b { font-size: 18px; font-weight: 600; display: block; line-height: 1.1; } .evo-date span { font-size: 12.5px; color: var(--muted); }
.evo-author { display: flex; align-items: center; gap: 9px; flex: 1; font-size: 14.5px; min-width: 200px; } .evo-author small { display: block; color: var(--muted); font-size: 12px; }
.av-mini { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.evo-actions { display: flex; align-items: center; gap: 4px; }
.evo-actions .dropdown { position: relative; }
.evo-actions .exp-btn { color: var(--link); font-size: 14px; padding: 5px 10px; border-radius: 8px; background: transparent; } .evo-actions .exp-btn:hover { background: var(--hover); }
.evo-body { padding: 8px 18px 14px; }
.tl-item.collapsed .evo-body { display: none; }
.evo-sec-v { display: grid; grid-template-columns: 150px 1fr; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.evo-sec-v:last-child { border: 0; }
.evo-sec-v .tag { align-self: start; display: inline-block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); padding: 4px 10px; border-radius: 8px; text-align: center; }
.evo-sec-v > div { white-space: pre-wrap; padding-top: 2px; }
.evo-sec-v mark { background: #fff3a8; color: #222; border-radius: 3px; }
@media (max-width: 700px) { .evo-sec-v { grid-template-columns: 1fr; gap: 4px; } .profile-grid { grid-template-columns: 1fr; } .pt-hero { flex-direction: column; text-align: center; } .pt-chips { justify-content: center; } }
@media (max-width: 1100px) { .hc-side { position: static; max-height: none; } }

/* ---------- Ficha: tarjetas de datos ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; }
.tile span { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.tile b { font-weight: 500; font-size: 15.5px; word-break: break-word; }
.ficha-side-btns .pay-dd { width: 100%; } .ficha-side-btns .pay-dd > .btn { width: 100%; justify-content: center; text-transform: uppercase; }
.ficha-side-btns .pay-dd .menu { left: 0; right: auto; min-width: 100%; }
.pdf-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: #fdeaea; color: #c62828; font-size: 20px; }

/* ---------- Ventanas (modales) ---------- */
.modal { border-radius: 20px; overflow: hidden; box-shadow: 0 30px 80px rgba(10,20,30,.35); }
.modal-head { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border-bottom: 1px solid var(--line); padding: 20px 28px 14px; align-items: center; }
.modal-head h2 { font-size: 24px; font-weight: 600; display: flex; align-items: center; gap: 12px; }
.modal-body { padding: 18px 28px 24px; }
.modal-foot { background: var(--surface-2); padding: 14px 28px; }
.modal .close { background: var(--bg-soft); color: var(--muted); width: 32px; height: 32px; transition: all .2s var(--ease); }
.modal .close:hover { background: var(--danger); color: #fff; transform: rotate(90deg); }
.evo-date-chip { font-size: 14px; font-weight: 500; background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px; padding: 3px 12px; }

/* ---------- Evolucionar ---------- */
.evo-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.ebtn { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 9px 16px; cursor: pointer; color: var(--text); font-size: 14.5px; transition: all .2s var(--ease); }
.ebtn svg { width: 20px; height: 20px; color: var(--brand); }
.ebtn:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(14,159,142,.2); }
.evo-bar .dropdown .menu { left: 0; right: auto; min-width: 270px; } .evo-bar .dropdown .menu a { cursor: pointer; }
.evo-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.tchip { padding: 5px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-size: 13.5px; cursor: pointer; margin-right: 6px; transition: all .15s var(--ease); display: inline-block; }
.tchip:hover { background: var(--brand); color: #fff; text-decoration: none; transform: translateY(-1px); }
:root[data-theme="dark"] .tchip { color: #7fe0d3; }
.evo-note { background: var(--brand-soft); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; }
.evo-profile { background: var(--surface-2); border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; }
.evo-profile-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.evo-wrap { display: flex; flex-direction: column; gap: 12px; border: 0; background: transparent; }
.evo-sec { border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px 8px; background: var(--surface); border-left: 5px solid var(--c, var(--brand)); transition: box-shadow .2s, border-color .2s; }
.evo-sec:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--brand)) 25%, transparent); }
.evo-sec .lab { text-transform: none; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.evo-sec .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--brand)); display: inline-block; }
.evo-sec .lab .tools a { cursor: pointer; }
.seg button { transition: background .15s, color .15s; }
.tool-opt { padding: 10px 6px; border-bottom: 1px solid var(--line); color: var(--text); align-items: flex-start; }
.tool-opt input { margin-top: 4px; }
.modal-foot .btn.lg { padding: 11px 24px; }

/* ---------- Cobros / QR ---------- */
.pay-box { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.pay-qr { width: 240px; height: 240px; flex-shrink: 0; background: #fff; border-radius: 16px; padding: 8px; box-shadow: 0 6px 20px rgba(16,24,32,.15); }
.pay-qr svg { width: 100%; height: 100%; }
.pay-info { flex: 1; min-width: 260px; }
.pay-alias { display: flex; flex-direction: column; margin-bottom: 8px; } .pay-alias b { font-size: 26px; letter-spacing: .5px; color: var(--brand-dark); }
.pay-amount { font-size: 34px; font-weight: 600; margin-bottom: 6px; }
.pay-warn { background: #fff4e0; color: #8a5300; border-radius: 10px; padding: 9px 12px; font-size: 13.5px; margin: 8px 0; }
:root[data-theme="dark"] .pay-warn { background: #3a2c16; color: #f0c177; }
.qr-status { display: flex; align-items: center; gap: 10px; background: var(--surface-2); padding: 10px 14px; border-radius: 10px; margin-top: 10px; font-weight: 500; }
.spin { width: 16px; height: 16px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spinr 1s linear infinite; display: inline-block; }
@keyframes spinr { to { transform: rotate(360deg); } }

.module .m-ico svg.ico { color: inherit; margin: 0; width: 42px; height: 42px; }
.module.small .m-ico svg.ico { width: 28px; height: 28px; }
.module:hover .ico { transform: none; }

/* ---------- v5: barra fija del paciente, desplegables, tuerca ---------- */
.pt-sticky { position: sticky; top: 0; z-index: 35; background: var(--bg); padding: 12px 0 10px; margin: -12px 0 10px; transition: box-shadow .25s; }
.pt-sticky .pt-hero { margin-bottom: 10px; transition: padding .25s var(--ease), gap .25s; }
.pt-sticky .pt-actions { margin-bottom: 0; }
.pt-sticky.stuck { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; box-shadow: 0 10px 18px -12px rgba(16,24,32,.45); border-bottom: 1px solid var(--line); }
.pt-sticky.stuck .pt-hero { flex: 1; margin: 0; padding: 8px 16px; gap: 14px; border-radius: 14px; min-width: 260px; }
.pt-sticky.stuck .avatar.xl { width: 46px; height: 46px; border-radius: 13px; font-size: 18px; box-shadow: none; }
.pt-sticky.stuck .pt-hero h1 { font-size: 20px; margin: 0 0 2px; }
.pt-sticky.stuck .pt-chips .pchip:not(.keep) { display: none; }
.pt-sticky.stuck .pt-chips .pchip { padding: 2px 10px; font-size: 13px; }
.pt-sticky.stuck .btn.lg { padding: 8px 16px; font-size: 15px; }
.pt-tools { position: relative; z-index: 30; }
.tl-item:has(.dropdown.open) { z-index: 25; }
.hc-side { top: calc(var(--stick-h, 0px) + 14px); max-height: calc(100vh - var(--stick-h, 0px) - 28px); }
.gear-wrap { position: relative; display: inline-block; margin-left: 14px; }
.gear-wrap .gear-link { margin: 0; }
.gear-wrap[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%); background: #1f2d33; color: #fff; padding: 4px 10px; border-radius: 6px; font-size: 12.5px; white-space: nowrap; pointer-events: none; z-index: 20; }
.gear-link[data-tip]:hover::after { content: none; }
.tools-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface-2); }
.tools-row .tchip { margin: 0; }
.tools-row .tlinks { margin-left: auto; display: flex; gap: 14px; font-size: 13.5px; }
.tool-def { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tool-def:last-child { border: 0; }
.tool-def .sw { margin-top: 3px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; margin-bottom: 12px; }

/* v6: barra del paciente "fixed" con espacio reservado (sin cambios de altura del documento = sin parpadeo) */
.pt-slot { display: flow-root; }
.pt-sticky { position: relative; top: auto; }
.pt-sticky.stuck { position: fixed; top: 0; margin: 0; padding: 8px 12px; box-sizing: border-box; border-radius: 0 0 16px 16px; }
.pt-sticky.stuck .pt-hero { flex-wrap: nowrap; }
.pt-sticky.stuck .pt-chips { flex-wrap: wrap; gap: 6px; }

/* Un ancestro con animación/transform se convierte en el "contenedor" de los elementos fixed y la barra se iba con el scroll */
.pt-slot, .pt-slot * { will-change: auto; }
main > .pt-slot { animation: none; transform: none; }

/* v7: la cabecera del paciente es normal (sin sticky/fixed); una barra compacta aparece y desaparece con fundido al hacer scroll */
.pt-slot, .pt-sticky { position: static; margin: 0 0 6px; padding: 0; background: transparent; box-shadow: none; border: 0; }
.pt-sticky .pt-hero { margin-bottom: 12px; }
.pt-mini { position: fixed; top: 0; z-index: 35; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 8px 16px; box-sizing: border-box;
  background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 18px 18px; box-shadow: 0 12px 28px -14px rgba(16,24,32,.45);
  opacity: 0; transform: translateY(-14px); pointer-events: none; visibility: hidden;
  transition: opacity .45s ease, transform .45s var(--ease), visibility 0s linear .45s; }
.pt-mini.show { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }
.pt-mini .mini-id { flex: 1; min-width: 240px; }
.pt-mini .mini-id > b { font-size: 17px; font-weight: 600; display: block; line-height: 1.2; }
.pt-mini .pt-chips { gap: 6px; } .pt-mini .pchip { padding: 1px 9px; font-size: 12.5px; }
.pt-mini .mini-actions { display: flex; gap: 8px; align-items: center; }
.pt-mini .btn { padding: 7px 14px; font-size: 14.5px; }
.pt-mini .pay-dd .menu { right: 0; left: auto; }
.hc-side { transition: top .4s var(--ease), max-height .4s var(--ease); }
.pt-mini { animation: none; }
