/* ============================================================
   MEDIWEB CLINICAL DESIGN SYSTEM - STYLES FOR OCCUPATIONAL HEALTH
   ============================================================ */

/* Form Elements */
select {
  font: 13px/1.4 'Plus Jakarta Sans', sans-serif;
  color: var(--ink);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  background: var(--surface);
  transition: all 0.15s ease;
}

label select {
  display: block;
  width: 100%;
  margin-top: 6px;
}

.form-panel {
  max-width: 1100px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 16px 20px;
  margin-top: 18px;
}

.form-section-title {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  margin-top: 24px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.helper {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
  transition: all 0.15s ease;
  cursor: pointer;
  margin: 0;
}

.check-row:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  margin: 0;
  cursor: pointer;
}

.check-row span {
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
}

/* ============================================================
   AUTH / PORTAL DE ACCESO (PÁGINA DE INICIO DE SESIÓN)
   ============================================================ */

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(at 0% 0%, #f0fdfa 0px, transparent 50%), radial-gradient(at 100% 100%, #eff6ff 0px, transparent 50%), #f8fafc;
  padding: 24px;
  box-sizing: border-box;
}

.auth-card-wide {
  width: min(100%, 780px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.08);
}

.auth-card {
  width: min(100%, 440px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.08);
}

.auth-card h1 {
  font-size: 22px;
  margin: 16px 0 6px;
}

.auth-card p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 20px;
}

.clinic-selector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 28px 0 24px;
}

.clinic-select-card {
  display: flex;
  flex-direction: column;
  padding: 30px 24px;
  background: #ffffff;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  text-align: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.clinic-select-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(13, 148, 136, 0.12);
}

.clinic-select-card.partner:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(2, 132, 199, 0.12);
}

.clinic-select-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}

.clinic-select-card .clinic-select-icon-wrap {
  background: #ccfbf1;
  color: #0f766e;
}

.clinic-select-card.partner .clinic-select-icon-wrap {
  background: #e0f2fe;
  color: #0369a1;
}

.clinic-select-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  background: #f0fdfa;
  color: var(--primary);
  border: 1px solid #99f6e4;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.clinic-select-card.partner .clinic-select-badge {
  background: #f0f9ff;
  color: var(--accent);
  border-color: #bae6fd;
}

.clinic-select-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.25;
}

.clinic-select-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.45;
}

.clinic-select-btn {
  margin-top: auto;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  width: 100%;
  justify-content: center;
}

.clinic-select-card:hover .clinic-select-btn {
  background: var(--primary-hover);
}

.clinic-select-card.partner .clinic-select-btn {
  background: var(--accent);
}

.clinic-select-card.partner:hover .clinic-select-btn {
  background: #0284c7;
}

.clinic-selected-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 20px;
}

.clinic-selected-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.clinic-change-link {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.clinic-change-link:hover {
  text-decoration: underline;
}

/* ============================================================
   AGENDA DE CITAS Y CALENDARIO MENSUAL
   ============================================================ */

.agenda-panel {
  padding: 24px 28px;
}

.calendar-head, .selected-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.calendar-head {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.calendar-head h2 {
  margin: 4px 0 0;
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

.calendar-nav {
  display: flex;
  gap: 8px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  margin: 20px 0 28px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.calendar-weekday {
  padding: 12px 10px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calendar-day {
  min-height: 82px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  background: #ffffff;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: all 0.15s ease;
}

.calendar-day:not(.is-empty):hover {
  background: #f0fdfa;
}

.calendar-day.is-empty {
  background: #fafafa;
}

.calendar-number {
  font-size: 14px;
  font-weight: 700;
  color: #334155;
}

.calendar-day.is-today .calendar-number {
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: #ccfbf1;
  border-radius: 50%;
}

.calendar-day.is-selected {
  background: #f0fdfa;
  box-shadow: inset 0 0 0 2px var(--primary);
}

.calendar-count {
  width: max-content;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 12px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.selected-day-head {
  margin: 6px 0 16px;
  padding: 16px 20px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.selected-day-head h3 {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}

.selected-day-head h3 span {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.date-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.date-filter label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.date-filter input[type="date"] {
  height: 36px;
  padding: 4px 10px;
  width: auto;
}

/* ============================================================
   MATRIZ DE SEGUIMIENTO DE PACIENTES (action=patients)
   ============================================================ */

.matrix-panel {
  padding: 0;
  overflow: hidden;
}

.matrix-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--line);
}

.matrix-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--primary);
  text-transform: uppercase;
}

.matrix-controls {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 18px 28px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.matrix-controls label {
  margin: 0;
}

.matrix-search {
  width: 320px;
}

.matrix-filter {
  width: 220px;
}

.matrix-count {
  margin-left: auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 8px;
}

.matrix-legend {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 12px 28px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-light);
}

.matrix-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.matrix-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-style: normal;
  font-weight: 700;
  font-size: 11px;
}

.matrix-dot.pending { background: #fef3c7; color: #b45309; }
.matrix-dot.realizado { background: #dcfce7; color: #15803d; }
.matrix-dot.no_aplica { background: #f1f5f9; color: #64748b; }

.matrix-scroll {
  max-height: 65vh;
  overflow: auto;
}

.exam-matrix th, .exam-matrix td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line-light);
  font-size: 12px;
}

.exam-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f8fafc;
  text-align: center;
}

.exam-matrix thead .matrix-area-head {
  background: #f0fdfa;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0.05em;
}

.exam-matrix .matrix-person-head,
.exam-matrix .matrix-person {
  position: sticky;
  left: 0;
  z-index: 12;
  width: 280px;
  min-width: 280px;
  text-align: left;
  background: #ffffff;
  box-shadow: 4px 0 8px -4px rgba(15, 23, 42, 0.08);
}

.exam-matrix thead .matrix-person-head {
  z-index: 15;
  background: #f8fafc;
}

.exam-matrix .matrix-person b {
  font-size: 13px;
  color: var(--ink);
  display: block;
}

.exam-matrix .matrix-person small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.matrix-progress {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 12px;
  background: #f1f5f9;
  color: #475569;
  font-size: 10px;
  font-weight: 700;
}

.matrix-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.matrix-mark:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.matrix-mark.pendiente { background: #fef3c7; color: #b45309; }
.matrix-mark.realizado { background: #dcfce7; color: #15803d; }
.matrix-mark.no_aplica { background: #f1f5f9; color: #64748b; }

.protocol-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.protocol-pills i {
  padding: 2px 6px;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
}

/* ============================================================
   ADMINISTRACIÓN Y USUARIOS (action=users)
   ============================================================ */

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 24px;
  align-items: start;
}

.inline-form {
  display: flex;
  gap: 6px;
  align-items: center;
}

.reschedule-form {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.reschedule-form input {
  height: 32px;
  font-size: 11px;
  padding: 4px 8px;
  width: auto;
}

/* ============================================================
   HOJA DE RUTA IMPRIMIBLE (route_print.php)
   ============================================================ */
.route-print-body {
  background: #f1f5f9;
  padding: 24px 14px 60px;
}
.route-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  max-width: 210mm;
  margin: 0 auto 16px;
}
.route-sheet {
  width: min(210mm, 100%);
  min-height: 297mm;
  margin: 0 auto;
  padding: 12mm 14mm;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  color: #0f172a;
  font: 11px Arial, sans-serif;
  box-sizing: border-box;
}
@media print {
  body.route-print-body {
    padding: 0;
    background: #fff;
  }
  .route-toolbar {
    display: none !important;
  }
  .route-sheet {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
}
