:root {
  /* Paleta corporativa Xuma / Grupo ilao */
  --purple-700: #26235e; /* ilao navy — se conserva el nombre de la variable para no tocar cada regla */
  --purple-600: #2626a5; /* ilao primario */
  --purple-500: #3636dd; /* ilao medio */
  --purple-100: #e6f4ff; /* ilao claro */
  --ink: #1f2333;
  --muted: #64748b;
  --bg: #ededf4;
  --card: #ffffff;
  --border: #e6e8ef;
  --green: #00ad6f;
  --amber: #ff7300;
  --red: #dc2626;
  --blue: #0082f7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.hidden { display: none !important; }

/* Header */
.topbar {
  background: linear-gradient(90deg, var(--purple-700), var(--purple-500));
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.94);
  padding: 6px 14px;
  border-radius: 10px;
}
.brand-logo img { display: block; height: 28px; width: auto; }
.brand-title { font-weight: 700; font-size: 17px; }

.topbar nav { display: flex; align-items: center; gap: 8px; }
.nav-btn {
  background: rgba(255,255,255,0.9);
  color: var(--purple-700);
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}
.nav-btn.ghost {
  background: transparent;
  color: white;
  font-weight: 600;
}
.nav-btn.active { background: white; }

.user-badge {
  background: rgba(255,255,255,0.12);
  color: white;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.user-badge .badge-role {
  background: rgba(255,255,255,0.9);
  color: var(--purple-700);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
}

/* Layout */
.page { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.page h1 { margin: 0 0 4px; font-size: 26px; }
.subtitle { color: var(--muted); margin: 0 0 22px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 800px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.stat-value { font-size: 22px; font-weight: 800; line-height: 1; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 24px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.card-header h2 { margin: 0; font-size: 18px; }

.controls-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

button, input, select {
  font-family: inherit;
  font-size: 14px;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: var(--purple-600); color: white; }
.btn-primary:hover { background: var(--purple-700); }
.btn-secondary { background: #f1f2f6; color: var(--ink); }
.btn-outline { background: white; border: 1px solid var(--border); color: var(--ink); }
.btn-green { background: var(--green); color: white; }
.btn-link { background: none; color: var(--purple-600); font-weight: 600; cursor: pointer; border: none; padding: 6px 4px; }
.btn-danger { background: #fee2e2; color: var(--red); }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }

.input, select.input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  background: white;
  color: var(--ink);
}

.tabs { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  background: #f7f7fb;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  border: none;
}
.tab.active { background: white; color: var(--ink); }

.list { display: flex; flex-direction: column; gap: 12px; }
.empty-msg { text-align: center; color: var(--muted); padding: 24px 0; }

.item-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  position: relative;
}
.item-top { display: flex; justify-content: space-between; gap: 10px; }
.item-name { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.item-doc { color: var(--muted); font-size: 13px; white-space: nowrap; }
.item-line { color: #374151; font-size: 14px; margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.item-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.item-footer { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.item-actions { display: flex; gap: 8px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-PENDIENTE { background: #ffedd9; color: var(--amber); }
.badge-CONFIRMADA { background: var(--purple-100); color: var(--blue); }
.badge-ATENDIDA { background: #dcf7e7; color: var(--green); }
.badge-CANCELADA { background: #fee2e2; color: var(--red); }
.badge-NO_CONFIRMADO, .badge-NO_INGRESO { background: #f1f5f9; color: var(--muted); }

.tag { background: var(--purple-100); color: var(--purple-700); padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }

.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 3px;
  color: var(--muted);
  font-size: 15px;
}
.icon-btn:hover { color: var(--ink); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }

/* Modal */
.overlay {
  position: fixed; inset: 0; background: rgba(15, 15, 25, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; z-index: 50;
}
.modal {
  background: white; border-radius: 16px; padding: 26px;
  width: 100%; max-width: 560px;
}
.modal h3 { margin: 0 0 4px; font-size: 20px; }
.modal .modal-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.modal-close { position: absolute; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid.single { grid-template-columns: 1fr; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field input, .field select { width: 100%; }
.field-hint { font-size: 12px; color: var(--muted); margin: 5px 0 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* Horario de atención — estilo Microsoft Bookings: por día, uno o varios
   bloques de horario independientes, o "No disponible" si no tiene ninguno. */
.horario-dias {
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.horario-dia {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  background: white;
  border-bottom: 1px solid var(--border);
}
.horario-dia:last-child { border-bottom: none; }
.horario-dia-label { font-size: 13px; font-weight: 700; padding-top: 8px; }
.horario-dia-bloques { display: flex; flex-direction: column; gap: 8px; }

.horario-bloque { display: flex; align-items: center; gap: 8px; }
.horario-bloque .input.horario-inicio,
.horario-bloque .input.horario-fin { width: 118px; padding: 7px 10px; }
.horario-sep { color: var(--muted); font-weight: 700; }

.horario-vacio {
  flex: 1;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  background: #fafafd;
}

.horario-del-btn, .horario-add-btn {
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 8px; border: 1px solid var(--border); background: #fafafd;
  cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.horario-add-btn { color: var(--purple-600); font-size: 18px; font-weight: 700; }
.horario-del-btn { color: var(--red); }
.horario-add-btn:hover { background: var(--purple-100); }
.horario-del-btn:hover { background: #fee2e2; }

.horario-excepcion {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px; background: #fafafd;
}
.horario-excepcion-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; font-size: 13px;
}
.horario-excepcion .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.especialidad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 16px 0; }
@media (max-width: 600px) { .especialidad-grid { grid-template-columns: 1fr; } }
.especialidad-card {
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
}
.especialidad-card.selected { border-color: var(--purple-600); background: var(--purple-100); }
.especialidad-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--purple-100); color: var(--purple-700);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin: 0 auto 10px;
}
.especialidad-card h4 { margin: 0 0 4px; font-size: 15px; }
.especialidad-card p { margin: 0; color: var(--muted); font-size: 13px; }

.paciente-info-box, .cita-info-box {
  background: #f7f7fb; border-radius: 12px; padding: 14px 16px; margin: 14px 0;
}
.cita-info-box { background: var(--purple-100); }
.paciente-info-box .grid2, .cita-info-box .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font-size: 14px; }

/* Calendario de disponibilidad */
.calendario-box {
  display: grid;
  grid-template-columns: minmax(0, 300px) 1fr;
  gap: 18px;
  margin-top: 4px;
}
@media (max-width: 620px) { .calendario-box { grid-template-columns: 1fr; } }

.calendario-panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.calendario-header {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 14px; margin-bottom: 10px; text-transform: capitalize;
}
.calendario-header .icon-btn { font-size: 18px; padding: 2px 8px; }
.calendario-dow {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center; font-size: 11px; color: var(--muted); font-weight: 700;
  margin-bottom: 4px;
}
.calendario-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.cal-day {
  aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 13px; border: none; background: transparent;
  color: var(--ink); cursor: default;
}
.cal-day.vacio { visibility: hidden; }
.cal-day.disponible { font-weight: 700; color: var(--purple-700); background: var(--purple-100); cursor: pointer; }
.cal-day.disponible:hover { background: #d7def5; }
.cal-day.no-disponible { color: #c2c6d1; background: #f4f4f8; cursor: not-allowed; }
.cal-day.seleccionado { background: var(--purple-600); color: white; }
.calendario-leyenda { display: flex; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.calendario-leyenda .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.dot-disp { background: var(--purple-600); }
.dot-no { background: #c2c6d1; }

.calendario-slots strong { display: block; font-size: 13px; margin-bottom: 10px; }
.slots-grid { display: flex; flex-wrap: wrap; gap: 8px; max-height: 260px; overflow-y: auto; }
.slot-btn {
  border: 1px solid var(--border); background: white; color: var(--ink);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.slot-btn:hover { border-color: var(--purple-500); }
.slot-btn.seleccionado { background: var(--purple-600); color: white; border-color: var(--purple-600); }
.slots-empty { color: var(--muted); font-size: 13px; }

/* Login — split screen, Grupo ilao Kit Gráfico V.1 */
@keyframes ilaoGradShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes ilaoFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes ilaoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--card);
  font-family: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
}

.login-brand-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px;
  background: linear-gradient(120deg, var(--purple-600) 0%, var(--purple-500) 45%, var(--green) 100%);
  background-size: 220% 220%;
  animation: ilaoGradShift 16s ease-in-out infinite;
}
.login-brand-blob { position: absolute; border-radius: 50%; background: rgba(255,255,255,0.08); }
.login-brand-blob-1 { top: -120px; right: -140px; width: 380px; height: 380px; }
.login-brand-blob-2 { bottom: -150px; left: -100px; width: 320px; height: 320px; background: rgba(255,255,255,0.06); }

.login-brand-logo { position: relative; animation: ilaoFadeUp 0.5s ease-out both; }
.login-brand-logo img { height: 80px; width: auto; display: block; }

.login-brand-copy { position: relative; animation: ilaoFadeUp 0.6s ease-out 0.1s both; }
.login-brand-illustration { width: 100%; max-width: 320px; display: block; animation: ilaoFloat 6s ease-in-out infinite; opacity: 0.92; }
.login-brand-copy h1 {
  font-family: 'Bricolage Grotesque', 'Segoe UI', sans-serif;
  font-weight: 700; font-size: 32px; line-height: 1.18; color: #fff;
  letter-spacing: -0.01em; margin: 28px 0 12px; max-width: 460px;
}
.login-brand-copy p { font-size: 15.5px; line-height: 1.6; color: rgba(255,255,255,0.85); margin: 0; max-width: 400px; }

.login-form-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 32px; background: var(--card);
}
.login-card { width: 100%; max-width: 380px; animation: ilaoFadeUp 0.5s ease-out 0.15s both; }
.login-card h2 {
  font-family: 'Bricolage Grotesque', 'Segoe UI', sans-serif;
  font-size: 26px; font-weight: 700; margin: 0 0 6px; color: var(--purple-700); letter-spacing: -0.01em;
}
.login-card p.subtitle { margin: 0 0 30px; color: var(--muted); font-size: 14.5px; }
.field-full { margin-bottom: 18px; }
.field-full label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; color: var(--purple-700); }
.field-full input { width: 100%; }

.input-icon-wrap {
  position: relative; display: flex; align-items: center; gap: 10px;
  background: var(--purple-100); border-radius: 12px; padding: 0 16px;
  border: 1.5px solid transparent; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input-icon-wrap:focus-within { border-color: var(--purple-500); box-shadow: 0 0 0 3px rgba(54, 54, 221, 0.12); }
.input-icon-wrap .input-icon { position: static; flex-shrink: 0; color: var(--purple-600); pointer-events: none; }
.input-icon-wrap input.input { padding: 13px 0; }

.login-card .input {
  border: none; background: none; border-radius: 0;
  padding: 13px 0; font-size: 14.5px; color: var(--ink); flex: 1; min-width: 0;
}
.login-card .input:focus { outline: none; box-shadow: none; }
.login-card .input::placeholder { color: #94a0c2; }

.input-eye-btn {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: none; border: none; padding: 4px; margin: 0; cursor: pointer; color: var(--muted);
}
.input-eye-btn:hover { color: var(--purple-600); }

.login-card .btn-primary {
  width: 100%; justify-content: center; margin-top: 6px; padding: 15px 22px;
  border-radius: 999px; font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--purple-500); box-shadow: 0 8px 20px -6px rgba(38, 38, 165, 0.55);
}
.login-card .btn-primary:hover { background: var(--purple-600); }
.login-card .btn-primary:disabled { opacity: 0.7; cursor: default; box-shadow: none; }

.error-msg { color: var(--red); font-size: 13px; margin: 10px 0 0; min-height: 16px; text-align: center; }
.login-footer {
  font-size: 12px; color: var(--muted); margin: 28px 0 0; text-align: center;
  padding-top: 18px; border-top: 1px solid var(--border); letter-spacing: 0.01em;
}

@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand-panel { display: none; }
  .login-form-panel { padding: 32px 20px; }
}

.search-input-wrap { position: relative; }
.search-input-wrap .input { padding-left: 34px; min-width: 240px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: white;
  padding: 12px 18px; border-radius: 10px; font-size: 14px; z-index: 100;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
