/* Variables del programa mapeadas a las variables del sistema (app.css) */
:root {
  --program-primary: var(--accent);
  --program-primary-light: var(--accent-muted);
  --program-primary-dark: var(--accent-hover);
  --program-secondary: var(--blue);
  --program-accent: var(--yellow);
  --program-bg: var(--bg-body);
  --program-border: var(--border-default);
  --program-text: var(--text-primary);
  --program-text-light: var(--text-muted);
  --program-muted: var(--text-muted);
}

body.programa {
  background: var(--bg-body);
}

.program-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--program-border);
}

.program-header .header-info {
  flex: 1;
  min-width: 260px;
}

.program-header .header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.program-header h1 {
  font-size: 1.6rem;
  margin: 0 0 6px 0;
  color: var(--program-text);
  font-weight: 700;
}

.program-header .subtitle {
  color: var(--program-text-light);
  font-size: 0.85rem;
  max-width: 420px;
  line-height: 1.5;
  margin: 0;
}

.wizard-wrapper {
  display: grid;
  gap: 28px;
}

.wizard-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--program-border);
  box-shadow: 0 4px 12px rgba(16, 37, 66, 0.04);
}

/* Por defecto ocultar todos los pasos - JS muestra el activo */
.wizard-step {
  display: none;
}

.step-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--program-border);
  background: var(--bg-card);
  color: var(--program-text-light);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.step-chip .index {
  height: 24px;
  width: 24px;
  min-width: 24px;
  border-radius: 999px;
  background: var(--program-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--program-text);
  font-weight: 700;
  font-size: 0.8rem;
}

.step-chip.active {
  border-color: var(--program-primary);
  background: var(--program-primary-light);
  color: var(--program-primary);
}

.step-chip.active .index {
  background: var(--program-primary);
  color: white;
}

.step-chip.done {
  border-color: var(--program-secondary);
  color: var(--program-secondary);
}

.wizard-surface {
  background: var(--bg-card);
  border-radius: 20px;
  border: 1px solid var(--program-border);
  box-shadow: 0 14px 32px rgba(16, 37, 66, 0.06);
  padding: 32px;
}

.step-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--program-primary-light);
}

.step-title h2 {
  font-size: 1.35rem;
  margin: 0;
  color: var(--program-text);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-title h2::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--program-primary);
  border-radius: 2px;
}

.step-title .goal {
  font-size: 0.9rem;
  color: var(--program-text-light);
  padding-left: 14px;
}

.field-grid {
  display: grid;
  gap: 20px;
}

/* Secciones dentro de pasos */
.step-section {
  background: var(--bg-body);
  border: 1px solid var(--program-border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}

.step-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--program-text);
  margin: 0 0 14px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-section-title .material-icons {
  font-size: 18px;
  color: var(--program-primary);
}

.field-row {
  display: grid;
  gap: 18px;
}

.field-row.columns-2 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.field-row.columns-3 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--program-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.field label .material-icons {
  font-size: 16px;
  color: var(--program-text-light);
}

.field label .required {
  color: #ef4444;
  font-size: 0.75rem;
}

.field input[type="text"],
.field input[type="search"],
.field textarea,
.field select {
  border: 1px solid var(--program-border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.95rem;
  color: var(--program-text);
  background: var(--bg-body);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input[disabled],
.field textarea[disabled],
.field select[disabled] {
  background: #f2f4f8;
  color: rgba(16, 37, 66, 0.55);
  cursor: not-allowed;
}

.field textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.7;
  padding: 14px 16px;
  font-size: 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--program-border);
  border-radius: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field textarea:focus {
  outline: none;
  border-color: var(--program-primary);
  box-shadow: 0 0 0 3px rgba(15, 76, 117, 0.1);
}

.field textarea::placeholder {
  color: var(--program-text-light);
  opacity: 0.7;
}

/* Textareas en maturity comments */
.maturity-comments textarea {
  min-height: 80px;
  width: 100%;
  padding: 12px 14px;
  font-size: 0.88rem;
  line-height: 1.6;
  border: 1px solid var(--program-border);
  border-radius: 10px;
  background: var(--bg-body);
  resize: vertical;
}

.maturity-comments textarea:focus {
  outline: none;
  border-color: var(--program-primary);
  box-shadow: 0 0 0 3px rgba(15, 76, 117, 0.1);
  background: var(--bg-card);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--program-primary);
  box-shadow: 0 0 0 3px rgba(15, 76, 117, 0.12);
}

.inline-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-options .option-chip {
  border: 1px solid var(--program-border);
  padding: 10px 14px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.88rem;
  color: var(--program-text);
}

.inline-options .option-chip input {
  accent-color: var(--program-primary);
  width: 16px;
  height: 16px;
}

.inline-options .option-chip:hover {
  border-color: var(--program-primary);
  background: var(--program-primary-light);
}

.inline-options .option-chip:has(input:checked) {
  border-color: var(--program-primary);
  background: var(--program-primary-light);
  color: var(--program-primary);
  font-weight: 600;
}

.note-box {
  background: rgba(15, 76, 117, 0.08);
  border: 1px solid rgba(15, 76, 117, 0.18);
  padding: 16px;
  border-radius: 14px;
  color: var(--program-text);
  font-size: 0.9rem;
}

.note-box.highlight {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(15, 76, 117, 0.06);
  border-color: rgba(15, 76, 117, 0.2);
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 24px;
}

.note-box.highlight .material-icons {
  font-size: 22px;
  color: var(--program-primary);
  flex-shrink: 0;
  margin-top: 1px;
}

.maturity-grid {
  display: grid;
  gap: 18px;
}

.maturity-card {
  background: var(--bg-card);
  border: 1px solid var(--program-border);
  border-radius: 14px;
  padding: 20px;
  display: grid;
  gap: 16px;
  transition: all 0.2s ease;
  border-left: 4px solid var(--program-primary);
}

.maturity-card:hover {
  box-shadow: 0 6px 20px rgba(15, 76, 117, 0.1);
}

.maturity-card.level-bajo { border-left-color: #22c55e; }
.maturity-card.level-medio { border-left-color: #f59e0b; }
.maturity-card.level-alto { border-left-color: #ef4444; }

.maturity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--program-border);
}

.maturity-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--program-text);
}

.maturity-header span {
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: var(--program-primary);
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.maturity-criteria {
  display: grid;
  gap: 10px;
}

.maturity-criteria label.option-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--program-border);
  border-radius: 10px;
  padding: 10px 14px;
  transition: all 0.2s ease;
  cursor: pointer;
  font-size: 0.88rem;
}

.maturity-criteria label.option-chip input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--program-primary);
}

.maturity-criteria label.option-chip:hover {
  border-color: var(--program-primary);
  background: var(--program-primary-light);
}

.maturity-criteria label.option-chip:has(input:checked) {
  border-color: var(--program-primary);
  background: var(--program-primary-light);
}

.maturity-comments textarea {
  width: 100%;
  min-height: 100px;
  border-radius: 12px;
  resize: vertical;
}

.dynamic-list {
  display: grid;
  gap: 16px;
}

.dynamic-card {
  border: 1px solid var(--program-border);
  border-radius: 14px;
  padding: 20px;
  background: var(--bg-card);
  display: grid;
  gap: 16px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.dynamic-card:hover {
  border-color: var(--program-primary-light);
  box-shadow: 0 4px 16px rgba(15, 76, 117, 0.08);
}

.dynamic-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--program-border);
}

.dynamic-card-header h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--program-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dynamic-card-header h4 .card-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--program-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dynamic-card-header h4 .card-icon .material-icons {
  font-size: 16px;
  color: var(--program-primary);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--program-border);
  background: var(--bg-card);
}

.status-pill input {
  accent-color: var(--program-secondary);
}

.table-scroll {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--program-border);
}

/* ===== RULES STEP - TABLA MEJORADA ===== */
.rules-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--program-muted);
}
.rules-empty .material-icons {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.rules-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

.rules-table th,
.rules-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--program-border);
  text-align: left;
  vertical-align: middle;
}

.rules-table thead th {
  background: var(--program-primary-light);
  color: var(--program-text);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.rules-table tbody tr:hover {
  background: rgba(15, 76, 117, 0.03);
}

.criticality-cell {
  background: #f8fafc;
  border-right: 3px solid var(--program-primary);
  vertical-align: middle;
}
.criticality-cell.criticality-baja { border-right-color: #22c55e; }
.criticality-cell.criticality-media { border-right-color: #f59e0b; }
.criticality-cell.criticality-alta { border-right-color: #ef4444; }
.criticality-cell.criticality-critica { border-right-color: #7c3aed; }

.criticality-cell strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.criticality-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--program-primary);
  flex-shrink: 0;
}
.criticality-baja .criticality-indicator { background: #22c55e; }
.criticality-media .criticality-indicator { background: #f59e0b; }
.criticality-alta .criticality-indicator { background: #ef4444; }
.criticality-critica .criticality-indicator { background: #7c3aed; }

.maturity-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}
.maturity-bajo {
  background: #dcfce7;
  color: #166534;
}
.maturity-medio {
  background: #fef3c7;
  color: #92400e;
}
.maturity-alto {
  background: #fee2e2;
  color: #991b1b;
}

.outcome-select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--program-border);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-card);
}
.outcome-select:focus {
  outline: none;
  border-color: var(--program-primary);
  box-shadow: 0 0 0 3px rgba(15, 76, 117, 0.1);
}
.outcome-select.outcome-approved {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}
.outcome-select.outcome-warning {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}
.outcome-select.outcome-rejected {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.rule-flag {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
  color: #64748b;
}
.rule-flag input {
  display: none;
}
.rule-flag .material-icons {
  font-size: 16px;
}
.rule-flag .flag-label {
  display: none;
}
.rule-flag:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.rule-flag.active {
  background: var(--program-primary);
  border-color: var(--program-primary);
  color: #fff;
}
.rule-flag.active:hover {
  background: var(--program-primary-dark);
}

@media (min-width: 768px) {
  .rule-flag .flag-label {
    display: inline;
  }
}

@media (max-width: 640px) {
  .rules-table {
    min-width: 600px;
  }
  .rule-flag .flag-label {
    display: none;
  }
}

.step-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--program-border);
  flex-wrap: wrap;
  gap: 12px;
}

.step-actions .left,
.step-actions .right {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-program {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  border: none;
  background: var(--program-primary);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-program .material-icons {
  font-size: 20px;
}

.btn-program:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 76, 117, 0.18);
}

.btn-program.secondary {
  background: var(--program-secondary);
}

.btn-program.success {
  background: #16a34a;
}

.btn-program.success:hover {
  box-shadow: 0 10px 18px rgba(22, 163, 74, 0.25);
}

.btn-program.warning {
  background: #f59e0b;
}

.btn-program.warning:hover {
  box-shadow: 0 10px 18px rgba(245, 158, 11, 0.25);
}

.btn-program.ghost {
  background: transparent;
  color: var(--program-text-light);
  border: 1px solid var(--program-border);
}

.btn-program.ghost:hover {
  background: var(--program-primary-light);
  border-color: var(--program-primary);
  color: var(--program-primary);
  box-shadow: none;
  transform: none;
}

.btn-program.btn-sm {
  padding: 8px 14px;
  font-size: 0.82rem;
  border-radius: 10px;
}

.btn-program.btn-sm .material-icons {
  font-size: 18px;
}

/* Botón agregar con estilo mejorado */
.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 2px dashed var(--program-border);
  background: transparent;
  color: var(--program-text-light);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-add:hover {
  border-color: var(--program-primary);
  background: var(--program-primary-light);
  color: var(--program-primary);
}

.btn-add .material-icons {
  font-size: 18px;
}

.readonly-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 209, 102, 0.15);
  border: 1px solid rgba(255, 209, 102, 0.6);
  color: #a66300;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.8rem;
}

.readonly-badge .material-icons {
  font-size: 16px;
}

/* Hint de confirmación */
.confirmation-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px 0;
  padding: 12px 16px;
  background: rgba(15, 76, 117, 0.06);
  border-radius: 10px;
  color: var(--program-text-light);
  font-size: 0.88rem;
}

.confirmation-hint .material-icons {
  font-size: 18px;
  color: var(--program-primary);
}

.export-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--program-border);
}

.export-actions a {
  text-decoration: none;
}

/* Paso 8 - Resumen visual */
.summary-grid {
  display: grid;
  gap: 24px;
}

.summary-section {
  border: 1px solid rgba(16, 37, 66, 0.12);
  border-radius: 20px;
  padding: 24px 28px;
  background: var(--bg-card);
  box-shadow: 0 22px 42px rgba(15, 76, 117, 0.08);
  display: grid;
  gap: 20px;
}

.summary-section header {
  display: grid;
  gap: 6px;
}

.summary-section header h3 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  color: var(--program-text);
}

.summary-section header p {
  margin: 0;
  color: var(--program-text-light);
  font-size: 0.95rem;
}

.section-tag {
  justify-self: flex-start;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(0, 168, 204, 0.12);
  color: var(--program-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.program-identity .identity-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.identity-grid .label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--program-text-light);
  margin-bottom: 6px;
}

.identity-grid strong {
  display: block;
  font-size: 1.05rem;
  color: var(--program-text);
}

.identity-grid small {
  display: block;
  margin-top: 4px;
  color: var(--program-text-light);
}

.classification-panels {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.classification-panel {
  border: 1px dashed rgba(16, 37, 66, 0.18);
  border-radius: 16px;
  padding: 18px 20px;
  background: var(--bg-card);
  display: grid;
  gap: 14px;
}

.classification-panel h4 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--program-text);
}

.classification-panel p {
  margin: 0;
  color: var(--program-text-light);
  font-size: 0.9rem;
}

.classification-scale {
  display: grid;
  gap: 14px;
}

.scale-item {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid rgba(16, 37, 66, 0.08);
  box-shadow: 0 4px 20px rgba(16, 37, 66, 0.05);
  position: relative;
}

.scale-item .scale-meta {
  font-size: 0.75rem;
  color: var(--program-text-light);
}

.scale-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 4px;
  border-radius: 2px;
  background: var(--accent-color, rgba(16, 37, 66, 0.2));
}

.scale-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.scale-item-header strong {
  font-size: 1.05rem;
  color: var(--program-text);
}

.scale-subtitle {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--program-text-light);
}

.scale-description {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--program-text-light);
  line-height: 1.4;
}

.scale-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--program-text-light);
}

.scale-meta-row span {
  min-width: 72px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.tag-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.scale-list {
  margin: 6px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  color: var(--program-text-light);
  font-size: 0.85rem;
}

.scale-empty {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: rgba(16, 37, 66, 0.55);
}

.scale-meta-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(15, 76, 117, 0.08);
  color: var(--program-text);
  font-size: 0.8rem;
}

.classification-scale .level-baja { --accent-color: #0ea5e9; }

.classification-scale .level-media { --accent-color: #6366f1; }

.classification-scale .level-alta { --accent-color: #f97316; }

.classification-scale .level-critica { --accent-color: #dc2626; }

.scale-item strong {
  color: var(--program-text);
  font-size: 1rem;
}

.scale-item small {
  color: var(--program-text-light);
  font-size: 0.85rem;
}

.scale-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent-color, var(--program-secondary));
  box-shadow: 0 0 0 3px rgba(0, 168, 204, 0.12);
}

.classification-scale.maturity .scale-item {
  border-color: rgba(148, 163, 184, 0.22);
}

.classification-scale.maturity .level-bajo { --accent-color: #ef4444; }

.classification-scale.maturity .level-medio { --accent-color: #f59e0b; }

.classification-scale.maturity .level-alto { --accent-color: #16a34a; }

.decision-matrix .matrix-wrapper {
  display: grid;
  gap: 20px;
  position: relative;
  padding-left: 48px;
  padding-top: 36px;
}

.decision-matrix .matrix {
  overflow-x: auto;
  border-radius: 18px;
  border: 1px solid rgba(16, 37, 66, 0.14);
  background: var(--bg-card);
}

.matrix-header {
  display: grid;
  grid-template-columns: 160px repeat(auto-fit, minmax(160px, 1fr));
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border-default);
  padding-bottom: 6px;
}

.matrix-corner {
  padding: 18px;
  display: grid;
  gap: 4px;
  align-content: center;
}

.matrix-corner-title {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.matrix-corner small {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.matrix-col {
  padding: 18px;
  text-align: center;
  display: grid;
  gap: 6px;
}

.matrix-col-label {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--text-primary);
}

.matrix-col-sub {
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: 0.01em;
  color: var(--text-muted);
}

.matrix-col {
  padding: 18px;
  text-align: center;
}

.matrix-body {
  display: grid;
}

.matrix-axis {
  position: absolute;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  pointer-events: none;
}

.matrix-axis-y {
  left: 0;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  transform-origin: center;
  writing-mode: vertical-rl;
  border-right: 1px solid var(--border-default);
  padding-right: 6px;
  margin-right: 8px;
  height: calc(100% - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.matrix-axis-x {
  top: 8px;
  left: 48px;
  right: 0;
  text-align: center;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-default);
}

.matrix-row {
  display: grid;
  grid-template-columns: 160px repeat(auto-fit, minmax(160px, 1fr));
  border-top: 1px solid rgba(16, 37, 66, 0.06);
}

.matrix-row + .matrix-row {
  margin-top: 4px;
}

.matrix-row-header {
  padding: 18px;
  background: rgba(240, 244, 249, 0.95);
  font-weight: 600;
  color: var(--program-text);
  display: grid;
  gap: 6px;
}

.matrix-row-sub {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--program-text-light);
}

.matrix-cell {
  position: relative;
  padding: 18px;
  border-left: 1px solid rgba(16, 37, 66, 0.04);
  display: grid;
  gap: 10px;
  justify-items: center;
  align-items: center;
  text-align: center;
  background: var(--bg-card);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.matrix-cell-diagonal {
  box-shadow: inset 0 0 0 2px rgba(15, 76, 117, 0.16);
}

.matrix-cell.empty {
  color: rgba(16, 37, 66, 0.25);
}

.matrix-cell:hover {
  background: rgba(15, 76, 117, 0.04);
  box-shadow: inset 0 0 0 2px rgba(15, 76, 117, 0.08);
}

.matrix-cell::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #102542;
  color: #fff;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  line-height: 1.3;
  width: 200px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform-origin: bottom center;
  box-shadow: 0 12px 24px rgba(16, 37, 66, 0.25);
  white-space: pre-wrap;
  z-index: 5;
}

.matrix-cell[data-tooltip]:hover::after {
  opacity: 1;
  transform: translate(-50%, -4px);
}

.outcome-label {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(16, 37, 66, 0.85);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(16, 37, 66, 0.12);
  background: transparent;
}

.outcome-tags {
  display: inline-flex;
  gap: 6px;
}

.outcome-tags span {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  border: 1px solid rgba(16, 37, 66, 0.15);
  background: rgba(16, 37, 66, 0.04);
  color: rgba(16, 37, 66, 0.65);
}

.matrix-cell.outcome-aprobado .outcome-label {
  border-color: rgba(34, 197, 94, 0.4);
  color: #047857;
}

.matrix-cell.outcome-aprobado_excepcion .outcome-label {
  border-color: rgba(245, 158, 11, 0.4);
  color: #b45309;
}

.matrix-cell.outcome-rechazado .outcome-label {
  border-color: rgba(248, 113, 113, 0.5);
  color: #b91c1c;
}

.matrix-legend {
  border-left: 2px solid rgba(16, 37, 66, 0.12);
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.matrix-legend h4 {
  margin: 0;
  color: var(--program-text);
}

.matrix-legend ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.matrix-legend li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--program-text-light);
}

.legend-pill {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: rgba(15, 76, 117, 0.14);
}

.matrix-legend li strong {
  display: block;
  font-size: 0.9rem;
  color: var(--program-text);
}

.matrix-legend li small {
  font-size: 0.75rem;
  display: block;
}

.legend-pill.outcome-aprobado {
  background: linear-gradient(135deg, #d1f3e0 0%, #a3e4c4 100%);
}

.legend-pill.outcome-aprobado_excepcion {
  background: linear-gradient(135deg, #fff0d6 0%, #ffdc9f 100%);
}

.legend-pill.outcome-rechazado {
  background: linear-gradient(135deg, #ffd6d6 0%, #ff9f9f 100%);
}

.legend-pill.outcome-requiere_remediacion {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.outcome-aprobado {
  background: linear-gradient(135deg, #d1f3e0 0%, #a3e4c4 100%);
}

.outcome-aprobado_excepcion {
  background: linear-gradient(135deg, #fff0d6 0%, #ffdc9f 100%);
}

.outcome-rechazado {
  background: linear-gradient(135deg, #ffd6d6 0%, #ff9f9f 100%);
}

.outcome-requiere_remediacion {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.governance-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.governance-grid article {
  background: rgba(15, 76, 117, 0.06);
  border-radius: 16px;
  padding: 18px;
  display: grid;
  gap: 10px;
}

.governance-grid h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  margin: 0;
  color: var(--program-text);
}

.governance-grid p,
.governance-grid li {
  margin: 0;
  color: var(--program-text-light);
  font-size: 0.9rem;
}

.governance-grid ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.confirmation-block {
  display: grid;
  gap: 18px;
}

.confirmation-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(255, 209, 102, 0.4);
  background: rgba(255, 209, 102, 0.14);
  border-radius: 18px;
  padding: 18px 22px;
}

.confirmation-card h4 {
  margin: 0 0 6px 0;
  font-size: 1.1rem;
}

.confirmation-card p {
  margin: 0;
  color: var(--program-text-light);
}

.confirmation-note {
  display: grid;
  gap: 8px;
}

.confirmation-note textarea {
  min-height: 120px;
  border-radius: 16px;
  padding: 14px;
}

.status-pill.active {
  background: rgba(20, 184, 166, 0.12);
  border-color: rgba(20, 184, 166, 0.28);
  color: #047857;
}

.status-pill.pending {
  background: rgba(255, 209, 102, 0.12);
  border-color: rgba(255, 209, 102, 0.28);
  color: #a16207;
}

@media (max-width: 768px) {
  .summary-section {
    padding: 20px;
  }

  .matrix-header {
    grid-template-columns: 120px repeat(auto-fit, minmax(140px, 1fr));
  }

  .matrix-row {
    grid-template-columns: 120px repeat(auto-fit, minmax(140px, 1fr));
  }

  .confirmation-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

.badge-accent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 168, 204, 0.12);
  color: var(--program-secondary);
  border: 1px solid rgba(0, 168, 204, 0.28);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}

.last-updated {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--program-text-light);
  background: rgba(15, 76, 117, 0.05);
  padding: 8px 14px;
  border-radius: 10px;
}

/* Toolbar del programa */
.program-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.program-toolbar .toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.program-toolbar .toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.version-pill {
  background: var(--program-primary);
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
}

.status-pill.active {
  background: rgba(0, 168, 204, 0.12);
  color: var(--program-secondary);
  border-color: rgba(0, 168, 204, 0.3);
}

.status-pill.pending {
  background: rgba(255, 209, 102, 0.15);
  color: #a66300;
  border-color: rgba(255, 209, 102, 0.5);
}

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 3px solid rgba(15, 76, 117, 0.16);
  border-top-color: var(--program-primary);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.program-toast {
  position: fixed;
  top: 80px;
  right: 24px;
  min-width: 260px;
  max-width: 400px;
  background: #102542;
  color: #fff;
  padding: 14px 20px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16, 37, 66, 0.25);
  font-size: 14px;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 9999;
}

.program-toast.success {
  background: var(--program-secondary);
}

.program-toast.error {
  background: #d62828;
}

.program-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .wizard-surface {
    padding: 24px;
  }
  .step-chip {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
  .step-chip .index {
    height: 20px;
    width: 20px;
    min-width: 20px;
    font-size: 0.7rem;
  }
}

/* ============================================
   MEJORAS UX - TOOLBAR Y ESTADOS
   ============================================ */

.program-toolbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--program-border);
  box-shadow: 0 2px 8px rgba(16, 37, 66, 0.06);
  margin-top: 16px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.version-pill {
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--program-primary-light);
  color: var(--program-primary);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

/* Botón de acción con icono de advertencia */
.btn-program.warning {
  background: #f59e0b;
  color: white;
}

.btn-program.warning:hover {
  box-shadow: 0 10px 18px rgba(245, 158, 11, 0.25);
}

/* Botón de acción de éxito */
.btn-program.success {
  background: #10b981;
  color: white;
}

.btn-program.success:hover {
  box-shadow: 0 10px 18px rgba(16, 185, 129, 0.25);
}

/* Estado del programa con animación */
.status-pill.active {
  animation: pulse-active 2s ease-in-out infinite;
}

@keyframes pulse-active {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 168, 204, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(0, 168, 204, 0); }
}

/* Indicador de modo edición */
.editing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  font-weight: 600;
  font-size: 0.75rem;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.editing-indicator .material-icons {
  font-size: 14px;
}

/* Transiciones suaves para botones del toolbar */
.toolbar-actions .btn-program {
  transition: all 0.25s ease;
}

.toolbar-actions .btn-program:not([style*="display: none"]) {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mejora visual para el badge de solo lectura */
.readonly-badge {
  animation: pulse-warning 2s ease-in-out infinite;
}

@keyframes pulse-warning {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 209, 102, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(255, 209, 102, 0); }
}
