/* =============================================================
   TEM · Plataforma de Marcas — Design System
   Warm paper aesthetic · Orange accent #F47C3C
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --paper:     #FAF7F2;
  --paper-2:   #F2EEE6;
  --paper-3:   #E8E4DC;
  --ink:       #1A1A1A;
  --ink-2:     #4A4A4A;
  --ink-3:     #8A8A8A;
  --line:      rgba(26,26,26,0.18);
  --orange:    #F47C3C;
  --orange-bg: rgba(244,124,60,0.10);
  --navy:      #1D3557;
  --green:     #4F8A4A;
  --green-bg:  rgba(79,138,74,0.10);
  --amber:     #C98A1F;
  --amber-bg:  rgba(201,138,31,0.10);
  --red:       #C44A3E;
  --red-bg:    rgba(196,74,62,0.10);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--paper-3);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  margin: 0;
}

/* ── NAV ─────────────────────────────────────────── */
.tem-nav {
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
  padding: 0 48px;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 0 var(--ink);
}

.tem-logo {
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -0.04em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.tem-logo .dot { color: var(--orange); }
.tem-logo .sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  margin-left: 6px;
  letter-spacing: 0.06em;
}

.tem-nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}
.tem-nav-links a {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: 0.15s;
}
.tem-nav-links a:hover { color: var(--ink); background: var(--paper-2); }
.tem-nav-links a.active { color: var(--ink); font-weight: 700; }

.tem-nav-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--orange);
  border: 2px solid var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── EYEBROW ─────────────────────────────────────── */
.eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 4px;
}

/* ── CARDS ───────────────────────────────────────── */
.tem-card {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 3px 3px 0 var(--ink);
  transition: border-color .3s, box-shadow .3s;
}
.tem-card--filtrado {
  border-color: var(--orange);
  box-shadow: 3px 3px 0 var(--orange);
}

/* Banner filtro activo encima de la tabla */
#filtro-activo-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--orange-bg);
  border: 1.5px solid var(--orange);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--orange);
}
#filtro-activo-banner button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--orange);
  font-weight: 900;
  padding: 0 2px;
  line-height: 1;
}

/* Chip activo en el resumen */
.tem-chip.chip-active {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  font-weight: 800;
}
.tem-card--accent {
  border-color: var(--orange);
  box-shadow: 3px 3px 0 var(--orange);
}
.tem-box {
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}
.tem-box--ghost {
  background: transparent;
  border-style: dashed;
}

/* ── BUTTONS ─────────────────────────────────────── */
.tem-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  text-decoration: none;
  transition: 0.15s;
  white-space: nowrap;
  border: 1.5px solid var(--ink);
}
.tem-btn--ghost {
  background: transparent;
  color: var(--ink);
}
.tem-btn--ghost:hover { background: var(--paper-2); color: var(--ink); }
.tem-btn--accent {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  box-shadow: 2px 2px 0 var(--ink);
}
.tem-btn--accent:hover {
  background: #e06828;
  color: #fff;
  box-shadow: none;
  transform: translate(2px,2px);
}
.tem-btn--lg {
  font-size: 15px;
  padding: 12px 28px;
  border-radius: 10px;
}
.tem-btn--primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ── CHIPS ───────────────────────────────────────── */
.tem-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid currentColor;
  white-space: nowrap;
}
.tem-chip--ghost   { color: var(--ink-3); border-color: var(--line); background: transparent; }
.tem-chip--accent  { color: var(--orange); border-color: var(--orange); background: var(--orange-bg); }
.tem-chip--green   { color: var(--green);  border-color: var(--green);  background: var(--green-bg); }
.tem-chip--amber   { color: var(--amber);  border-color: var(--amber);  background: var(--amber-bg); }
.tem-chip--red     { color: var(--red);    border-color: var(--red);    background: var(--red-bg); }

.tem-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.tem-dot--green  { background: var(--green); }
.tem-dot--amber  { background: var(--amber); }
.tem-dot--red    { background: var(--red); }
.tem-dot--orange { background: var(--orange); }

/* ── SCORE GAUGE ─────────────────────────────────── */
.score-gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.score-gauge {
  position: relative;
  width: 140px;
  height: 140px;
}
.score-gauge svg { width: 140px; height: 140px; }
.score-gauge-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-num {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
}
.score-denom {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 700;
}
.score-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: center;
  max-width: 140px;
}

/* ── PROGRESS BAR ────────────────────────────────── */
.tem-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
  display: inline-block;
  width: 100%;
}
.tem-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--ink);
  font-style: normal;
}
.tem-bar--green i  { background: var(--green); }
.tem-bar--amber i  { background: var(--amber); }
.tem-bar--red i    { background: var(--red); }

/* ── TABLE ───────────────────────────────────────── */
.tem-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tem-table th {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1.5px solid var(--ink);
}
.tem-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tem-table tr:hover td { background: var(--paper-2); }
.tem-table tr:last-child td { border-bottom: none; }

/* ── STATUS ROWS ─────────────────────────────────── */
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line);
}
.status-row:last-child { border-bottom: none; }
.status-row-left { display: flex; align-items: center; gap: 10px; }
.status-row-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  flex-shrink: 0;
}

/* ── REASONING BOXES ─────────────────────────────── */
.reason-box {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 8px;
}
.reason-score {
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  flex-shrink: 0;
}
.reason-score--pos { color: var(--green); }
.reason-score--neg { color: var(--red); }
.reason-score--warn { color: var(--amber); }

/* ── INDEX PAGE ──────────────────────────────────── */
.index-hero {
  background: var(--paper);
  background-image: radial-gradient(rgba(26,26,26,0.04) 1px, transparent 1px);
  background-size: 14px 14px;
  padding: 72px 48px 60px;
  min-height: calc(100vh - 54px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-eyebrow { margin-bottom: 10px; }

.hero-h1 {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 14px;
}
.hero-h1 .accent { color: var(--orange); }

.hero-sub {
  font-size: 16px;
  color: var(--ink-2);
  line-height: 1.6;
  max-width: 520px;
  margin-bottom: 32px;
}

.search-card {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 28px 28px 24px;
  max-width: 860px;
  box-shadow: 4px 4px 0 var(--ink);
}

.field-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
  display: block;
  margin-bottom: 8px;
}

.tem-input {
  width: 100%;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  padding: 12px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: 0.15s;
}
.tem-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-bg);
}
.tem-input::placeholder { color: var(--ink-3); }
.tem-input--error, .tem-input--error:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-bg);
}
.field-error {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
}

/* ── ESTADOS DE CARGA (heurística 01) ─────────────── */
.tem-btn:disabled, .tem-btn[aria-busy="true"] {
  opacity: .7;
  cursor: progress;
  transform: none !important;
  box-shadow: none !important;
}
.spinner {
  width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* Toast (confirmación de acciones) */
.tem-toast {
  position: fixed; top: 18px; right: 18px; z-index: 300;
  background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 700;
  border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--orange);
  display: flex; align-items: center; gap: 12px;
  animation: toast-in .2s ease-out;
}
.tem-toast button {
  background: none; border: 1.5px solid rgba(255,255,255,.6); color: #fff;
  border-radius: 6px; padding: 3px 9px; font-size: 12px; font-weight: 700; cursor: pointer;
}
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Foco visible para teclado (accesibilidad) */
.tem-btn:focus-visible, .tem-chip[onclick]:focus-visible, .clase-num:focus-visible, .clase-all:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.tem-input--lg {
  font-size: 22px;
  font-weight: 800;
  padding: 14px 18px;
  letter-spacing: -0.01em;
}

.tem-select {
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  padding: 11px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  cursor: pointer;
  width: 100%;
}
.tem-select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-bg);
}

.country-chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── STATS STRIP ─────────────────────────────────── */
.stats-strip {
  background: var(--paper-2);
  border-top: 1.5px solid var(--ink);
  padding: 20px 48px;
  display: flex;
  gap: 40px;
  align-items: center;
}
.stat-item { text-align: center; }
.stat-num {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
}
.stat-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 4px;
}
.stats-divider {
  width: 1px;
  height: 36px;
  background: var(--line);
}

/* ── RESULTS PAGE ────────────────────────────────── */
.results-wrap {
  padding: 0 48px 48px;
}

.breadcrumb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 48px 8px;
}
.breadcrumb-path {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
}
.breadcrumb-path .current { color: var(--ink); font-weight: 700; }
.breadcrumb-actions { display: flex; gap: 8px; }

.verdict-h1 {
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 6px 0 12px;
}
.verdict-h1 .brand { color: var(--orange); }

.verdict-summary-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.comparable-section { margin-top: 16px; }
.brand-mini {
  display: flex;
  flex-direction: column;
  width: 160px;
  padding: 10px 14px 13px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--ink);
  font-family: 'Inter', sans-serif;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}
.brand-mini-tag {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--orange);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-mini-name {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-top: 5px;
  line-height: 1.1;
  word-break: break-word;
  overflow-wrap: break-word;
}

.reasoning-grid {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* ── SECTION HEADER ──────────────────────────────── */
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-head h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 4px 0 0;
  letter-spacing: -0.01em;
}

/* ── FOOTER ──────────────────────────────────────── */
.tem-footer {
  background: var(--ink);
  color: rgba(255,255,255,0.5);
  font-size: 11px;
  text-align: center;
  padding: 16px 48px;
  margin-top: 48px;
}
.tem-footer a { color: rgba(255,255,255,0.4); text-decoration: none; }
.tem-footer a:hover { color: rgba(255,255,255,0.7); }

/* ── UTIL ────────────────────────────────────────── */
.row-between {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

.fw-900 { font-weight: 900; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.color-muted { color: var(--ink-3); }
.color-orange { color: var(--orange); }

/* ── CLASE PICKER ────────────────────────────────────── */
.clase-picker { display:flex; flex-wrap:wrap; gap:3px; margin-top:6px; }
.clase-all {
  width:100%; padding:4px 0; font-size:11px; font-weight:700; text-align:center;
  border:1.5px solid var(--orange); border-radius:6px; cursor:pointer;
  background:var(--orange); color:#fff; transition:all 0.15s; user-select:none;
}
.clase-all.inactive {
  background:var(--paper); color:var(--ink-3); border-color:var(--line);
}
.clase-num {
  width:26px; height:22px; display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:700; border:1.5px solid var(--line); border-radius:5px;
  cursor:pointer; color:var(--ink-3); background:var(--paper);
  transition:all 0.12s; user-select:none;
}
.clase-num:hover { border-color:var(--orange); color:var(--orange); }
.clase-num.active { background:var(--orange); color:#fff; border-color:var(--orange); }

/* ── SOLO-ACTIVAS TOGGLE ─────────────────────────────── */
.activas-toggle {
  display:flex; align-items:center; gap:7px; font-size:12px; font-weight:600;
  cursor:pointer; color:var(--ink-2); user-select:none;
}
.activas-toggle input[type=checkbox] { cursor:pointer; accent-color:var(--orange); }

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 900px) {
  .tem-nav { padding: 0 16px; gap: 12px; flex-wrap: wrap; height: auto; min-height: 54px; }
  .index-hero { padding: 40px 16px 36px; }
  .breadcrumb-bar { padding: 12px 16px 8px; flex-wrap: wrap; gap: 8px; }
  .results-wrap { padding: 0 16px 32px; }
  .row-between { flex-direction: column; }
  .stats-strip { padding: 16px; flex-wrap: wrap; gap: 20px; }
  /* Navegación en móvil: fila desplazable debajo del logo, nunca oculta (heurística 06) */
  .tem-nav-links {
    order: 10; flex: 1 0 100%;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 0 0 8px; gap: 2px; scrollbar-width: none;
  }
  .tem-nav-links::-webkit-scrollbar { display: none; }
  .tem-nav-links a { font-size: 12px; padding: 5px 10px; flex-shrink: 0; }
  .tem-nav-links a.active { background: var(--orange-bg); color: var(--orange); }
}

@media (max-width: 600px) {
  .search-card { padding: 18px; }
  .reasoning-grid { flex-direction: column; }
  .tem-btn--lg { font-size: 14px; padding: 10px 20px; }
}

/* ── PRINT ───────────────────────────────────────── */
@media print {
  .tem-nav, .breadcrumb-actions, .stats-strip, .tem-footer,
  .no-print { display: none !important; }
  body { background: #fff; }
  .tem-card, .search-card { box-shadow: none; border: 1px solid #ccc; }
}