/* ============================================================
   calculators.css — Calculator-specific styles for forsuccess.today
   Always loaded together with assets/main.css.
   main.css  →  tokens, reset, header, hero, card, buttons, footer
   this file →  two-col layout, forms, results, quiz components,
                insights, FAQ, related tools, specialized lists
   ============================================================ */

/* ── Calculator UI — Shared layout utilities ─────────────── */
.calc-form-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
}
.calc-form-subtitle {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 24px;
}
.calc-result-title {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
}
.calc-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.calc-empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}
.calc-empty-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.calc-empty-desc {
  font-size: 0.875rem;
}
.assessment-layout {
  max-width: 700px;
  margin: 0 auto;
}
/* ── Two-Column Calculator Layout ───────────────────────── */
.two-col { display: grid; gap: 24px; }
@media (min-width: 768px) { .two-col { grid-template-columns: 1fr 1fr; } }

/* ── Intro definition + calculator ordering ─────────────────
   The definition stays first in the source so crawlers and AI
   extractors read it early. On phones the calculator is shown
   first, so the tool is not buried under a block of text. */
.tool-lead { display: flex; flex-direction: column; }
@media (max-width: 767px) {
  .tool-lead__intro { order: 2; }
  .tool-lead__calc  { order: 1; }
}

/* ── Read more for long definition blocks ───────────────────
   tool-readmore.js opts a block in and clamps it. The full copy
   always stays in the HTML, so crawlers and AI extractors read
   the complete passage whether or not the reader expands it. */
.tool-readmore__body { position: relative; }
.tool-readmore.is-clamped .tool-readmore__body {
  max-height: calc(var(--readmore-lines, 3) * 1.71rem);
  overflow: hidden;
}
.tool-readmore.is-clamped .tool-readmore__body::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.4rem;
  background: linear-gradient(to bottom, transparent, var(--white));
  pointer-events: none;
}
.tool-readmore__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
}
.tool-readmore__toggle:hover { text-decoration: underline; }
.tool-readmore__toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Form — Base ────────────────────────────────────────── */
.form-group       { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; font-size: .9rem; color: var(--subtle, #374151); margin-bottom: 6px; }
/* Slider groups: flex gap avoids margin-collapse; label spacing is handled by gap, not margin */
.form-group:has(.slider-row),
.form-group:has(.range-row) {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.form-group:has(.slider-row) > label,
.form-group:has(.range-row) > label { margin-bottom: 0; }
.hint             { font-size: .8rem; color: var(--muted); margin-top: 4px; }

/* .num-input has its own width (pill or narrow field); exclude from full-width number rule */
input[type=number]:not(.num-input),
input[type=text],
input[type=date],
input[type=time],
select {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text);
  background: var(--white);
  transition: border-color .2s;
  -moz-appearance: textfield;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { -webkit-appearance: none; }
input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

/* ── Form — Range Slider (unified .slider-row pattern) ─────── */
/* Canonical: .slider-row > input[type=range].range-input + input.num-input (pill) */
input[type=range] {
  width: 100%;
  max-width: 100%;
  cursor: pointer;
  accent-color: var(--primary);
  min-height: 28px;
  height: auto;
  vertical-align: middle;
  box-sizing: border-box;
}

/* One row layout for all calculator sliders (.range-row kept as alias) */
.range-row,
.slider-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  padding-top: 10px;
  padding-bottom: 10px;
  min-height: 36px;
  position: relative;
  z-index: 1;
}
.range-input {
  flex: 1 1 auto;
  min-width: 0;
  accent-color: var(--primary);
}

/* Value pill (Health) — same look as editable numeric pill (Money slider rows) */
.range-val {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.875rem;
  min-width: 4.5rem;
  max-width: 12rem;
  text-align: center;
  flex-shrink: 0;
  line-height: 1.25;
}

/* Editable number pill inside slider row */
.slider-row .num-input,
.range-row .num-input {
  width: auto !important; /* override inline width on some tools */
  min-width: 4.5rem;
  max-width: 12rem;
  flex-shrink: 0;
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 700;
  text-align: center;
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: none;
}
.slider-row .num-input:focus,
.range-row .num-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
  border-color: transparent;
}
.slider-row .num-input:hover,
.range-row .num-input:hover {
  background: var(--primary-soft);
}

/* Standalone numeric fields (not beside a range) — keep bordered field */
.num-input {
  width: 90px;
  min-width: 90px;
  flex-shrink: 0;
  padding: 9px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  text-align: right;
  color: var(--text);
  background: var(--white);
}
.num-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

/* Hybrid slider+input: unit suffix wrapper (BMI and health tools with inline units).
   Also aliased as .bmi-value-pill for backwards compatibility. */
.calc-value-pill,
.bmi-value-pill,
.num-input-unit-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-shrink: 0;
  min-width: 4.75rem;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  line-height: 1.25;
  white-space: nowrap;
}
.slider-row .calc-value-pill .num-input,
.slider-row .bmi-value-pill .num-input,
.slider-row .num-input-unit-wrap .num-input {
  width: auto !important;
  min-width: 2.5ch;
  max-width: 5ch;
  padding: 0 !important;
  margin: 0;
  border: none !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  text-align: right;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--primary);
  flex: 0 1 auto;
}
.calc-value-pill .calc-value-unit,
.bmi-value-pill .bmi-value-unit,
.num-input-unit-wrap .num-input-suffix {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  opacity: 0.65;
  flex-shrink: 0;
  line-height: 1;
}
.slider-row .calc-value-pill:focus-within,
.slider-row .bmi-value-pill:focus-within,
.slider-row .num-input-unit-wrap:focus-within {
  box-shadow: 0 0 0 2px var(--ring);
}
[data-theme="dark"] .calc-value-pill,
[data-theme="dark"] .bmi-value-pill,
[data-theme="dark"] .num-input-unit-wrap {
  background: #1e3a5f;
}
[data-theme="dark"] .slider-row .calc-value-pill .num-input,
[data-theme="dark"] .slider-row .bmi-value-pill .num-input,
[data-theme="dark"] .slider-row .num-input-unit-wrap .num-input,
[data-theme="dark"] .calc-value-pill .calc-value-unit,
[data-theme="dark"] .bmi-value-pill .bmi-value-unit,
[data-theme="dark"] .num-input-unit-wrap .num-input-suffix {
  color: #93c5fd;
}
[data-theme="dark"] .slider-row .calc-value-pill:focus-within,
[data-theme="dark"] .slider-row .bmi-value-pill:focus-within,
[data-theme="dark"] .slider-row .num-input-unit-wrap:focus-within {
  box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.35);
}
#calculatorForm .calc-age-missing,
#calculatorForm .bmi-age-missing {
  background-color: rgba(234, 179, 8, 0.15) !important;
  border-color: rgba(234, 179, 8, 0.6) !important;
}
[data-theme="dark"] #calculatorForm .calc-age-missing,
[data-theme="dark"] #calculatorForm .bmi-age-missing {
  background-color: rgba(234, 179, 8, 0.2) !important;
  border-color: rgba(234, 179, 8, 0.5) !important;
}

/* ── Form — Select Arrow ────────────────────────────────── */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Form — Radio Pill Options ──────────────────────────── */
.radio-group  { display: flex; flex-wrap: wrap; gap: 10px; }
.radio-option {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 500;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease, transform .1s ease;
  color: var(--subtle);
}
.radio-option:hover              { border-color: color-mix(in srgb, var(--primary) 40%, transparent); background: var(--primary-soft); }
.radio-option:active             { transform: scale(0.98); }
.radio-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.radio-option:has(input:focus-visible) { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.radio-option input              { accent-color: var(--primary); }
/* Column variant */
.radio-group.col    { flex-direction: column; gap: 8px; }

/* ── Form — Checkbox Grid Options ───────────────────────── */
.checkbox-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.check-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: .85rem;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease, transform .1s ease;
  color: var(--subtle);
}
.check-opt:hover { border-color: color-mix(in srgb, var(--primary) 40%, transparent); background: var(--primary-soft); }
.check-opt:active { transform: scale(0.98); }
.check-opt:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.check-opt:has(input:focus-visible) { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.check-opt input { accent-color: var(--primary); }
@media (prefers-reduced-motion: reduce) {
  .radio-option, .check-opt { transition: none; }
  .radio-option:active, .check-opt:active { transform: none; }
}

/* ── Result Card ────────────────────────────────────────── */
.result-card {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--white);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: none;
  transition: border-color .2s ease;
}
.result-card.hidden { display: none !important; }
.result-card h2     { font-size: .8rem; color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 16px; }

.result-main   { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
#resultValue   { font-family: var(--font-mono); font-size: clamp(2.5rem, 6vw, 3.5rem); font-weight: 600; letter-spacing: -0.04em; color: var(--text); line-height: 1; }
.result-unit   { font-size: 1rem; color: var(--muted); font-weight: 600; margin-bottom: 16px; }
.result-number { font-family: var(--font-mono); font-size: clamp(2.5rem, 6vw, 3.5rem); font-weight: 600; letter-spacing: -0.04em; color: var(--text); line-height: 1; margin-bottom: 4px; }
.result-main .result-unit { margin-bottom: 0; }

.progress-bar  { background: var(--surface-2); border-radius: 100px; height: 6px; overflow: hidden; margin: 16px 0; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 100px; transition: width .8s ease; width: 0; }

#resultExplanation { color: var(--subtle); font-size: .95rem; line-height: 1.7; margin-top: 8px; }

.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 16px 0; }
.result-stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.result-stat .s-label,
.result-stat .s-lab   { font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.result-stat .s-value,
.result-stat .s-val   { font-size: 1.3rem; font-weight: 800; color: var(--accent); margin-top: 2px; }
/* Preferred order: label above value */
.result-stat .s-label + .s-value,
.result-stat .s-lab + .s-val { margin-top: 2px; }

/* Highlight pop on result reveal: scale + fade the whole card in, then pulse a ring */
@keyframes highlight {
  0%   { box-shadow: 0 0 0 0   var(--ring); }
  70%  { box-shadow: 0 0 0 12px transparent; }
  100% { box-shadow: 0 0 0 0   transparent; }
}
@keyframes result-card-pop {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.result-card.highlight {
  animation: result-card-pop .3s ease, highlight .7s ease;
}
@media (prefers-reduced-motion: reduce) {
  .result-card { transition: none; }
  .result-card.highlight { animation: none; }
}

/* ── Dimension Bars (burnout, promotion, decision-fatigue) ── */
.dim-section { margin-top: 14px; }
.dim-label {
  display: flex;
  justify-content: space-between;
  font-size: .8rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
  margin-top: 10px;
}
.dim-bar  { background: #e0e7ff; border-radius: 999px; height: 7px; overflow: hidden; }
.dim-fill { height: 100%; border-radius: 999px; transition: width .7s ease; }

/* ── Likert Scale Buttons (burnout / focus quiz) ─────────── */
.likert-group { display: flex; gap: 8px; flex-wrap: wrap; }
.likert-btn {
  flex: 1;
  min-width: 80px;
  padding: 10px 6px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
  font-size: .8rem;
  font-weight: 500;
  text-align: center;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease, transform .1s ease;
  color: var(--subtle);
}
.likert-btn:hover { border-color: color-mix(in srgb, var(--primary) 40%, transparent); background: var(--primary-soft); }
.likert-btn:active { transform: scale(0.97); }
.likert-btn:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.likert-btn:has(input:focus-visible) { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.likert-btn input { display: none; }
@media (prefers-reduced-motion: reduce) {
  .likert-btn { transition: none; }
  .likert-btn:active { transform: none; }
}
.risk-label { display: inline-block; padding: 6px 16px; border-radius: 20px; font-weight: 700; font-size: 1rem; margin-bottom: 12px; }

/* ── Routine / Schedule List ────────────────────────────── */
.routine-list { list-style: none; padding: 0; margin: 12px 0; }
.routine-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  background: rgba(255,255,255,.8);
  border-radius: 8px;
  margin-bottom: 8px;
  border-left: 3px solid var(--primary);
}
.time-tag      { background: var(--primary); color: #fff; font-weight: 700; font-size: .8rem; padding: 3px 10px; border-radius: 6px; white-space: nowrap; flex-shrink: 0; }
.activity-name { font-weight: 600; font-size: .9rem; color: var(--text); }
.activity-desc { font-size: .8rem; color: var(--muted); margin-top: 2px; }

/* ── Side Hustle Cards ──────────────────────────────────── */
.hustle-list { list-style: none; padding: 0; margin: 8px 0; }
.hustle-item {
  background: rgba(255,255,255,.85);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 10px;
  border-left: 4px solid var(--primary);
}
.h-title { font-weight: 700; font-size: 1rem; color: var(--text); margin-bottom: 4px; }
.h-meta  { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.h-badge { background: var(--primary-soft); color: var(--primary); font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.h-step  { font-size: .82rem; color: var(--muted); font-style: italic; }

/* ── Savings Milestones ─────────────────────────────────── */
.milestones     { list-style: none; padding: 0; margin: 10px 0; }
.milestone-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255,255,255,.7);
  border-radius: 7px;
  margin-bottom: 5px;
  font-size: .82rem;
  font-weight: 600;
  color: #374151;
}
.milestone-item .m-date { color: var(--primary); }

/* ── Savings Rate split bar & projection ──────────────── */
.split-bar { display: flex; height: 6px; border-radius: 100px; overflow: hidden; margin: 16px 0 6px; background: var(--surface-2); }
.split-spent { background: #f59e0b; transition: width .8s ease; height: 100%; }
.split-saved { background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .8s ease; height: 100%; }
.split-legend { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
.tier-at_risk { background: #fee2e2; color: #b91c1c; }
.tier-slow_progress { background: #ffedd5; color: #c2410c; }
.tier-baseline_healthy { background: #fef9c3; color: #a16207; }
.tier-high_achiever { background: var(--primary-soft); color: var(--primary); }
.tier-hyper_saver { background: #dcfce7; color: #15803d; }
.projection-bar-wrap { list-style: none; margin: -2px 0 8px; padding: 0 0 0 12px; }
[data-theme="dark"] .split-bar { background: var(--surface-2); }

/* ── Income / Breakdown List ────────────────────────────── */
.breakdown-list { list-style: none; padding: 0; margin: 10px 0; }
.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255,255,255,.7);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: .875rem;
  font-weight: 600;
}
.breakdown-item .b-label { color: #374151; }
.breakdown-item .b-val   { color: var(--primary); font-weight: 700; }

/* ── Goal Breakdown — Task List ─────────────────────────── */
.task-list { list-style: none; padding: 0; margin: 12px 0; }
.task-item {
  background: rgba(255,255,255,.8);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
  border-left: 3px solid var(--primary);
  font-size: .9rem;
  color: var(--text);
}
.task-item strong { color: var(--primary); }

/* ── Freelance — Price Range Display ────────────────────── */
.price-range { background: rgba(255,255,255,.8); border-radius: 8px; padding: 14px; margin-bottom: 12px; text-align: center; }
.range-text  { font-size: .85rem; color: #374151; margin-top: 4px; }

/* ── Insights Section ───────────────────────────────────── */
.insights-grid { display: grid; gap: 16px; margin-bottom: 24px; }
@media (min-width: 640px) { .insights-grid { grid-template-columns: repeat(3, 1fr); } }

.insight-card { background: var(--white); border-radius: var(--radius); padding: 22px; box-shadow: 0 4px 12px rgba(0,0,0,.05); border-top: 3px solid var(--primary); }
.insight-card .i-title { font-size: .8rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.insight-card p { font-size: .875rem; color: var(--muted); line-height: 1.6; }

/* ── FAQ Section ────────────────────────────────────────── */
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-item { background: var(--white); border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.04); overflow: hidden; }
.faq-q {
  width: 100%;
  text-align: left;
  padding: 16px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  transition: background .2s;
}
.faq-q:hover                      { background: #f9fafb; }
.faq-q:focus-visible              { outline: none; box-shadow: inset 0 0 0 3px var(--ring); }
.faq-q .chevron                   { font-style: normal; flex-shrink: 0; transition: transform .3s; }
.faq-q[aria-expanded=true] .chevron { transform: rotate(45deg); }
/* Grid-row animation: unlike a fixed max-height, this animates to the answer's
   real height at any length instead of capping/clipping long answers. */
.faq-a {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows .3s ease;
}
.faq-a.open { grid-template-rows: 1fr; }
/* Padding lives only in the open state: vertical padding on a grid item adds
   irreducible height even at `grid-template-rows: 0fr` (min-height: 0 only
   shrinks content, not padding), which left a sliver of clipped text visible
   on closed items. */
.faq-a p {
  min-height: 0;
  overflow: hidden;
  color: var(--subtle);
  line-height: 1.7;
  font-size: .9rem;
  padding: 0 20px;
  margin: 0;
  transition: padding .3s ease;
}
.faq-a.open p { padding: 0 20px 16px; }
@media (prefers-reduced-motion: reduce) {
  .faq-a, .faq-a p { transition: none; }
}

/* ── Related Tools Grid ─────────────────────────────────── */
.related-grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .related-grid { grid-template-columns: repeat(3, 1fr); } }

.tool-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: none;
  transition: border-color .2s ease;
  color: inherit;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
}
.tool-card:hover   { transform: none; box-shadow: none; border-color: var(--subtle); }
.tool-card:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.tool-card .t-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 0 12px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.125rem;
  line-height: 1;
  flex-shrink: 0;
}
.tool-card h3      { font-size: .95rem; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.tool-card p       { font-size: .825rem; color: var(--muted); line-height: 1.5; flex: 1 1 auto; }
.tool-card .arrow  { color: var(--primary); font-weight: 700; margin-top: auto; padding-top: 12px; display: inline-block; font-size: .875rem; }
@media (prefers-reduced-motion: reduce) {
  .tool-card { transition: none; }
  .tool-card:hover { transform: none; }
}
[data-theme="dark"] .tool-card:focus-visible { box-shadow: 0 0 0 3px var(--ring); }

/* ── Tools filter bar (search + category chips, "All Tools" page) ───────── */
.tools-filter-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: -8px 0 28px;
  padding: 12px var(--page-gutter, var(--home-section-px, 20px));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.tools-filter-bar__inner {
  max-width: var(--content-max, 1120px);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.tools-filter-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 220px;
  min-width: 0;
}
.tools-filter-search svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.tools-filter-search input {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px 10px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text);
  background: var(--white);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.tools-filter-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}
.tools-filter-chips {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 2px;
  flex: 2 1 480px;
  min-width: 0;
  min-height: 42px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  isolation: isolate;
}
.tools-filter-chips::-webkit-scrollbar { display: none; }
.tools-filter-chip {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 8px 14px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--muted);
  cursor: pointer;
  transition: color .18s var(--ease-out, ease);
}
.tools-filter-chip:hover { color: var(--text); }
.tools-filter-chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.tools-filter-chip.is-active { color: var(--on-primary); }
.tools-filter-chip__glow {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: var(--radius-sm);
  background: var(--primary);
  box-shadow: none;
  transition: transform .25s var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)), width .25s var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
  z-index: 0;
  pointer-events: none;
}
.tools-filter-bar__count {
  flex-basis: 100%;
  margin: 2px 0 0;
  font-size: .78rem;
  color: var(--muted);
}
.tool-card.is-filtered-out { display: none !important; }
.tools-section--empty { display: none !important; }
.tools-filter-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
[data-theme="dark"] .tools-filter-search input { background: var(--white); }
@media (prefers-reduced-motion: reduce) {
  .tools-filter-chip__glow { transition: none; }
}
@media (max-width: 640px) {
  .tools-filter-bar { top: 0; margin-bottom: 20px; }
  .tools-filter-search, .tools-filter-chips { flex-basis: 100%; }
}

/* ── Responsive — Calculator-specific tweaks ────────────── */
@media (max-width: 640px) {
  #resultValue,
  .result-number   { font-size: 2.5rem; }
  .checkbox-group  { grid-template-columns: 1fr; }
  .result-grid     { grid-template-columns: 1fr 1fr; }
  .likert-group    { gap: 5px; }
  .likert-btn      { min-width: 56px; font-size: .75rem; padding: 8px 4px; }
}

/* ── Dark Mode — Calculator Overrides ───────────────────── */
/* Radio / checkbox options (base color already tracks var(--subtle)) */
[data-theme="dark"] .radio-option:has(input:checked) { background: var(--primary-soft); }
[data-theme="dark"] .check-opt:has(input:checked) { background: var(--primary-soft); }

/* Slider value pills (Health .range-val + Money .slider-row .num-input) */
[data-theme="dark"] .range-val {
  background: var(--surface-2);
  color: var(--primary);
}
[data-theme="dark"] .slider-row .num-input,
[data-theme="dark"] .range-row .num-input {
  background: var(--surface-2);
  color: var(--primary);
}
[data-theme="dark"] .slider-row .num-input:hover,
[data-theme="dark"] .range-row .num-input:hover {
  background: color-mix(in srgb, var(--primary) 16%, var(--surface-2));
}
[data-theme="dark"] .slider-row .num-input:focus,
[data-theme="dark"] .range-row .num-input:focus {
  box-shadow: 0 0 0 2px var(--ring);
}

/* Result card */
[data-theme="dark"] .result-card {
  background: var(--white);
  border-color: var(--border);
}
[data-theme="dark"] .progress-bar            { background: var(--surface-2); }
[data-theme="dark"] .result-stat             { background: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] .result-stat .s-value,
[data-theme="dark"] .result-stat .s-val      { color: var(--primary); }

/* Dimension bars */
[data-theme="dark"] .dim-label                { color: var(--subtle); }
[data-theme="dark"] .dim-bar                  { background: #334155; }

/* Likert scale (base background/color already track var(--white)/var(--subtle)) */
[data-theme="dark"] .likert-btn:has(input:checked)   { background: #1e3a5f; }

/* List-item surfaces */
[data-theme="dark"] .routine-item,
[data-theme="dark"] .hustle-item    { background: rgba(255,255,255,.05); }
[data-theme="dark"] .milestone-item,
[data-theme="dark"] .breakdown-item,
[data-theme="dark"] .task-item,
[data-theme="dark"] .price-range    { background: rgba(255,255,255,.05); }
[data-theme="dark"] .milestone-item         { color: var(--subtle); }
[data-theme="dark"] .breakdown-item .b-label { color: var(--subtle); }
[data-theme="dark"] .range-text              { color: var(--subtle); }
[data-theme="dark"] .h-badge                 { background: #1e3a5f; }

/* FAQ */
[data-theme="dark"] .faq-q:hover { background: #273449; }
[data-theme="dark"] .faq-a p     { color: var(--subtle); }

/* ── Language Dropdown — styles live in main.css (loaded on every page) ── */
