:root {
  --bg: #EBF0EF;
  --surface: #FFFFFF;
  --surface-2: #F6F9F8;
  --ink: #12343B;
  --ink-soft: #5C7378;
  --primary: #0E5C67;
  --primary-2: #0A464F;
  --accent: #E0803A;
  --line: #DBE6E5;
  --ok: #1F7A5A;
  --ok-bg: #E3F3EC;
  --warn: #9A5B12;
  --warn-bg: #F7ECDB;
  --neutral-bg: #EAF0EF;
  --danger: #A23B3B;
  --danger-bg: #F6E6E4;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(18,52,59,.04), 0 8px 24px rgba(18,52,59,.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
}

/* ---------- Layout ---------- */
.app { display: block; min-height: 100vh; }

/* Barra superior horizontal */
.topbar {
  background: var(--primary-2);
  color: #CFE3E2;
  display: flex; align-items: center; gap: 28px;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
  height: 62px;
}

.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #f0a765);
  position: relative; flex: none;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 7px 11px;
  border-left: 3px solid #fff; border-radius: 2px;
  transform: rotate(18deg);
}
.brand-name {
  font-family: "Fraunces", serif; font-size: 20px; color: #fff; font-weight: 500; letter-spacing: .2px;
  white-space: nowrap; overflow: hidden; text-overflow: clip; min-width: 0;
  display: inline-block; max-width: 100%;
}
/* flex: 0 (no crece) para dejar sitio al menú; el ancho máximo obliga a que
   el nombre se achique más si hace falta, en vez de robarle espacio al menú. */
.brand { min-width: 0; overflow: hidden; flex: 0 1 auto; max-width: 42vw; }
.topbar { overflow: hidden; }
@media (max-width: 820px) {
  .brand { max-width: 60vw; }
}
.brand-name em { font-style: normal; color: #9FC6C4; font-weight: 400; }

.topnav { display: flex; align-items: center; gap: 4px; flex: 1; overflow-x: auto; }
.topnav-item {
  background: none; border: none; cursor: pointer;
  color: #A9C9C7; font: inherit; font-size: 14.5px; white-space: nowrap;
  padding: 9px 15px; border-radius: 9px; transition: background .15s, color .15s;
}
.topnav-item:hover { background: rgba(255,255,255,.06); color: #E7F1F0; }
.topnav-item.is-active { background: var(--primary); color: #fff; font-weight: 500; }

.topbar-user { display: flex; align-items: center; gap: 10px; flex: none; font-size: 12.5px; color: #9FC6C4; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #57C08A; box-shadow: 0 0 0 3px rgba(87,192,138,.2); }

/* Fila de subpestañas */
.subnav {
  background: #fff; border-bottom: 1px solid var(--line, #E8EDEE);
  display: flex; align-items: center; gap: 2px;
  padding: 0 28px; position: sticky; top: 62px; z-index: 40;
  overflow-x: auto;
}
.subnav-item {
  background: none; border: none; cursor: pointer; font: inherit; font-size: 14px;
  color: var(--ink-soft); padding: 13px 16px; border-bottom: 2.5px solid transparent;
  white-space: nowrap; transition: color .15s, border-color .15s;
}
.subnav-item:hover { color: var(--ink); }
.subnav-item.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.main { padding: 18px 28px 48px; max-width: none; margin: 0; }

/* ---------- Sections ---------- */
.section { display: none; animation: rise .25s ease; }
.section.is-active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .section { animation: none; } }

.head { margin-bottom: 16px; text-align: left; }
.head h1 { font-family: "Fraunces", serif; font-weight: 500; font-size: 22px; margin: 0; letter-spacing: -.2px; }
.sub { color: var(--ink-soft); margin: 5px 0 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.card-title { font-family: "Fraunces", serif; font-weight: 500; font-size: 18px; margin: 0 0 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.card-head .card-title { margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

/* ---------- Forms ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.grid label.wide { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-soft); font-weight: 500; }
input, select {
  font: inherit; font-size: 14.5px; color: var(--ink);
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #9DB1B4; }
input:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14,92,103,.14); background: #fff;
}

.btn {
  background: var(--primary); color: #fff; border: none; cursor: pointer;
  font: inherit; font-weight: 500; font-size: 14.5px;
  padding: 11px 20px; border-radius: 10px; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--primary-2); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--line); text-decoration: none; display: inline-block; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--primary); }
.btn.sm { padding: 8px 15px; font-size: 13.5px; }
.panel-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.stat-label { display: block; color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.stat-num { display: block; font-family: "Fraunces", serif; font-size: 40px; font-weight: 500; margin-top: 8px; letter-spacing: -.5px; }

/* ---------- Calendario ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.cal-head .card-title { margin: 0; }
.cal-nav { display: flex; gap: 6px; }
.cal-nav .chip { min-width: 34px; text-align: center; font-weight: 500; }

.cal-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.cal { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 12.5px; }
table.cal th, table.cal td { border: 1px solid var(--line); }

.cal-corner { background: var(--surface-2); position: sticky; left: 0; z-index: 3; width: 54px; }
.cal-day { padding: 8px 6px; text-align: center; font-family: "Fraunces", serif; font-weight: 500; font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--ink); background: var(--surface-2); border-bottom: none; }
.cal-prof { padding: 6px 8px; text-align: center; font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-soft); background: var(--surface-2); white-space: nowrap; min-width: 92px; }
.cal-day.es-hoy, .cal-prof.es-hoy { background: var(--ok-bg); color: var(--primary); }

.cal-time { padding: 4px 8px; text-align: right; font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-soft); background: var(--surface-2); position: sticky; left: 0; z-index: 2; white-space: nowrap; font-weight: 400; }
.cal-cell { height: 30px; padding: 2px; vertical-align: top; background: #fff; }
.cal-cell.es-hoy-col { background: #F3F9F6; }

.cal-cita {
  display: block; width: 100%; border: none; cursor: pointer;
  font: inherit; font-size: 11px; text-align: left; padding: 3px 6px;
  border-radius: 5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; color: var(--ink); border-left: 3px solid transparent;
}
.cal-cita.reservada { background: var(--neutral-bg); border-left-color: var(--ink-soft); }
.cal-cita.confirmada { background: var(--ok-bg); border-left-color: var(--ok); color: var(--ok); }
.cal-cita.realizada { background: #E4EEF3; border-left-color: #2C6B87; color: #2C6B87; }
.cal-cita:hover { filter: brightness(.96); }
.search { max-width: 260px; background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-soft); font-weight: 600; padding: 0 14px 10px; }
td { padding: 12px 14px; border-top: 1px solid var(--line); font-size: 14px; }
td.right, th.right { text-align: right; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
.clickable { cursor: pointer; }
.mono { font-family: "IBM Plex Mono", monospace; }
.id-cell { font-family: "IBM Plex Mono", monospace; color: var(--ink-soft); font-size: 13px; }
.empty-row td { color: var(--ink-soft); text-align: center; padding: 26px; }

/* ---------- Badges ---------- */
.badge { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 999px; display: inline-block; }
.badge.reservada { background: var(--neutral-bg); color: var(--ink-soft); }
.badge.confirmada { background: var(--ok-bg); color: var(--ok); }
.badge.realizada { background: #E4EEF3; color: #2C6B87; }
.badge.cancelada { background: var(--danger-bg); color: var(--danger); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.chip {
  font: inherit; font-size: 12.5px; border: 1px solid var(--line); background: #fff;
  color: var(--ink-soft); padding: 5px 10px; border-radius: 8px; cursor: pointer;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.link-del { color: var(--danger); background: none; border: none; cursor: pointer; font: inherit; font-size: 13px; }
.link-del:hover { text-decoration: underline; }

/* ---------- Mini list (catálogo) ---------- */
.mini-list { list-style: none; padding: 0; margin: 6px 0 0; }
.mini-list li { padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; display: flex; justify-content: space-between; }
.mini-list li span { color: var(--ink-soft); font-family: "IBM Plex Mono", monospace; font-size: 13px; }

/* ---------- Drawer (ficha) ---------- */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(18,52,59,.28);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 430px; max-width: 92vw;
  background: var(--surface); box-shadow: -12px 0 40px rgba(18,52,59,.14);
  transform: translateX(100%); transition: transform .25s ease; z-index: 50;
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer-backdrop { transition: none; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 24px 24px 18px; border-bottom: 1px solid var(--line); }
.drawer-title { font-family: "Fraunces", serif; font-weight: 500; font-size: 22px; margin: 0; }
.drawer-sub { color: var(--ink-soft); margin: 4px 0 0; font-size: 13.5px; }
.icon-btn { background: var(--surface-2); border: 1px solid var(--line); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--ink-soft); font-size: 14px; }
.icon-btn:hover { color: var(--ink); border-color: var(--primary); }
.drawer-body { padding: 20px 24px; overflow-y: auto; }
.drawer-block { margin-bottom: 26px; }
.drawer-block h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-soft); margin: 0 0 12px; }

.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li { padding: 11px 0; border-top: 1px solid var(--line); font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.doc-list li.empty { color: var(--ink-soft); justify-content: flex-start; }
.doc-cat { font-size: 11.5px; color: var(--primary); background: var(--ok-bg); padding: 2px 8px; border-radius: 6px; }
.doc-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-list a { color: var(--primary); text-decoration: none; font-size: 13px; font-weight: 500; }
.doc-list a:hover { text-decoration: underline; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 200;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  html, body, .app { max-width: 100vw; overflow-x: hidden; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
  .topbar-user { display: none; }
  .subnav { top: 0; padding: 0 12px; }
  .main { padding: 22px 16px 48px; max-width: 100%; box-sizing: border-box; }
  .section { max-width: 100%; overflow-x: hidden; }
  .grid, .stats, .two-col { grid-template-columns: 1fr; }
  input, select, textarea {
    max-width: 100%;
    box-sizing: border-box;
  }
  .card { max-width: 100%; overflow-x: auto; box-sizing: border-box; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ---------- Ficha de paciente ---------- */
.ficha-titulo { margin-top: 12px; }
.id-pill { font-family: "IBM Plex Mono", monospace; font-size: 12.5px; background: var(--neutral-bg); color: var(--ink-soft); padding: 3px 9px; border-radius: 999px; }
.ficha-cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; align-items: start; }
.ficha-cols > div { min-width: 0; }
.grid.three { grid-template-columns: 1fr 1fr 1fr; }
textarea {
  font: inherit; font-size: 14.5px; color: var(--ink);
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); resize: vertical; transition: border-color .15s, box-shadow .15s;
}
textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,92,103,.14); background: #fff; }
.hint { font-size: 12.5px; color: var(--ink-soft); margin: 10px 0 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.form-card h2.card-title:not(:first-child) { margin-top: 22px; }

.badge.pagada { background: var(--ok-bg); color: var(--ok); }
.badge.pendiente { background: var(--warn-bg); color: var(--warn); }
.obs-cell { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }

@media (max-width: 1000px) {
  .ficha-cols { grid-template-columns: 1fr; }
  .grid.three { grid-template-columns: 1fr 1fr; }
}

/* ---------- Mejoras calendario y pagos ---------- */
.badge.parcial { background: var(--warn-bg); color: var(--warn); }

.cal-filter {
  font: inherit; font-size: 13px; color: var(--ink);
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); max-width: 210px;
}
.cal-filter:focus { outline: none; border-color: var(--primary); }

/* La cita se estira tantas franjas (30px cada una) como dure el servicio */
td.cal-cell { position: relative; overflow: visible; }
td.cal-cell[data-cal-tipo="citas"] { cursor: pointer; }
td.cal-cell[data-cal-tipo="citas"]:hover { background: rgba(14, 92, 103, 0.04); }
.cal-cita {
  position: absolute; top: 2px; left: 2px; right: 2px;
  height: calc(var(--span, 1) * 30px - 4px);
  z-index: 1; display: flex; flex-direction: column; align-items: flex-start;
  gap: 1px; overflow: hidden; line-height: 1.25; padding: 3px 6px;
}
.cal-cita:hover { z-index: 2; }
.cc-nombre { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cc-tel { font-family: "IBM Plex Mono", monospace; font-size: 10px; opacity: .8; }
.cc-obs { font-size: 10px; opacity: .85; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; }

/* ---------- Login y sesión ---------- */
.login-screen {
  position: fixed; inset: 0; background: var(--primary-2);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.login-card {
  background: var(--surface); border-radius: 18px; padding: 36px 34px;
  width: 360px; max-width: 92vw; box-shadow: 0 24px 60px rgba(0,0,0,.25);
  display: flex; flex-direction: column; gap: 14px;
}
.login-logo { display: flex; justify-content: center; margin-bottom: 6px; }
.login-logo img { max-height: 90px; max-width: 220px; width: auto; height: auto; object-fit: contain; }
.login-brand { margin-bottom: 4px; }

/* Cobros: pendientes y nuevo cobro en la misma fila */
.cobros-row { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: start; margin-bottom: 20px; }
.cobros-row > .card { margin-bottom: 0; }
@media (max-width: 1000px) { .cobros-row { grid-template-columns: 1fr; } }

/* Imagen corporativa (Administración) */
.marca-card { margin-top: 20px; }
.marca-fila { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.marca-preview {
  width: 220px; height: 100px; border: 1px dashed var(--line); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; background: var(--primary-2);
  overflow: hidden;
}
.marca-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.marca-vacia { color: var(--ink-soft); font-size: 13px; }
.marca-acciones { display: flex; gap: 10px; flex-wrap: wrap; }
.login-title { font-family: "Fraunces", serif; font-weight: 500; font-size: 24px; margin: 0 0 6px; }
.login-btn { margin-top: 6px; }
.login-error { color: var(--danger); font-size: 13.5px; min-height: 18px; margin: 0; }

.rail-user { display: flex; align-items: center; gap: 8px; }
.rail-salir {
  background: none; border: 1px solid rgba(255,255,255,.18); color: #A9C9C7;
  font: inherit; font-size: 12.5px; padding: 6px 11px; border-radius: 8px; cursor: pointer;
}
.rail-salir:hover { color: #fff; border-color: rgba(255,255,255,.4); }

.oculto { display: none !important; }

/* ---------- Expediente y analítica ---------- */
.expediente { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.doc-link { background: none; border: none; color: var(--primary); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; padding: 0; }
.doc-link:hover { text-decoration: underline; }

.check-row { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); font-weight: 400; }
.check input { accent-color: var(--primary); width: 16px; height: 16px; }
.total-row td { border-top: 2px solid var(--line); }

/* hidden debe ganar a los display de las clases */
.login-screen[hidden], .app[hidden] { display: none !important; }

/* ---------- Modales ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(18,52,59,.32);
  opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 80;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--surface); border-radius: 16px; padding: 26px;
  width: 800px; max-width: 94vw; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 70px rgba(18,52,59,.3); z-index: 90;
}
.modal[hidden] { display: none !important; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.modal-head .card-title { margin: 0; }

.head-actions { display: flex; gap: 10px; align-items: center; }
.check-inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 13.5px; color: var(--ink-soft); }
.check-inline input { accent-color: var(--primary); width: 15px; height: 15px; }
.badge.espera { background: #EAE6F4; color: #5B4A8A; }

/* ---------- Filtros en cabeceras ---------- */
.filtro-fecha { flex-direction: row; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }
.filtro-fecha input, .filtro-fecha select { padding: 6px 9px; font-size: 13px; }
.card-head .head-actions { flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Caja ---------- */
.caja-stats { grid-template-columns: repeat(4, 1fr); }
.stat-num.sm { font-size: 28px; }
.stat.destacada { background: var(--primary); }
.stat.destacada .stat-label, .stat.destacada .stat-num { color: #fff; }
.form-card.bloqueada { opacity: .7; }
.dif-preview, .cerrada-msg { padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 500; margin-bottom: 14px; }
.dif-preview.ok, .cerrada-msg.ok { background: var(--ok-bg); color: var(--ok); }
.dif-preview.warn, .cerrada-msg.warn { background: var(--warn-bg); color: var(--warn); }
.cerrada-msg { margin-top: 12px; margin-bottom: 0; }
@media (max-width: 1000px) { .caja-stats { grid-template-columns: 1fr 1fr; } }

/* Panel con 5 tarjetas (citas, pacientes, 3 métodos) */
#stats-panel { grid-template-columns: repeat(5, 1fr); }
#stats-panel .stat-num.sm { font-size: 26px; }
@media (max-width: 1100px) { #stats-panel { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { #stats-panel { grid-template-columns: 1fr 1fr; } }

/* ---------- Bloqueos en calendario ---------- */
.cal-cell.bloq { background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(90,74,138,.10) 5px, rgba(90,74,138,.10) 10px); }
.cal-cell.bloq-vacaciones { background-color: #EFF4FB; }
.cal-cell.bloq-baja { background-color: #FBEEEE; }
.cal-cell.bloq-permiso { background-color: #F3F0FA; }
.cal-cell.bloq-otro { background-color: #F2F2F0; }
.badge.motivo-vacaciones { background: #E4EEF3; color: #2C6B87; }
.badge.motivo-baja { background: var(--danger-bg); color: var(--danger); }
.badge.motivo-permiso { background: #EAE6F4; color: #5B4A8A; }
.badge.motivo-otro { background: var(--neutral-bg); color: var(--ink-soft); }

/* ---------- Botón WhatsApp ---------- */
.chip.wa { border-color: #25D366; color: #128C4B; }
.chip.wa:hover { background: #E7F8EE; border-color: #128C4B; }

/* ---------- Botón WhatsApp en ficha ---------- */
.ficha-head { display: flex; justify-content: space-between; align-items: flex-start; }
.wa-btn { background: #25D366; border: none; display: inline-flex; align-items: center; gap: 8px; }
.wa-btn:hover { background: #1EBE5A; }
.wa-ico { font-size: 16px; }
td.center, th.center { text-align: center; }

/* ---------- Clases ---------- */
.cal-cita.clase { background: #EAF3F1; border-left: 3px solid var(--primary); }
.cal-cita.clase.cancelada { opacity: .5; text-decoration: line-through; }
.cal-cita.clase .cc-obs .badge { font-size: 10px; }

/* ============ Rediseño Panel ============ */
/* Tareas de inicio */
.onboarding { margin-bottom: 24px; }
.task-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 2px; }
.task { display: flex; align-items: center; gap: 14px; padding: 16px 8px; border-bottom: 1px solid var(--line, #E8EDEE); }
.task:last-child { border-bottom: none; }
.task-check { flex: 0 0 26px; height: 26px; border-radius: 50%; border: 2px solid #CBD8DA; display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 700; }
.task.done .task-check { background: var(--primary); border-color: var(--primary); }
.task-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.task-title { font-weight: 600; color: var(--ink); }
.task.done .task-title { color: var(--ink-soft); }
.task-desc { font-size: 13px; color: var(--ink-soft); }
.task-state { color: var(--primary); font-weight: 600; font-size: 14px; }

/* Cabecera de métricas + selector de periodo */
.metrics-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; background: #EDF2F2; border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--ink-soft); cursor: pointer; transition: all .15s; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 600; }

/* Tarjeta de total destacada */
#stats-panel { grid-template-columns: repeat(6, 1fr); }
.stat-total { grid-column: span 2; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; }
.stat-total .stat-label { color: rgba(255,255,255,.85); }
.stat-total .stat-num { color: #fff; }
.stat-foot { display: block; font-size: 12px; color: rgba(255,255,255,.75); margin-top: 4px; }
@media (max-width: 1100px) { #stats-panel { grid-template-columns: repeat(2, 1fr); } .stat-total { grid-column: span 2; } }
@media (max-width: 640px) { #stats-panel { grid-template-columns: 1fr; } .stat-total { grid-column: span 1; } }


/* Botón cerrar sesión en topbar */
.topbar .rail-salir {
  background: rgba(255,255,255,.1); color: #E7F1F0; border: none;
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 12.5px;
}
.topbar .rail-salir:hover { background: rgba(255,255,255,.18); }

/* Placeholder "Próximamente" (Bonos) */
.placeholder-card { text-align: center; }
.placeholder { padding: 40px 20px; max-width: 460px; margin: 0 auto; }
.placeholder-badge {
  display: inline-block; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px; margin-bottom: 14px;
}
.placeholder p { color: var(--ink-soft); line-height: 1.6; }

/* ============ Accesos directos ============ */
.shortcuts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.shortcut {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: #fff; border: 1px solid var(--line, #E8EDEE); border-radius: 14px;
  padding: 16px 18px; cursor: pointer; transition: box-shadow .15s, transform .1s, border-color .15s;
}
.shortcut:hover { box-shadow: 0 4px 14px rgba(0,0,0,.07); border-color: var(--primary); transform: translateY(-1px); }
.shortcut-ico {
  flex: none; width: 42px; height: 42px; border-radius: 11px;
  background: #EAF3F1; color: var(--primary); display: grid; place-items: center;
  font-size: 20px; font-weight: 700;
}
.shortcut-txt { display: flex; flex-direction: column; gap: 1px; }
.shortcut-txt strong { color: var(--ink); font-size: 14.5px; }
.shortcut-txt small { color: var(--ink-soft); font-size: 12.5px; }
@media (max-width: 760px) { .shortcuts { grid-template-columns: 1fr; } }

/* ============ Avatares de profesional ============ */
.avatar { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none; display: inline-grid; place-items: center; vertical-align: middle; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.avatar-ini { background: var(--primary); color: #fff; font-size: 13px; font-weight: 600; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.emp-cell { display: flex; align-items: center; gap: 10px; }

/* Campo de foto en el formulario */
.foto-field { display: flex; align-items: center; gap: 12px; }
.foto-preview { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line, #E8EDEE); }

/* ============ Calendario rotado (días en filas, horas en columnas) ============ */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-subhead { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.cal-subhead .card-title { margin: 0; }

.calr-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.calr { min-width: max-content; background: #fff; }
.calr-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.calr-row:last-child { border-bottom: none; }

.calr-daylabel {
  flex: none; width: 66px; position: sticky; left: 0; z-index: 3;
  background: var(--surface-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  font-family: "Fraunces", serif; font-size: 12px; color: var(--ink); padding: 6px 4px; line-height: 1.2;
}
.calr-daylabel span { font-size: 17px; font-weight: 500; }
.calr-daylabel.es-hoy { background: var(--ok-bg); color: var(--primary); }
.calr-corner { background: var(--surface-2); }

.calr-lane { position: relative; display: block; }
.calr-headrow { position: sticky; top: 0; z-index: 4; background: var(--surface-2); }
.calr-hlane { display: flex; }
.calr-hcell {
  width: var(--slot-w); flex: none; box-sizing: border-box;
  font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--ink-soft);
  padding: 7px 0 6px 4px; border-left: 1px solid transparent;
}
.calr-hcell.calr-hour { border-left: 1px solid var(--line); }

.calr-slot {
  position: absolute; top: 0; bottom: 0; width: var(--slot-w);
  border-left: 1px solid #F0F4F4;
}
.calr-slot.calr-slot-hour { border-left: 1px solid var(--line); }
/* posicionar los slots de fondo en fila */
.calr-lane .calr-slot:nth-child(n) { }
.calr-lane { }
/* usamos flex para el fondo */
.calr-lane > .calr-slot { position: static; display: inline-block; height: 100%; vertical-align: top; }
.calr-lane { white-space: nowrap; font-size: 0; }

.calr-chip {
  position: absolute; box-sizing: border-box; z-index: 2;
  border: none; border-left: 3px solid var(--ink-soft); border-radius: 5px;
  background: var(--neutral-bg); cursor: pointer; overflow: hidden;
  padding: 3px 6px; text-align: left; font-size: 11px; white-space: nowrap; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 4px;
}
.calr-chip .cc-nombre { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.calr-chip .cc-prof { color: var(--ink-soft); font-weight: 400; }
.calr-chip.reservada { background: var(--neutral-bg); border-left-color: var(--ink-soft); }
.calr-chip.confirmada { background: var(--ok-bg); border-left-color: var(--ok); }
.calr-chip.realizada { background: #E4EEF3; border-left-color: #2C6B87; }
.calr-chip.clase { background: #EAF3F1; border-left-color: var(--primary); }
.calr-chip.clase.cancelada { opacity: .5; text-decoration: line-through; }
.calr-chip:hover { filter: brightness(.96); z-index: 5; }
.calr-chip .badge { font-size: 9px; padding: 1px 5px; }

/* ============ Calendario vertical por horas (12 filas) ============ */
table.cal-vert { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 12px; }
table.cal-vert th, table.cal-vert td { border: 1px solid var(--line); }
table.cal-vert .cal-corner { background: var(--surface-2); position: sticky; left: 0; z-index: 3; width: 54px; }
table.cal-vert .cal-day { padding: 7px 6px; text-align: center; font-family: "Fraunces", serif; font-weight: 500; font-size: 13px; color: var(--ink); background: var(--surface-2); }
table.cal-vert .cal-prof { padding: 5px 8px; text-align: center; font-size: 11px; font-weight: 500; color: var(--ink-soft); background: var(--surface-2); white-space: nowrap; min-width: 90px; }
table.cal-vert .cal-day.es-hoy, table.cal-vert .cal-prof.es-hoy { background: var(--ok-bg); color: var(--primary); }
table.cal-vert .cal-time { padding: 4px 8px; text-align: right; font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-soft); background: var(--surface-2); position: sticky; left: 0; z-index: 2; white-space: nowrap; vertical-align: top; }
.cal-hourcell { position: relative; padding: 0; background: #fff; min-width: 90px; vertical-align: top; }
.cal-hourcell.es-hoy-col { background: #F3F9F6; }
.cal-hourcell.bloq { background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(90,74,138,.10) 5px, rgba(90,74,138,.10) 10px); }
.cal-hourcell.bloq-vacaciones { background-color: #EFF4FB; }
.cal-hourcell.bloq-baja { background-color: #FBEEEE; }
.cal-hourcell.bloq-permiso { background-color: #F3F0FA; }
.cal-hourcell.bloq-otro { background-color: #F2F2F0; }
.cal-hourcell .cal-cita {
  position: absolute; left: 2px; right: 2px; z-index: 2;
  border: none; border-left: 3px solid var(--ink-soft); border-radius: 5px;
  background: var(--neutral-bg); cursor: pointer; overflow: hidden;
  padding: 2px 5px; text-align: left; display: flex; flex-direction: column; gap: 0; line-height: 1.25;
}
.cal-hourcell .cal-cita .cc-nombre { font-weight: 600; color: var(--ink); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-hourcell .cal-cita .cc-tel, .cal-hourcell .cal-cita .cc-obs { font-size: 10px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-hourcell .cal-cita.confirmada { background: var(--ok-bg); border-left-color: var(--ok); }
.cal-hourcell .cal-cita.realizada { background: #E4EEF3; border-left-color: #2C6B87; }
.cal-hourcell .cal-cita.clase { background: #EAF3F1; border-left-color: var(--primary); }
.cal-hourcell .cal-cita.clase.cancelada { opacity: .5; text-decoration: line-through; }
.cal-hourcell .cal-cita:hover { filter: brightness(.96); z-index: 5; }
.cal-hourcell .cal-cita .badge { font-size: 9px; padding: 1px 5px; }

/* ============ Compactado general (más contenido sin scroll) ============ */
.head .sub { font-size: 12.5px; margin-top: 2px; }
.card { padding: 16px 18px; margin-bottom: 14px; }
.card-title { font-size: 15px; }
.card-head { margin-bottom: 10px; }
table { font-size: 12.5px; }
th { font-size: 10.5px; letter-spacing: .4px; }
td, th { padding: 7px 9px; }
label { font-size: 12px; }
input, select, textarea { font-size: 13px; padding: 7px 10px; }
.btn { padding: 8px 14px; font-size: 13px; }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.chip { padding: 5px 10px; font-size: 12px; }
.grid { gap: 10px 14px; }
.stats { gap: 12px; }
.stat { padding: 14px 16px; }
.stat-num { font-size: 26px; }
.stat-num.sm { font-size: 19px; }
.stat-label { font-size: 11.5px; }
.shortcut { padding: 12px 14px; }
.shortcut-ico { width: 34px; height: 34px; font-size: 17px; }
.shortcut-txt strong { font-size: 13px; }
.shortcut-txt small { font-size: 11.5px; }
.shortcuts { gap: 12px; margin-bottom: 18px; }
.task { padding: 11px 6px; }
.task-title { font-size: 13px; }
.task-desc { font-size: 11.5px; }
.task-check { flex-basis: 22px; width: 22px; height: 22px; font-size: 12px; }
.onboarding { margin-bottom: 18px; }
.metrics-head { margin-bottom: 10px; }
.seg button { padding: 6px 12px; font-size: 12px; }
.topbar { height: 54px; }
.topnav-item { padding: 8px 13px; font-size: 13.5px; }
.subnav { top: 54px; }
.subnav-item { padding: 11px 14px; font-size: 13px; }
.hint { font-size: 11.5px; }
.badge { font-size: 10.5px; padding: 2px 7px; }

/* Pestañas dentro de una tarjeta (calendario Citas/Clases) — mismo estilo que la subnav */
.tabs { display: flex; align-items: center; gap: 2px; }
.tabs button {
  background: none; border: none; cursor: pointer; font: inherit; font-size: 13px;
  color: var(--ink-soft); padding: 8px 14px; border-bottom: 2.5px solid transparent;
  transition: color .15s, border-color .15s;
}
.tabs button:hover { color: var(--ink); }
.tabs button.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
/* Accesos directos: 3 por fila (2ª fila = clases) */
.shortcuts { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .shortcuts { grid-template-columns: 1fr; } }

/* Cabeceras de sección ocultas: el menú ya indica dónde estás y así sube el contenido */
.section > .head { display: none; }
.main { padding-top: 14px; }

/* ============ Panel de Administración (superadmin) ============ */
/* El menú destaca del resto */
.topnav-item.topnav-admin {
  background: rgba(224,128,58,.16);
  color: #F3C9A5;
  border: 1px solid rgba(224,128,58,.45);
  margin-left: 8px;
  font-weight: 500;
}
.topnav-item.topnav-admin:hover { background: rgba(224,128,58,.28); color: #fff; }
.topnav-item.topnav-admin.is-active {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224,128,58,.22);
}

/* Cabecera del panel: siempre visible aunque el resto de .head estén ocultas */
.admin-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  background: linear-gradient(135deg, var(--primary-2), #123f47);
  color: #fff; border-radius: 14px; padding: 18px 22px; margin-bottom: 16px;
  border-left: 5px solid var(--accent);
}
.admin-hero h1 { font-family: "Fraunces", serif; font-weight: 500; font-size: 22px; margin: 0 0 3px; }
.admin-hero p { margin: 0; font-size: 12.5px; color: #B7D2D0; }
.admin-badge {
  flex: none; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: .4px; text-transform: uppercase; padding: 5px 11px; border-radius: 999px;
}

.admin-card { border-left: 3px solid var(--accent); }
.admin-card .card-title { color: var(--primary); }
.admin-card textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 10px; font: inherit; font-size: 13px; background: #FAFCFC; resize: vertical;
}
.admin-card .chip.sm { padding: 1px 7px; font-size: 11px; margin-left: 4px; vertical-align: middle; }

.admin-guardar {
  position: sticky; bottom: 0; background: var(--bg, #EFF3F3);
  padding: 12px 0; display: flex; align-items: center; gap: 12px;
  border-top: 1px solid var(--line);
}

/* Botón de acción destructiva */
.btn.peligro { background: #B3403A; color: #fff; }
.btn.peligro:hover { background: #9A342F; }
.no-aplica { display: none; }

/* ============ Horario del profesional ============ */
.hor-dia { display: flex; align-items: flex-start; gap: 16px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.hor-dia:last-child { border-bottom: none; }
.hor-switch { display: flex; align-items: center; gap: 9px; cursor: pointer; flex: 0 0 150px; margin: 0; }
.hor-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.hor-slider { width: 36px; height: 20px; background: #CBD8DA; border-radius: 999px; position: relative; transition: background .15s; flex: none; }
.hor-slider::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .15s; }
.hor-switch input:checked + .hor-slider { background: var(--primary); }
.hor-switch input:checked + .hor-slider::after { transform: translateX(16px); }
.hor-nombre { font-size: 13px; color: var(--ink); font-weight: 500; }
.hor-dia:not(.on) .hor-nombre { color: var(--ink-soft); font-weight: 400; }
.hor-tramos { flex: 1; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hor-tramo { display: flex; align-items: center; gap: 7px; }
.hor-tramo input[type="time"] { padding: 5px 8px; font-size: 12.5px; width: auto; }
.hor-tramo span { color: var(--ink-soft); font-size: 12px; }

/* ============ Próximamente (hoja de ruta) ============ */
.prox-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; border-radius: 14px; padding: 18px 22px; margin-bottom: 16px;
}
.prox-hero h1 { font-family: "Fraunces", serif; font-weight: 500; font-size: 22px; margin: 0 0 3px; }
.prox-hero p { margin: 0; font-size: 12.5px; color: #B7D2D0; max-width: 620px; }
.prox-badge {
  flex: none; background: rgba(255,255,255,.16); color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: .4px; text-transform: uppercase; padding: 5px 11px; border-radius: 999px;
}
.prox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.prox-card { margin: 0; display: flex; flex-direction: column; gap: 7px; }
.prox-card h3 { font-family: "Fraunces", serif; font-weight: 500; font-size: 16px; margin: 0; color: var(--ink); }
.prox-card p { margin: 0; font-size: 12.5px; color: var(--ink-soft); line-height: 1.55; }
.prox-etiqueta {
  align-self: flex-start; font-size: 10.5px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
  background: #EDF2F2; color: var(--ink-soft);
}
.prox-etiqueta.pronto { background: var(--ok-bg); color: var(--ok); }
.prox-etiqueta.estudio { background: #F3EEE7; color: #8A6A3A; }

/* La barra superior desliza sin mostrar la barra de scroll */
/* Barra de desplazamiento fina y visible en el menú superior */
.topnav { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.35) transparent; }
.topnav::-webkit-scrollbar { height: 6px; }
.topnav::-webkit-scrollbar-track { background: transparent; }
.topnav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.30);
  border-radius: 6px;
}
.topnav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.5); }
/* Barra de desplazamiento fina y visible en el submenú (Develop, etc.) */
.subnav { scrollbar-width: thin; scrollbar-color: rgba(18,52,59,.25) transparent; }
.subnav::-webkit-scrollbar { height: 6px; }
.subnav::-webkit-scrollbar-track { background: transparent; }
.subnav::-webkit-scrollbar-thumb {
  background: rgba(18,52,59,.22);
  border-radius: 6px;
}
.subnav::-webkit-scrollbar-thumb:hover { background: rgba(18,52,59,.4); }

/* Avisos publicados por el proveedor */
.aviso-app { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--primary);
  border-radius: 12px; padding: 13px 16px; margin-bottom: 12px; }
.aviso-app.aviso { border-left-color: var(--accent); }
.aviso-app.mantenimiento { border-left-color: #B3403A; }
.aviso-app strong { font-size: 13.5px; }
.aviso-app p { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; white-space: pre-wrap; }


/* --- Ajuste responsive móvil: evitar desbordamiento horizontal --- */
@media (max-width: 820px) {
  /* Todas las rejillas de formulario a una columna */
  .grid, .grid.three, .stats, .two-col,
  .ficha-cols, .form-card .grid { grid-template-columns: 1fr !important; }

  /* Ficha de paciente */
  #ficha .ficha-head { flex-direction: column; gap: 8px; }

  /* Cobros y tablas en móvil */
  .cobros-row { grid-template-columns: 1fr; }
  .caja-stats { grid-template-columns: 1fr 1fr; }
  .ficha-cols { grid-template-columns: 1fr; }
}

/* ─── Botón de fichaje ─────────────────────────────────────── */
#fichar-wrap {
  margin: 0 0 16px;
}

.btn-fichar {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  transition: transform .12s, box-shadow .12s;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}

.btn-fichar:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,.16); }
.btn-fichar:active { transform: translateY(0); }

/* Entrada: verde del tema */
.btn-fichar.entrada {
  background: linear-gradient(135deg, var(--primary) 0%, #16818F 100%);
  color: #fff;
}

/* Salida: rojo adaptado al tema */
.btn-fichar.salida {
  background: linear-gradient(135deg, #C0392B 0%, #9B2C2C 100%);
  color: #fff;
}

#fichar-ico {
  font-size: 22px;
  flex: none;
}

#fichar-txt {
  flex: 1;
  text-align: left;
}

#fichar-sub {
  font-size: 12px;
  opacity: .8;
  font-weight: 400;
}

/* Indicador de fuera de rango en tabla */
.text-warn { color: #C05621; font-weight: 600; }

/* Etiqueta de tipo de empleado */
.badge.tipo-admin {
  background: #E0803A22;
  color: #A85D1F;
  border: 1px solid #E0803A55;
  font-size: 11px;
  padding: 2px 8px;
  margin-left: 6px;
}

/* ─── Matriz de permisos por rol (Develop) ──────────────────────── */
.perm-card { margin-bottom: 18px; padding: 18px 20px; }
.perm-menu {
  margin: 0 0 12px; font-size: 16px; color: var(--primary);
  border-bottom: 2px solid var(--line, #E8EDEE); padding-bottom: 8px;
}
.perm-tabla { width: 100%; border-collapse: collapse; }
.perm-tabla th {
  text-align: left; font-size: 12px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-soft, #6B7B7A); padding: 6px 8px;
}
.perm-tabla td { padding: 10px 8px; border-top: 1px solid var(--line, #EEF2F2); vertical-align: top; }
.perm-col { text-align: center; width: 130px; }
.perm-col input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; accent-color: var(--primary); }
.perm-ayuda { display: block; margin-top: 3px; font-weight: 400; }
@media (max-width: 820px) {
  .perm-col { width: 80px; }
  .perm-tabla th, .perm-tabla td { padding: 8px 4px; font-size: 13px; }
}

/* ─── Separadores de grupo en el submenú (Develop) ──────────────── */
.subnav-grupo {
  display: inline-flex;
  align-items: center;
  flex: none;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft, #8496A0);
  padding: 0 10px 0 14px;
  margin-left: 6px;
  border-left: 1px solid var(--line, #E2E9EA);
  height: 22px;
  white-space: nowrap;
}
/* El primer grupo no necesita la línea divisoria a la izquierda */
.subnav-grupo:first-child {
  border-left: none;
  margin-left: 0;
  padding-left: 4px;
}

/* ─── Checks de especialidades en el formulario de empleado ───── */
/* Checkboxes de especialidades en formulario de empleado */
#e-especialidades-wrap {
  grid-column: 1 / -1;  /* ocupa todo el ancho del grid */
}
#e-especialidades-wrap > label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft, #5C7378);
  margin-bottom: 6px;
}
.checks-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 4px;
  padding: 12px 14px;
  background: var(--bg, #F4F7F7);
  border-radius: 10px;
  border: 1px solid var(--line, #E2E9EA);
}
.check-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  min-width: 140px;
}
.check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  flex: none;
}
/* Especialidades en la lista de empleados */
.emp-esps {
  display: block;
  font-size: 12px;
  color: var(--ink-soft, #8496A0);
  margin-top: 2px;
}

/* ─── Ficha de sesión clínica ─────────────────────────────── */
.ficha-card {
  margin-bottom: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
}
.ficha-card .card-title {
  font-size: 16px;
  margin-bottom: 8px;
}
.ficha-card .sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 10px;
}
.ficha-card textarea {
  width: 100%;
  box-sizing: border-box;
  flex: 1;
  min-height: 80px;
}
.ficha-card .wide {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.ficha-card .wide textarea {
  flex: 1;
}
.ficha-meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ficha-meta .btn { font-size: 12px; padding: 5px 12px; }

/* Modal ancho para ficha de sesión */
.modal.modal-wide { width: 1100px; }

/* Grid 2 columnas para ficha de sesión */
.ficha-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
  align-items: stretch;
}
.ficha-grid .ficha-full { grid-column: 1 / -1; }
.ficha-grid .ficha-bc-tall { grid-row: span 3; }
@media (max-width: 820px) {
  .modal.modal-wide { width: 94vw; }
  .ficha-grid { grid-template-columns: 1fr; }
  .ficha-grid .ficha-bc-tall { grid-row: span 1; max-height: none; }
}

/* Tratamientos: checks más pequeños */
.checks-sm label { font-size: 12.5px; }
.checks-sm input[type="checkbox"] { width: 14px; height: 14px; }

/* Body chart container */
#body-chart-container svg { max-width: 100%; height: auto; }

/* Evolución: radio badges */
.ficha-evol-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.ficha-evol-option {
  cursor: pointer;
  display: flex;
  align-items: center;
}
.ficha-evol-option input { display: none; }
.ficha-evol-option .badge {
  padding: 8px 18px;
  font-size: 14px;
  border: 2px solid transparent;
  transition: all .15s;
  cursor: pointer;
}
.ficha-evol-option input:checked + .badge {
  border-color: currentColor;
  transform: scale(1.05);
  font-weight: 600;
}

/* Icono de ficha en agenda */
.btn-ficha-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background .12s;
  vertical-align: middle;
}
.btn-ficha-icon:hover { background: var(--surface-2); }

/* Icono en calendario */
.cc-ficha {
  cursor: pointer;
  font-size: 11px;
  margin-right: 3px;
}

/* Accesos directos destacados (mismo tema que el botón de fichar) */
.shortcut-destacado {
  background: linear-gradient(135deg, var(--primary) 0%, #16818F 100%);
  border: none;
  color: #fff;
}
.shortcut-destacado:hover {
  box-shadow: 0 6px 18px rgba(14,92,103,.28);
  transform: translateY(-1px);
  border-color: transparent;
}
.shortcut-destacado .shortcut-ico {
  background: rgba(255,255,255,.18);
  color: #fff;
}
.shortcut-destacado .shortcut-txt strong { color: #fff; }
.shortcut-destacado .shortcut-txt small { color: rgba(255,255,255,.78); }

/* Cabecera del panel "Para empezar" con botón de cerrar */
.onboarding-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
