/* ==========================================
   VARIABLES Y RESET
   ========================================== */
:root {
  --azul-1: #20264b;
  --azul-2: #223364;
  --primary: #3b82f6;
  --bg: #f6f8fb;
  --panel: #fff;
  --borde: #e3e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow-xl: 0 10px 32px rgba(32,38,75,.14);
  --radius: 16px;
}

* {
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100vh;
  background: linear-gradient(120deg, #f0f4fa 80%, #dde7fa);
  color: #1a2440;
}

/* ==========================================
   LAYOUT PRINCIPAL
   ========================================== */
.wrap {
  display: flex;
  min-height: 100vh;
}

aside {
  background: linear-gradient(120deg, var(--azul-2) 65%, var(--primary));
  width: 295px;
  padding: 36px 22px 24px;
  color: #fff;
  border-radius: 0 26px 26px 0;
  box-shadow: 2px 0 18px rgba(32,38,75,.1);
  text-align: center;
  display: flex;
  flex-direction: column;
}

.logo {
  width: 92px;
  height: 92px;
  margin: 0 auto 18px;
  border-radius: 22px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 4px 22px rgba(44,74,140,.11);
  border: 2px solid #fff;
}

.brand {
  font-size: 1.28em;
  font-weight: 800;
  letter-spacing: -1px;
}

.subtitle {
  font-weight: 600;
  opacity: .86;
  margin-bottom: 18px;
}

/* ==========================================
   STEPPER / NAVEGACIÓN
   ========================================== */
.stepper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.stepper button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: none;
  background: transparent;
  color: #e6edff;
  font-weight: 700;
  border-radius: 13px;
  cursor: pointer;
  justify-content: flex-start;
  transition: all 0.2s;
}

.stepper button .b {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff2;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.stepper button.current {
  background: #fff2;
  color: #fff;
  box-shadow: 0 6px 14px rgba(0,0,0,.15);
}

.stepper button.current .b {
  background: #fff;
  color: var(--azul-2);
}

/* ==========================================
   MAIN CONTENT AREA
   ========================================== */
main {
  flex: 1;
  padding: 32px 42px;
  overflow-y: auto;
}

h2 {
  color: var(--azul-1);
  font-size: 1.76em;
  margin-bottom: 8px;
}

.subtitle-main {
  color: #64748b;
  margin-bottom: 24px;
}

/* ==========================================
   PANELS
   ========================================== */
.panel {
  display: none;
}

.panel.show {
  display: block;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================
   CARDS
   ========================================== */
.card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--borde);
}

.card h3 {
  color: var(--azul-1);
  font-size: 1.22em;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================
   GRID SYSTEM
   ========================================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.col {
  display: flex;
  flex-direction: column;
}

.col.span-2 {
  grid-column: span 2;
}

/* ==========================================
   FORM ELEMENTS
   ========================================== */
label {
  font-weight: 600;
  color: var(--azul-1);
  margin-bottom: 6px;
  font-size: 0.92em;
}

input, select, textarea {
  padding: 11px 14px;
  border: 1.5px solid var(--borde);
  border-radius: 10px;
  font-size: 0.94em;
  transition: all 0.2s;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.readonly {
  background: #f1f5f9;
  cursor: not-allowed;
}

.field-error {
  color: var(--danger);
  font-size: 0.85em;
  margin-top: 4px;
  display: none;
}

.field-error.show {
  display: block;
}

.field-hint {
  color: #64748b;
  font-size: 0.85em;
  margin-top: 4px;
}

/* ==========================================
   SUBTABS
   ========================================== */
.subtabs {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.subtabs button {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid #dbe3ff;
  background: #eef2ff;
  color: #1f2b4d;
  font-weight: 800;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.subtabs button:hover {
  background: #f3f6ff;
  border-color: #cfd8ff;
}

.subtabs button.current {
  background: linear-gradient(180deg, #3b82f6, #2f66db);
  border-color: #2f66db;
  color: #fff;
  box-shadow: 0 6px 16px rgba(59,130,246,.28);
}

/* ==========================================
   TAB CONTENT
   ========================================== */
.efg {
  display: none;
}

.efg.active {
  display: block;
}

/* ==========================================
   ACTIONS / BUTTONS
   ========================================== */
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin: 18px 0 0;
  padding-top: 18px;
  border-top: 2px solid #e6ecf7;
}

.actions button {
  padding: 12px 22px;
  border: none;
  border-radius: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
}

.btn-secondary {
  background: #e6ecf7;
  color: var(--azul-1);
}

.btn-secondary:hover {
  background: #d5def3;
}

.btn-primary {
  background: linear-gradient(92deg, var(--primary), #2563eb);
  color: #fff;
  box-shadow: 0 4px 14px rgba(59,130,246,.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59,130,246,.35);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================
   ALERTS / MESSAGES
   ========================================== */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-weight: 600;
  animation: slideDown 0.3s;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert.success {
  background: #dcfce7;
  color: #065f46;
  border: 1px solid #16a34a;
}

.alert.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

/* ==========================================
   VACUNAS
   ========================================== */
.vacs {
  display: block;
}

.vac-box {
  background: #f8fbff;
  border: 1px solid #e0ecff;
  border-radius: 12px;
  padding: 18px;
}

.vac-title {
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 12px;
}

.chk {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  font-weight: 500;
}

.chk input {
  width: auto;
}

/* ==========================================
   EXAM TABLE
   ========================================== */
.exam-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.exam-table th {
  background: #f1f5f9;
  padding: 10px;
  text-align: left;
  font-weight: 700;
  border-bottom: 2px solid #e2e8f0;
  font-size: 0.9em;
}

.exam-table td {
  padding: 10px;
  border-bottom: 1px solid #e2e8f0;
}

.exam-table input,
.exam-table select {
  padding: 6px 10px;
  font-size: 0.9em;
}

/* ==========================================
   ANEXOS / FILE UPLOAD
   ========================================== */
.anexos-upload {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.3s;
}

.anexos-upload:hover {
  border-color: var(--primary);
  background: #f0f9ff;
}

.file-list {
  margin-top: 16px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
}

.file-item button {
  background: #fee2e2;
  color: #991b1b;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

/* ==========================================
   UTILIDADES
   ========================================== */
.hidden {
  display: none !important;
}

.mb-24 {
  margin-bottom: 24px;
}

.mt-8 {
  margin-top: 8px;
}

.section-subtitle {
  color: var(--azul-1);
  margin-bottom: 12px;
  font-size: 1.1em;
  font-weight: 600;
}

/* Upload zone styles */
.upload-icon {
  font-size: 3em;
  margin-bottom: 12px;
}

.upload-title {
  font-weight: 700;
  color: var(--azul-1);
  margin-bottom: 8px;
}

.upload-subtitle {
  color: #64748b;
  font-size: 0.9em;
}

/* PDF button */
.btn-pdf {
  background: linear-gradient(92deg, #059669, #047857) !important;
  color: #fff !important;
}

/* File input hidden */
#fileInput {
  display: none;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 767px) {
  .wrap {
    flex-direction: column;
  }

  aside {
    width: 100%;
    border-radius: 0 0 26px 26px;
    padding: 20px 16px;
  }

  .stepper {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
  }

  .stepper button {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 0.85em;
  }

  .stepper button span {
    display: none;
  }

  main {
    padding: 20px 16px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .col.span-2 {
    grid-column: span 1;
  }

  h2 {
    font-size: 1.4em;
  }

  .exam-table {
    font-size: 0.85em;
  }

  .exam-table th,
  .exam-table td {
    padding: 8px 6px;
  }
} 0 6px 20px rgba(59,130,246,.35);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================
   ALERTS / MESSAGES
   ========================================== */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-weight: 600;
  animation: slideDown 0.3s;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert.success {
  background: #dcfce7;
  color: #065f46;
  border: 1px solid #16a34a;
}

.alert.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

/* ==========================================
   EXAM TABLE
   ========================================== */
.exam-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.exam-table th {
  background: #f1f5f9;
  padding: 10px;
  text-align: left;
  font-weight: 700;
  border-bottom: 2px solid #e2e8f0;
  font-size: 0.9em;
}

.exam-table td {
  padding: 10px;
  border-bottom: 1px solid #e2e8f0;
}

.exam-table input,
.exam-table select {
  padding: 6px 10px;
  font-size: 0.9em;
}

/* ==========================================
   ANEXOS / FILE UPLOAD
   ========================================== */
.anexos-upload {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.3s;
}

.anexos-upload:hover {
  border-color: var(--primary);
  background: #f0f9ff;
}

.anexos-upload input {
  display: none;
}

.file-list {
  margin-top: 16px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
}

.file-item button {
  background: #fee2e2;
  color: #991b1b;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 767px) {
  .wrap {
    flex-direction: column;
  }

  aside {
    width: 100%;
    border-radius: 0 0 26px 26px;
    padding: 20px 16px;
  }

  .stepper {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
  }

  .stepper button {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 0.85em;
  }

  .stepper button span {
    display: none;
  }

  main {
    padding: 20px 16px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .col.span-2 {
    grid-column: span 1;
  }

  h2 {
    font-size: 1.4em;
  }

  .exam-table {
    font-size: 0.85em;
  }

  .exam-table th,
  .exam-table td {
    padding: 8px 6px;
  }
}