/* ===== SHARED TOOL COMPONENT (Phase 17) =====
   Extracted from _reference/tool-debt-vs-invest.html.
   Every tool page inherits this baseline. */

.tool { display: grid; gap: 18px; }
.fields { display: grid; gap: 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--text-3); font-family: var(--font-mono); }
.field input[type=number],
.field input[type=text],
.field select {
 width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
 color: var(--text); font-family: var(--font-mono); font-size: 16px; padding: 10px 12px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--orange-fg); outline-offset: 1px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }

/* Result box (answer-first) */
.tool-result { background: rgba(247,147,26,.07); border-left: 3px solid var(--orange-fg); border-radius: 0 10px 10px 0; padding: 16px 18px; }
.tool-result .verdict { font-size: 21px; font-weight: 700; margin: 0 0 6px; }
.tool-result p { margin: 0; font-size: 15px; }

/* Scenario table */
.tool table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tool th, .tool td { text-align: left; padding: 9px 10px; border: 1px solid var(--border); }
.tool th { color: var(--text-3); font-weight: 600; }

/* Action buttons (share, export, reset) */
.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.tool-actions button {
 background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
 font-family: var(--font-mono); font-size: 13px; padding: 9px 14px; border-radius: 8px; cursor: pointer;
}
.tool-actions button:hover { border-color: var(--orange-fg); color: var(--orange-fg); }

/* "How this is calculated" collapsible */
.tool-calc { border: 1px solid var(--border); border-radius: 10px; padding: 0 16px; }
.tool-calc summary { cursor: pointer; padding: 13px 0; color: var(--text-3); font-size: 13px; }

/* Check/toggle inputs */
.tool-check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-3); }
.tool-check input { width: 18px; height: 18px; accent-color: var(--orange-fg); }

/* ===== TOOL COMPONENT (2026-07-04 reference: fire-calculator) =====
   The reusable, token-driven vocabulary that the 89-tool fleet migrates onto.
   Design brief: Tufte density + Pico form polish + icon/label restraint, on the
   existing dark financial-terminal identity. Every value is a token — no hex.
   Reuses existing containers rather than forking them:
     .tool-layout / .tool-inputs  (grid + sticky sidebar + global focus ring)
     .tool-assumptions            (the "what this assumes" disclosure)
     .tool-actions                (share / export button row)
     .tool-results-sticky         (mobile pinned result bar)
   Everything below is additive and generic — no fire-specific names.
   ------------------------------------------------------------------------- */

/* --- Input field: mono label stacked over a right-aligned numeric input --- */
.tool-field { display: grid; gap: var(--space-2xs); }
.tool-field + .tool-field { margin-top: var(--space-sm); }
.tool-label {
 font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.1em;
 text-transform: uppercase; color: var(--text-3); line-height: 1.4;
 display: flex; align-items: center; gap: var(--space-2xs); flex-wrap: wrap;
}
.tool-input {
 width: 100%; padding: 9px 12px; background: var(--bg-3); color: var(--text);
 border: 1px solid var(--border); border-radius: var(--radius-md);
 font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.4;
 transition: border-color .15s ease;
}
/* Numeric inputs read as figures: tabular, lining, right-aligned (Tufte). */
.tool-input[type="number"] { text-align: right; font-feature-settings: var(--num-features); }
.tool-input:hover { border-color: var(--border-hi); }
/* Keep the site's existing visible orange focus ring (see styles.css .tool-inputs). */
.tool-input:focus, .tool-field select:focus { outline: 2px solid var(--orange-fg); outline-offset: 1px; border-color: var(--orange-fg); }
.tool-hint { font-size: var(--text-xs); color: var(--text-3); line-height: 1.45; margin-top: var(--space-2xs); }

/* --- Input affix: $, %, yr, BTC, sats etc. bonded to the input edge --- */
.input-group { display: flex; align-items: stretch; }
.input-group .tool-input { border-radius: 0; }
.input-group > :first-child { border-top-left-radius: var(--radius-md); border-bottom-left-radius: var(--radius-md); }
.input-group > :last-child { border-top-right-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); }
.input-affix {
 display: flex; align-items: center; padding: 0 10px; background: var(--bg-2);
 border: 1px solid var(--border); color: var(--text-3);
 font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.04em; white-space: nowrap;
}
.input-affix--prefix { border-right: 0; }
.input-affix--suffix { border-left: 0; }
.input-group .tool-input:focus + .input-affix--suffix,
.input-group .input-affix--prefix:has(+ .tool-input:focus) { border-color: var(--orange-fg); }

/* --- Grouped sub-panel of fields (e.g. an optional section) --- */
.tool-group { padding: var(--space-sm); background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-md); margin-top: var(--space-sm); }
.tool-group-title { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--orange-fg); margin-bottom: var(--space-xs); }
.tool-group .tool-input { background: var(--bg-2); }

/* --- Result grid + cards: dense, right-weighted figures --- */
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-between); margin-bottom: var(--space-md); }
.result-grid--pair { grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .result-grid--pair { grid-template-columns: 1fr; } }
.result-card { padding: var(--space-sm); background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.result-card--center { text-align: center; }
/* Emphasis variant: orange left rule marks the primary / selected figure. */
.result-card--accent { border-left: 3px solid var(--orange); border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.result-label { font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); margin-bottom: var(--space-2xs); }
.result-card--accent .result-label { color: var(--orange-fg); }
.result-value { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; color: var(--text); font-feature-settings: var(--num-features); line-height: 1.1; }
.result-card--accent .result-value { color: var(--orange-fg); font-weight: 800; }

/* --- Verdict: the answer-first headline figure for a single-number tool --- */
.result-verdict { padding: var(--space-md); background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: var(--space-md); }
.result-verdict .result-value { font-size: var(--text-3xl); }

/* --- Progress meter --- */
.tool-meter { padding: var(--space-md); background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: var(--space-md); }
.tool-meter-label { font-size: var(--text-sm); color: var(--text-2); margin-bottom: var(--space-xs); font-feature-settings: var(--num-features); }
.tool-meter-track { height: 8px; background: var(--bg-3); border-radius: var(--radius-full); overflow: hidden; }
.tool-meter-fill { height: 100%; width: 0; background: var(--orange); border-radius: var(--radius-full); transition: width .3s ease; }

/* --- Chart frame --- */
.tool-chart { padding: var(--space-sm); background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: var(--space-sm); }

/* --- Note / callout: left-ruled aside (assumptions caveats, "if impossible"…) --- */
.tool-note { padding: var(--space-sm) var(--space-md); background: var(--bg-2); border: 1px solid var(--border); border-left: 3px solid var(--orange); border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.tool-note-title { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange-fg); margin-bottom: var(--space-xs); }
.tool-note p { color: var(--text-2); font-size: var(--text-sm); line-height: 1.7; margin: 0 0 var(--space-xs); }
.tool-note p:last-child { margin-bottom: 0; }
.tool-note ul { color: var(--text-2); font-size: var(--text-sm); line-height: 1.75; padding-left: 22px; margin: 0 0 var(--space-xs); }
.tool-note li { margin-bottom: var(--space-2xs); }

/* --- Related links: quiet row of internal cross-links --- */
.tool-related { padding: var(--space-md); background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.tool-related h2 { font-family: var(--font-display); font-weight: 700; font-size: var(--text-xl); margin: 0 0 var(--space-sm); }
.tool-related-links { display: grid; gap: var(--space-xs); }
.tool-related-links a { display: block; color: var(--text-2); padding: 9px 12px; background: var(--bg-3); border: 1px solid transparent; border-radius: var(--radius-md); text-decoration: none; font-size: var(--text-sm); transition: border-color .15s ease, color .15s ease; }
.tool-related-links a:hover { border-color: var(--border-hi); }
.tool-related-links a strong { color: var(--text); }

/* --- Inline orange link inside tool prose --- */
.tool-link { color: var(--orange-fg); }

/* --- Fine-print footer line --- */
.tool-fineprint { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--text-3); text-align: center; margin-top: var(--space-xl); padding-top: var(--space-sm); border-top: 1px solid var(--border); }
.tool-fineprint a { color: inherit; text-decoration: underline; }

/* --- Vertical spacing between the tool's stacked block sections --- */
.tool-section + .tool-section { margin-top: var(--space-lg); }
