/* ═══════════ IMPBA Recepción · estilos (sobrio, institucional; mismo tono que el Centro de Control) ═══════════ */
:root {
  --primary: #10314a; --primary-2: #1a4668; --primary-light: #e4ecf4;
  --accent: #0f766e; --accent-light: #d9f0ec;
  --danger: #c0392b; --danger-light: #fbe7e4; --ok: #0b8a3a; --ok-light: #e4f4ea; --warn: #b7791f; --warn-light: #fbf1dc; --info: #2563eb; --info-light: #e5edfb;
  --bg: #eef2f6; --card: #ffffff; --text: #1a2530; --muted: #55677a; --muted-2: #8a9bab; --border: #d7e0e9;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,49,74,.06), 0 6px 18px -8px rgba(16,49,74,.18); --shadow-lg: 0 24px 60px -24px rgba(0,0,0,.45);
  --sidebar-w: 236px; font-size: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; min-height: 100dvh; overflow-x: hidden; line-height: 1.4; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
img { max-width: 100%; }
h2, h3 { color: var(--primary); font-weight: 600; line-height: 1.2; }

/* ── pantalla de carga ── */
#login-screen { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 22px; background: linear-gradient(160deg, var(--primary) 0%, var(--primary-2) 55%, #0f766e 140%); }
.login-box { background: #fff; border-radius: 18px; padding: 30px 26px 26px; width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); text-align: center; }
.login-logo { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 18px; overflow: hidden; box-shadow: 0 10px 26px rgba(16,49,74,.35); }
.login-logo img { width: 100%; height: 100%; display: block; }
.login-box h1 { font-size: 1.25rem; color: var(--primary); }
.login-box .sub { font-size: .85rem; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.spin { width: 26px; height: 26px; border: 3px solid #d7e0e9; border-top-color: var(--primary); border-radius: 50%; animation: gira .8s linear infinite; margin: 16px auto 8px; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ── botones ── */
.btn { border: 1px solid transparent; border-radius: 9px; padding: .55rem 1rem; font-weight: 600; font-size: .92rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; white-space: nowrap; text-decoration: none; min-height: 40px; transition: filter .15s, background .15s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--primary-light); }
.btn-light { background: #fff; color: var(--primary); }
.btn-ghost-light { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.35); }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; min-height: 32px; border-radius: 8px; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1.02rem; min-height: 48px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: none; color: var(--primary); text-decoration: underline; padding: 0; font: inherit; cursor: pointer; text-align: left; }
.btn-quitar { color: var(--danger); align-self: end; }

/* ── formularios ── */
label.field { display: block; margin-bottom: .75rem; min-width: 0; }
label.field > span { display: block; font-size: .74rem; font-weight: 700; color: var(--muted); margin-bottom: .25rem; text-transform: uppercase; letter-spacing: .03em; }
input:where(:not([type=checkbox]):not([type=radio]):not([type=file])), select, textarea { width: 100%; max-width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 9px; padding: .55rem .7rem; background: #fff; font-size: 16px; min-height: 42px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16,49,74,.12); }
input.ro, input[readonly] { background: #f5f7fa; color: var(--muted); }
textarea { resize: vertical; min-height: 60px; }
input[type=file] { padding: .4rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .7rem; }
.form-row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; }
.check-line { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; font-size: .92rem; cursor: pointer; }
.check-line input, .urgente-check input { width: 1.15rem; height: 1.15rem; accent-color: var(--primary); flex: none; }
.urgente-check { display: flex; align-items: center; gap: .5rem; margin-bottom: .8rem; font-weight: 700; color: var(--danger); font-size: .9rem; cursor: pointer; background: var(--danger-light); border-radius: 9px; padding: .55rem .8rem; }
.urgente-check input { accent-color: var(--danger); }
.aviso { background: var(--warn-light); border: 1px solid #e8d5a8; border-radius: 9px; padding: .6rem .8rem; font-size: .88rem; margin-bottom: .8rem; }
.error-txt { color: var(--danger); }
.ok-txt { color: var(--ok); font-weight: 600; }
.alerta-txt { color: var(--danger); font-weight: 700; }
.vencido { color: var(--danger); font-weight: 700; }

/* ── carcasa ── */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar { width: var(--sidebar-w); flex: none; background: var(--primary); color: #cfdbe6; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; }
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.1); padding-top: calc(1rem + env(safe-area-inset-top)); }
.brand-icon { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.sidebar-brand strong { display: block; font-size: 1.05rem; color: #fff; letter-spacing: .04em; }
.sidebar-brand small { color: #9fb6c8; font-size: .74rem; }
.sidebar-nav { flex: 1; padding: .7rem .55rem; display: flex; flex-direction: column; gap: .1rem; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem; border-radius: 9px; color: #c3d2df; font-weight: 500; font-size: .92rem; border: none; background: none; width: 100%; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav-item .nav-ico { font-size: 1.1rem; width: 1.4rem; text-align: center; }
.sidebar-footer { padding: .8rem; border-top: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: .5rem; justify-content: space-between; }
.user-chip { display: flex; align-items: center; gap: .55rem; font-size: .8rem; line-height: 1.25; min-width: 0; flex: 1; }
.user-chip > div { min-width: 0; flex: 1; }
.user-chip strong { display: block; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip small { color: #9fb6c8; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip.grande strong, .user-chip.grande small { color: inherit; }
.user-chip.grande strong { color: var(--primary); font-size: 1rem; }
.user-chip.grande small { color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .82rem; flex: none; }
.sidebar-footer .btn-ghost { color: #c3d2df; background: transparent; border-color: rgba(255,255,255,.25); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .8rem; padding: .7rem 1.2rem; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; padding-top: calc(.7rem + env(safe-area-inset-top)); }
.topbar h2 { font-size: 1.1rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: .7rem; }
.clock { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hamb { display: none; background: none; border: none; font-size: 1.4rem; color: var(--text); padding: .2rem .4rem; }
.offline-badge { display: none; font-size: .72rem; font-weight: 700; background: var(--warn-light); color: var(--warn); border-radius: 20px; padding: .2rem .6rem; }
body.offline .offline-badge { display: inline-block; }
.view { padding: 1.2rem 1.4rem 2rem; max-width: 1320px; width: 100%; margin: 0 auto; }

/* solo ver: se ocultan botones de captura */
body.solo-ver .no-ver { display: none !important; }
.solo-ver-si, .exp-acciones.solo-ver-si { display: none; }
body.solo-ver .solo-ver-si, body.solo-ver .exp-acciones.solo-ver-si { display: flex; }

/* ── tarjetas ── */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; min-width: 0; }
.card h3 { font-size: 1rem; margin-bottom: .75rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.card h3 .spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.grid-2 > *, .grid-4 > *, .form-row > *, .form-row-3 > *, .form-row-4 > * { min-width: 0; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .8rem 1rem; min-width: 0; }
.stat-num { font-size: 1.8rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.stat-num.stat-txt { font-size: 1rem; padding: .35rem 0 .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-label { font-size: .76rem; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.warn .stat-num { color: var(--warn); } .stat.info .stat-num { color: var(--info); } .stat.ok .stat-num { color: var(--ok); } .stat.danger .stat-num { color: var(--danger); }

/* ── tablas ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .5rem .55rem; border-bottom: 2px solid var(--border); white-space: nowrap; }
.tbl td { padding: .5rem .55rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:hover td { background: #f6f8fb; }
.folio-cell { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary); white-space: nowrap; }

/* ── chips ── */
.chip { display: inline-block; padding: .15rem .55rem; border-radius: 20px; font-size: .72rem; font-weight: 700; white-space: nowrap; vertical-align: middle; background: #eef2f6; color: var(--muted); }
.chip.exp { background: var(--primary-light); color: var(--primary); font-variant-numeric: tabular-nums; }
.chip.espera, .chip.programada { background: var(--warn-light); color: var(--warn); }
.chip.consulta, .chip.llego { background: var(--info-light); color: var(--info); }
.chip.atendido, .chip.realizada, .chip.confirmada { background: var(--ok-light); color: var(--ok); }
.chip.no_asistio, .chip.est-fallecido, .chip.alerta { background: var(--danger-light); color: var(--danger); }
.chip.cancelado, .chip.cancelada { background: #eef2f6; color: var(--muted); text-decoration: line-through; }
.chip.urgente { background: var(--danger); color: #fff; }
.chip.est-reportado { background: var(--warn-light); color: var(--warn); } .chip.est-adoptado { background: var(--ok-light); color: var(--ok); } .chip.est-resguardo, .chip.est-extraviado { background: var(--info-light); color: var(--info); }

/* ── buscador / resultados ── */
.search-box { position: relative; }
.search-box input { padding-left: 2.5rem; }
.search-box::before { content: "🔍"; position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); opacity: .55; pointer-events: none; }
.search-grande input { font-size: 1.1rem; min-height: 52px; }
.hero-search { padding: 1.2rem; }
.res-list { display: flex; flex-direction: column; gap: .4rem; margin-top: .6rem; }
.res-item { display: flex; align-items: center; gap: .75rem; width: 100%; text-align: left; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: .6rem .75rem; transition: border-color .15s, background .15s; min-width: 0; }
.res-item:hover { border-color: var(--primary); background: var(--primary-light); }
.res-ico { font-size: 1.5rem; width: 2rem; text-align: center; flex: none; }
.res-info { min-width: 0; flex: 1; }
.res-info strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-info small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.paciente-box { display: flex; align-items: center; gap: .8rem; background: var(--primary-light); border-radius: 10px; padding: .7rem .9rem; margin-bottom: .9rem; }
.paciente-datos { flex: 1; min-width: 0; }
.paciente-datos strong { display: block; }
.paciente-datos small { display: block; color: var(--muted); }
.paciente-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.dueno-sel { display: flex; align-items: center; gap: .6rem; background: var(--primary-light); border-radius: 9px; padding: .5rem .8rem; margin-bottom: .8rem; flex-wrap: wrap; }
.foto-row { display: flex; align-items: center; gap: .8rem; margin: .4rem 0 .8rem; }
.foto-btn { cursor: pointer; }
.foto-prev { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }

/* ── cola de turnos ── */
.queue-now { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.qn-label { font-size: .74rem; font-weight: 700; letter-spacing: .08em; opacity: .8; text-transform: uppercase; }
.qn-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; padding: .4rem 0; border-top: 1px solid rgba(255,255,255,.14); }
.qn-row:first-of-type { border-top: 0; }
.qn-row > div:first-child { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.qn-turno { font-size: 2.2rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.qn-nombre { font-size: 1rem; font-weight: 600; opacity: .95; min-width: 0; }
.qn-nombre small { font-weight: 400; opacity: .85; }
.qn-empty { font-size: 1.05rem; opacity: .8; padding: .5rem 0; }
.queue-item { display: flex; align-items: center; gap: .7rem; padding: .55rem .3rem; border-bottom: 1px solid var(--border); min-width: 0; }
.queue-item:last-child { border-bottom: none; }
.queue-item.urgente { background: #fff6f5; border-left: 3px solid var(--danger); padding-left: .5rem; border-radius: 6px; }
.queue-turno { width: 54px; height: 50px; flex: none; border-radius: 10px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; text-align: center; line-height: 1.15; }
.queue-turno.small-t { font-size: .76rem; }
.est-consulta .queue-turno { background: var(--info-light); color: var(--info); }
.est-atendido .queue-turno, .est-realizada .queue-turno, .est-confirmada .queue-turno { background: var(--ok-light); color: var(--ok); }
.est-no_asistio .queue-turno, .est-cancelado .queue-turno, .est-cancelada .queue-turno { background: #eef2f6; color: var(--muted); }
.queue-info { flex: 1; min-width: 0; }
.queue-info strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-info small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-actions { display: flex; gap: .35rem; flex: none; align-items: center; }
.menu-ctx { position: fixed; z-index: 95; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 240px; padding: .3rem; display: flex; flex-direction: column; }
.menu-ctx button { background: none; border: none; text-align: left; padding: .55rem .7rem; border-radius: 7px; font-size: .9rem; }
.menu-ctx button:hover { background: var(--primary-light); }

/* ── pestañas ── */
.tabs-row { display: flex; gap: .3rem; border-bottom: 1px solid var(--border); margin-bottom: .9rem; align-items: center; flex-wrap: wrap; }
.tabs-row.scroll-x { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab-btn { background: none; border: none; padding: .55rem .8rem; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: .9rem; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn .num { background: #eef2f6; border-radius: 10px; padding: 0 .4rem; font-size: .72rem; }
.tab-btn.active .num { background: var(--primary-light); color: var(--primary); }

/* ── expediente ── */
.exp-head { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: start; }
.exp-foto { width: 96px; height: 96px; border-radius: 14px; background: var(--primary-light); display: grid; place-items: center; overflow: hidden; position: relative; }
.exp-foto img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.exp-foto-ico { font-size: 2.6rem; }
.exp-datos { min-width: 0; }
.exp-datos h2 { font-size: 1.3rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.exp-linea { margin-top: .25rem; font-size: .92rem; }
.exp-acciones { display: flex; flex-direction: column; gap: .4rem; align-items: stretch; }
.hist-item { display: flex; gap: .7rem; padding: .6rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; align-items: flex-start; }
.hist-item:last-child { border-bottom: none; }
.hist-item.clic { cursor: pointer; border-radius: 8px; }
.hist-item.clic:hover { background: #f6f8fb; }
.hist-item > div:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.hist-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.hist-item small { color: var(--muted); display: block; }
.hist-acc { flex: none; }
.det { margin-bottom: .5rem; font-size: .92rem; overflow-wrap: anywhere; }
.det b { color: var(--primary); }
.lista-meds { margin: .3rem 0 .3rem 1.2rem; }
.adj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; }
.adj-grid.mini { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
.adj-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: .5rem; display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center; font-size: .78rem; min-width: 0; }
.adj-card img { width: 100%; height: 90px; object-fit: cover; border-radius: 6px; background: #eef2f6; }
.adj-card span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.adj-card small { color: var(--muted); }
.adj-ico { font-size: 2.2rem; }
.adj-full { width: 100%; max-height: 75vh; object-fit: contain; }
.adj-frame { width: 100%; height: 75vh; border: 0; }
.adj-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .6rem; }
.adj-item { display: grid; grid-template-columns: 64px 1fr auto; gap: .6rem; align-items: center; background: #f6f8fb; border-radius: 10px; padding: .5rem; }
.adj-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.adj-item small { grid-column: 2; color: var(--muted); }
.adj-item .btn-quitar { grid-column: 3; grid-row: 1 / span 2; }

/* ── consulta ── */
.consulta-form .card { margin-top: 1rem; }
.linea-din { align-items: end; grid-template-columns: 1.4fr 1fr 1fr auto; }
.med-item { display: grid; grid-template-columns: 28px 1fr auto; gap: .6rem; align-items: start; background: #f6f8fb; border-radius: 10px; padding: .7rem; margin-bottom: .6rem; }
.med-num { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; margin-top: 1.3rem; }
.med-campos { min-width: 0; }
.med-campos label.field { margin-bottom: .5rem; }
.acciones-fijas { position: sticky; bottom: 0; background: rgba(238,242,246,.94); backdrop-filter: blur(6px); padding: .8rem 0 calc(.8rem + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: .6rem; margin-top: 1rem; z-index: 5; flex-wrap: wrap; min-width: 0; }
.acciones-fijas .btn-lg { min-width: 0; white-space: normal; text-align: center; }

/* ── agenda ── */
.cal-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.cal-header h3 { flex: 1; text-align: center; margin: 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; }
.cal-dow { text-align: center; font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: .25rem 0; }
.cal-day { min-height: 64px; border: 1px solid var(--border); border-radius: 9px; padding: .3rem .4rem; background: #fff; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.cal-day:hover { border-color: var(--primary); }
.cal-day.out { opacity: .3; cursor: default; background: transparent; border-color: transparent; }
.cal-day.pasado { background: #f6f8fb; }
.cal-day.today { border-color: var(--accent); border-width: 2px; }
.cal-day.sel { background: var(--primary-light); border-color: var(--primary); }
.cal-num { font-weight: 700; font-size: .85rem; }
.cal-cupo, .cal-flag { font-size: .68rem; font-weight: 700; border-radius: 6px; padding: .05rem .3rem; align-self: flex-start; }
.cal-cupo.libre { background: var(--ok-light); color: var(--ok); } .cal-cupo.medio { background: var(--warn-light); color: var(--warn); } .cal-cupo.lleno { background: var(--danger-light); color: var(--danger); }
.cal-flag.cerrado { background: #e8edf2; color: var(--muted); }
.wa-link { color: #16a34a; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.pasos { margin: .4rem 0 0 1.2rem; font-size: .9rem; line-height: 1.6; }
.ios-share { border: 1px solid var(--border); border-radius: 4px; padding: 0 .25rem; }

/* ── modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,25,40,.55); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 1rem; animation: fadeIn .12s ease; }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; animation: popIn .14s ease; }
.modal-lg { max-width: 780px; } .modal-xl { max-width: 1000px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem .5rem; position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-head h3 { font-size: 1.05rem; margin: 0; }
.modal-close { background: none; border: none; font-size: 1.2rem; color: var(--muted); padding: .2rem .5rem; }
.modal-body { padding: .3rem 1.2rem 1.2rem; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .9rem; align-items: center; }
.modal-actions.flex-wrap { flex-wrap: wrap; }
@keyframes fadeIn { from { opacity: 0; } } @keyframes popIn { from { transform: scale(.97); opacity: 0; } }

/* ── toast ── */
.toast-root { position: fixed; bottom: calc(1rem + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: .5rem; align-items: center; width: max-content; max-width: 92vw; pointer-events: none; }
.toast { background: #1a2530; color: #fff; padding: .65rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: .9rem; font-weight: 600; animation: toastIn .18s ease; max-width: 92vw; overflow-wrap: anywhere; }
.toast.ok { background: var(--ok); } .toast.error { background: var(--danger); } .toast.warn { background: var(--warn); }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } }

/* ── visor de impresión ── */
.print-overlay { position: fixed; inset: 0; z-index: 110; background: #4a5a6a; display: flex; flex-direction: column; }
.print-bar { display: flex; align-items: center; gap: .5rem; padding: .6rem .9rem; padding-top: calc(.6rem + env(safe-area-inset-top)); background: #fff; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.print-bar strong { color: var(--primary); }
.print-frame-wrap { flex: 1; overflow: auto; padding: 1rem; display: flex; justify-content: center; }
.print-frame { width: 100%; max-width: 860px; height: 100%; min-height: 1100px; border: 0; background: #fff; box-shadow: var(--shadow-lg); }

/* ── pantalla de sala ── */
.pantalla-sala { position: fixed; inset: 0; z-index: 80; background: #0b2237; color: #fff; display: flex; flex-direction: column; padding: 3vh 4vw; overflow: hidden; }
.ps-body > * { min-width: 0; overflow: hidden; }
.ps-controls { display: flex; align-items: center; gap: 1vw; }
.ps-btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 10px; font-size: 1.1vw; padding: .4vh .9vw; cursor: pointer; opacity: .7; }
.ps-btn:hover { opacity: 1; }
.ps-head { display: flex; align-items: center; justify-content: space-between; opacity: .9; }
.ps-head h1 { font-size: 2.2vw; letter-spacing: .1em; }
.ps-clock { font-size: 2.2vw; font-variant-numeric: tabular-nums; }
.ps-body { flex: 1; display: grid; grid-template-columns: 1.3fr 1fr; gap: 4vw; align-items: center; }
.ps-now { text-align: center; }
.ps-label { font-size: 2vw; letter-spacing: .2em; color: #7dd3c8; font-weight: 700; }
.ps-turno { font-size: 11vw; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.ps-nombre { font-size: 2.8vw; font-weight: 600; opacity: .95; }
.ps-sub { font-size: 1.6vw; opacity: .7; }
.ps-next h2 { font-size: 1.6vw; letter-spacing: .15em; color: #7dd3c8; margin-bottom: 1.5vh; }
.ps-empty { font-size: 2vw; opacity: .5; }
.ps-wait-grid { display: flex; flex-wrap: wrap; gap: 1vw; }
.ps-wait { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: 1vw; padding: 1.2vh 1.4vw; text-align: center; min-width: 9vw; }
.ps-wait .ps-t { font-size: 2.4vw; font-weight: 800; font-variant-numeric: tabular-nums; }
.ps-wait .ps-n { font-size: 1.1vw; opacity: .8; max-width: 12vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-nota { margin-top: 2.5vh; font-size: 1.1vw; opacity: .45; font-style: italic; }

/* ── barra inferior (móvil) ── */
.bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--card); border-top: 1px solid var(--border); padding: .25rem .3rem calc(.25rem + env(safe-area-inset-bottom)); justify-content: space-around; }
.bnav-item { display: flex; flex-direction: column; align-items: center; gap: .05rem; background: none; border: none; color: var(--muted); font-size: .62rem; font-weight: 600; padding: .25rem .4rem; border-radius: 9px; min-width: 54px; }
.bnav-item .nav-ico { font-size: 1.3rem; }
.bnav-item.active { color: var(--primary); }

/* ── utilidades ── */
.muted { color: var(--muted); } .small { font-size: .82rem; } .mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; }
.flex { display: flex; align-items: center; gap: .5rem; } .flex-wrap { flex-wrap: wrap; } .spacer { flex: 1; }
.empty-state { text-align: center; color: var(--muted); padding: 1.6rem 1rem; font-size: .92rem; }
.empty-state .es-ico { font-size: 2.2rem; display: block; margin-bottom: .3rem; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: .8rem; }
.filters label.field { margin-bottom: 0; flex: 1; min-width: 140px; }

/* ── responsive ── */
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .form-row-4 { grid-template-columns: 1fr 1fr; } .linea-din { grid-template-columns: 1fr 1fr; } }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } .exp-head { grid-template-columns: auto 1fr; } .exp-acciones { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; } }
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 60; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .hamb { display: block; }
  .bottom-nav { display: flex; }
  .view { padding: .9rem .9rem 5.5rem; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .acciones-fijas { bottom: calc(56px + env(safe-area-inset-bottom)); }
  .toast-root { bottom: calc(70px + env(safe-area-inset-bottom)); }
  body.en-pantalla .toast-root { bottom: 1rem; }
  #co-auto { display: none; }
  .acciones-fijas .btn-lg { flex: 1; }
}
@media (max-width: 600px) {
  :root { font-size: 15px; }
  .form-row-4, .linea-din { grid-template-columns: 1fr 1fr; }
  .grid-4 { gap: .5rem; } .stat { padding: .6rem .7rem; } .stat-num { font-size: 1.4rem; }
  .card { padding: .9rem; }
  .queue-actions .btn-sm { padding: .3rem .5rem; }
  .queue-turno { width: 46px; height: 44px; font-size: .9rem; }
  .exp-foto { width: 72px; height: 72px; } .exp-foto-ico { font-size: 2rem; }
  .exp-acciones .btn { flex: 1 1 45%; }
  .cal-day { min-height: 50px; padding: .2rem .25rem; }
  .cal-cupo, .cal-flag { font-size: .6rem; }
  .med-item { grid-template-columns: 1fr auto; } .med-num { display: none; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-height: 94dvh; border-radius: 16px 16px 0 0; }
  .btn-lg { font-size: .95rem; }
  .hero-search .btn-lg { flex: 1 1 100%; }
  .print-frame { min-height: 900px; }
  .ps-btn { font-size: .8rem; padding: .3rem .6rem; }
  .ps-head h1, .ps-clock { font-size: 1rem; } .ps-body { grid-template-columns: 1fr; } .ps-turno { font-size: 20vw; } .ps-nombre { font-size: 6vw; } .ps-label, .ps-next h2 { font-size: 4vw; } .ps-wait .ps-t { font-size: 6vw; } .ps-wait .ps-n { font-size: 3vw; max-width: 30vw; } .ps-empty { font-size: 4vw; } .ps-nota { font-size: 3vw; }
}
@media (hover: none) { .queue-info strong, .queue-info small { white-space: normal; } }
@media print { body { background: #fff; } .sidebar, .topbar, .bottom-nav, .toast-root, #modal-root { display: none !important; } }
