/* ============================================
   407 LEGAL · Tools / interactive subpages
   Used by /guia-accidente/, /tengo-un-caso/, /antes-del-accidente/
   Inherits tokens + base from styles.css; load AFTER styles.css.
   ============================================ */

/* ---------- TOOL PAGE FRAME ---------- */
.tool-page {
  background: var(--cream);
  padding: 56px 0 96px;
  min-height: calc(100vh - 80px);
}
@media (max-width: 720px) {
  .tool-page { padding: 32px 0 72px; }
}

.tool-page__header {
  text-align: center;
  margin-bottom: 28px;
}
.tool-page__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--rust-deep);
  text-decoration: none;
  margin-bottom: 18px;
  text-transform: uppercase;
}
.tool-page__back:hover { color: var(--navy); }

/* ---------- LANDING-PAGE TOOLS ROW ---------- */
.tools-row {
  background: var(--cream-2);
  padding: 64px 0;
  border-top: 1px solid rgba(9, 30, 49, 0.06);
  border-bottom: 1px solid rgba(9, 30, 49, 0.06);
}
.tools-row__head { text-align: center; margin-bottom: 36px; }
.tools-row__grid {
  display: grid;
  grid-template-columns: 1fr 1.28fr 1fr;
  gap: 22px;
  align-items: stretch;
}
@media (max-width: 1080px) {
  .tools-row__grid { grid-template-columns: 1fr 1.18fr 1fr; gap: 18px; }
}
@media (max-width: 880px) {
  .tools-row__grid { grid-template-columns: 1fr; }
}
.tool-card.tool-card--featured {
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-3) 100%);
  border-color: rgba(238,167,47,0.35);
  color: var(--cream);
  box-shadow: 0 22px 48px -22px rgba(9,30,49,0.55);
}
.tool-card.tool-card--featured .tool-card__icon {
  background: linear-gradient(140deg, var(--gold) 0%, var(--gold-2) 100%);
  color: var(--navy);
}
.tool-card.tool-card--featured .tool-card__kicker { color: var(--gold-3); }
.tool-card.tool-card--featured .tool-card__title  { color: var(--cream); }
.tool-card.tool-card--featured .tool-card__body   { color: rgba(244,237,227,0.88); }
.tool-card.tool-card--featured .tool-card__cta    { color: var(--gold); }
.tool-card.tool-card--featured::before {
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold) 100%);
  opacity: 1;
}
.tool-card.tool-card--featured:hover {
  border-color: var(--gold);
  box-shadow: 0 28px 58px -24px rgba(9,30,49,0.65);
}
.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 30px 26px 26px;
  background: var(--white);
  border: 1px solid rgba(9, 30, 49, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: var(--ink);
  transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out), border-color 220ms var(--ease-out);
  overflow: hidden;
}
.tool-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-3) 100%);
  opacity: 0.9;
}
.tool-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: var(--shadow-card);
}
.tool-card__icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--navy) 0%, var(--navy-3) 100%);
  color: var(--gold);
  display: grid;
  place-items: center;
}
.tool-card__icon svg { width: 28px; height: 28px; }
.tool-card__kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rust-deep);
}
.tool-card__title {
  font-family: var(--f-display);
  font-size: clamp(22px, 2.6vw, 26px);
  font-weight: 800;
  line-height: 1.15;
  margin: 0;
  color: var(--navy);
}
.tool-card__body {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-muted);
  margin: 0;
}
.tool-card__cta {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-deep);
}
.tool-card__cta svg { width: 16px; height: 16px; transition: transform 220ms var(--ease-out); }
.tool-card:hover .tool-card__cta svg { transform: translateX(4px); }

/* ---------- SOFI AVATAR + CHAT WRAPPER ---------- */
.sofi-shell {
  background: var(--white);
  border: 1px solid rgba(9, 30, 49, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.sofi-shell__head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-3) 100%);
  color: var(--cream);
}
.sofi-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  flex: 0 0 48px;
  background:
    radial-gradient(circle at 30% 30%, var(--gold-3) 0%, var(--gold) 60%, var(--gold-2) 100%);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 3px rgba(238, 167, 47, 0.32);
  position: relative;
}
.sofi-avatar svg { width: 28px; height: 28px; color: var(--navy); }
.sofi-avatar__pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(238, 167, 47, 0.5);
  animation: sofiPulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes sofiPulse {
  0%   { transform: scale(0.9); opacity: 0.7; }
  100% { transform: scale(1.25); opacity: 0; }
}
.sofi-shell__title {
  font-family: var(--f-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
  margin: 0;
}
.sofi-shell__sub {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-3);
  margin: 2px 0 0;
}
.sofi-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gold-3);
}
.sofi-status::before {
  content: "";
  width: 8px; height: 8px;
  background: #21d27a;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(33, 210, 122, 0.18);
}

.sofi-shell__body { padding: 22px 22px 6px; min-height: 320px; }
.sofi-shell__foot {
  padding: 14px 22px 18px;
  border-top: 1px solid rgba(9, 30, 49, 0.06);
  background: var(--cream-2);
}

/* ---------- CHAT BUBBLES ---------- */
.bubble {
  max-width: 88%;
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 15.5px;
  line-height: 1.55;
  margin-bottom: 12px;
  animation: bubbleIn 360ms var(--ease-out);
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bubble--sofi {
  background: var(--cream-2);
  border: 1px solid rgba(9, 30, 49, 0.06);
  border-top-left-radius: 6px;
  color: var(--ink);
}
.bubble--user {
  background: var(--navy);
  color: var(--cream);
  border-top-right-radius: 6px;
  margin-left: auto;
}
.bubble strong { color: var(--navy); font-weight: 700; }
.bubble--user strong { color: var(--gold-3); }

/* ---------- OPTION CHIPS ---------- */
.opt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 8px 0 18px;
}
.opt-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 14px 16px;
  background: var(--white);
  border: 1.5px solid rgba(9, 30, 49, 0.12);
  border-radius: 14px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
  transition: border-color 180ms var(--ease-out), background 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.opt-chip > span:last-child {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.opt-chip:hover {
  border-color: var(--gold);
  background: var(--cream-2);
  transform: translateY(-1px);
}
.opt-chip__icon {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  color: var(--gold-deep);
}
.opt-chip--selected {
  border-color: var(--gold);
  background: rgba(238, 167, 47, 0.1);
  box-shadow: 0 0 0 3px rgba(238, 167, 47, 0.18);
}
.opt-chip__num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  display: grid; place-items: center;
}

/* ---------- INLINE FORM FIELDS ---------- */
.inline-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 16px;
}
.inline-field label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
}
.inline-field input,
.inline-field select,
.inline-field textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid rgba(9, 30, 49, 0.18);
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--white);
  transition: border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}
.inline-field input:focus,
.inline-field select:focus,
.inline-field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: var(--shadow-input);
}

/* ---------- PROGRESS BAR ---------- */
.progress {
  height: 6px;
  background: rgba(9, 30, 49, 0.08);
  border-radius: 99px;
  margin: 4px 0 18px;
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-3) 100%);
  border-radius: 99px;
  width: 0%;
  transition: width 500ms var(--ease-out);
}

/* ---------- RESULT CARD ---------- */
.result-card {
  background: linear-gradient(140deg, var(--navy) 0%, var(--navy-3) 100%);
  color: var(--cream);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  margin-top: 18px;
  position: relative;
  overflow: hidden;
}
.result-card::before {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(238, 167, 47, 0.4) 0%, transparent 70%);
  pointer-events: none;
}
.result-card__kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-3);
  margin: 0 0 8px;
}
.result-card__band {
  font-family: var(--f-display);
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.result-card__note {
  font-size: 14px;
  line-height: 1.55;
  opacity: 0.85;
  margin: 0 0 18px;
}
.result-card__why {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(244, 237, 227, 0.14);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.55;
}
.result-card__why strong { color: var(--gold-3); }

/* ---------- COMPLIANCE FOOTER ---------- */
.tool-disclaimer {
  margin-top: 30px;
  padding: 18px 22px;
  background: rgba(9, 30, 49, 0.04);
  border: 1px solid rgba(9, 30, 49, 0.08);
  border-radius: 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-muted);
}
.tool-disclaimer strong { color: var(--navy); }

/* ---------- GUIDE PAGE: TREE / TIMELINE ---------- */
.guide-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: center;
  gap: 14px;
  margin: 24px auto 36px;
  max-width: 760px;
}
@media (max-width: 720px) {
  .guide-mode { grid-template-columns: 1fr; max-width: 420px; }
}
.guide-mode__btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 18px 18px;
  background: var(--white);
  border: 1.5px solid rgba(9, 30, 49, 0.1);
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  transition: border-color 180ms var(--ease-out), background 180ms var(--ease-out);
}
.guide-mode__btn:hover { border-color: var(--gold); background: var(--cream-2); }
.guide-mode__btn--active {
  border-color: var(--gold);
  background: rgba(238, 167, 47, 0.08);
  box-shadow: var(--shadow-input);
}
.guide-mode__icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--navy);
  color: var(--gold);
  display: grid; place-items: center;
}
.guide-mode__icon svg { width: 20px; height: 20px; }
.guide-mode__title {
  font-weight: 800;
  color: var(--navy);
  font-size: 15.5px;
}
.guide-mode__sub {
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.45;
}

/* timeline */
.timeline {
  position: relative;
  margin: 22px 0;
  padding-left: 38px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 14px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-3) 100%);
}
.timeline__step {
  position: relative;
  background: var(--white);
  border: 1px solid rgba(9, 30, 49, 0.08);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
}
.timeline__step::before {
  content: "";
  position: absolute;
  left: -32px; top: 22px;
  width: 14px; height: 14px;
  background: var(--gold);
  border: 3px solid var(--white);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--gold-2);
}
.timeline__when {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rust-deep);
  margin: 0 0 6px;
}
.timeline__title {
  font-family: var(--f-display);
  font-size: 19px;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 6px;
  line-height: 1.2;
}
.timeline__body {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-muted);
  margin: 0 0 8px;
}
.timeline__bullets {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
}
.timeline__bullets li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 6px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}
.timeline__bullets li::before {
  content: "✓";
  position: absolute;
  left: 0; top: 0;
  color: var(--gold-deep);
  font-weight: 800;
}

/* tree (decision diagram, simplified) */
.tree {
  background: var(--cream-2);
  border: 1px solid rgba(9, 30, 49, 0.08);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  margin: 22px 0;
}
.tree__node {
  background: var(--white);
  border: 1.5px solid rgba(9, 30, 49, 0.1);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
  position: relative;
}
.tree__node--prompt {
  background: var(--navy);
  color: var(--cream);
  border-color: var(--navy);
  text-align: center;
}
.tree__node--prompt h3 {
  font-family: var(--f-display);
  margin: 0;
  font-size: 18px;
}
.tree__branches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 600px) {
  .tree__branches { grid-template-columns: 1fr; }
}
.tree__branch {
  background: var(--white);
  border: 1.5px solid rgba(9, 30, 49, 0.1);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  padding: 14px 16px;
}
.tree__branch h4 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 14.5px;
  font-weight: 800;
}
.tree__branch p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-muted);
}

/* panic strip */
.panic-strip {
  background: linear-gradient(120deg, #2a0606 0%, #4a0e0e 100%);
  color: var(--cream);
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.panic-strip__icon {
  width: 48px; height: 48px;
  background: rgba(238, 167, 47, 0.15);
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--gold-3);
  flex-shrink: 0;
}
.panic-strip__copy { flex: 1 1 280px; }
.panic-strip__title { font-family: var(--f-display); font-weight: 800; font-size: 19px; margin: 0 0 4px; }
.panic-strip__sub { font-size: 14px; opacity: 0.85; margin: 0; }
.panic-strip .btn { flex-shrink: 0; }

/* ---------- BUTTON HELPERS USED IN TOOLS ---------- */
.btn--full { width: 100%; }
.btn--quiet {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid rgba(9, 30, 49, 0.16);
}
.btn--quiet:hover {
  border-color: var(--navy);
  background: var(--cream-2);
}

/* ---------- DO / DON'T LIST (timeline) ---------- */
.timeline__dosdonts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0 0;
}
@media (max-width: 600px) {
  .timeline__dosdonts { grid-template-columns: 1fr; }
}
.timeline__dos,
.timeline__donts {
  list-style: none;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
}
.timeline__dos {
  background: rgba(33, 210, 122, 0.08);
  border: 1px solid rgba(33, 210, 122, 0.28);
  color: #0f3b25;
}
.timeline__donts {
  background: rgba(180, 30, 30, 0.06);
  border: 1px solid rgba(180, 30, 30, 0.28);
  color: #4a0e0e;
}
.timeline__dosdonts h5 {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.timeline__dos h5 { color: #0a6f3d; }
.timeline__donts h5 { color: #8a1414; }
.timeline__dos li,
.timeline__donts li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 5px;
  font-weight: 600;
}
/* Heading <li> (contains <h5>) skips the bullet marker */
.timeline__dos li:has(h5),
.timeline__donts li:has(h5) {
  padding-left: 0;
  margin-bottom: 0;
}
.timeline__dos li:has(h5)::before,
.timeline__donts li:has(h5)::before { content: none; }
.timeline__dos li:not(:has(h5))::before {
  content: "✓";
  position: absolute; left: 0; top: 0;
  color: #0a6f3d;
  font-weight: 900;
}
.timeline__donts li:not(:has(h5))::before {
  content: "✗";
  position: absolute; left: 0; top: 0;
  color: #b41e1e;
  font-weight: 900;
}

/* ---------- RESULT CARD VARIANTS + RANGE ---------- */
.result-card--refer {
  background: linear-gradient(140deg, #2a1505 0%, #4a2510 100%);
}
.result-card--refer::before {
  background: radial-gradient(circle, rgba(238, 167, 47, 0.28) 0%, transparent 70%);
}
.result-card__range {
  font-family: var(--f-display);
  font-size: clamp(26px, 3.6vw, 34px);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--gold-3);
  margin: 0 0 14px;
  line-height: 1.15;
}

/* ---------- BILINGUAL LANG-TOGGLE OVERRIDE ----------
   styles.css declares `[data-lang-en] { display:none }` at specificity
   (0,1,0). Several class rules in this file set explicit `display` values
   on the same elements at the same specificity but appear LATER in source
   order, so they were winning and English was leaking into the Spanish
   view (.timeline__when, .sofi-status, etc). We re-establish the toggle
   with compound class+attribute selectors that bump specificity to (0,2,0). */
.tool-page [data-lang-en],
.timeline__when[data-lang-en],
.sofi-status[data-lang-en],
.sofi-shell__sub[data-lang-en],
.timeline__title [data-lang-en],
.timeline__body [data-lang-en],
.timeline__bullets li [data-lang-en],
.tree__branch h4[data-lang-en],
.tree__branch p[data-lang-en],
.tree__node--prompt h3[data-lang-en],
.guide-mode__title[data-lang-en],
.guide-mode__sub[data-lang-en],
.panic-strip__title [data-lang-en],
.panic-strip__sub [data-lang-en],
.tool-card__kicker[data-lang-en],
.tool-card__title[data-lang-en],
.tool-card__body[data-lang-en],
.tool-card__cta[data-lang-en] {
  display: none;
}
html[lang="en"] .tool-page [data-lang-es],
html[lang="en"] .timeline__when[data-lang-es],
html[lang="en"] .sofi-status[data-lang-es],
html[lang="en"] .sofi-shell__sub[data-lang-es],
html[lang="en"] .timeline__title [data-lang-es],
html[lang="en"] .timeline__body [data-lang-es],
html[lang="en"] .timeline__bullets li [data-lang-es],
html[lang="en"] .tree__branch h4[data-lang-es],
html[lang="en"] .tree__branch p[data-lang-es],
html[lang="en"] .tree__node--prompt h3[data-lang-es],
html[lang="en"] .guide-mode__title[data-lang-es],
html[lang="en"] .guide-mode__sub[data-lang-es],
html[lang="en"] .panic-strip__title [data-lang-es],
html[lang="en"] .panic-strip__sub [data-lang-es],
html[lang="en"] .tool-card__kicker[data-lang-es],
html[lang="en"] .tool-card__title[data-lang-es],
html[lang="en"] .tool-card__body[data-lang-es],
html[lang="en"] .tool-card__cta[data-lang-es] {
  display: none;
}
html[lang="en"] .tool-page [data-lang-en] { display: inline; }
html[lang="en"] .timeline__when[data-lang-en] { display: inline-block; }
html[lang="en"] .sofi-status[data-lang-en] { display: inline-flex; }
html[lang="en"] .sofi-shell__sub[data-lang-en],
html[lang="en"] .guide-mode__title[data-lang-en],
html[lang="en"] .guide-mode__sub[data-lang-en],
html[lang="en"] .tool-card__kicker[data-lang-en],
html[lang="en"] .tool-card__body[data-lang-en] { display: block; }
html[lang="en"] .tool-card__title[data-lang-en] { display: block; }
html[lang="en"] .tool-card__cta[data-lang-en] { display: inline-flex; }
html[lang="en"] .tree__branch h4[data-lang-en],
html[lang="en"] .tree__branch p[data-lang-en],
html[lang="en"] .tree__node--prompt h3[data-lang-en] { display: block; }
/* Restore block display for DO/DON'T headings inside dosdonts lists */
html[lang="en"] .timeline__dosdonts h5[data-lang-en] { display: block; }

/* ---------- SOFI FLOW v2 (TENGO-UN-CASO) ---------- */
.bubble {
  max-width: min(88%, 600px);
}
.bubble + .bubble { margin-top: 4px; }

.sofi-em {
  color: var(--gold-3);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.bubble--sofi .warn-aside {
  border-left: 3px solid var(--rust-deep);
  padding: 2px 0 2px 12px;
  margin: 0;
  color: var(--ink);
}
.bubble--sofi .warn-aside strong { color: var(--rust-deep); }

/* Wider chips, denser grid for the 11-chip case-type picker and the role sub-menus */
.opt-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.opt-chip {
  min-height: 64px;
  white-space: normal;
  align-items: center;
}

@media (max-width: 640px) {
  .bubble { max-width: 100%; }
  .opt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- KNOWLEDGE BASE LAYOUT (antes-del-accidente) ---------- */
.kb-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 36px;
  align-items: start;
  margin: 28px 0 40px;
}
.kb-toc {
  position: sticky;
  top: 84px;
  align-self: start;
  font-size: 13.5px;
}
.kb-toc__details > summary {
  font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  font-size: 11.5px; color: var(--gold-deep);
  cursor: pointer; list-style: none; margin-bottom: 10px;
}
.kb-toc__details > summary::-webkit-details-marker { display: none; }
.kb-toc__list {
  list-style: none; padding: 0; margin: 0; counter-reset: tocn;
  border-left: 1px solid rgba(9,30,49,0.12);
}
.kb-toc__list li { counter-increment: tocn; }
.kb-toc__list a {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 4px;
  align-items: baseline;
  padding: 8px 12px 8px 14px;
  color: var(--ink-muted); text-decoration: none;
  border-left: 3px solid transparent; margin-left: -2px;
  letter-spacing: -0.005em;
  line-height: 1.35;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease;
}
.kb-toc__list a::before {
  content: counter(tocn, decimal-leading-zero);
  color: rgba(160, 107, 0, 0.55);
  font-weight: 800; font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  transition: color 180ms ease;
}
.kb-toc__list a:hover {
  color: var(--navy);
  border-left-color: rgba(238, 167, 47, 0.5);
  background: rgba(238, 167, 47, 0.05);
}
.kb-toc__list a:hover::before { color: var(--gold-deep); }
.kb-toc__list a.is-active {
  color: var(--navy);
  border-left-color: var(--gold);
  font-weight: 600;
}
.kb-toc__list a.is-active::before { color: var(--navy); }

.kb-article { min-width: 0; }
.kb-section {
  scroll-margin-top: 96px;
  margin: 0 0 44px;
  padding-top: 24px;
  border-top: 1px solid rgba(9,30,49,0.08);
}
.kb-section:first-of-type { border-top: 0; padding-top: 0; }
.kb-section__num {
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.16em;
  color: var(--gold-3); margin: 0 0 6px; text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.kb-section__title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 800; color: var(--navy);
  letter-spacing: -0.012em; line-height: 1.18; margin: 0 0 14px;
}
.kb-section h3 {
  font-size: 17px; font-weight: 700; color: var(--navy);
  margin: 22px 0 8px;
  scroll-margin-top: 96px;
}
.kb-section p { line-height: 1.62; color: var(--ink); margin: 0 0 14px; }
.kb-section a { color: var(--gold-deep); text-decoration: underline; }
.kb-section a:hover { color: var(--navy); }
.kb-section ul {
  list-style: none; padding: 0; margin: 4px 0 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.kb-section ul li {
  position: relative; padding-left: 22px;
  line-height: 1.55; color: var(--ink);
}
.kb-section ul li::before {
  content: ""; position: absolute; left: 4px; top: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold);
}

.kb-component {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 6px 0 14px;
}
.kb-component__item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--cream-2);
  border: 1px solid rgba(9,30,49,0.1);
  border-radius: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--navy);
}
.kb-component__item::before {
  content: attr(data-num);
  flex-shrink: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--navy); color: var(--gold);
  font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
}

.kb-emph {
  display: block;
  padding: 12px 14px;
  background: rgba(238,167,47,0.08);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  font-weight: 600; color: var(--navy);
  margin: 8px 0 18px;
  line-height: 1.55;
}
.kb-emph strong { color: var(--rust-deep); }

.kb-final-cta {
  margin: 36px 0 0;
  padding: 24px;
  background: var(--cream-2);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
}
.kb-final-cta h3 { margin: 0 0 10px; font-size: 20px; color: var(--navy); }
.kb-final-cta p  { margin: 0 0 14px; color: var(--ink-muted); line-height: 1.55; }
.kb-final-cta__actions { display: grid; gap: 10px; }

@media (max-width: 880px) {
  .kb-layout { grid-template-columns: 1fr; gap: 18px; }
  .kb-toc {
    position: static;
    background: var(--cream-2);
    border-radius: 10px;
    padding: 14px 16px;
  }
  .kb-section { margin-bottom: 32px; }
}
