/* Diseño: colores del Hospital de la Gente (verde azulado, azul, rojo) + tipografía Poppins / Inter */
:root {
  --brand: #0e9f86;
  --brand-dark: #0a7a67;
  --brand-soft: #e6f6f2;
  --blue: #2563c9;
  --blue-soft: #e9f0fc;
  --red: #e23744;
  --red-soft: #fdecee;
  --sun: #ffd43b;
  --ink: #0f2233;
  --muted: #5b6b7c;
  --line: #e3e9ef;
  --bg: #f3f7f9;
  --card: #ffffff;
  --ok: #128a4b;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 34, 51, .06);
  --shadow: 0 2px 4px rgba(15, 34, 51, .04), 0 12px 32px rgba(15, 34, 51, .08);
  --grad: linear-gradient(120deg, var(--brand) 0%, #0b8fa3 55%, var(--blue) 100%);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .display { font-family: "Poppins", "Inter", sans-serif; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 700; } h2 { font-size: 1.3rem; font-weight: 700; } h3 { font-size: 1.05rem; font-weight: 600; }
a { color: var(--blue); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
img { max-width: 100%; }
svg.i { width: 20px; height: 20px; flex: none; }

/* ---------- barra superior ---------- */
.topbar { background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.topbar::before { content: ""; display: block; height: 4px; background: linear-gradient(90deg, var(--brand) 0 40%, var(--blue) 40% 75%, var(--red) 75% 100%); }
.topbar .in { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img.logo { height: 42px; width: auto; display: block; }
.brand .mark { width: 40px; height: 40px; border-radius: 12px; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; font-family: Poppins, sans-serif; flex: none; }
.brand .txt { min-width: 0; border-left: 1px solid var(--line); padding-left: 12px; }
.brand .name { font-family: Poppins, sans-serif; font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .sub { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.topbar .spacer { flex: 1; }
.userchip { display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: .85rem; }
.userchip .av { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
@media (max-width: 640px) { .brand .txt { display: none; } .userchip .nm { display: none; } }

/* ---------- pie con nuestra marca discreta ---------- */
.poweredby { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 26px 12px 30px; color: var(--muted); }
.poweredby .lbl { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.pm { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.pm img { height: 24px; }
.pm .w { font-family: Poppins, sans-serif; font-weight: 800; font-size: 1rem; letter-spacing: -.01em; }
.pm .w .a { color: #00b88a; } .pm .w .b { color: #0a1f5c; }
.pm-tag { font-style: italic; font-size: .72rem; color: var(--muted); margin-top: -2px; letter-spacing: .02em; }

/* ---------- layout ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 22px 16px 10px; }
.narrow { max-width: 540px; margin: 0 auto; padding: 22px 16px 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card.elev { box-shadow: var(--shadow); border-color: transparent; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 820px) { .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.section-title .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- formularios ---------- */
label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input, select, textarea { width: 100%; font: inherit; color: inherit; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
input:disabled, textarea:disabled, select:disabled { background: #f7f9fb; color: #44525f; }
.field { margin-bottom: 13px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; color: var(--ink); font-size: .95rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--brand); }
.fieldset-title { font-family: Poppins, sans-serif; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--brand-dark); margin: 18px 0 10px; display: flex; align-items: center; gap: 8px; }
.fieldset-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; border: 1.5px solid transparent; border-radius: 12px; padding: 11px 18px; cursor: pointer; text-decoration: none; background: var(--brand); color: #fff; transition: transform .08s, filter .15s, background .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; padding: 14px 18px; font-size: 1.02rem; }
.btn.grad { background: var(--grad); }
.btn.blue { background: var(--blue); }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: #c9d3dd; }
.btn.light { background: #eef3f6; color: var(--ink); }
.btn.danger { background: var(--red); color: #fff; }
.btn.white { background: #fff; color: var(--brand-dark); }
.btn.outline-white { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }
.btn.sm { padding: 7px 12px; font-size: .84rem; border-radius: 10px; }
.btn.round { width: 54px; height: 54px; border-radius: 50%; padding: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }

.alert { display: block; padding: 12px 14px; border-radius: 12px; background: var(--red-soft); color: #8a1f2a; margin: 10px 0; font-size: .92rem; }
.alert.info { background: var(--blue-soft); color: #1b3f86; }
.alert.ok { background: #e6f6ee; color: #0f5a33; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: #eef2f6; color: var(--muted); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip.programada { background: #eef2f6; color: #4a5866; }
.chip.en_espera { background: #fff4d6; color: #8a5a00; }
.chip.en_curso { background: var(--blue-soft); color: var(--blue); }
.chip.finalizada, .chip.agendada { background: var(--brand-soft); color: var(--brand-dark); }
.chip.cancelada, .chip.no_asistio, .chip.prioritaria { background: var(--red-soft); color: #b0212d; }
.chip.pendiente { background: #fff4d6; color: #8a5a00; }

/* ---------- tablas ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
.table td { padding: 13px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcfd; }
.table-wrap { overflow-x: auto; }
.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .06em; }
.who { display: flex; align-items: center; gap: 10px; }
.who .av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; background: var(--blue-soft); color: var(--blue); flex: none; }

/* ---------- pestañas ---------- */
.tabs { display: flex; gap: 6px; padding: 5px; background: #e9eff3; border-radius: 14px; margin-bottom: 18px; overflow-x: auto; width: fit-content; max-width: 100%; }
.tabs button { background: none; border: 0; padding: 9px 16px; font: inherit; font-weight: 600; color: var(--muted); border-radius: 10px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: .72rem; text-align: center; }

/* ---------- KPIs ---------- */
.kpi-card { display: flex; gap: 14px; align-items: center; }
.kpi-card .ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.kpi { font-family: Poppins, sans-serif; font-size: 1.7rem; font-weight: 700; line-height: 1; }
.kpi-lbl { font-size: .8rem; color: var(--muted); }

/* ---------- portada ---------- */
.hero { position: relative; color: #fff; overflow: hidden; }
.hero .bg { position: absolute; inset: 0; background-size: cover; background-position: center 40%; }
.hero .bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(8, 88, 76, .94) 0%, rgba(10, 110, 120, .82) 45%, rgba(37, 99, 201, .35) 100%); }
.hero .in { position: relative; max-width: 1240px; margin: 0 auto; padding: 64px 16px 92px; }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); font-weight: 800; max-width: 640px; }
.hero p.lead { font-size: 1.12rem; opacity: .93; max-width: 560px; }
.hero .kicker { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); padding: 6px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600; margin-bottom: 16px; }
.hero .kicker .dot { width: 8px; height: 8px; border-radius: 50%; background: #5ff2c6; box-shadow: 0 0 0 4px rgba(95,242,198,.25); }
.hero .ctas { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.overlap { margin-top: -56px; position: relative; z-index: 2; }
.step-num { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-family: Poppins, sans-serif; margin-bottom: 10px; }
.photo-card { padding: 0; overflow: hidden; display: grid; grid-template-columns: 1fr 1fr; }
.photo-card img { width: 100%; height: 100%; object-fit: cover; min-height: 260px; display: block; }
.photo-card .body { padding: 28px; }
@media (max-width: 820px) { .photo-card { grid-template-columns: 1fr; } .photo-card img { min-height: 200px; max-height: 260px; } }
.ticks { list-style: none; padding: 0; margin: 12px 0 0; }
.ticks li { display: flex; gap: 10px; margin: 8px 0; }
.ticks li::before { content: "✓"; color: var(--brand); font-weight: 800; }
.choice { display: block; text-decoration: none; color: inherit; }
.choice .card { transition: transform .15s, box-shadow .15s; height: 100%; }
.choice:hover .card { transform: translateY(-3px); box-shadow: var(--shadow); }
.emergency { background: var(--red-soft); border: 1px solid #f6c7cc; color: #8a1f2a; border-radius: 14px; padding: 12px 16px; display: flex; gap: 10px; align-items: center; font-size: .92rem; }

/* ---------- acceso (split) ---------- */
.split { min-height: calc(100vh - 66px); display: grid; grid-template-columns: 1.05fr 1fr; }
.split .side { position: relative; background-size: cover; background-position: center; color: #fff; display: flex; align-items: flex-end; padding: 40px; }
.split .side::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8,88,76,.15) 0%, rgba(8,70,90,.88) 100%); }
.split .side > * { position: relative; }
.split .form { display: flex; flex-direction: column; justify-content: center; padding: 30px 16px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } .split .side { min-height: 200px; padding: 22px; } }

/* ---------- video ---------- */
.stage { position: relative; background: radial-gradient(ellipse at center, #16323f 0%, #0b1820 75%); border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/10; }
.stage video.remote { width: 100%; height: 100%; object-fit: cover; display: block; }
.stage video.local { position: absolute; right: 14px; bottom: 14px; width: 26%; max-width: 190px; aspect-ratio: 3/4; object-fit: cover; border-radius: 14px; border: 2px solid rgba(255,255,255,.85); background: #1d2c35; transform: scaleX(-1); box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.stage .overlay { position: absolute; inset: 0; display: grid; place-items: center; color: #e5eef4; text-align: center; padding: 24px; }
.stage .overlay h2 { color: #fff; }
.stage .tag { position: absolute; left: 14px; top: 14px; background: rgba(10, 20, 28, .55); backdrop-filter: blur(6px); color: #fff; font-size: .78rem; padding: 6px 12px; border-radius: 999px; display: inline-flex; gap: 8px; align-items: center; }
.stage .tag .live { width: 8px; height: 8px; border-radius: 50%; background: #3ee08f; }
.controls { display: flex; gap: 12px; justify-content: center; padding: 14px 0 2px; flex-wrap: wrap; }
.ctrl { width: 52px; height: 52px; border-radius: 50%; border: 0; background: #eef3f6; color: var(--ink); display: grid; place-items: center; cursor: pointer; transition: background .15s; }
.ctrl:hover { background: #e2e9ee; }
.ctrl.off { background: #2b3a45; color: #fff; }
.ctrl.hang { background: var(--red); color: #fff; }
.ctrl svg { width: 22px; height: 22px; }
.ctrl:disabled { opacity: .45; cursor: not-allowed; }
.pulse-ring { width: 74px; height: 74px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; background: rgba(14,159,134,.25); animation: ring 1.8s infinite; }
.pulse-ring > div { width: 50px; height: 50px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; color: #fff; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(14,159,134,.45); } 70% { box-shadow: 0 0 0 22px rgba(14,159,134,0); } 100% { box-shadow: 0 0 0 0 rgba(14,159,134,0); } }

/* ---------- pasos del paciente ---------- */
.stepper { display: flex; gap: 6px; margin-bottom: 18px; }
.stepper .s { flex: 1; text-align: center; font-size: .7rem; font-weight: 600; color: var(--muted); }
.stepper .s .bar { height: 5px; border-radius: 3px; background: var(--line); margin-bottom: 6px; }
.stepper .s.on { color: var(--brand-dark); }
.stepper .s.on .bar { background: var(--grad); }
.consent-box { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: #fafcfd; font-size: .9rem; }
.consent-box ul { margin: 0; padding-left: 18px; } .consent-box li { margin: 4px 0; }
.bigcode { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 2.1rem; font-weight: 800; letter-spacing: .14em; color: var(--brand-dark); text-align: center; padding: 16px; border: 2px dashed color-mix(in srgb, var(--brand) 40%, var(--line)); border-radius: 16px; background: var(--brand-soft); }
.doc-btn { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); background: #fff; transition: border-color .15s, box-shadow .15s; }
.doc-btn:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.doc-btn .ico { width: 42px; height: 42px; border-radius: 12px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; font-weight: 800; font-size: .7rem; flex: none; }
.doc-btn .t { font-weight: 600; } .doc-btn .s { font-size: .8rem; color: var(--muted); }
.success-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin: 0 auto 12px; }

/* ---------- consola médica ---------- */
.console { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 18px; align-items: start; }
@media (max-width: 1040px) { .console { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: 78px; }
@media (max-width: 1040px) { .sticky { position: static; } }
.dx-results { border: 1px solid var(--line); border-radius: 12px; margin-top: 6px; max-height: 240px; overflow: auto; background: #fff; box-shadow: var(--shadow); }
.dx-results div { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); font-size: .9rem; }
.dx-results div:hover { background: var(--brand-soft); }
.pill { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; background: var(--blue-soft); color: #173a7a; margin: 3px 4px 6px 0; font-size: .86rem; }
.pill.main { background: var(--brand-soft); color: var(--brand-dark); }
.pill button { border: 0; background: none; cursor: pointer; color: inherit; font-size: 1.05rem; line-height: 1; opacity: .7; }
.med { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; background: #fbfdfe; position: relative; }
.med .num { position: absolute; top: -10px; left: 14px; background: var(--blue); color: #fff; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
details.hist { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; background: #fff; }
details.hist summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.chat { height: 150px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-size: .88rem; background: #fafcfd; display: flex; flex-direction: column; gap: 6px; }
.chat .m { max-width: 85%; padding: 7px 11px; border-radius: 12px; background: #fff; border: 1px solid var(--line); align-self: flex-start; }
.chat .m.me { align-self: flex-end; background: var(--brand); color: #fff; border-color: var(--brand); }
.patient-head { display: flex; gap: 14px; align-items: center; }
.patient-head .av { width: 52px; height: 52px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-family: Poppins, sans-serif; font-size: 1.1rem; flex: none; }
.meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin-top: 14px; font-size: .86rem; }
.meta div span { display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.savebar { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); }
.waiting-banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 16px; background: linear-gradient(90deg, #fff8e1, #fffdf6); border: 1px solid #f6e3a6; margin-bottom: 16px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 100; box-shadow: var(--shadow); font-size: .92rem; }
.modal-bg { position: fixed; inset: 0; background: rgba(10, 25, 35, .5); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 22px; max-width: 640px; width: 100%; max-height: 92vh; overflow: auto; padding: 26px; box-shadow: var(--shadow); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
