/* =====================================================================
   plan-auto.css  —  Wizard generador + modales personalizar / historial
   ===================================================================== */

/* Columnas del pyf-grid que no existían */
.pyf-col-5  { grid-column: span 5; }
.pyf-col-7  { grid-column: span 7; }
.pyf-col-12 { grid-column: 1 / -1; }

@media (max-width: 980px) {
  .pyf-col-5, .pyf-col-7, .pyf-col-12 { grid-column: 1 / -1; }
}

/* ======= Barras compactas en Resumen activo ========================= */
.pyf-bars-compact {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 6px;
}
.pyf-bars-compact .pyf-bar { font-size: 11.5px; }

/* ======= Wizard ====================================================== */
.pga-wizard-card .pga-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}
.pga-wizard-card .pga-step:last-of-type { border-bottom: none; }

.pga-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(79,140,255,.12);
  color: #4f8cff;
  font-weight: 700;
  font-size: 13px;
}

.pga-step-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 6px;
}

/* ── Paso 1: pills de presets ── */
.pga-preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pga-pill {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-2);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  transition: all .15s ease;
}
.pga-pill:hover {
  border-color: rgba(79,140,255,.5);
  background: rgba(79,140,255,.06);
}
.pga-pill.is-active {
  background: #4f8cff;
  color: #fff;
  border-color: #4f8cff;
}

/* ── Paso 2: radios de tiempos ── */
.pga-tiempos-radios {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.pga-radio {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-2);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text);
  transition: all .15s ease;
}
.pga-radio:hover { border-color: rgba(79,140,255,.5); }
.pga-radio input { accent-color: #4f8cff; margin: 0; }
.pga-radio:has(input:checked) {
  background: rgba(79,140,255,.12);
  border-color: #4f8cff;
  color: #4f8cff;
  font-weight: 600;
}

/* ── Paso 3: sugerencia ── */
.pga-suggest {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--card-2);
  border: 1px dashed var(--border);
  font-size: 12.5px;
  color: var(--muted);
}
.pga-suggest-active {
  border-style: solid;
  border-color: rgba(79,140,255,.35);
  background: rgba(79,140,255,.06);
  color: var(--text);
}
.pga-suggest strong { color: #4f8cff; }

/* ── Paso 4: override ── */
.pga-override-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.pga-override-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}
.pga-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.pga-opt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  transition: all .15s ease;
}
.pga-opt:hover { border-color: rgba(79,140,255,.45); }
.pga-opt input { display: none; }
.pga-opt:has(input:checked) {
  background: rgba(79,140,255,.12);
  border-color: #4f8cff;
  color: #4f8cff;
  font-weight: 600;
}

.pga-personalizar-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: #4f8cff;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
}
.pga-personalizar-link:hover { border-bottom-color: #4f8cff; }

/* ── Wizard actions ── */
.pga-wizard-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 14px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
}

.pga-btn {
  padding: 8px 14px;
  border: 1px solid rgba(79,140,255,.4);
  border-radius: 8px;
  background: rgba(79,140,255,.10);
  color: #4f8cff;
  font: 600 13px/1 inherit;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.pga-btn:hover {
  background: rgba(79,140,255,.18);
  box-shadow: 0 4px 14px rgba(79,140,255,.18);
  transform: translateY(-1px);
}
.pga-btn:active { transform: translateY(0); }
.pga-btn-primary {
  background: #4f8cff;
  color: #fff;
  border-color: #4f8cff;
}
.pga-btn-primary:hover {
  background: #3b7dff;
  box-shadow: 0 6px 18px rgba(79,140,255,.35);
}

/* ======= Modales (Personalizar + Historial) ========================= */
.pga-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity .15s ease, visibility 0s linear .15s;
}
.pga-modal[aria-hidden="false"] {
  visibility: visible;
  opacity: 1;
  transition: opacity .15s ease, visibility 0s linear 0s;
}
.pga-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  cursor: pointer;
}
.pga-modal-dialog {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 720px;
  width: calc(100vw - 40px);
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  overflow: hidden;
}
.pga-modal-wide { max-width: 960px; }
.pga-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.pga-modal-header h3 {
  margin: 0;
  font-size: 15px;
  color: var(--text);
}
.pga-modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background .15s ease;
}
.pga-modal-close:hover { background: var(--card-2); color: var(--text); }
.pga-modal-body {
  padding: 16px 18px;
  overflow: auto;
  flex: 1;
}
.pga-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

/* ======= Matriz editable (modal Personalizar) ====================== */
.pga-matriz-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-2);
  margin-top: 10px;
}
.pga-matriz {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
.pga-matriz thead th {
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.pga-matriz thead th:first-child { text-align: left; padding-left: 12px; }
.pga-matriz tbody td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.pga-matriz tbody tr:last-child td { border-bottom: none; }
.pga-grupo-cell {
  text-align: left !important;
  padding-left: 12px !important;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
}
.pga-w {
  width: 54px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
}
.pga-w:focus {
  outline: none;
  border-color: #4f8cff;
  box-shadow: 0 0 0 2px rgba(79,140,255,.15);
}
.pga-sum {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 38px;
}
.pga-sum-ok  { color: #16a34a; }
.pga-sum-bad { color: #dc2626; }

/* ======= Historial de planes ======================================== */
.pga-historial-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 10px;
}
.pga-historial-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.pga-historial-table thead th {
  background: var(--card-2);
  color: var(--muted);
  text-align: left;
  padding: 10px 12px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.pga-historial-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.pga-historial-table tbody tr:last-child td { border-bottom: none; }
.pga-historial-row { cursor: pointer; transition: background .15s ease; }
.pga-historial-row:hover { background: rgba(79,140,255,.08); }
.pga-historial-empty {
  text-align: center;
  padding: 30px !important;
  color: var(--muted);
  font-style: italic;
}
.pga-historial-error { color: #dc2626; }

.pga-tipo-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(79,140,255,.15);
  color: #4f8cff;
  letter-spacing: .04em;
}

/* "Otra atención" (decisión #1): versión creada por otro nutri. Solo se marca, no
   se expone identidad; esas versiones no se pueden eliminar (inmutables). */
.pga-otra-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(224,168,0,.15);
  color: #b07d12;
  letter-spacing: .03em;
}
.pga-historial-row.pga-otra-atencion { background: rgba(224,168,0,.06); }
.pga-historial-row.pga-otra-atencion:hover { background: rgba(224,168,0,.12); }
.pga-otra-lock { font-size: 14px; opacity: .65; cursor: default; }

.pga-btn-eliminar {
  background: transparent;
  border: 1px solid transparent;
  font-size: 15px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--muted);
  transition: all .15s ease;
}
.pga-btn-eliminar:hover {
  background: rgba(220, 38, 38, .12);
  color: #dc2626;
  border-color: rgba(220, 38, 38, .3);
}

/* ======= Light theme overrides ====================================== */
#app.light-theme .pga-suggest,
#app.light-theme .pga-pill,
#app.light-theme .pga-radio,
#app.light-theme .pga-opt { background: #fff; border-color: rgba(0,0,0,.10); }
#app.light-theme .pga-modal-dialog { background: #fff; border-color: rgba(0,0,0,.08); }
#app.light-theme .pga-modal-overlay { background: rgba(0,0,0,.45); }
#app.light-theme .pga-matriz-wrap,
#app.light-theme .pga-historial-wrap { background: #f8fafc; border-color: rgba(0,0,0,.08); }
#app.light-theme .pga-matriz thead th,
#app.light-theme .pga-historial-table thead th { background: #fff; border-color: rgba(0,0,0,.08); }
#app.light-theme .pga-w { background: #fff; border-color: rgba(0,0,0,.12); }
