/* Mejoras (suite de mejora, 2026-10-13) */
.suite-tabs { display: flex; gap: 6px; margin: 4px 0 10px; flex-wrap: wrap; }
.suite-tab { border: 1px solid var(--border-color, #ddd); background: transparent; padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.suite-tab.active { background: var(--accent-color, #0f6cbd); color: #fff; border-color: transparent; }
.suite-count { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; background: #d13438; color: #fff; font-size: 0.75em; }
.suite-muted { color: var(--text-secondary, #666); font-size: 0.86em; }
.suite-bad { color: #d13438; }
.suite-table { width: 100%; border-collapse: collapse; font-size: 0.88em; }
.suite-table th, .suite-table td { border-bottom: 1px solid var(--border-color, #eee); padding: 6px; text-align: left; vertical-align: top; }
.suite-click { cursor: pointer; }
.suite-click:hover { background: var(--hover-bg, rgba(0,0,0,0.04)); }
.suite-card { border: 1px solid var(--border-color, #e5e5e5); border-radius: 8px; padding: 12px 14px; margin: 8px 0; }
.suite-card label { display: block; margin: 6px 0; }
.suite-card input[type=text], .suite-card textarea, .suite-card select { width: 100%; max-width: 640px; }
.suite-row { margin: 8px 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.suite-row input[type=text] { flex: 1; min-width: 220px; }
.suite-link { background: none; border: none; color: var(--accent-color, #0f6cbd); cursor: pointer; padding: 0; text-decoration: underline; }
.suite-chip { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--hover-bg, #eef2f7); font-size: 0.8em; }
.suite-steps { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0 10px; }
.suite-step { border: 1px solid var(--border-color, #ddd); background: transparent; border-radius: 14px; padding: 3px 10px; font-size: 0.8em; cursor: pointer; }
.suite-step.active { background: var(--accent-color, #0f6cbd); color: #fff; border-color: transparent; }
.suite-step.done { border-color: #2e9e4f; }
.suite-step-body { min-height: 120px; }
.suite-comp { border-left: 3px solid var(--accent-color, #0f6cbd); padding: 4px 10px; margin: 8px 0; }
.suite-comp pre, .suite-step-body pre { white-space: pre-wrap; font-size: 0.85em; max-height: 260px; overflow: auto; }
.suite-result { font-size: 1.1em; font-weight: 600; }
.suite-primary { font-weight: 600; }
.suite-nav { display: flex; gap: 6px; justify-content: flex-end; }
/* ¿Es la causa? (2026-10-14) */
.suite-cause { border-left: 4px solid #999; padding: 6px 10px; margin: 8px 0; border-radius: 4px; }
.suite-cause-CLAVE { border-left-color: #d13438; }
.suite-cause-PROBABLE { border-left-color: #e0a100; }
.suite-cause-COINCIDENCIA { border-left-color: #8a8886; }
/* Antes y después (2026-10-14) */
ins.suite-add { background: #d4f4dd; text-decoration: none; padding: 0 1px; }
del.suite-del { background: #fde7e9; color: #a4262c; }
.suite-chip-add { background: #d4f4dd; }
.suite-chip-del { background: #fde7e9; }
.suite-doc { margin: 8px 0 14px; }
pre.suite-final { white-space: pre-wrap; max-height: 360px; overflow: auto; border: 1px solid var(--border-color, #e5e5e5); padding: 8px; border-radius: 6px; }
.suite-tests li { margin: 10px 0; }

/* Inicio de Mejoras (2026-10-14) */
.suite-detected { list-style: none; margin: 0; padding: 0; }
.suite-detected-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border-color, #eee); }
.suite-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.suite-stat { display: flex; flex-direction: column; gap: 2px; text-align: left; border: 1px solid var(--border-color, #ddd); background: transparent; border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.suite-stat-n { font-size: 1.5em; font-weight: 600; }
.suite-intake ul { margin: 6px 0; padding-left: 18px; }
@media (max-width: 640px) { .suite-detected-row { flex-direction: column; align-items: flex-start; } }
.suite-tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.suite-tool h4 { margin: 0 0 4px; }
.suite-crumb { margin: 0 0 10px; font-size: 0.9em; color: var(--text-secondary, #666); }
.suite-warn { border-color: #e0a100; background: rgba(224,161,0,0.08); }
.suite-ok { color: #1b7a3a; }
.suite-spark { font-family: monospace; letter-spacing: 1px; }
.suite-checklist { list-style: none; padding-left: 0; }
.suite-strip-compact { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.suite-chip-btn { border: 1px solid var(--border-color, #ddd); background: transparent; border-radius: 16px; padding: 3px 10px; cursor: pointer; font-size: 0.86em; }
.suite-chip-btn.has { border-color: var(--accent-color, #0f6cbd); }
.suite-warn-text { color: #8a5a00; }
.suite-phasebar { letter-spacing: 2px; color: var(--accent-color, #0f6cbd); font-size: 0.9em; }
.suite-q-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border-color, #eee); }
.suite-journey { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0 0 8px; font-size: 0.86em; }
.suite-jstep { padding: 2px 8px; border-radius: 12px; border: 1px solid var(--border-color, #ddd); color: var(--text-secondary, #666); }
.suite-jstep.done { color: var(--text-primary, #222); }
.suite-jstep.now { background: var(--accent-color, #0f6cbd); color: #fff; border-color: transparent; }
.suite-jsep { color: var(--text-secondary, #888); }
.suite-ficha-cta { margin: 14px 0; }
.suite-ficha-cta .hd-btn { padding: 8px 18px; font-size: 1em; }
.suite-propose { margin: 4px 0 8px; }
@media (max-width: 640px) { .suite-q-row { flex-direction: column; align-items: flex-start; } }
.suite-step-off { opacity: 0.45; cursor: default; }
.suite-edit textarea { width: 100%; max-width: 760px; }
.suite-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.suite-match-comp { margin: 8px 0; }
.suite-working { border: 1px solid var(--accent-color, #0f6cbd); border-radius: 8px; padding: 10px 14px; margin: 10px 0; background: rgba(15,108,189,0.06); }
.suite-working-steps { list-style: none; margin: 6px 0; padding: 0; }
.suite-working-steps li { padding: 2px 0; }
.suite-gdone { color: #1b7a3a; }
.suite-gnow { font-weight: 600; }
.suite-gtodo { color: var(--text-secondary, #888); }
.suite-old { opacity: 0.55; }
.suite-spinner { display: inline-block; width: 11px; height: 11px; border: 2px solid var(--accent-color, #0f6cbd); border-right-color: transparent; border-radius: 50%; animation: suite-spin 0.8s linear infinite; vertical-align: -1px; }
@keyframes suite-spin { to { transform: rotate(360deg); } }
.suite-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.suite-modal { background: var(--bg-primary, #fff); color: var(--text-primary, #222); border-radius: 10px; padding: 18px 20px; width: min(520px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,0.3); }
.suite-modal h3 { margin: 0 0 8px; }
.suite-modal-text { margin: 0 0 10px; }
.suite-modal textarea { width: 100%; box-sizing: border-box; }
.suite-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.suite-danger { background: #b91c1c !important; border-color: #b91c1c !important; color: #fff !important; }
#suite-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 10001; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.suite-toast { background: #7f1d1d; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.25); }
.suite-toast-ok { background: #166534; }
.suite-scope { margin: 2px 0 6px 18px; padding: 0; }
.suite-flow { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.suite-flow-main { min-width: 0; }
.suite-side { position: sticky; top: 8px; border: 1px solid var(--border-color, #e5e5e5); border-radius: 8px; padding: 10px 12px; background: var(--bg-secondary, rgba(0,0,0,0.02)); font-size: 0.9em; }
.suite-side h5 { margin: 0 0 6px; }
.suite-side-what { margin: 0 0 8px; }
.suite-lamps { list-style: none; margin: 0 0 6px; padding: 0; }
.suite-lamp { padding: 3px 0; }
.suite-bar { position: sticky; bottom: 0; z-index: 5; margin: 14px -2px 0; padding: 10px 2px; background: var(--bg-primary, #fff); border-top: 1px solid var(--border-color, #e5e5e5); display: flex; gap: 8px; justify-content: space-between; }
.suite-ba { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0; }
.suite-ba-col h6 { margin: 0 0 4px; font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary, #666); }
.suite-ba-col pre { margin: 0; white-space: pre-wrap; }
.suite-ba-after { border-left: 3px solid #1b7a3a; padding-left: 8px; }
@media (max-width: 900px) { .suite-flow { grid-template-columns: minmax(0, 1fr); } .suite-side { position: static; } }
@media (max-width: 700px) { .suite-ba { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .suite-side { order: -1; } }

/* Cola priorizada y paginada (2026-10-15) */
.suite-q-group { list-style: none; margin: 0.9rem 0 0.2rem; padding: 0 0 0.2rem; border-bottom: 1px solid var(--border-color, #ddd); font-size: 0.8rem; color: var(--text-secondary, #666); text-transform: uppercase; letter-spacing: 0.04em; }
.suite-q-group:first-child { margin-top: 0.2rem; }
.suite-pager { display: flex; align-items: center; gap: 0.8rem; justify-content: center; margin: 0.8rem 0 0.2rem; }
.suite-pager button[disabled] { opacity: 0.45; cursor: default; }

/* Mejoras: aspecto y navegación (2026-10-20, bloque C) */
.suite-wizard { border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.suite-wizard h3 { margin: 0 0 6px; font-size: 1.15em; }
.suite-wizard .suite-steps { gap: 6px; }
.suite-step { transition: background .15s, border-color .15s, transform .1s; }
.suite-step:not(.suite-step-off):hover { border-color: var(--accent-color, #0f6cbd); }
.suite-step.done::before { content: "✓ "; color: #2e9e4f; }
.suite-progress { height: 5px; background: var(--border-color, #e5e5e5); border-radius: 3px; overflow: hidden; margin: 2px 0 4px; }
.suite-progress > span { display: block; height: 100%; background: var(--accent-color, #0f6cbd); border-radius: 3px; transition: width .25s; }
.suite-progress-label { margin: 0 0 8px; font-size: 0.82em; color: var(--text-secondary, #666); }
.suite-next-hint { align-self: center; font-size: 0.85em; color: var(--text-secondary, #666); margin-left: auto; }
.suite-bar { box-shadow: 0 -4px 10px rgba(0,0,0,0.04); }
.suite-reco { border-left: 5px solid #999; border-radius: 8px; padding: 10px 14px; margin: 6px 0 14px; background: var(--bg-secondary, rgba(0,0,0,0.03)); }
.suite-reco-title { font-size: 1.1em; font-weight: 700; margin-bottom: 2px; }
.suite-reco p { margin: 2px 0 4px; }
.suite-reco-why { margin: 4px 0 0; padding-left: 18px; }
.suite-reco-why li { margin: 4px 0; }
.suite-reco-ok { border-left-color: #1b7a3a; background: rgba(27,122,58,0.08); }
.suite-reco-okish { border-left-color: #8bc34a; background: rgba(139,195,74,0.10); }
.suite-reco-warn { border-left-color: #e0a100; background: rgba(224,161,0,0.10); }
.suite-reco-bad { border-left-color: #d13438; background: rgba(209,52,56,0.08); }
.suite-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 6px 0 10px; }
.suite-tile { position: relative; border: 1px solid var(--border-color, #ddd); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; background: var(--bg-primary, #fff); }
.suite-tile h5 { margin: 0; font-size: 1.05em; }
.suite-tile p { margin: 0; flex: 1; }
.suite-tile .hd-btn { width: 100%; }
.suite-tile-reco { border-color: var(--accent-color, #0f6cbd); box-shadow: 0 0 0 2px rgba(15,108,189,0.18); }
.suite-tile-badge { position: absolute; top: -9px; right: 10px; background: var(--accent-color, #0f6cbd); color: #fff; font-size: 0.7em; padding: 1px 8px; border-radius: 9px; }
.suite-tile-no-go .hd-btn:not(.suite-primary) { border-color: #d13438; color: #a4262c; }
@media (max-width: 640px) { .suite-bar { flex-wrap: wrap; } .suite-next-hint { display: none; } }

/* Mejoras: cola por tipo y propuesta en acordeones (2026-10-20, bloque D) */
.suite-seg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; }
.suite-seg-btn { border: 1px solid var(--border-color, #ddd); background: transparent; border-radius: 16px; padding: 3px 12px; cursor: pointer; font-size: 0.86em; }
.suite-seg-btn.on { background: var(--accent-color, #0f6cbd); color: #fff; border-color: transparent; }
.suite-q-section { border: 1px solid var(--border-color, #e5e5e5); border-radius: 10px; margin: 8px 0; padding: 0 12px; background: var(--bg-primary, #fff); }
.suite-q-section > summary { cursor: pointer; padding: 9px 0; list-style: none; }
.suite-q-section > summary::-webkit-details-marker { display: none; }
.suite-q-section > summary::before { content: "▸"; display: inline-block; width: 1.1em; transition: transform .15s; }
.suite-q-section[open] > summary::before { transform: rotate(90deg); }
.suite-q-section[open] > summary { border-bottom: 1px solid var(--border-color, #eee); }
.suite-count-soft { background: var(--hover-bg, #eef2f7); color: var(--text-primary, #222); }
.suite-acc { border-left: 3px solid var(--accent-color, #0f6cbd); border-radius: 0 8px 8px 0; padding: 6px 12px; margin: 10px 0; background: var(--bg-secondary, rgba(0,0,0,0.02)); }
.suite-acc > summary { cursor: pointer; list-style: none; padding: 4px 0; }
.suite-acc > summary::-webkit-details-marker { display: none; }
.suite-acc > summary::before { content: "▸"; display: inline-block; width: 1.1em; transition: transform .15s; }
.suite-acc[open] > summary::before { transform: rotate(90deg); }
.suite-acc-title { font-weight: 700; }
.suite-acc-sum { margin-left: 6px; color: var(--text-secondary, #555); font-size: 0.9em; }

/* Mejoras: qué cambiará en LuzIA (2026-10-20, E3) */
.suite-changes { border: 1px solid var(--border-color, #e5e5e5); border-left: 5px solid #1b7a3a; border-radius: 8px; padding: 10px 14px; margin: 6px 0 14px; background: rgba(27,122,58,0.05); }
.suite-changes h5 { margin: 0 0 6px; font-size: 1.05em; }
.suite-changes ul { margin: 0; padding-left: 18px; }
.suite-changes li { margin: 5px 0; }

/* Mejoras: propuestas sueltas guiadas (2026-10-20, E2) */
.suite-lamps-wide .suite-lamp { padding: 6px 0; border-bottom: 1px solid var(--border-color, #eee); }
.suite-ev-list { margin: 6px 0 8px; padding-left: 18px; }
.suite-ev-list li { margin: 3px 0; }

/* Mejoras: buscador y tablas ordenables (2026-10-20, E4) */
.suite-search { margin: 4px 0 10px; }
.suite-search input { width: 100%; max-width: 520px; padding: 7px 12px; border: 1px solid var(--border-color, #ccc); border-radius: 18px; font-size: 0.95em; }
.suite-th { background: none; border: none; cursor: pointer; font: inherit; font-weight: 700; padding: 0; color: inherit; text-align: left; }
.suite-th:hover { color: var(--accent-color, #0f6cbd); }
.suite-sortable td { vertical-align: top; }

/* Mejoras: Inicio por etapas (2026-10-20, E1) */
.suite-stage { border: 1px solid var(--border-color, #e5e5e5); border-radius: 10px; margin: 10px 0; padding: 0 14px; background: var(--bg-primary, #fff); }
.suite-stage > summary { cursor: pointer; padding: 10px 0; list-style: none; font-size: 1.05em; }
.suite-stage > summary::-webkit-details-marker { display: none; }
.suite-stage > summary::before { content: "▸"; display: inline-block; width: 1.1em; transition: transform .15s; }
.suite-stage[open] > summary::before { transform: rotate(90deg); }
.suite-stage[open] > summary { border-bottom: 1px solid var(--border-color, #eee); }
.suite-stage-decidir { border-left: 5px solid #1b7a3a; }
.suite-stage-tocan { border-left: 5px solid #e0a100; }
.suite-stage-hint { margin: 6px 0 2px; }
.suite-origin { background: rgba(15,108,189,0.10); }
.suite-proposes { color: var(--text-primary, #222); }
.suite-box-compact { padding: 8px 12px; }
.suite-box-compact textarea { width: 100%; max-width: 640px; margin: 4px 0; }

/* 2026-10-25: el Portón único y Calidad (CRRT) viven en Mejoras › Avanzado y NO deben verse en el menú, ni un instante tras reiniciar el contenedor. _hdApplyAuth (app.js) pone display:'' a todo lo [data-admin-only] cada vez que se revalida la sesión y los volvía a mostrar hasta que la suite los ocultaba otra vez. Ahora están ocultos por defecto (!important) y solo se ven si el servidor confirma expresamente que el camino único está apagado (clase suite-legacy-visible). */
body:not(.suite-legacy-visible) .hd-nav-btn[data-page="crrt-calidad"],
body:not(.suite-legacy-visible) .hd-nav-btn[data-page="porton-unico"] { display: none !important; }
