/* Auditoría final de accesibilidad, contraste y UX. Se carga después de todos los estilos públicos. */
:root{
  --teal:#0b6f69;
  --muted:#586579;
  --tool-teal:#0b6f69;
  --tool-muted:#56647b;
  --a11y-focus:#1f5fbf;
  --a11y-focus-soft:rgba(31,95,191,.2);
  --a11y-danger:#9f2f26;
}

html{overflow-x:hidden}
body{overflow-wrap:break-word}
::selection{color:#fff;background:#102d62}
::placeholder{color:#59667a;opacity:1}

:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{
  outline:3px solid var(--a11y-focus)!important;
  outline-offset:3px!important;
}
:where(input,select,textarea):focus-visible{
  box-shadow:0 0 0 4px var(--a11y-focus-soft)!important;
}
:where(button,a,summary){-webkit-tap-highlight-color:rgba(31,95,191,.14)}

/* Contraste de textos secundarios y estados pequeños. */
.publication span,
.story-meta,
.byline-card span,
.section-head>p,
.next-edition p,
.author-card p,
.newsletter small,
.author-profile p,
.listing-hero p,
.tool-card p,
.tool-card small,
.home-route p,
.discovery-card p,
.topic-hub-card p,
.disclosure,
.legal{color:#586579}

.content-badge b,
.story-meta span:first-child,
.type-podcast b,
.tool-hero-meta b,
.calculator-intro>span,
.result-interpretation>span,
.comparison-reading>span{color:#0b6f69}
.type-video b{color:#a52f24}

/* Enlaces reconocibles sin depender solo del color. */
.article a:not(.primary-action):not(.secondary-action),
.tool-copy a:not(.primary-action):not(.secondary-action),
.privacy-copy a,
.about-copy a{
  color:#173f7c;
  text-decoration-line:underline;
  text-decoration-thickness:.09em;
  text-underline-offset:.18em;
}
.article a:hover,.tool-copy a:hover{color:#0b2f69}

/* Objetivos táctiles y foco coherente. */
.nav a,
.filters button,
.share button,
.share a,
.read-button,
.newsletter button,
.menu-button,
.calculator-presets button,
.calculator-actions button,
.tax-event-actions a,
.tax-controls select,
.filter-toggle,
.today-button,
.calendar-nav button,
[data-select-month],
[data-select-visible],
[data-tax-download],
[data-open-selection],
.rule-composer>summary,
.rule-form-actions button{
  min-height:44px;
}
.nav a{display:inline-flex;align-items:center;padding-inline:3px}
.filters button,.share button,.share a{padding:10px 14px}

/* Formularios generales. */
input,select,textarea,button{font:inherit}
input,select,textarea{max-width:100%}
textarea{resize:vertical}
.newsletter input,.lead-fields input,.lead-fields textarea{
  color:#15191f;
  background:#fff;
}
.newsletter input:focus-visible{border-bottom-color:#1f5fbf!important}

/* Herramientas: estructura resistente a restricciones heredadas. */
.tool-workspace,
.tool-input-panel,
.tool-result-panel,
.calculator-input-group,
.comparator-fields,
.comparison-option,
.result-breakdown,
.result-summary{min-width:0}

.tool-input-panel,
.comparator-input-panel{container-type:inline-size}

.tool-input-panel fieldset{min-inline-size:0}
.tool-input-panel label,
.tool-input-panel .money-field,
.comparator-fields .calculator-fields>label{
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
}

.tool-input-panel input[type=number],
.tool-input-panel input[type=text],
.tool-input-panel input[type=email],
.tool-input-panel input[type=tel],
.tool-input-panel select,
.tool-input-panel textarea{
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  min-height:52px;
  padding:13px 14px!important;
  color:#142039!important;
  background:#fff!important;
  border-color:#9eabc0!important;
  line-height:1.25!important;
  text-overflow:clip;
}
.tool-input-panel textarea{min-height:110px}
.tool-input-panel input:hover,
.tool-input-panel select:hover,
.tool-input-panel textarea:hover{border-color:#61738f!important}

.field-label{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:end!important;
  gap:6px 12px!important;
  min-height:2.5em;
  color:#27344d;
  line-height:1.35;
}
.field-label small{
  color:#56647b!important;
  line-height:1.2;
  white-space:normal;
}

.money-input{
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  grid-template-columns:44px minmax(0,1fr)!important;
  border-color:#9eabc0!important;
}
.money-input>b{
  min-width:44px;
  color:#102d62!important;
  background:#e8f0fb!important;
  border-right-color:#c0cada!important;
}
.tool-input-panel .money-input input{
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  padding-inline:14px!important;
  white-space:nowrap;
}

.numeric-value-long{font-size:.9rem!important;letter-spacing:-.015em!important}
.numeric-value-very-long{font-size:.8rem!important;letter-spacing:-.025em!important}

.calculator-presets{
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(88px,1fr));
  gap:8px!important;
}
.calculator-presets button{
  width:100%;
  min-width:0!important;
  min-height:42px!important;
  padding:9px 10px!important;
  color:#33425e!important;
  border-color:#9eabc0!important;
  white-space:normal;
  line-height:1.2!important;
}
.calculator-presets button:hover{color:#102d62!important;border-color:#102d62!important}
.calculator-presets button.active,
.calculator-presets button[aria-pressed=true]{color:#fff!important;background:#102d62!important;border-color:#102d62!important}

/* Comparador: controles amplios y números completos. */
.comparator-scenarios{
  grid-template-columns:repeat(auto-fit,minmax(min(260px,100%),1fr))!important;
  align-items:start;
  gap:18px!important;
}
.comparator-fields{padding:22px!important;border-color:#bdc7d7!important}
.comparator-fields legend{
  width:min(100% - 8px,30rem)!important;
  padding-inline:8px!important;
}
.comparator-fields legend>span{color:#0b6f69!important}
.comparator-fields legend>small{color:#56647b!important;font-size:.76rem!important}
.comparator-fields .calculator-fields{width:100%;gap:18px!important}

.comparison-options{
  grid-template-columns:repeat(auto-fit,minmax(min(230px,100%),1fr))!important;
  gap:12px!important;
}
.comparison-option{container-type:inline-size}
.comparison-option header{min-height:0!important}
.comparison-option header p{color:#d9e3f1!important;font-size:.78rem!important}
.comparison-option dt{color:#d2dced!important;font-size:.73rem!important}
.comparison-option dd{
  max-width:100%;
  color:#fff!important;
  font-size:clamp(.82rem,4.2cqw,1rem)!important;
  line-height:1.25!important;
  white-space:nowrap;
  overflow:visible;
  word-break:normal;
  overflow-wrap:normal!important;
  font-variant-numeric:tabular-nums;
}
.comparison-option dd.result-value-long{font-size:clamp(.75rem,3.7cqw,.9rem)!important}
.comparison-option dd.result-value-very-long{font-size:clamp(.68rem,3.25cqw,.82rem)!important}

.result-summary>strong,
.result-breakdown dd{
  max-width:100%;
  white-space:nowrap;
  overflow:visible;
  word-break:normal;
  overflow-wrap:normal!important;
  font-variant-numeric:tabular-nums;
}
.result-summary>strong.result-value-long{font-size:clamp(2.05rem,4vw,3.35rem)!important}
.result-summary>strong.result-value-very-long{font-size:clamp(1.72rem,3.4vw,2.7rem)!important}
.result-breakdown dd.result-value-long{font-size:.83rem!important}
.result-breakdown dd.result-value-very-long{font-size:.75rem!important}

.calculator-actions button{
  white-space:normal!important;
  overflow-wrap:anywhere;
}
.calculator-actions .secondary-action{border-color:rgba(255,255,255,.68)!important}
.calculator-actions .quiet-action{color:#e1e8f3!important}
.calculator-disclaimer{color:#d2dceb!important;font-size:.74rem!important}

/* Paneles de contacto de herramientas. */
.lead-panel{scroll-margin-top:110px}
.lead-fields{gap:16px!important}
.lead-fields label{color:#27344d!important;font-weight:800}
.lead-fields input,.lead-fields textarea{
  width:100%!important;
  min-width:0!important;
  min-height:48px;
  color:#142039!important;
  background:#fff!important;
  border-color:#9eabc0!important;
}
.lead-fields textarea{min-height:108px}
.consent{line-height:1.45}
.consent input{width:20px;height:20px;flex:none}

/* Calendario: controles y acciones legibles. */
.tax-calendar-page .tax-controls label{color:#34425b!important}
.tax-calendar-page .tax-controls select,
.tax-calendar-page .tax-controls input{
  color:#142039!important;
  background:#fff!important;
  border-color:#9eabc0!important;
}
.tax-calendar-page .tax-event-copy>p{color:#46546d!important}
.tax-calendar-page .tax-event-actions{gap:8px!important}
.tax-calendar-page .tax-event-actions a{
  padding:9px 12px!important;
  color:#173f7c!important;
  background:#fff!important;
  border:1px solid #9eabc0!important;
  border-radius:9px;
  text-decoration:none;
}
.tax-calendar-page .tax-event-actions a:hover{border-color:#102d62!important;background:#eef4fc!important}
.tax-calendar-page .tax-event[data-urgency=past]{opacity:.86!important}
.tax-calendar-page .tax-event time::after{color:#4e5c73!important}
.rule-composer>summary{align-items:center}
.rule-form-grid input,.rule-form-grid select,.rule-form-grid textarea{
  width:100%;
  min-height:46px;
  color:#142039;
  background:#fff;
  border-color:#9eabc0;
}

/* Evitar que transformaciones de hover reduzcan legibilidad o corten contenido. */
.story-card,.tool-card,.home-route a,.discovery-card,.topic-hub-card{min-width:0}
.story-card h3,.tool-card h3,.home-route strong,.discovery-card h3,.topic-hub-card h3{overflow-wrap:anywhere}

@container (max-width:560px){
  .comparator-scenarios{grid-template-columns:1fr!important}
  .field-label{grid-template-columns:1fr;min-height:0}
  .field-label small{text-align:left!important}
}

@media(max-width:680px){
  .calculator-presets{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .comparison-options{grid-template-columns:1fr!important}
  .comparison-option dd{font-size:1rem!important}
  .result-summary>strong{white-space:normal;overflow-wrap:anywhere!important}
  .tax-calendar-page .tax-event-actions a{width:100%}
}

@media(prefers-contrast:more){
  :root{--muted:#455267;--tool-muted:#455267}
  .tool-input-panel input,.tool-input-panel select,.tool-input-panel textarea,.money-input{border-width:2px!important;border-color:#54657e!important}
  .calculator-presets button,.tax-event-actions a{border-width:2px!important}
}

@media(forced-colors:active){
  :where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{outline:3px solid Highlight!important}
  .money-input,.tool-input-panel input,.tool-input-panel select,.tool-input-panel textarea{forced-color-adjust:auto}
}
