/* SodiaAlpha — panel v1. Sin build, sin dependencias. */

:root {
  --bg: #f6f7f5;
  --card: #ffffff;
  --ink: #16211c;
  --muted: #6b7a72;
  --line: #e2e6e1;
  --brand: #1b6b52;
  --brand-ink: #ffffff;
  --warn: #b7791f;
  --bad: #a02c2c;
  --ok: #1b6b52;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 32, 24, 0.06), 0 8px 24px rgba(16, 32, 24, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--brand); }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { font-weight: 700; letter-spacing: -0.02em; }
.brand span { color: var(--brand); }

.nav { display: flex; gap: 4px; margin-left: 8px; flex-wrap: wrap; }
.nav a {
  padding: 7px 12px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
}
.nav a:hover { background: #eef2ef; color: var(--ink); }
.nav a[aria-current="page"] { background: var(--brand); color: var(--brand-ink); }

.spacer { flex: 1; }

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #e9f0ec;
  color: var(--brand);
  white-space: nowrap;
}
.pill.warn { background: #fdf3e3; color: var(--warn); }
.pill.muted { background: #eceeec; color: var(--muted); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 24px 64px; }

h1 { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 4px; }
.lead { color: var(--muted); margin: 0 0 24px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.card.hero { background: var(--brand); color: #fff; border-color: transparent; }
.card.hero .label { color: #cfe3d9; }
.card.hero .big { color: #fff; }

.label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.big { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; }
.sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 24px 12px; text-align: center; }

/* Tablas en modo archivo legado — cifras atenuadas y badges neutros */
.table-archivo td.num,
.table-archivo td.num span,
.table-archivo td.num strong {
  color: #7d8b83 !important;
  font-weight: 500 !important;
}
.table-archivo strong {
  color: #4a5550;
}
.table-archivo .pill {
  background: #edf0ee !important;
  color: #6b7a72 !important;
  border: 1px solid #dcdfdc !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.05); }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.small { padding: 7px 12px; font-size: 13px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}
.field input:focus { outline: 2px solid #bcd8cc; border-color: var(--brand); }

.auth {
  max-width: 420px;
  margin: 8vh auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.alert {
  display: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 14px;
  background: #fdecec;
  color: var(--bad);
  border: 1px solid #f5c9c9;
}
.alert.show { display: block; }
.alert.ok { background: #e9f5ef; color: var(--ok); border-color: #c3e2d3; }

.hint { font-size: 13px; color: var(--muted); margin-top: 12px; }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.tabs button {
  flex: 1;
  padding: 9px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--brand); color: #fff; border-color: transparent; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input[type="search"] {
  flex: 1;
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.upgrade {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  border: 1px dashed #b9cdc2;
  background: #f2f7f4;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.upgrade p { margin: 0; color: var(--muted); font-size: 14px; }

/* ============================================================= */
/* FASE 4 · UI DECISIÓN HERMES D×J (Ficha de Producto, Matriz 2x2, Razones) */
/* ============================================================= */

.score-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.score-badges-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.badge-d {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-j {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-ev {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.veredicto-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.veredicto-pill.escalar {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}
.veredicto-pill.ejecutar_a_ciegas, .veredicto-pill.ciegas {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}
.veredicto-pill.oportunidad_oculta, .veredicto-pill.oculta {
  background: #e0e7ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}
.veredicto-pill.descartar {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}
.veredicto-pill.evidencia_insuficiente, .veredicto-pill.insuficiente {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

/* Modal Ficha de Producto */
.ficha-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ficha-modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 900px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 18px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.ficha-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
  background: #fafbfa;
  position: sticky;
  top: 0;
  z-index: 20;
}
.ficha-modal-body {
  padding: 26px;
}

.ficha-close-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--muted);
}
.ficha-close-btn:hover {
  background: #f1f5f9;
  color: var(--ink);
}

.indicators-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.indicator-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  position: relative;
}
.indicator-box.d-box { border-top: 4px solid #0284c7; }
.indicator-box.j-box { border-top: 4px solid #ea580c; }
.indicator-box.ev-box { border-top: 4px solid #059669; }

.indicator-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
.indicator-val {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.indicator-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Banner de veredicto grande */
.veredicto-banner {
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.veredicto-banner.escalar {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #14532d;
}
.veredicto-banner.ejecutar_a_ciegas, .veredicto-banner.ciegas {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
}
.veredicto-banner.oportunidad_oculta, .veredicto-banner.oculta {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #312e81;
}
.veredicto-banner.descartar {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #7f1d1d;
}
.veredicto-banner.evidencia_insuficiente, .veredicto-banner.insuficiente {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  color: #374151;
}

/* Matriz 2x2 */
.matrix-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.matrix-svg-wrapper {
  width: 100%;
  max-width: 440px;
  margin: 12px auto;
}

/* Sección Por Qué NO */
.why-no-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}
.why-no-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
}
.why-no-lead {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 16px;
}
.reasons-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.reason-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  border-left: 5px solid #94a3b8;
}
.reason-item.dato { border-left-color: #0284c7; }
.reason-item.derivado { border-left-color: #7c3aed; }
.reason-item.regla { border-left-color: #d97706; }
.reason-item.juicio { border-left-color: #ea580c; }

.reason-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.tag-capa {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.tag-capa.dato { background: #0284c7; color: #fff; }
.tag-capa.derivado { background: #7c3aed; color: #fff; }
.tag-capa.regla { background: #d97706; color: #fff; }
.tag-capa.juicio { background: #ea580c; color: #fff; }

.reason-score-badge {
  font-weight: 700;
  font-size: 13px;
  color: #b91c1c;
}
.reason-evidence-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 12px;
  color: #334155;
  margin-top: 8px;
  line-height: 1.45;
}
.reason-evidence-box strong {
  color: #0f172a;
}

