/* ==========================================================================
   I HATE CALCULATOR DETAILED TOOL PAGE — EDITORIAL FINANCIAL REFERENCE
   Byline, Editorial Guidance, Ledger Amortization Table, Mathematical Proofs
   ========================================================================== */

/* Breadcrumb Bar */
.tool-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 1.25rem 0 0.75rem;
}

.tool-breadcrumbs a {
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.tool-breadcrumbs a:hover {
  color: var(--brand-primary);
}

.tool-breadcrumbs .crumb-separator {
  color: var(--border-hover);
}

/* Tool Header */
.tool-header {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
}

.tool-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.tool-header-info {
  flex: 1;
  min-width: 300px;
}

.tool-header-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.tool-title-wrap {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

.tool-title-icon {
  width: 3.75rem;
  height: 3.75rem;
  min-width: 3.75rem;
  border-radius: 16px;
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.tool-title-wrap:hover .tool-title-icon {
  transform: scale(1.08);
}

.tool-title {
  font-size: clamp(1.85rem, 3.5vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 0;
}

.tool-subtitle {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 780px;
}

/* Editorial Byline & Fact-Check Bar */
.editorial-byline-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.65rem 1rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.byline-reviewer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--text-primary);
}

.byline-meta {
  color: var(--text-muted);
}

/* Tool Actions (Share, Embed, Export) */
.tool-action-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Workspace Layout */
.tool-workspace {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.75rem;
  margin-bottom: 3.5rem;
  align-items: start;
}

@media (max-width: 960px) {
  .tool-workspace {
    grid-template-columns: 1fr;
  }
}

/* Form Container Card */
.tool-form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

/* Advanced Options Accordion */
.adv-options-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  transition: all 0.15s ease;
}

.adv-options-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.adv-options-body {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1rem 0.25rem 0.25rem;
}

/* Results Sticky Column */
.tool-result-sticky {
  position: sticky;
  top: calc(var(--header-height) + 1.25rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.tool-result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  position: relative;
}

/* Payoff Milestone Badge */
.payoff-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--brand-forest-subtle);
  color: var(--brand-forest);
  border: 1px solid rgba(22, 101, 52, 0.2);
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 0.75rem;
}

/* Editorial Guidance Callout Note */
.editorial-insight-card {
  background: var(--bg-surface-elevated);
  border-left: 3px solid var(--brand-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1rem 1.15rem;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-top: 1rem;
}

.editorial-insight-title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Comparison Grid: 15-Year vs 30-Year Matrix */
.term-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 1.25rem;
}

.term-comparison-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.term-comparison-card.highlight {
  border-color: var(--brand-primary);
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
}

.term-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.term-monthly {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.term-interest {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Amortization Schedule Section (Accounting Ledger Style) */
.amortization-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 3.5rem;
}

.amortization-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.amortization-toggle-pills {
  display: inline-flex;
  padding: 0.2rem;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.amort-pill-btn {
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.amort-pill-btn.active {
  background: var(--bg-surface);
  color: var(--brand-primary);
  box-shadow: var(--shadow-xs);
}
/* Ledger Amortization Container & Collapsible Architecture */
.amort-ledger-container {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-top: 1rem;
}

.amort-table-wrapper {
  position: relative;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

/* Default Collapsed State - Shows preview of first 4 periods */
.amort-table-wrapper.is-collapsed {
  max-height: 255px;
}

/* Expanded State - Shows full multi-decade ledger */
.amort-table-wrapper.is-expanded {
  max-height: 30000px;
}

.amort-table-wrapper.is-collapsed .amort-fade-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
}

.amort-table-wrapper.is-expanded .amort-fade-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.amort-fade-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 96px;
  background: linear-gradient(180deg, rgba(250, 249, 246, 0) 0%, var(--bg-surface) 95%);
  z-index: 15;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  pointer-events: none;
}

[data-theme="dark"] .amort-fade-overlay {
  background: linear-gradient(180deg, rgba(19, 19, 18, 0) 0%, var(--bg-surface) 95%);
}

.amort-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.btn-amort-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.55rem 1.35rem;
  border-radius: 9999px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-hover);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 40px;
}

.btn-amort-expand:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-amort-expand:active {
  transform: scale(0.98);
}

.btn-amort-expand .chevron-icon {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.amort-table-wrapper.is-expanded + .amort-toggle-bar .chevron-icon {
  transform: rotate(180deg);
}

.amort-meta-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Mobile Horizontal Swipe Indicator */
.mobile-table-hint {
  display: none;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  padding: 0.4rem 0.75rem;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  letter-spacing: 0.02em;
}

@media (max-width: 640px) {
  .mobile-table-hint {
    display: block;
  }
}

/* Ledger Amortization Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 0;
  border: none;
}

.amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  text-align: right;
}

.amort-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.amort-table th:first-child,
.amort-table td:first-child {
  text-align: left;
}

.amort-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amort-table tbody tr:nth-child(even) {
  background: var(--bg-app);
}

.amort-table tbody tr:hover {
  background: var(--bg-surface-elevated);
}

/* Pinned Period Column on Mobile Horizontal Scroll */
@media (max-width: 640px) {
  .amort-table {
    font-size: 0.78rem;
  }
  .amort-table th, .amort-table td {
    padding: 0.6rem 0.65rem;
  }
  .amort-table th:first-child,
  .amort-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 8;
    background: var(--bg-surface);
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.06);
  }
  .amort-table th:first-child {
    z-index: 15;
    background: var(--bg-surface-elevated);
  }
  .amort-table tbody tr:nth-child(even) td:first-child {
    background: var(--bg-app);
  }
}

/* Educational Content & Math Formulas */
.guide-section {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2.5rem;
  margin-bottom: 4rem;
}

@media (max-width: 960px) {
  .guide-section {
    grid-template-columns: 1fr;
  }
}

.prose-guide {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.prose-guide h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1.5rem 0 0.75rem;
}

.prose-guide p {
  margin-bottom: 0.85rem;
}

.math-formula-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--brand-primary);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--brand-primary);
  font-weight: 600;
  overflow-x: auto;
}

/* FAQ Accordions */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
}

.faq-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.faq-item[open] {
  border-color: var(--border-hover);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-chevron {
  transition: transform 0.15s ease;
  color: var(--text-muted);
}

.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
  color: var(--brand-primary);
}

.faq-answer {
  padding: 0 1.25rem 1.15rem;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.85rem;
}

/* ==========================================================================
   OMNI-STYLE ENCYCLOPEDIC & E-E-A-T COMPONENTS
   ========================================================================== */

/* Author & Reviewer E-E-A-T Card */
.eeat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-xs);
  flex-wrap: wrap;
}

.eeat-profiles {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  flex-wrap: wrap;
}

.eeat-profile-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.eeat-avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: var(--brand-sand-light);
  border: 1.5px solid var(--border-subtle);
  flex-shrink: 0;
}

.eeat-profile-role {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.eeat-profile-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.eeat-profile-credentials {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.eeat-audit-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  background: var(--brand-forest-subtle);
  border: 1px solid rgba(22, 101, 52, 0.2);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand-forest);
}

/* Step-by-Step Procedure */
.step-guide-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.step-guide-item {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.step-number {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  background: var(--brand-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

[data-theme="dark"] .step-number {
  background: var(--brand-primary);
  color: var(--bg-app);
}

.step-body {
  flex: 1;
}

.step-body h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.step-body p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.35rem;
}

/* Worked Example Box */
.worked-example-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.75rem 2rem;
  margin: 2rem 0;
}

.worked-example-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-accent);
  margin-bottom: 0.75rem;
}

.worked-example-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.worked-example-scenario {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.worked-example-steps {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.worked-example-step {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--border-subtle);
}

.worked-example-step:last-child {
  border-bottom: none;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  padding-top: 0.75rem;
}

/* Reference Comparison Matrix Table */
.matrix-table-wrap {
  overflow-x: auto;
  margin: 1.75rem 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  text-align: left;
  background: var(--bg-surface);
}

.matrix-table th {
  background: var(--bg-surface-elevated);
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.matrix-table td {
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.matrix-table tr:last-child td {
  border-bottom: none;
}

.matrix-table tr:hover td {
  background: var(--bg-surface-elevated);
}

/* Limitations & Nuances Alert Box */
.limitations-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--brand-accent);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 2rem 0;
}

.limitations-box h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.limitations-box p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.limitations-box ul {
  padding-left: 1.25rem;
  margin-bottom: 0;
}

.limitations-box li {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

/* Citation & Sources Block */
.citations-section {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border-subtle);
}

.citations-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.citation-item {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
  line-height: 1.5;
}

.citation-item a {
  color: var(--brand-primary);
  text-decoration: underline;
}

/* ==========================================================================
   COLLAPSIBLE SCIENTIFIC GUIDE & BOT-FRIENDLY ACCORDION
   Preserves 100% of DOM content for search engine indexers while saving vertical space
   ========================================================================== */
.guide-collapsible-wrapper {
  position: relative;
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.guide-collapsible-content {
  position: relative;
  max-height: 460px;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.guide-collapsible-content.is-expanded {
  max-height: 30000px;
}

.guide-fade-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 220px;
  background: linear-gradient(to bottom, rgba(250, 249, 246, 0) 0%, rgba(250, 249, 246, 0.85) 50%, var(--bg-app, #faf9f6) 100%);
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 15;
}

[data-theme="dark"] .guide-fade-overlay {
  background: linear-gradient(to bottom, rgba(19, 19, 18, 0) 0%, rgba(19, 19, 18, 0.85) 50%, var(--bg-app, #131312) 100%);
}

.guide-collapsible-content.is-expanded .guide-fade-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.guide-toggle-bar {
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 25;
  margin-top: -2.5rem;
  margin-bottom: 2.5rem;
}

.btn-guide-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.85rem;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 700;
  border: 1.5px solid var(--border-hover);
  border-radius: 9999px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-guide-toggle:hover {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 41, 66, 0.24);
}

.btn-guide-toggle .toggle-icon {
  transition: transform 0.3s ease;
}

.btn-guide-toggle.is-expanded .toggle-icon {
  transform: rotate(180deg);
}

/* ==========================================================================
   OMNI-STYLE ACTION BUTTONS ("Add as preferred on Google", Share, Embed)
   ========================================================================== */
.btn-google-preferred {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1a73e8;
  background: rgba(66, 133, 244, 0.08);
  border: 1px solid rgba(66, 133, 244, 0.25);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s ease;
}

[data-theme="dark"] .btn-google-preferred {
  color: #8ab4f8;
  background: rgba(138, 180, 248, 0.1);
  border-color: rgba(138, 180, 248, 0.28);
}

.btn-google-preferred:hover {
  background: rgba(66, 133, 244, 0.16);
  border-color: #1a73e8;
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-google-preferred:hover {
  background: rgba(138, 180, 248, 0.2);
  border-color: #8ab4f8;
}

/* ==========================================================================
   FLOATING BACK TO TOP BUTTON
   ========================================================================== */

/* ==========================================================================
   CONTEXTUAL RELATED TOOLS SECTION
   ========================================================================== */
.related-tools-section {
  margin: 3.5rem 0 2rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border-subtle);
}

.related-tools-kicker {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-accent);
  margin-bottom: 0.35rem;
}

.related-tools-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.related-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.15rem;
}

.related-tool-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-card);
}

.related-tool-card:hover {
  border-color: var(--brand-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
}

.related-tool-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.related-tool-icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  line-height: 1;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.related-tool-card:hover .related-tool-icon {
  transform: scale(1.12);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  border-color: var(--brand-primary);
}

.related-tool-badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.related-tool-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

.related-tool-card:hover .related-tool-name {
  color: var(--brand-primary);
}

.related-tool-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.related-tool-action {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.related-tool-card:hover .related-tool-action {
  gap: 0.55rem;
}

/* ==========================================================================
   MOBILE FLOATING QUICK-RESULT BAR (FOR 90% MOBILE TRAFFIC)
   ========================================================================== */
.mobile-quick-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 950;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-hover);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
  padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
  transform: translateY(0);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

@supports (backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px)) {
  .mobile-quick-bar {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  [data-theme="dark"] .mobile-quick-bar {
    background: rgba(26, 26, 25, 0.94);
  }
}

@media (max-width: 768px) {
  .mobile-quick-bar {
    display: block;
  }
}

.mobile-quick-bar.is-hidden {
  transform: translateY(115%);
  opacity: 0;
  pointer-events: none;
}

.mobile-quick-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 600px;
  margin: 0 auto;
  gap: 0.75rem;
}

.mobile-quick-data {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.mobile-quick-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.mobile-quick-amount {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand-primary);
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

[data-theme="dark"] .mobile-quick-amount {
  color: var(--brand-forest);
}

.mobile-quick-term {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.mobile-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1.05rem;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(15, 41, 66, 0.2);
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.mobile-quick-btn:active {
  transform: scale(0.96);
}

/* ==========================================================================
   MOBILE-FIRST HIGH-PRECISION LAYOUT AUDIT (SCREEN <= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  /* Safe clearance for mobile floating bar */
  body {
    padding-bottom: 4.5rem;
  }

  /* Back to top button floats above mobile bottom bar */

  /* Compact workspace padding */
  .tool-workspace {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-bottom: 2.25rem;
  }

  .tool-form-card {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-lg);
    gap: 1.15rem;
  }

  /* Form Inputs - prevent iOS Safari auto-zoom with 16px min */
  .calc-input-box input,
  input[type="number"],
  input[type="text"],
  select {
    font-size: 16px !important;
    min-height: 44px;
  }

  /* Slider Touch Target Optimization */
  input[type="range"] {
    height: 6px;
    touch-action: pan-y;
  }
  input[type="range"]::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  }

  /* Preset Pills: Horizontal touch-scrollable strip */
  .preset-pills-row,
  .calc-preset-group {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    gap: 0.45rem;
  }
  .preset-pills-row::-webkit-scrollbar,
  .calc-preset-group::-webkit-scrollbar {
    display: none;
  }

  .preset-pill-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Results Card Flow on Mobile */
  .tool-result-sticky {
    position: static;
    top: auto;
  }

  .tool-result-card {
    padding: 1.25rem 1rem;
  }

  .calc-result-value {
    font-size: 2.2rem;
  }

  /* Amortization Section Mobile Polish */
  .amortization-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .amortization-toggle-pills {
    width: 100%;
    display: flex;
  }

  .amort-pill-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.25rem;
  }

  .amort-toggle-bar {
    padding: 0.75rem 1rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .btn-amort-expand {
    width: 100%;
    max-width: 320px;
  }

  /* Related Tools Grid */
  .related-tools-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .related-tool-card {
    padding: 1.15rem 1rem;
  }

  /* Guide Editorial Section */
  .guide-section {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
  }
}

/* ── Ô lưới mặc định KHÔNG co dưới min-content, nên khung nhập và khung kết
      quả giữ nguyên 334px trên màn 320px → tràn. min-width:0 cho phép co.
      Thêm 20/09/2026 sau khi đo thật ở 320px. ── */
@media (max-width: 420px) {
  .tool-workspace > * { min-width: 0; }
  .tool-form-card, .tool-result-sticky { min-width: 0; }
}

/* ── 4. Nút "lên đầu trang" trông như vết nhoè đè lên số tiền ──
   Nền `--bg-surface-elevated` trong suốt một phần + `backdrop-filter: blur`
   khiến chữ phía dưới hiện mờ XUYÊN QUA nút → nhìn y như lỗi hiển thị,
   đúng chỗ cột số tiền bên phải. Trên điện thoại cho nền ĐẶC hẳn.
   (thêm 20/09/2026 sau khi nhìn ảnh chụp thật) */
@media (max-width: 700px) {

}

/* ══════════════════════════════════════════════════════════════════════════
   HỌ LỚP `calc-*` — BỔ SUNG 20/09/2026
   --------------------------------------------------------------------------
   🔴 8 trang công cụ (FIRE, Body Fat, CD, Flooring, Macro, Margin, Sales Tax,
   Trip Splitter) dựng bằng khuôn khác với 8 trang đầu: chúng dùng
   `.calc-workspace-grid / .calc-input-panel / .calc-output-panel /
   .calc-breakdown-*` — mà **không tệp CSS nào có một luật nào cho chúng**.
   Hậu quả: mất sạch khung thẻ, chữ chạy sát hai mép màn hình, các dòng kết
   quả thành chữ trần. Không lỗi nào báo, mọi phép đo tràn-ngang đều xanh —
   vì chữ trần thì có tràn đâu mà báo. Chỉ NHÌN mới thấy.
   Các luật dưới đây bám đúng kiểu `.tool-form-card` / `.tool-result-card`
   sẵn có để hai khuôn nhìn như một.
   ══════════════════════════════════════════════════════════════════════════ */

.calc-workspace-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.75rem;
  margin-bottom: 3.5rem;
  align-items: start;
}

.calc-input-panel,
.calc-output-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  min-width: 0;
}

.calc-output-panel {
  position: sticky;
  top: calc(var(--header-height) + 1.25rem);
}

/* ── Khối kết quả lớn ── */
.calc-result-header { display: flex; flex-direction: column; gap: 0.3rem; }

.calc-result-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.calc-result-big {
  font-family: var(--font-financial);
  font-size: clamp(1.9rem, 7vw, 2.6rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;   /* số dài không kéo giãn thẻ */
}

/* ── Lưới các dòng "nhãn — giá trị" ── */
.calc-breakdown-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.calc-breakdown-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.95rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  min-width: 0;
}

.calc-breakdown-label {
  font-size: 0.86rem;
  color: var(--text-secondary);
  min-width: 0;
}

.calc-breakdown-value {
  font-family: var(--font-financial);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Thanh tiến độ ── */
.calc-progress-track {
  width: 100%;
  height: 9px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.calc-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--brand-forest, #1f5c3d);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Vài lớp lẻ cũng chưa có luật ── */
.toggle-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.variable-box {
  padding: 0.85rem 1rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--brand-primary, #16293f);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.65;
  margin: 0.85rem 0;
}

.citations-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.citations-list li { padding-left: 1rem; position: relative; line-height: 1.6; }
.citations-list li::before { content: "—"; position: absolute; left: 0; color: var(--text-muted); }

.google-g-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Điện thoại: một cột, thôi dính, lề gọn ── */
@media (max-width: 960px) {
  .calc-workspace-grid { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .calc-output-panel { position: static; top: auto; }
}
@media (max-width: 600px) {
  .calc-input-panel,
  .calc-output-panel { padding: 1.1rem; border-radius: var(--radius-lg); }
  .calc-breakdown-card { padding: 0.7rem 0.8rem; }
  .calc-breakdown-label { font-size: 0.82rem; }
  .calc-breakdown-value { font-size: 0.9rem; }
}

/* ── Ô chọn: mũi tên đè lên chữ, cắt cụt "Single (Standard Deduction: $14,60" ──
   Trình duyệt vẽ mũi tên đè LÊN nội dung nếu không chừa chỗ. */
.calc-input-box select,
.calc-field-group select,
select.calc-select {
  padding-right: 2.4rem;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Ba lớp bọc/tiện ích còn thiếu luật — nhỏ nhưng thiếu thì mất khoảng cách */
.faq-accordion { display: flex; flex-direction: column; gap: 0.6rem; }
.adv-options-accordion { display: flex; flex-direction: column; gap: 0.5rem; }
.font-financial { font-family: var(--font-financial); }

/* ── 6 lớp cho khuôn trang công cụ MỚI (sinh bằng build/sinh-trang.py) ──
   Thêm 20/09/2026. Bám đúng kiểu các thẻ sẵn có để trang mới và trang cũ
   nhìn như một. */
.calc-panel-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0.2rem 0 0;
}

.tool-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.62rem;
  border-radius: var(--radius-md);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.tool-badge.badge-primary { background: #eef2f7; border-color: #d3dce7; color: #16293f; }
.tool-badge.badge-verified { background: #e8f5ee; border-color: #c7e6d4; color: #1f5c3d; }
[data-theme="dark"] .tool-badge.badge-primary { background: #1c2836; border-color: #2c3d50; color: #cfe0f2; }
[data-theme="dark"] .tool-badge.badge-verified { background: #14291f; border-color: #235138; color: #9fd9bb; }

.section-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-brick, #b4532a);
  margin-bottom: 0.4rem;
}

/* Hộp lưu ý / cảnh báo trong bàn tính */
.calc-note {
  padding: 0.7rem 0.9rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--brand-primary, #16293f);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Hàng nút chọn nhanh (đơn vị, mốc dựng sẵn…) */
.calc-chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.calc-chip {
  flex: 0 1 auto;
  min-width: 0;
  padding: 0.42rem 0.72rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
}
.calc-chip:hover { border-color: var(--border-hover); color: var(--text-primary); }
.calc-chip.active {
  background: var(--brand-primary, #16293f);
  border-color: var(--brand-primary, #16293f);
  color: #fff;
}
@media (max-width: 420px) { .calc-chip { font-size: 0.75rem; padding: 0.4rem 0.6rem; } }

/* Chữ gợi ý nhỏ bên phải nhãn ô nhập (khuôn trang công cụ mới) */
.calc-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: right;
  min-width: 0;
}
@media (max-width: 480px) { .calc-hint { font-size: 0.7rem; } }

/* Ô nhập nhiều dòng cho công cụ lập trình viên (thêm 20/09/2026) */
.calc-textarea {
  width: 100%;
  min-width: 0;
  padding: 0.75rem 0.85rem;
  font-family: var(--font-financial), ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  resize: vertical;
  tab-size: 2;
}
.calc-textarea:focus { outline: none; border-color: var(--brand-primary, #16293f); }
.calc-textarea[readonly] { background: var(--bg-surface-elevated); }
@media (max-width: 600px) { .calc-textarea { font-size: 0.76rem; padding: 0.6rem 0.7rem; } }

/* ── Dòng "nhãn — giá trị" khi GIÁ TRỊ quá dài ──
   Phát hiện 20/09/2026 bằng cách NHÌN ảnh chụp: dòng "Next birthday" có giá
   trị "268 days (Tuesday, June 15, 2027)" giữ `white-space:nowrap` và
   `flex-shrink:0` nên nó ĐÈ LÊN nhãn. Phép đo tràn-ngang mù với lỗi này vì
   chữ chỉ chồng nhau bên TRONG thẻ, không hề vượt ra ngoài màn hình.
   Cho cả hàng xuống dòng khi không đủ chỗ. */
.calc-breakdown-card { flex-wrap: wrap; row-gap: 0.15rem; }
.calc-breakdown-label { flex: 1 1 auto; }
.calc-breakdown-value { max-width: 100%; }
@media (max-width: 520px) {
  .calc-breakdown-value {
    white-space: normal;
    text-align: right;
    overflow-wrap: anywhere;
  }
}

/* ==========================================================================
   ĐỢT 3 — 20/09/2026 · THU GỌN ĐẦU TRANG + THANH HÀNH ĐỘNG DƯỚI BÀN TÍNH

   VÌ SAO (đo thật trên iPhone 390px trước khi sửa):
     breadcrumb 73px + tool-header 454px + thẻ E-E-A-T 268px  = 930px
     ⇒ ô nhập đầu tiên nằm ở y=932-1219, tức khách phải cuộn hơn MỘT màn hình
       mới thấy thứ họ vào đây để dùng. Nút Share/Embed/Print thì chiếm chỗ
       ngay trên bàn tính.
   ĐÍCH: bàn tính lọt vào màn hình đầu tiên (y < 400px).
   ========================================================================== */

/* ── Thanh hành động MỚI, đặt dưới bàn tính ───────────────────────────── */
.tool-actions-below {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.1rem;
  margin: -1.75rem 0 2.25rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg, 14px);
}

.tool-actions-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-right: auto;
}

.tool-actions-below .tool-action-group {
  gap: 0.45rem;
}

.tool-actions-below .btn-sm {
  padding: 0.42rem 0.75rem;
  font-size: 0.78rem;
}

/* Nút "thêm vào nguồn ưa thích của Google" dài nhất — cho xuống hàng riêng
   trên màn hẹp thay vì ép cả hàng vỡ. */
.tool-actions-below .btn-google-preferred {
  font-size: 0.76rem;
  padding: 0.42rem 0.7rem;
}

/* ── ĐIỆN THOẠI: thu gọn mọi thứ phía trên bàn tính ───────────────────── */
@media (max-width: 720px) {

  /* Breadcrumb: 73px (bị xuống 2 dòng) → 1 dòng cuộn ngang */
  .tool-breadcrumbs {
    padding: 0.6rem 0 0.35rem;
    font-size: 0.72rem;
    gap: 0.35rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
  }
  .tool-breadcrumbs::-webkit-scrollbar { display: none; }
  .tool-breadcrumbs > * { flex-shrink: 0; }

  /* Tool header: bỏ viền dày, giảm khoảng trống */
  .tool-header {
    padding-bottom: 0.85rem;
    margin-bottom: 1rem;
  }
  .tool-header-top { gap: 0.6rem; }
  .tool-header-info { min-width: 0; }

  /* Nhãn: 1 hàng cuộn ngang, chữ nhỏ — trước đây xuống 2-3 dòng */
  .tool-header-badges {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 0.35rem;
    margin-bottom: 0.45rem;
    padding-bottom: 0.1rem;
  }
  .tool-header-badges::-webkit-scrollbar { display: none; }
  .tool-header-badges > * {
    flex-shrink: 0;
    font-size: 0.64rem;
    padding: 0.2rem 0.5rem;
    letter-spacing: 0.04em;
  }

  /* Tiêu đề: biểu tượng 60px → 38px, chữ nhỏ lại một bậc */
  .tool-title-wrap {
    gap: 0.65rem;
    margin-bottom: 0.4rem;
    flex-wrap: nowrap;
    align-items: center;
  }
  .tool-title-icon {
    width: 2.35rem;
    height: 2.35rem;
    min-width: 2.35rem;
    font-size: 1.2rem;
    border-radius: 11px;
    box-shadow: none;
  }
  .tool-title,
  .tool-title-wrap h1 {
    font-size: 1.32rem;
    line-height: 1.22;
    letter-spacing: -0.015em;
  }

  /* Mô tả mở đầu: cắt còn 3 dòng, chạm vào để mở hết.
     Chữ vẫn nằm nguyên trong DOM nên Google vẫn đọc đủ. */
  .tool-subtitle {
    font-size: 0.855rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0;
  }
  .tool-subtitle.mo-rong {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
  }
  .nut-mo-mo-ta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.3rem;
    padding: 0.15rem 0;
    background: none;
    border: 0;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--brand-primary, #0f2942);
    cursor: pointer;
  }
  .nut-mo-mo-ta::after {
    content: '▾';
    font-size: 0.68rem;
    transition: transform 0.15s ease;
  }
  .nut-mo-mo-ta[aria-expanded="true"]::after { transform: rotate(180deg); }

  /* Thanh hành động dưới bàn tính: gọn hết mức */
  .tool-actions-below {
    margin: -0.75rem 0 1.5rem;
    padding: 0.7rem 0.8rem;
    gap: 0.5rem;
  }
  .tool-actions-below .tool-actions-label {
    width: 100%;
    margin-right: 0;
    font-size: 0.64rem;
  }
  .tool-actions-below .tool-action-group {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .tool-actions-below .btn-sm {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    padding: 0.5rem 0.4rem;
    font-size: 0.75rem;
  }
  /* Nút Google chiếm trọn hàng dưới, chữ rút ngắn bằng CSS không được nên
     để nó tự xuống hàng riêng. */
  .tool-actions-below .btn-google-preferred {
    flex: 1 0 100%;
    justify-content: center;
  }

  /* Thẻ E-E-A-T nay nằm dưới bàn tính — thu nhỏ cho khỏi chiếm chỗ */
  .eeat-card { padding: 0.9rem 1rem; margin-bottom: 1.5rem; }
  .eeat-profiles { gap: 0.6rem; }
  .eeat-profile-item { padding: 0.5rem 0; }
}

/* Màn rất hẹp: ép thêm một bậc nữa */
@media (max-width: 400px) {
  .tool-title, .tool-title-wrap h1 { font-size: 1.2rem; }
  .tool-title-icon { width: 2.1rem; height: 2.1rem; min-width: 2.1rem; font-size: 1.05rem; }
}

/* ==========================================================================
   ĐỢT 3b — 20/09/2026 · TỈA BÀN TÍNH TRÊN ĐIỆN THOẠI

   NHÌN ẢNH CHỤP mới thấy: `.calc-label-row` xếp nhãn và chữ gợi ý cạnh nhau
   (`justify-content: space-between`). Trên màn 390px cả hai cùng xuống dòng,
   nên MỘT ô nhập ngốn 4 dòng chữ: "Cost of Goods Sold / (COGS)" bên trái và
   "Direct unit production / cost" bên phải. Xếp chồng thì gọn hơn hẳn.
   ========================================================================== */
@media (max-width: 720px) {
  /* Bảng kết quả: số to vừa phải, thẻ con 2 cột cho đỡ dài */
  .calc-result-big { font-size: 1.85rem; }
  .calc-breakdown-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }
  .calc-breakdown-card { padding: 0.6rem 0.7rem; }
  .calc-breakdown-label { font-size: 0.66rem; }
  .calc-breakdown-value { font-size: 0.92rem; }

  .calc-input-panel, .calc-output-panel, .tool-form-card, .tool-result-card {
    padding: 1rem;
  }
  .calc-workspace-grid { gap: 0.85rem; }
}

