:root {
  /* Marca — navy (estructura y confianza) */
  --navy-900: #0E1B2E;
  --navy-700: #1B2B48;
  --navy-500: #2E4468;
  /* Marca — teal (accion y lo vivo) */
  --teal-700: #2F7573;
  --teal-600: #3E8E8C;
  --teal-500: #55A8A6;
  --teal-300: #93C9C6;
  --teal-100: #D9EBE9;
  --teal-50:  #EFF6F5;

  /* Acento (mapeado a la escala teal) */
  --accent: #55A8A6;         /* teal 500 — rellenos, botones, isotipo */
  --accent-hover: #3E8E8C;   /* teal 600 — hover de boton, estados activos */
  --accent-light: #D9EBE9;   /* teal 100 — fondos suaves, chips, nav activo */
  --accent-dark: #2F7573;    /* teal 700 — TEXTO y links (pasa AA en blanco) */

  /* Neutros */
  --bg: #F6F8F8;             /* papel */
  --surface: #FFFFFF;
  --surface-muted: #F1F4F5;
  --border: #E1E7E8;         /* linea */
  --border-soft: #EAF0F0;
  --text: #0E1B2E;           /* navy 900 */
  --text-muted: #65757E;     /* gris texto */
  --text-soft: #98A6AC;

  /* Semanticos clinicos (el color comunica estado, nunca decora) */
  --success-bg: #E6F3EE;
  --success-text: #2E8B6E;   /* confirmado */
  --warn-bg: #FBF1DC;
  --warn-text: #B9820F;      /* pendiente */
  --danger-bg: #FAE9E7;
  --danger-text: #C0392F;    /* alerta clinica */
  --info-bg: #E7F0F5;
  --info-text: #3B7EA1;      /* informativo */

  /* Tipografia */
  --font-display: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --shadow-xs: 0 1px 2px rgba(16, 30, 54, 0.04);
  --shadow-sm: 0 2px 10px rgba(16, 30, 54, 0.05);
  --shadow-md: 0 10px 28px rgba(16, 30, 54, 0.09);
  --shadow-lg: 0 22px 56px rgba(16, 30, 54, 0.16);
}

/* --- Modo oscuro ----------------------------------------------------------
   El tema se controla de dos formas y ambas terminan en el mismo lugar:
     1. Switch manual (theme.js) -> escribe <html data-theme="dark|light">.
     2. Sin JS: se sigue al sistema operativo con @media (prefers-color-scheme).
   Como TODO el sitio usa var(--...), basta re-definir la paleta y cada
   componente se adapta solo. La paleta oscura se declara una vez en
   %dark-palette y se aplica a las dos condiciones. El bloque @media se ignora
   si el usuario forzo el tema claro ([data-theme="light"]). */

/* Paleta oscura: forzada por el switch. */
:root[data-theme='dark'] {
  color-scheme: dark;   /* scrollbars, inputs nativos, autofill en oscuro */

  --accent: #55A8A6;
  --accent-hover: #6FBFBD;
  --accent-light: #17332F;   /* fondo suave (chips, nav activo) en oscuro */
  --accent-dark: #93C9C6;    /* teal 300 — texto y links legibles en oscuro */

  /* Escala de marca teal: los tonos MUY claros (50/100) se usan como fondo de
     chips/paneles; en oscuro deben oscurecerse o se ven como parches luminosos. */
  --teal-100: #1D3F3B;
  --teal-50:  #16302D;
  --teal-300: #93C9C6;

  /* Escala de marca navy: los navys casi negros se pierden contra el fondo
     oscuro; se aclaran para que isotipo, avatares y panel de login se lean. */
  --navy-900: #22344F;
  --navy-700: #2A3F5E;
  --navy-500: #3A557E;

  /* Neutrales */
  --bg: #0B1521;             /* papel oscuro */
  --surface: #131F2D;
  --surface-muted: #1A2836;
  --border: #2A3B4D;
  --border-soft: #21313F;
  --text: #E8EEF2;
  --text-muted: #9AACB6;
  --text-soft: #6C7E89;

  /* Semanticos (fondos oscuros + texto claro, manteniendo el matiz) */
  --success-bg: #123528;
  --success-text: #57C99B;
  --warn-bg: #362A11;
  --warn-text: #E0B44E;
  --danger-bg: #3A1E1B;
  --danger-text: #E8837A;
  --info-bg: #122E3D;
  --info-text: #74B4D6;

  /* Sombras mas marcadas para que las tarjetas se despeguen del fondo */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 22px 56px rgba(0, 0, 0, 0.55);
}

/* Misma paleta como respaldo sin JS: seguir al SO, salvo si se forzo claro.
   Mantener EN SINCRONIA con :root[data-theme='dark'] de arriba. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --accent: #55A8A6;
    --accent-hover: #6FBFBD;
    --accent-light: #17332F;
    --accent-dark: #93C9C6;
    --teal-100: #1D3F3B;
    --teal-50:  #16302D;
    --teal-300: #93C9C6;
    --navy-900: #22344F;
    --navy-700: #2A3F5E;
    --navy-500: #3A557E;
    --bg: #0B1521;
    --surface: #131F2D;
    --surface-muted: #1A2836;
    --border: #2A3B4D;
    --border-soft: #21313F;
    --text: #E8EEF2;
    --text-muted: #9AACB6;
    --text-soft: #6C7E89;
    --success-bg: #123528;
    --success-text: #57C99B;
    --warn-bg: #362A11;
    --warn-text: #E0B44E;
    --danger-bg: #3A1E1B;
    --danger-text: #E8837A;
    --info-bg: #122E3D;
    --info-text: #74B4D6;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 22px 56px rgba(0, 0, 0, 0.55);
  }
}

/* --- Retoques que no pueden depender solo de tokens (colores hardcodeados en
       los hover de estos botones / el recuadro del QR). Aplican en ambas rutas
       de tema oscuro. --- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .btn-secondary:hover { border-color: var(--text-soft); }
  :root:not([data-theme='light']) .btn-danger-ghost:hover { border-color: var(--danger-text); }
  :root:not([data-theme='light']) #link-qr { background: #fff; }
}
:root[data-theme='dark'] .btn-secondary:hover { border-color: var(--text-soft); }
:root[data-theme='dark'] .btn-danger-ghost:hover { border-color: var(--danger-text); }
:root[data-theme='dark'] #link-qr { background: #fff; }

/* --- Switch de tema (lo inyecta theme.js). En la cabecera de la app y en el
       nav de la landing/pricing va como boton-icono (.btn-icon); en paginas
       sin barra (login, legales) cae al boton flotante de abajo. --- */
.theme-toggle-inline { flex-shrink: 0; }
.theme-toggle-inline svg { width: 18px; height: 18px; }

.theme-toggle-fab {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 850;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.theme-toggle-fab:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle-fab svg { width: 18px; height: 18px; }
@media (max-width: 640px) {
  .theme-toggle-fab { width: 34px; height: 34px; left: 12px; bottom: 12px; }
}
@media print { .theme-toggle-fab { display: none !important; } }

* { box-sizing: border-box; }

.hidden { display: none !important; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-dark); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* Titulos en la familia display (Poppins). Nunca en parrafos. */
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; }

/* --- Marca --- */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
}
a.brand:hover .brand-name { color: var(--accent); }

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--navy-900);
  color: var(--teal-500);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

.brand-mark svg { width: 20px; height: 20px; }

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
}
.brand-name i { font-style: normal; color: var(--teal-600); }

/* --- Formularios --- */

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin: 14px 0 6px;
  color: var(--text-muted);
}

input,
textarea,
select {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

input::placeholder { color: var(--text-soft); }

/* --- Botones --- */

button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

button:active { transform: translateY(1px); }

/* Las clases .btn-* se escribieron para el elemento <button>: el padding, la
   tipografia y el radio viven en la regla `button` de arriba, NO en la clase.
   Un <a class="btn-primary"> heredaba solo el color y salia como un link
   pintado, sin caja.
   Se usa :where(a) a proposito: no suma especificidad, asi que esta regla queda
   en 0,1,0 igual que .btn-sm, .btn-lg o .plan-cta, y como va declarada ANTES,
   cualquiera de esas la sobreescribe. Con `a.btn-primary` (0,1,1) pasaria lo
   contrario y los botones grandes de la landing se encogerian. */
:where(a).btn-primary,
:where(a).btn-secondary,
:where(a).btn-danger-ghost,
:where(a).btn-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  /* El borde transparente es para que el primario mida igual de alto que el
     secundario, que si lleva borde de 1px. */
  border: 1px solid transparent;
}

:where(a).btn-primary:hover,
:where(a).btn-secondary:hover,
:where(a).btn-danger-ghost:hover,
:where(a).btn-whatsapp:hover { text-decoration: none; }

.btn-primary,
.btn-secondary,
.btn-danger-ghost,
.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary svg,
.btn-secondary svg,
.btn-danger-ghost svg,
.btn-whatsapp svg { width: 17px; height: 17px; flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-sm); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-muted); border-color: #cbd5e1; }

.btn-danger-ghost {
  background: transparent;
  color: var(--danger-text);
  border: 1px solid var(--border);
}
.btn-danger-ghost:hover { background: var(--danger-bg); border-color: #f3c6c1; }

.btn-whatsapp {
  background: #25d366;
  color: #fff;
  border: 1px solid #25d366;
}
.btn-whatsapp:hover { background: #1ebe5b; border-color: #1ebe5b; box-shadow: var(--shadow-sm); }
.btn-whatsapp svg { fill: currentColor; }

.btn-icon {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--surface-muted); color: var(--text); }
.btn-icon svg { width: 18px; height: 18px; }

.btn-sm { padding: 7px 12px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.btn-sm svg { width: 15px; height: 15px; flex-shrink: 0; }

/* --- Tarjetas --- */

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

/* --- Mensajes --- */

.error {
  color: var(--danger-text);
  font-size: 13px;
  margin-top: 10px;
  min-height: 16px;
}

.info {
  color: var(--success-text);
  font-size: 13px;
  margin-top: 10px;
  min-height: 16px;
}

/* --- Badges --- */

.badge {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.badge.linked { background: var(--success-bg); color: var(--success-text); }
label .badge { margin-left: 6px; vertical-align: 1px; }
.badge.unlinked { background: var(--warn-bg); color: var(--warn-text); }
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* --- Estados de cita --- */

.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.status-pendiente { background: var(--warn-text); }
.status-dot.status-confirmada { background: var(--success-text); }
.status-dot.status-asistio { background: var(--accent); }
.status-dot.status-cancelada { background: var(--danger-text); }
.status-dot.status-no_asistio { background: var(--text-soft); }

/* Seccion generica dentro de un modal (separada por una linea arriba),
   usada por "Agregar a tu calendario" y por el historial de citas del paciente. */
.modal-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.modal-section-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 8px; }

/* Item de lista de citas reusable (panel "Proximas citas" del calendario,
   historial de citas en la ficha de paciente). */
.upcoming-empty { text-align: center; padding: 22px 8px; color: var(--text-muted); font-size: 13px; }
.upcoming-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
  width: 100%;
}
.upcoming-item:hover { background: var(--surface-muted); }
.upcoming-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent-dark);
  flex-shrink: 0;
  line-height: 1.1;
}
.upcoming-date .day { font-family: var(--font-display); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.upcoming-date .month { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.upcoming-info { min-width: 0; flex: 1; }
.upcoming-info .title { font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upcoming-info .time { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upcoming-item .status-dot { margin-left: 4px; }

/* Item de la tarjeta de recordatorios del calendario (hoy y manana) */
.reminder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: transparent;
}
.reminder-item .reminder-info { min-width: 0; flex: 1; }
.reminder-item .reminder-name { font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reminder-item .reminder-when { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reminder-item.is-sent { opacity: 0.6; }
.reminder-item.is-sent .reminder-name { text-decoration: line-through; }
.reminder-wa-btn {
  flex-shrink: 0;
  padding: 7px;
  border-radius: var(--radius-sm);
  background: #25d366;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.reminder-wa-btn:hover { background: #1ebe5b; box-shadow: var(--shadow-sm); }
.reminder-wa-btn svg { width: 16px; height: 16px; fill: currentColor; }
.reminder-item.is-sent .reminder-wa-btn { background: var(--text-soft); }

.history-group + .history-group { margin-top: 10px; }
.history-group-label { font-size: 11px; font-weight: 600; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.03em; margin: 0 0 4px 8px; }
.history-group .upcoming-item { cursor: default; }
.history-group .upcoming-item:hover { background: transparent; }
#patient-history-list { max-height: 220px; overflow-y: auto; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge.status-pendiente { background: var(--warn-bg); color: var(--warn-text); }
.status-badge.status-confirmada { background: var(--success-bg); color: var(--success-text); }
.status-badge.status-asistio { background: var(--accent-light); color: var(--accent-dark); }
.status-badge.status-cancelada { background: var(--danger-bg); color: var(--danger-text); }
.status-badge.status-no_asistio { background: var(--surface-muted); color: var(--text-muted); }

/* --- Chip de usuario --- */

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
}

.avatar-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--navy-900);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* Foto de perfil dentro del circulo del avatar. El circulo ya recorta en
   redondo; la imagen solo tiene que llenarlo sin deformarse. */
.avatar-circle { overflow: hidden; }
.avatar-foto { width: 100%; height: 100%; object-fit: cover; display: block; }

.user-chip span:last-child {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* --- Cabecera de la app (calendario / pacientes) ---
   Ojo con el selector: las paginas publicas tambien usan <header> (la landing
   con .lp-hero, precios con .pricing-hero) y se estaban comiendo el
   border-bottom, el display:flex y el position:sticky de aqui. De ahi la raya
   que cruzaba la franja de "3 canales". Las cabeceras de la app van sin clase;
   las publicas siempre llevan una. */

header:not([class]) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 10px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

/* En celular la cabecera se parte en tres filas (saludo, buscador, acciones) y,
   pegada arriba, se comia ~210px de 844: un cuarto de la pantalla, siempre.
   Ahi la navegacion ya vive en la barra inferior fija, asi que la cabecera no
   necesita seguir al scroll y se deja correr. El corte es 720px, el mismo al
   que el rail pasa a barra inferior: los dos cambios van juntos. */
@media (max-width: 720px) {
  header { position: static; }
}
.header-left { display: flex; align-items: center; flex-wrap: wrap; row-gap: 8px; }
.header-actions { display: flex; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; }

.header-nav { display: flex; align-items: center; gap: 4px; margin-left: 20px; }
.header-nav a {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.header-nav a:hover { background: var(--surface-muted); color: var(--text); text-decoration: none; }
.header-nav a.active { background: var(--accent-light); color: var(--accent-dark); }

/* --- Menu desplegable del usuario --- */

.user-menu { position: relative; }
.user-chip { cursor: pointer; }
.user-chip:hover { background: var(--border-soft); }
.user-chip .chevron { width: 14px; height: 14px; color: var(--text-muted); transition: transform 0.15s ease; }
.user-chip[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 20;
}
.dropdown-menu.open { display: block; }
.dropdown-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 10px 8px 12px 12px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; }
.dropdown-header .name { font-size: 13px; font-weight: 600; color: var(--text); }
.dropdown-header .email { font-size: 12px; color: var(--text-muted); margin-top: 2px; word-break: break-all; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  border-radius: var(--radius-sm);
  background: transparent;
}
.dropdown-item:hover { background: var(--surface-muted); }
.dropdown-item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-muted); }
.dropdown-item span:not(.badge) { white-space: nowrap; }
.dropdown-item .badge { margin-left: auto; }
.dropdown-item.danger { color: var(--danger-text); }
.dropdown-item.danger svg { color: var(--danger-text); }

.dropdown-tz { padding: 6px 12px 10px; border-top: 1px solid var(--border-soft); margin-top: 4px; }
.dropdown-tz label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); margin: 8px 0 6px; }
.dropdown-tz label svg { width: 15px; height: 15px; flex-shrink: 0; }
.dropdown-tz select { font-size: 13px; padding: 8px 10px; }

@media (max-width: 640px) {
  header { padding: 12px 16px; justify-content: center; }
  .header-left { width: 100%; justify-content: center; }
  .header-nav { margin-left: 0; }
  .header-actions { width: 100%; justify-content: center; }
}

/* --- Modales --- */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 45, 0.45);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.modal-backdrop.open { display: flex; opacity: 1; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 26px;
  width: 340px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.96) translateY(6px);
  transition: transform 0.15s ease;
}
.modal-backdrop.open .modal { transform: scale(1) translateY(0); }

.modal h2 {
  margin: 0 0 18px;
  font-size: 16px;
  font-weight: 600;
}

.modal label { display: block; font-size: 13px; margin: 10px 0 4px; color: var(--text-muted); }
.modal-actions { display: flex; justify-content: space-between; margin-top: 22px; gap: 8px; }
.modal-actions .right { display: flex; gap: 8px; }
.form-error { color: var(--danger-text); font-size: 12px; margin-top: 8px; min-height: 14px; }

.modal-lg { width: 520px; max-width: calc(100vw - 32px); }
.form-row { display: grid; gap: 10px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1.2fr 1fr 1fr; }
.form-row label { margin-top: 0; }
@media (max-width: 520px) {
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
}

#link-code-box { text-align: center; }
#link-code-box p { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin: 0 0 4px; }
#link-code-box .code {
  font-size: 26px;
  letter-spacing: 5px;
  font-weight: 700;
  margin: 10px 0;
  color: var(--accent);
}
#link-qr {
  display: block;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 8px;
  background: #fff;
  margin: 12px auto;
}

/* --- Shell de autenticacion (login / registro / recuperar contrasena) --- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-shell {
  width: 100%;
  max-width: 960px;
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.auth-brand-panel {
  background: linear-gradient(165deg, var(--navy-700) 0%, var(--navy-900) 100%);
  color: #fff;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-brand-panel::after {
  content: '';
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  right: -180px;
  bottom: -200px;
}

.auth-brand-panel .brand-mark {
  background: rgba(255, 255, 255, 0.10);
  color: var(--teal-300);
}

.auth-brand-panel .brand-name {
  color: #fff;
  font-size: 16px;
}

.auth-brand-copy {
  position: relative;
  max-width: 380px;
}

.auth-brand-copy h1 {
  font-size: 30px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}

.auth-brand-copy p {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
  margin: 0;
}

.auth-features {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.auth-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.92);
}

.auth-features li svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-brand-foot {
  position: relative;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--surface);
}

.auth-form-panel .card {
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  box-shadow: none;
}

.auth-form-panel .brand { display: none; }

/* Salida hacia la landing. Sin esto, desde login / recuperar contrasena no
   habia forma de volver a "/" mas que borrando la URL a mano. */
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.auth-back:hover { color: var(--accent-dark); text-decoration: none; }
.auth-back svg { width: 15px; height: 15px; }

@media (max-width: 860px) {
  .auth-page { padding: 0; }
  .auth-shell { grid-template-columns: 1fr; min-height: 100vh; border-radius: 0; box-shadow: none; }
  .auth-brand-panel { display: none; }
  .auth-form-panel .brand { display: flex; margin-bottom: 24px; }
  .auth-back { margin-bottom: 14px; }
  .auth-form-panel .card { border: none; padding: 8px 4px; }
}

/* Aviso con el ID de acceso recien generado de una secretaria. Es el unico dato
   que el doctor no puede volver a deducir por su cuenta, asi que se muestra
   grande y se queda hasta que lo cierra (tambien vive en la lista del equipo). */
.team-nuevo {
  margin: 16px 0;
  padding: 18px 20px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--accent-light);
}
.team-nuevo[hidden] { display: none; }
.team-nuevo-titulo { font-size: 13.5px; font-weight: 600; color: var(--accent-dark); }
.team-nuevo-id {
  margin: 8px 0 10px;
  font-family: var(--font-mono, monospace);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  user-select: all;
}
.team-nuevo .hint { margin: 0 0 14px; }
/* Sobre el fondo teal claro de la caja, un btn-secondary transparente no se lee
   como boton: se le pone el fondo de superficie. */
.team-nuevo .btn-secondary { background: var(--surface); }

/* Fila de una secretaria en Ajustes -> Equipo, con su panel para cambiar la
   contraseña colgando debajo. */
.team-row { padding: 10px 0; border-top: 1px solid var(--border-soft); }
.team-row-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.team-row-acciones { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.team-clave { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.team-clave[hidden] { display: none; }
.team-clave input { flex: 1 1 180px; margin: 0; }
.team-clave .form-error { flex-basis: 100%; margin: 0; }

@media (max-width: 560px) {
  .team-row-top { flex-direction: column; align-items: flex-start; }
  .team-row-acciones { width: 100%; }
  .team-row-acciones button { flex: 1; }
}

/* --- Clínica (Ajustes) --- */
.clinica-cabeza { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.clinica-nombre { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.clinica-lugares { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.clinica-bloque { margin-top: 22px; }
.clinica-bloque h3 { font-size: 14px; margin: 0 0 6px; }
.clinica-etiqueta { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--accent-light); color: var(--accent-dark); vertical-align: 1px; }
.clinica-sub { font-size: 12px; color: var(--text-muted); }
.clinica-doctores { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; }
.clinica-doctores label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; font-weight: 400; }
.clinica-doctores input { width: auto; margin: 0 2px 0 0; }
.clinica-unirse { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.clinica-unirse input { flex: 1 1 200px; margin: 0; font-family: var(--font-mono, monospace); text-transform: uppercase; letter-spacing: 0.06em; }

/* Selector de doctor de la recepción compartida (secretaria de clínica). */
.recepcion-bar { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 7px 16px; font-size: 13px; background: var(--accent-light); color: var(--accent-dark); border-bottom: 1px solid var(--border-soft); }
.recepcion-bar select { width: auto; margin: 0; padding: 4px 8px; font-size: 13px; }

/* --- Suscripción (Ajustes) ---
   Ojo: el panel /admin ya tiene su propia .sub-pill (estilo inline en
   admin.html). Por eso estas clases van con otro nombre: si se llamaran igual,
   el margin de aqui se colaria en las pildoras de la tabla de admin. --- ----------------------------------------------
   Los colores salen de los tokens de estado, así que el modo oscuro ya queda
   resuelto por las redefiniciones de :root de arriba. */
.sub-state {
  margin-bottom: 18px;
}

.sub-status-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.sub-status-pill-trial    { background: var(--warn-bg);    color: var(--warn-text); }
.sub-status-pill-activo   { background: var(--success-bg); color: var(--success-text); }
.sub-status-pill-cortesia { background: var(--accent-light); color: var(--accent-dark); }
.sub-status-pill-vencido  { background: var(--surface-muted); color: var(--text-muted); }

.sub-plan {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--surface-muted);
}

.sub-plan-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sub-plan-head .hint { margin: 4px 0 0; }

.sub-plan-price {
  text-align: right;
  white-space: nowrap;
}

.sub-plan-price span {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sub-plan-price small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

/* Aviso de suscripción (cabecera compartida). */
.sub-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 16px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

.sub-banner a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

/* --- Rail de navegación -----------------------------------------------------
   Columna fija de iconos a la izquierda. El contenido de la página no se
   re-maqueta: solo se recorre con padding-left en el body, así las páginas que
   ya existían siguen funcionando sin tocarles el HTML. */
.app-rail {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 76px;
  z-index: 40;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0 16px;
  gap: 4px;
}

body.has-rail { padding-left: 76px; }

/* Transición entre páginas (Chrome/Edge/Safari 18+; los demás navegan como
   siempre). La página anterior se queda en pantalla hasta que la nueva está
   lista y se funden, en vez de pasar por blanco. El rail tiene nombre propio
   para que se quede quieto mientras el contenido cambia; por eso header.js lo
   pinta sin esperar a /api/me. */
@view-transition { navigation: auto; }
.app-rail { view-transition-name: app-rail; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.18s; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* Barrita de "cargando" al picar un botón del rail (ver prepararNavegacion en
   header.js). Avanza rápido al principio y se frena, sin llegar al final: la
   página nueva la reemplaza. */
body.navegando::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 1000;
  background: var(--accent);
  animation: navegando 2.5s cubic-bezier(0.1, 0.7, 0.3, 1) forwards;
}
@keyframes navegando { to { width: 85%; } }
@media (prefers-reduced-motion: reduce) {
  body.navegando::before { animation: none; width: 85%; opacity: 0.6; }
}

.rail-brand {
  color: var(--accent);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.rail-brand svg { width: 26px; height: 26px; }

.rail-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  overflow-y: auto;
  /* Sin barra visible: el rail es angosto y la barra se come el icono. */
  scrollbar-width: none;
}
.rail-items::-webkit-scrollbar { display: none; }

.rail-item {
  width: 64px;
  min-height: 50px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.12s ease, color 0.12s ease;
}

.rail-item svg { width: 20px; height: 20px; flex-shrink: 0; }

/* El nombre del destino, debajo del icono. Antes solo estaba en `title`, que es
   un tooltip: tarda en salir y en pantalla tactil no existe, asi que en celular
   la barra eran seis iconos a adivinar. */
.rail-label {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Divide los destinos de trabajo diario de los tableros de consulta. */
.rail-sep {
  width: 36px;
  height: 1px;
  background: var(--border);
  margin: 7px 0;
  flex-shrink: 0;
}

.rail-item:hover {
  background: var(--surface-muted);
  color: var(--text);
  text-decoration: none;
}

.rail-item.active {
  background: var(--accent);
  color: #fff;
}

/* En oscuro el teal saturado sobre icono blanco queda bien igual, pero el
   hover del activo no debe apagarlo. */
.rail-item.active:hover { background: var(--accent-hover); color: #fff; }

/* Pie del rail: tema, ajustes y el avatar. Empujado abajo del todo. */
.rail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; }

.rail-tema { background: none; border: none; padding: 6px 2px; font: inherit; }
/* Su gemelo dentro del menu del perfil solo sale en celular (ver el corte de
   720px mas abajo); en escritorio manda el del rail. */
.dropdown-item.solo-movil { display: none; }
.dd-glyph { display: grid; place-items: center; width: 16px; height: 16px; flex-shrink: 0; }
.dd-glyph svg { width: 16px; height: 16px; color: var(--text-muted); }
.rail-glyph { display: grid; place-items: center; width: 20px; height: 20px; }
.rail-glyph svg { width: 20px; height: 20px; }

/* El chip de usuario, ya dentro del rail, se queda en avatar: el nombre y el
   chevron no caben en 64px y el menu ya los muestra al abrirse. */
.user-menu.in-rail { width: 64px; display: flex; justify-content: center; }
.user-menu.in-rail .user-chip {
  width: 64px;
  min-height: 50px;
  flex-direction: column;
  gap: 3px;
  padding: 6px 2px;
  border-radius: 12px;
  background: none;
  border: none;
}
.user-menu.in-rail .user-chip:hover { background: var(--surface-muted); }
.user-menu.in-rail .user-chip #username,
.user-menu.in-rail .user-chip .chevron { display: none; }
.user-menu.in-rail .avatar-circle { width: 24px; height: 24px; font-size: 11px; flex-shrink: 0; }
.user-menu.in-rail .user-chip::after {
  content: 'Perfil';
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text-muted);
}

/* Desde el rail el menu abre hacia arriba y a la derecha, no hacia abajo y a
   la izquierda como cuando colgaba de la esquina de la cabecera. */
.user-menu.in-rail .dropdown-menu {
  top: auto;
  right: auto;
  bottom: 0;
  left: calc(100% + 10px);
}

/* En pantallas chicas el rail pasa a barra inferior: en un celular una columna
   de 60px se come el ancho que necesita la agenda. */
@media (max-width: 720px) {
  .app-rail {
    top: auto;
    right: 0;
    width: auto;
    height: 62px;
    flex-direction: row;
    align-items: stretch;
    justify-content: stretch;
    border-right: none;
    border-top: 1px solid var(--border);
    padding: 4px 4px 5px;
    gap: 0;
  }
  .rail-brand { display: none; }
  /* Los items se reparten el ancho en vez de ir a lo ancho que midan: con
     siete destinos, dejarlos crecer los sacaba de la pantalla. `display:
     contents` disuelve el contenedor para que Ajustes, que vive fuera de el,
     entre al mismo reparto en vez de llevarse una porcion aparte. */
  .rail-items { display: contents; }
  .rail-item { flex: 1 1 0; width: auto; min-width: 0; min-height: 0; padding: 4px 1px; gap: 2px; border-radius: 10px; }
  .rail-item svg { width: 19px; height: 19px; }
  .rail-label { font-size: 8px; letter-spacing: -0.04em; }
  /* En horizontal el separador es una linea vertical, no un guion. */
  .rail-sep { width: 1px; height: 26px; margin: 0 3px; align-self: center; }
  /* `display: contents` tambien aqui: asi Ajustes y Perfil entran al mismo
     reparto que los destinos en vez de repartirse una porcion entre ellos. */
  .rail-foot { display: contents; }
  .rail-tema { display: none; }
  .dropdown-item.solo-movil { display: flex; }
  .user-menu.in-rail, .user-menu.in-rail .user-chip { width: auto; }
  .user-menu.in-rail { flex: 1 1 0; min-width: 0; }
  .user-menu.in-rail .user-chip { min-height: 0; padding: 4px 1px; gap: 2px; width: 100%; }
  .user-menu.in-rail .user-chip::after { font-size: 9px; }
  /* Pegado al borde derecho y hacia arriba: a la derecha del rail ya no hay
     pantalla, y abajo esta la propia barra. */
  .user-menu.in-rail .dropdown-menu {
    left: auto;
    right: 0;
    bottom: calc(100% + 10px);
    min-width: min(280px, calc(100vw - 24px));
  }
  body.has-rail { padding-left: 0; padding-bottom: 62px; }
}

/* ===========================================================================
   Tablero de Inicio
   Todo sale de los tokens de :root, así que el modo oscuro ya queda cubierto
   por las redefiniciones de arriba: aquí no se escribe ni un color literal
   salvo el blanco del texto sobre el teal.
   =========================================================================== */

/* --- Barra superior (saludo + buscador + acciones) --- */
.topbar-greet { flex-direction: column; align-items: flex-start; gap: 2px; }

.topbar-date {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.topbar-greeting {
  margin: 0;
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 0 14px;
  height: 38px;
  min-width: 260px;
}

.topbar-search svg { width: 17px; height: 17px; color: var(--text-muted); flex-shrink: 0; }

.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text);
  width: 100%;
  padding: 0;
}

.topbar-search input::placeholder { color: var(--text-muted); }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 30;
  max-height: 320px;
  overflow-y: auto;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
}
.search-item:hover { background: var(--surface-muted); text-decoration: none; }
.search-vacio { margin: 0; padding: 12px; font-size: 13px; color: var(--text-muted); text-align: center; }

/* --- Rejilla general de la página --- */
.inicio { padding: 20px 24px 40px; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 14px 16px 16px;
  min-height: 92px;
}

/* La tarjeta de "por marcar" se resalta solo cuando hay algo pendiente: si
   siempre estuviera en ámbar dejaría de significar nada. */
.kpi-card.alerta { background: var(--warn-bg); border-color: var(--warn-text); }
.kpi-card.alerta .kpi-rotulo,
.kpi-card.alerta .kpi-valor { color: var(--warn-text); }

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}

.kpi-rotulo { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.kpi-valor { margin: 6px 0 0; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }

.kpi-chip {
  background: var(--accent-light);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.kpi-mono { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.kpi-link { font-size: 12.5px; font-weight: 600; color: var(--accent-dark); }

.kpi-btn {
  background: var(--surface);
  border: 1px solid var(--warn-text);
  color: var(--warn-text);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
}
.kpi-btn:hover { text-decoration: none; opacity: 0.85; }

.inicio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  gap: 16px;
  align-items: start;
}

.inicio-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* --- Calendario del mes (columna derecha) ---------------------------------
   Cada dia lleva `aspect-ratio: 1`, asi que su alto lo manda su ancho. Si se
   deja que las columnas sean 1fr, el calendario crece con la tarjeta y se
   desmadra; con la celda fija y `space-between` el mes llena el ancho pero su
   alto es predecible. 46px es el tamaño comodo para dar un tap. */
.calendario-card .minical-grid {
  grid-template-columns: repeat(7, 46px);
  justify-content: space-between;
  column-gap: 0;
}
.calendario-card .minical-dia { font-size: 13.5px; }
.calendario-card .minical-dow { font-size: 11px; padding-bottom: 8px; }
.calendario-card .minical-head h2 { font-size: 15px; }

/* En pantallas bajas el mes se encoge y ese sitio se lo quedan las otras dos
   tarjetas de la columna, que si no quedan sin aire. */
@media (max-height: 860px) {
  .calendario-card .minical-grid { grid-template-columns: repeat(7, 40px); }
  .calendario-card .minical-dia { font-size: 12.5px; }
}

/* --- Tablero ajustado a la ventana -----------------------------------------
   Solo en pantallas con sitio de sobra. Por debajo de 1081px la rejilla ya cae
   a una columna, y con menos de 700px de alto apretar todo dentro de la
   ventana deja las tarjetas en nada: en los dos casos manda el flujo normal y
   la pagina scrollea como siempre. */
@media (min-width: 1081px) and (min-height: 700px) {
  body.tablero {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  /* La cabecera es sticky, o sea que SI cuenta como hijo en flujo. El rail,
     los modales y el chat son fixed y no entran en este reparto. */
  body.tablero > header { flex-shrink: 0; }

  /* min-height: 0 en cada nivel: sin eso un hijo flex se niega a encogerse por
     debajo de su contenido y el scroll interno nunca aparece. */
  body.tablero > main.inicio {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  body.tablero .kpi-row { flex-shrink: 0; }
  body.tablero .inicio-grid { flex: 1 1 auto; min-height: 0; align-items: stretch; }
  body.tablero .inicio-side { min-height: 0; }

  /* A la izquierda la agenda ocupa todo el alto. A la derecha el calendario
     mide lo que mide y las otras dos se reparten lo que sobra. */
  body.tablero .agenda-card { min-height: 0; display: flex; flex-direction: column; }
  body.tablero .agenda-head { flex-shrink: 0; }
  body.tablero .agenda-lista { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

  /* Sombra de scroll. Dentro de un tablero de alto fijo la lista se corta a
     media fila y parece rota; esto avisa de que hay mas. Son cuatro capas: las
     dos `local` viajan con el contenido y tapan a las `scroll` cuando ya se
     llego al tope o al fondo, asi que la sombra aparece y desaparece sola, sin
     una linea de JS escuchando el scroll. */
  body.tablero .agenda-lista,
  body.tablero .inicio-side {
    background:
      linear-gradient(var(--surface) 30%, rgba(0, 0, 0, 0)) top / 100% 22px no-repeat local,
      linear-gradient(rgba(0, 0, 0, 0), var(--surface) 70%) bottom / 100% 22px no-repeat local,
      radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.13), rgba(0, 0, 0, 0)) top / 100% 9px no-repeat scroll,
      radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.13), rgba(0, 0, 0, 0)) bottom / 100% 9px no-repeat scroll;
  }
  /* La columna derecha scrollea como una sola pieza y sus tarjetas conservan
     su alto natural. Repartirla a base de flex dejaba Recordatorios en 45px en
     una laptop de 768 —solo el titulo, sin lista— y eso es peor que un scroll:
     una tarjeta aplastada no se puede leer, una que hay que bajar si. */
  body.tablero .inicio-side { overflow-y: auto; scrollbar-gutter: stable; }
  body.tablero .inicio-side > .card { flex-shrink: 0; }

  body.tablero > .asistente-wrap { flex: 1 1 auto; min-height: 0; }

  /* Calendario: la rejilla llena lo que quede de ventana. */
  body.tablero > #calendar-wrap { flex: 1 1 auto; min-height: 0; display: flex; margin: 16px auto; }
  body.tablero #calendar { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
}

/* --- Agenda del día --- */
.agenda-card { padding: 18px 20px 20px; }

.agenda-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.agenda-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.agenda-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--text-muted); }

.seg-control {
  display: flex;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.seg-control button,
.seg-control a {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.seg-control a:hover { text-decoration: none; color: var(--text); }
.seg-control .active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-xs); }

.agenda-lista { display: flex; flex-direction: column; gap: 14px; }
.agenda-vacia { margin: 8px 0; font-size: 13px; color: var(--text-muted); }
.agenda-cierre { margin: 4px 0 0; text-align: center; font-size: 12.5px; color: var(--text-muted); }

.agenda-fila { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; align-items: start; }

.agenda-hora {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  color: var(--text-muted);
  padding-top: 16px;
  text-align: right;
}

/* --- Tarjeta de cita --- */
.cita-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: var(--surface);
  flex-wrap: wrap;
}

/* La próxima cita se distingue con un borde teal, no con relleno: así el ojo
   la encuentra sin que la fila grite más que el resto de la agenda. */
.cita-card.proxima { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.avatar-ini {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-dark);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.cita-info { flex: 1 1 180px; min-width: 0; }
.cita-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cita-sig { font-size: 11.5px; color: var(--text-muted); }
.cita-nombre { margin: 3px 0 0; font-size: 14.5px; font-weight: 600; }
.cita-acciones { display: flex; gap: 8px; flex-wrap: wrap; }

.tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
  white-space: nowrap;
}
.tag-control { background: var(--accent-light); color: var(--accent-dark); }
.tag-procedimiento { background: var(--warn-bg); color: var(--warn-text); }
.tag-cancelada { background: var(--danger-bg); color: var(--danger-text); }
.tag-neutro { background: var(--surface-muted); color: var(--text-muted); }

/* --- Hueco libre y sugerencia de lista de espera --- */
.hueco-card {
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  background: var(--surface);
}

/* El hueco con sugerencia se pinta en teal punteado: es la acción que más
   dinero le devuelve al doctor, tiene que saltar sobre un hueco vacío. */
.hueco-card.con-sugerencia { border-color: var(--accent); background: var(--surface); }

.hueco-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-muted);
}
.hueco-head svg { width: 15px; height: 15px; flex-shrink: 0; }
.hueco-card.con-sugerencia .hueco-head { color: var(--accent-dark); }

.hueco-body {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.hueco-info { flex: 1 1 160px; min-width: 0; }
.hueco-nombre { margin: 0; font-size: 14px; font-weight: 600; }
.hueco-sub { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }
.hueco-otras { font-size: 12.5px; color: var(--text-muted); }
.hueco-otras:hover { color: var(--accent-dark); }
.hueco-accion { font-size: 12.5px; font-weight: 600; color: var(--accent-dark); display: inline-block; margin-top: 8px; }

/* --- Mini calendario --- */
.calendario-card { padding: 16px 18px 18px; }

.minical-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.minical-head h2 { margin: 0; font-size: 15.5px; font-weight: 600; }
.minical-nav { display: flex; gap: 4px; }

.minical-nav button {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.minical-nav button:hover { background: var(--surface-muted); color: var(--text); }
.minical-nav svg { width: 15px; height: 15px; }

.minical-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.minical-dow { font-size: 10.5px; font-weight: 600; color: var(--text-muted); padding-bottom: 6px; }

.minical-dia {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12.5px;
  color: var(--text);
}
.minical-dia:hover { background: var(--surface-muted); text-decoration: none; }
.minical-dia.fuera { color: var(--text-muted); opacity: 0.45; }
.minical-dia.hoy { background: var(--accent); color: #fff; font-weight: 600; }
.minical-dia.hoy:hover { background: var(--accent-hover); }

.minical-punto {
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.minical-dia.hoy .minical-punto { background: #fff; }

/* --- Próximas citas --- */
.proximas-card { padding: 16px 18px 12px; }

.proximas-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.proximas-head h2 { margin: 0; font-size: 15.5px; font-weight: 600; }
.proximas-head a { font-size: 12.5px; color: var(--text-muted); }
.proximas-head a:hover { color: var(--accent-dark); }

.prox-fila {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 4px;
  border-top: 1px solid var(--border-soft);
  color: var(--text);
}
.prox-fila:hover { text-decoration: none; background: var(--surface-muted); }

.prox-fecha { display: flex; flex-direction: column; line-height: 1.25; }
.prox-fecha i { font-style: normal; font-size: 10px; font-weight: 600; letter-spacing: 0.05em; color: var(--text-muted); }
.prox-fecha b { font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600; }

.prox-titulo { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Una cita cancelada se tacha: sigue ocupando su lugar en la lista para que el
   doctor vea que ese hueco quedó libre, pero se lee como ya no vigente. */
.prox-fila.cancelada .prox-titulo,
.prox-fila.cancelada .prox-fecha b { text-decoration: line-through; color: var(--text-muted); }

/* --- Tarjeta de recordatorios (se mudo de la barra del calendario) --- */
.recordatorios-card { padding: 16px 18px 14px; }
.recordatorios-card .proximas-head h2 { display: flex; align-items: center; gap: 7px; }
.recordatorios-card .wa-glyph { width: 16px; height: 16px; color: #25d366; flex-shrink: 0; }
.recordatorios-hint { margin: 0 0 12px; font-size: 12px; color: var(--text-muted); line-height: 1.4; }
#recordatorios-lista { display: flex; flex-direction: column; gap: 6px; }
.panel-count { flex-shrink: 0; font-size: 11.5px; font-weight: 600; color: var(--accent-dark); background: var(--accent-light); border-radius: 999px; padding: 1px 8px; min-width: 20px; text-align: center; }
.panel-count:empty { display: none; }

/* --- Adaptación a pantallas chicas --- */
@media (max-width: 1080px) {
  .inicio-grid { grid-template-columns: minmax(0, 1fr); }
  .inicio-side { flex-direction: row; flex-wrap: wrap; }
  .calendario-card, .proximas-card, .recordatorios-card { flex: 1 1 300px; }
}

@media (max-width: 760px) {
  .inicio { padding: 16px; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-search { min-width: 0; flex: 1 1 160px; }
  .agenda-fila { grid-template-columns: 44px minmax(0, 1fr); gap: 8px; }
  .cita-acciones { width: 100%; }
  .topbar-greeting { font-size: 21px; }

  /* En dos columnas la etiqueta y su accion se peleaban el ancho: "Por marcar
     asistencia" se partia en tres lineas y estiraba toda la fila. Aqui la
     tarjeta se vuelve rejilla y `display: contents` sube a .kpi-rotulo y a la
     accion al mismo nivel, para acomodarlas en dos filas: etiqueta completa
     arriba, numero abajo a la izquierda y la accion abajo a la derecha. */
  .kpi-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; row-gap: 10px; }
  .kpi-top { display: contents; }
  .kpi-rotulo { grid-row: 1; grid-column: 1 / -1; }
  .kpi-valor { grid-row: 2; grid-column: 1; margin: 0; }
  .kpi-chip, .kpi-mono, .kpi-link, .kpi-btn { grid-row: 2; grid-column: 2; justify-self: end; }
}

/* Sello de "ya se le avisó" en la tarjeta de cita del tablero de Inicio. */
.cita-avisado {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--success-text);
}
.cita-avisado svg { width: 12px; height: 12px; }

/* Con el rail presente, la navegación vive ahí: los enlaces del header viejo se
   esconden por CSS (no solo se quitan por JS) para que no parpadeen al cargar,
   y la marca también, porque el rail ya trae el isotipo arriba. */
.header-nav { display: none; }
body.has-rail header .brand { display: none; }
/* La pone header.js cuando, tras mudar todo al rail, no le queda nada dentro. */
header.cabecera-vacia { display: none; }


/* --- Asistente de IA ---------------------------------------------------------
   Estas reglas vivian sueltas dentro de calendar.html. Se traen aqui porque el
   chat se monta ahora en tres sitios: burbuja flotante en el calendario y en
   Inicio, y a pantalla completa en /asistente. Ver chat.js. */
.chat { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 14px;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
}
.chat-titulo { font-size: 14px; font-weight: 600; }
.chat-head-acciones { display: flex; align-items: center; gap: 6px; }
.chat-head-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 9px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.chat-head-btn:hover { background: rgba(255, 255, 255, 0.28); text-decoration: none; color: #fff; }
.chat-head-btn svg { width: 15px; height: 15px; }

.chat-mensajes {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  font-size: 13px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-vacio { margin: auto; max-width: 320px; text-align: center; font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.chat-msg { line-height: 1.5; white-space: pre-wrap; max-width: 85%; padding: 8px 12px; border-radius: 12px; }
.chat-msg.user { margin-left: auto; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant { margin-right: auto; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-msg.pending { color: var(--text-muted); font-style: italic; }

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.chat-input { flex: 1; min-width: 0; padding: 9px 12px; }
.chat-form button[type='submit']:disabled { opacity: 0.55; cursor: default; }

/* --- Burbuja flotante --- */
#chat-burbuja {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-md);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 35;
  padding: 0;
}
#chat-burbuja:hover { background: var(--accent-hover); }
#chat-burbuja svg { width: 24px; height: 24px; }

#chat-panel {
  display: none;
  position: fixed;
  right: 24px;
  bottom: 88px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 460px;
  max-height: calc(100vh - 140px);
  z-index: 36;
  padding: 0;
}
#chat-panel.open { display: flex; }

/* En celular el rail es una barra inferior de 62px: la burbuja y el panel se
   suben para no quedar debajo de ella. */
@media (max-width: 720px) {
  #chat-burbuja { right: 16px; bottom: 74px; }
  #chat-panel { right: 16px; left: 16px; bottom: 136px; width: auto; max-height: calc(100vh - 210px); }
}

/* --- Pagina /asistente -------------------------------------------------------
   Aqui el chat no es un panel: es la pagina. Mientras no hay conversacion se
   presenta como una pregunta ("¿como puedo ayudarte hoy?") con el area de
   escritura grande al centro y unos atajos debajo; al primer mensaje el saludo
   y los atajos se van, la conversacion toma el alto y el area baja. El cambio
   entero lo hace la clase .sin-historial que pone chat.js. */
.asistente-wrap {
  max-width: 820px;
  width: 100%;
  margin: 24px auto;
  padding: 0 16px 24px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#asistente-chat { flex: 1 1 auto; min-height: 420px; }

.chat-pagina {
  position: relative;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
  padding: 0;
}
/* Sin conversacion todo el bloque se centra verticalmente; con ella se pega
   arriba y el area de escritura se queda abajo. */
.chat-pagina.sin-historial { justify-content: center; }
/* Plan sin IA: en lugar del chat, un aviso centrado que lleva a los planes. */
.chat-pagina.chat-bloqueado { justify-content: center; align-items: center; text-align: center; }
.chat-bloqueado .chat-saludo { margin-bottom: 12px; }
.chat-bloqueado-texto { color: var(--text-soft); max-width: 460px; margin: 0 0 20px; }

.chat-saludo {
  font-family: var(--font-display);
  font-size: clamp(21px, 3.2vw, 32px);
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  color: var(--text);
  margin: 0 0 24px;
  padding: 0 8px;
}

.chat-pagina .chat-mensajes {
  background: transparent;
  padding: 4px 2px 20px;
  font-size: 14px;
  gap: 14px;
}
.chat-pagina .chat-msg { max-width: 78%; padding: 10px 14px; }

/* Caja de escribir: tarjeta redondeada que contiene el textarea y el boton. */
.chat-compositor {
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 6px 6px 4px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chat-compositor:focus-within { border-color: var(--accent); box-shadow: var(--shadow-md); }

.chat-pagina .chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
}
/* El textarea crece con el texto (lo mide chat.js) hasta 200px y luego hace
   scroll: un mensaje largo no debe empujar la conversacion fuera de pantalla. */
.chat-pagina .chat-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  resize: none;
  overflow-y: auto;
  max-height: 200px;
  padding: 12px 4px 12px 14px;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}
.chat-pagina .chat-input:focus { outline: none; box-shadow: none; border: 0; }
/* En la bienvenida el area de escribir es generosa: invita a pedir algo largo.
   El alto exacto lo fija chat.js al escribir (crece con el texto). */
.chat-pagina.sin-historial .chat-compositor { padding-bottom: 6px; }
.chat-pagina .chat-input::placeholder { color: var(--text-soft); }

.chat-enviar {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  margin-bottom: 3px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s;
}
.chat-enviar:hover { background: var(--accent-hover); }
.chat-enviar:disabled { opacity: 0.5; cursor: default; }
.chat-enviar svg { width: 19px; height: 19px; }

/* Atajos: lo que mas se le pide al asistente, a un clic. Solo con la
   conversacion vacia; una vez que hay hilo, estorban. */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 10px 4px 6px;
}
.chat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chat-chip:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent-dark); }
.chat-chip svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Borrar va en su propia fila, pegado a la derecha: flotando sobre el area de
   mensajes se encimaba con la primera burbuja del usuario. */
.chat-borrar-suelto {
  align-self: flex-end;
  flex-shrink: 0;
  margin-bottom: 6px;
  border: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}
.chat-borrar-suelto:hover { background: var(--surface-muted); color: var(--text); }

/* Lo que sobra segun el estado. */
.chat-pagina.sin-historial .chat-mensajes,
.chat-pagina.sin-historial .chat-borrar-suelto,
.chat-pagina:not(.sin-historial) .chat-saludo,
.chat-pagina:not(.sin-historial) .chat-chips { display: none; }

/* El reparto a ventana completa de body.tablero solo existe desde 1081px de
   ancho y 700px de alto. Por debajo, el chat se quedaba en sus 420px y el area
   de escribir flotaba a media pantalla con un hueco debajo. Aqui se le da el
   alto disponible a mano: dvh porque en el celular la barra del navegador
   aparece y desaparece. */
@media (max-width: 1080px), (max-height: 699px) {
  .asistente-wrap { min-height: calc(100dvh - 56px); margin-top: 16px; }
  #asistente-chat { flex: 1 1 auto; min-height: 0; }
}
/* Con el rail abajo (celular) hay 62px mas ocupados al pie. */
@media (max-width: 720px) {
  .asistente-wrap { min-height: calc(100dvh - 118px); }
}

@media (max-width: 720px) {
  .chat-saludo { font-size: 20px; margin-bottom: 18px; }
  .chat-chips { gap: 6px; }
  .chat-chip { padding: 7px 11px; font-size: 12px; }
  .chat-pagina .chat-msg { max-width: 88%; }
}

/* A pantalla completa la burbuja sobraria: ya estas dentro del chat. */
body.pagina-asistente #chat-burbuja, body.pagina-asistente #chat-panel { display: none !important; }

/* Ajustes -> Cuenta: cambio de correo pendiente de confirmar. */
.email-pending {
  margin: 10px 0 4px;
  padding: 14px;
  border: 1px solid var(--teal-100);
  background: var(--teal-50);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.email-pending[hidden] { display: none; }
.email-pending p { margin: 0 0 10px; color: var(--text); line-height: 1.5; word-break: break-word; }
.email-pending-row { display: flex; gap: 8px; }
.email-pending-row input { flex: 1; min-width: 0; margin: 0; font-family: var(--font-mono); letter-spacing: 0.3em; }
.email-pending-row button { flex: none; }
.email-pending-links { display: flex; justify-content: space-between; margin-top: 10px; }
.linkish { background: none; border: none; padding: 0; color: var(--accent-dark); font: inherit; font-weight: 500; cursor: pointer; }
.linkish:hover:not(:disabled) { text-decoration: underline; }
.linkish:disabled { color: var(--text-soft); cursor: default; }

/* Inicio -> aviso "Completa tu consultorio". Una sola linea discreta entre
   los indicadores y la agenda; en el tablero de alto fijo no le quita espacio
   a la agenda. */
.setup-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 14px;
  margin-bottom: 18px;
  border-radius: var(--radius-md);
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  color: var(--text);
  font-size: 13px;
}
.setup-card.hidden { display: none; }
body.tablero .setup-card { flex-shrink: 0; }
.setup-icono { width: 18px; height: 18px; flex: none; color: var(--accent-dark); }
.setup-texto { flex: 1; min-width: 0; margin: 0; line-height: 1.4; }
.setup-accion { flex: none; font-weight: 600; color: var(--accent-dark); white-space: nowrap; }
.setup-cerrar {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border: none; border-radius: 8px;
  background: none; color: var(--text-muted); cursor: pointer;
}
.setup-cerrar:hover { background: var(--teal-100); color: var(--text); }
.setup-cerrar svg { width: 15px; height: 15px; }

/* Recetas: faltan cedula/especialidad para poder imprimir la receta. */
.rx-faltan {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 0 16px; padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg); color: var(--warn-text);
  font-size: 13px; font-weight: 500; line-height: 1.45;
}
.rx-faltan.hidden { display: none; }
.rx-faltan .btn-sm { flex: none; text-decoration: none; }
