/* StatsPro — hoja de estilo propia. Los neutros, las escalas, el enfoque, la
   barra superior, la barra de bloques, los botones, los mensajes y la
   impresion vienen de labg-base.css (comun a la LABG Suite); aqui solo va la
   identidad de StatsPro y lo que es suyo. */

/* identidad: azul indigo de StatsPro y azul acero de acento (en oscuro,
   --primary-dark es el tono MAS CLARO: se usa para texto y para el boton al
   pasar el raton) */
:root {
  --primary-rgb: 59, 91, 219; --primary: #3b5bdb; --primary-dark: #2f49b0;
  --accent-rgb: 76, 114, 176; --accent: #4c72b0;
  --radius: 11px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary-rgb: 92, 124, 250; --primary: #5c7cfa; --primary-dark: #91a7ff;
    --accent-rgb: 123, 155, 209; --accent: #7b9bd1;
  }
}
:root[data-theme="dark"] {
  --primary-rgb: 92, 124, 250; --primary: #5c7cfa; --primary-dark: #91a7ff;
  --accent-rgb: 123, 155, 209; --accent: #7b9bd1;
}

main { max-width: 1080px; margin: 0 auto; padding: 0 20px 70px; }
.topbar-inner { max-width: 1080px; }
button.brand { border: 0; background: none; padding: 0; font-family: inherit; text-align: left; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: block; }
.brand-name { font-size: 1.16rem; font-weight: 700; letter-spacing: -0.5px; }
.brand-name .dot { color: var(--primary-text); }
.step-panel { padding-top: 4px; }

.badge-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.badge { font-size: 0.72rem; padding: 3px 10px; border-radius: 999px; background: var(--card-bg); border: 1px solid var(--border); color: var(--text-muted); }

/* ============================================================
   Bloque de inicio (panel-0): portada y tarjetas
   ============================================================ */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; margin: 22px 0 26px;
  background:
    radial-gradient(1100px 460px at 10% -12%, var(--primary-soft), transparent 62%),
    radial-gradient(760px 380px at 96% 6%, rgba(var(--accent-rgb), 0.13), transparent 62%),
    linear-gradient(180deg, var(--card-bg), var(--bg-soft));
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.hero-inner {
  display: grid; grid-template-columns: 1.02fr 1fr; gap: 26px;
  align-items: center; padding: 46px 44px 38px;
}
.hero h1 { font-size: 2.7rem; line-height: 1.08; margin: 0 0 14px; letter-spacing: -1.3px; font-weight: 800; }
.hero h1 .accent { color: var(--primary-text); }
.hero .lead { font-size: 1.08rem; color: var(--text-muted); margin: 0 0 22px; max-width: 580px; }
.hero .lead b { color: var(--text); font-weight: 600; }
.hero .badge-row { justify-content: flex-start; margin-top: 18px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hero-art svg { width: 100%; height: auto; display: block; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px; margin-bottom: 14px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--primary); border-radius: 2px; }

.art-card { fill: var(--card-bg); stroke: var(--border); }
.art-ax { stroke: var(--border-strong); stroke-width: 1; fill: none; }
.art-mut { fill: var(--text-muted); }

.section-title { font-size: 1.42rem; letter-spacing: -0.5px; margin: 38px 0 6px; }
.section-sub { color: var(--text-muted); margin: 0 0 18px; max-width: 820px; }

.workflow { display: flex; align-items: stretch; overflow-x: auto; padding: 4px 0 10px; }
.wf-step {
  flex: 1; min-width: 148px; padding: 12px 15px; cursor: pointer;
  background: var(--card-bg); border: 1px solid var(--border);
}
.wf-step + .wf-step { border-left: none; }
.wf-step:first-child { border-radius: 10px 0 0 10px; }
.wf-step:last-child { border-radius: 0 10px 10px 0; }
.wf-step:hover { background: var(--primary-soft); }
.wf-n { font-size: 0.66rem; color: var(--primary-text); font-weight: 700; letter-spacing: .09em; }
.wf-t { font-weight: 600; font-size: 0.86rem; margin: 2px 0 1px; }
.wf-d { font-size: 0.74rem; color: var(--text-muted); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.feat {
  display: flex; gap: 14px; align-items: flex-start; text-align: left; cursor: pointer;
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--card-bg); border: 1px solid var(--border); color: inherit;
  font: inherit; transition: border-color .15s, transform .15s;
}
.feat:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.feat-art { flex: 0 0 auto; width: 40px; height: 40px; }
.feat-art svg { width: 100%; height: 100%; display: block; }
.feat-n {
  display: inline-flex; width: 19px; height: 19px; border-radius: 50%; margin-right: 7px;
  align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700;
  background: var(--primary-soft); color: var(--primary-text); vertical-align: -3px;
}
.feat-t { display: block; font-weight: 600; margin-bottom: 3px; }
.feat-d { display: block; font-size: 0.83rem; color: var(--text-muted); line-height: 1.5; }

.closing {
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; align-items: start;
  margin: 40px 0 10px; padding: 24px 26px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius);
}
.closing h3 { margin: 0 0 8px; font-size: 1.06rem; }
.closing p { margin: 0; color: var(--text-muted); font-size: 0.92rem; line-height: 1.62; }
.closing-side { font-size: 0.86rem; }
.closing-side .cite-label { font-size: 0.72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--primary-text); margin-bottom: 8px; }
.closing-side ul { margin: 0; padding-left: 18px; color: var(--text-muted); }
.closing-side li { margin-bottom: 6px; }

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; padding: 30px 22px; }
  .hero h1 { font-size: 2.05rem; }
  .closing { grid-template-columns: 1fr; }
}

.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.card h2 { margin-top: 0; font-size: 1.22rem; }
.card h3 { font-size: 1rem; margin-bottom: 6px; }
.card h4 { font-size: 0.9rem; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.hint { color: var(--text-muted); font-size: 0.88rem; margin: 4px 0 10px; }
.step-panel { display: none; }
.step-panel.active { display: block; }

input[type=text], input[type=number], select, textarea {
  padding: 8px 11px; border-radius: 7px; border: 1px solid var(--field-border);
  font-family: inherit;
  background: var(--card-bg); color: var(--text); font-size: 0.9rem; max-width: 100%;
}
input[type=color] { width: 44px; height: 30px; padding: 2px; border-radius: 6px; border: 1px solid var(--border); background: var(--card-bg); }
input[type=range] { vertical-align: middle; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.inline-label { font-size: 0.9rem; color: var(--text-muted); display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.messages { margin-top: 12px; }

.config-group { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.config-group:last-of-type { border-bottom: none; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; cursor: pointer; margin-bottom: 6px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 14px; }

.results-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 14px 0; }
.stat-tile { background: var(--bg); border-radius: 8px; padding: 12px 16px; }
.stat-tile .stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-tile .stat-value { font-size: 1.3rem; font-weight: 600; margin-top: 2px; }
.stat-tile .stat-sub { font-size: 0.76rem; color: var(--text-muted); }
.results-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

.table-scroll { overflow: auto; max-height: 460px; margin: 10px 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
th, td { padding: 6px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--bg); position: sticky; top: 0; font-weight: 600; z-index: 1; }
tr:hover td { background: rgba(var(--accent-rgb), 0.06); }

/* ---- drop zone ---- */
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 34px 20px;
  text-align: center; cursor: pointer; transition: 0.15s; background: var(--bg);
}
.drop-zone:hover, .drop-zone.drag { border-color: var(--primary); background: rgba(var(--primary-rgb), 0.05); }
.drop-zone .dz-icon { font-size: 1.8rem; color: var(--primary-text); }
.drop-zone p { margin: 6px 0; }

/* ---- config de columnas ---- */
.col-config { display: grid; gap: 8px; margin: 14px 0; }
.col-config-row {
  display: grid; grid-template-columns: 1.4fr 1.1fr 1.3fr; gap: 12px; align-items: center;
  padding: 8px 10px; background: var(--bg); border-radius: 8px;
}
.col-config-row .col-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; }
.col-config-row .col-meta { font-size: 0.78rem; color: var(--text-muted); }
.col-config-row select { width: 100%; }
@media (max-width: 640px) { .col-config-row { grid-template-columns: 1fr; gap: 4px; } }

/* ---- estudio de graficas ---- */
.plot-studio { display: grid; grid-template-columns: 340px 1fr; gap: 20px; margin-top: 14px; }
@media (max-width: 900px) { .plot-studio { grid-template-columns: 1fr; } }
.plot-panel { border: 1px solid var(--border); border-radius: 10px; padding: 4px 14px 14px; background: var(--bg); max-height: 620px; overflow-y: auto; }
.opt-sec { padding: 12px 0; border-bottom: 1px solid var(--border); }
.opt-sec:last-child { border-bottom: none; }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.opt-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--text-muted); }
.opt-grid label.ck { flex-direction: row; align-items: center; gap: 6px; }
.opt-grid label.ck input { flex-shrink: 0; }
.opt-grid select, .opt-grid input[type=text], .opt-grid input[type=number] { width: 100%; }
.rv { font-variant-numeric: tabular-nums; color: var(--text); }
.style-bar {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin: 10px 0 14px;
}
.style-bar input[type=range] { width: 100%; }
.mini-check { display: grid; gap: 2px; }
.mini-check label { flex-direction: row; align-items: center; gap: 6px; font-size: 0.78rem; }

.plot-out { min-width: 0; }
.plot-canvas {
  border: 1px solid var(--border); border-radius: 10px; background: var(--card-bg);
  min-height: 340px; display: flex; align-items: center; justify-content: center; padding: 10px; overflow: auto;
}
.plot-canvas img { max-width: 100%; height: auto; border-radius: 4px; }
.plot-canvas.loading { opacity: 0.45; }

.spinner-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.spinner-box { background: var(--card-bg); padding: 26px 34px; border-radius: 12px; text-align: center; max-width: 340px; }
.spinner { width: 38px; height: 38px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; margin: 0 auto 12px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- bloque 3: supuestos ---- */
.btn-xs { min-height: 26px; padding: 4px 9px; font-size: 0.76rem; border-radius: 6px; }
.verdict { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; }
.verdict.ok { background: var(--success-soft); color: var(--success-text); }
.verdict.bad { background: var(--danger-soft); color: var(--danger-text); }
.verdict.warn { background: var(--warning-soft); color: var(--warning-text); }
.verdict-line { margin: 10px 0; font-size: 0.95rem; }
.verdict-line .hint { display: inline; }

details.theory { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 8px 0 14px; }
details.theory summary { cursor: pointer; font-size: 0.86rem; font-weight: 600; color: var(--primary-text); }
details.theory p { font-size: 0.85rem; color: var(--text-muted); margin: 8px 0 2px; }

.traffic { display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0 14px; }
.traffic-item { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
#a3RecBox ul { margin: 6px 0; padding-left: 20px; font-size: 0.9rem; }
#a3RecBox li { margin-bottom: 6px; }
#a3ModelTiles .stat-value { font-size: 0.95rem; word-break: break-word; }

.fig-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-top: 12px; }
.fig-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--card-bg); }
.fig-card img { width: 100%; height: auto; border-radius: 4px; margin-top: 8px; }
.fig-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.fig-head .hint { margin: 3px 0 0; font-size: 0.8rem; }
.fig-dl { display: flex; gap: 5px; flex-shrink: 0; }

/* ---- bloque 4 ---- */
.subtabs { display: flex; gap: 6px; border-bottom: 2px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.subtab { background: none; border: none; padding: 9px 16px; cursor: pointer; color: var(--text-muted);
  font-size: 0.92rem; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.subtab.active { color: var(--primary-text); border-bottom-color: var(--primary); font-weight: 600; }
.subtab-panel { display: none; }
.subtab-panel.active { display: block; }
tr.row-best td { background: var(--success-soft) !important; font-weight: 600; }
.rec-head { font-size: 0.98rem; margin: 2px 0 10px; }
#r4RecBox ul, #r4DetailBox ul { font-size: 0.88rem; padding-left: 20px; margin: 6px 0; }
#r4RecBox li { margin-bottom: 6px; }
.fig-box { width: 100%; overflow-x: auto; text-align: center; margin-top: 10px; }
.fig-box img { max-width: 100%; height: auto; border-radius: 6px; }
.fig-card #r4FigFit img, .fig-card #r4FigResid img, .fig-card #r4FigQQ img { width: 100%; height: auto; margin-top: 8px; border-radius: 4px; }
.fig-card .loading { opacity: 0.4; }

.mini-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 12px 0; }
.mini-tiles > div { background: var(--bg); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.mini-tiles span { font-size: 0.74rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.mini-tiles b { font-size: 1.05rem; }
.mini-tiles i { font-style: normal; font-size: 0.85rem; color: var(--primary-text); }
.mini-tiles small { font-size: 0.76rem; color: var(--text-muted); }
.two-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 10px; }
@media (max-width: 860px) { .two-tables { grid-template-columns: 1fr; } }

.dimdesc { font-size: 0.85rem; padding: 6px 0; border-bottom: 1px solid var(--border); }
.dimdesc:last-child { border-bottom: none; }
.dimdesc .pos { color: var(--success-text); }
.dimdesc .neg { color: var(--danger-text); }
#m6RecBox ul { font-size: 0.88rem; padding-left: 20px; }
#m6RecBox li { margin-bottom: 6px; }

.app-footer { text-align: center; color: var(--text-muted); font-size: 0.82rem; padding: 20px; }

@media print {
  .app-footer, .btn, .spinner-overlay, .plot-panel { display: none !important; }
  .step-panel { display: block !important; }
  .card { break-inside: avoid; }
}
