.cost-calculator { margin-top: 24px; padding: 24px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: #fff; min-width: 0; overflow-wrap: anywhere; scroll-margin-top: 160px; }
.cost-calculator *, .cost-calculator *::before, .cost-calculator *::after { box-sizing: border-box; }
.cost-calculator [hidden] { display: none !important; }
.cost-calculator p { margin: 0; }
.cost-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.cost-heading h3 { font-size: 20px; line-height: 1.3; font-weight: 600; }
.cost-snapshot { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.cost-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; min-width: 0; border: 1px solid var(--border); border-radius: 10px; padding: 3px; margin: 0 0 14px; background: rgba(var(--brand-blue-rgb), .04); }
.cost-modes legend, .cost-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.cost-modes label { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 44px; padding: 4px 8px; border-radius: 8px; font-size: 13px; line-height: 1.3; cursor: pointer; }
.cost-modes label:has(input:checked) { background: #fff; box-shadow: 0 1px 4px rgba(var(--brand-blue-rgb), .12); color: var(--brand-blue); }
.cost-modes input { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--brand-blue); }
.cost-calculator-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.cost-controls, .cost-fields > div { min-width: 0; }
.cost-calculator .guide-model-choice { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cost-calculator .guide-model-choice label { flex-shrink: 0; font-size: 13px; }
.cost-calculator .guide-model-choice select { flex: 1; width: 100%; max-width: 100%; min-width: 0; min-height: 44px; margin: 0; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-size: 16px; }
.cost-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cost-fields > div { display: flex; flex-direction: column; }
.cost-fields label { display: block; margin-bottom: 4px; color: var(--text-secondary); font-size: 12px; line-height: var(--text-leading-ui); }
.cost-fields input { width: 100%; min-width: 0; min-height: 44px; margin-top: auto; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-size: 16px; font-variant-numeric: tabular-nums; }
.cost-fields input[aria-invalid="true"] { border-color: #b42318; }
.cost-cache-control label { display: flex; justify-content: space-between; gap: 6px; }
#cost-cache-share { color: var(--brand-blue); font-weight: 600; white-space: nowrap; }
.cost-fields input[type="range"] { padding: 0; border: 0; background: transparent; accent-color: var(--brand-blue); cursor: pointer; }
.cost-cache-scale { display: none; }
.cost-advanced { margin-top: 4px; }
.cost-advanced > .cost-fields { margin: 4px 0 8px; }
.cost-calculator summary { min-height: 44px; padding: 11px 0; font-size: 13px; line-height: 1.5; font-weight: 500; cursor: pointer; }
.cost-calculator #cost-input-note, .cost-calculator #cost-error { font-size: 12px; line-height: 1.6; }
.cost-calculator #cost-error { color: #b42318; margin-top: 6px; }
.cost-result { min-width: 0; padding: 16px; border-radius: 10px; background: rgba(var(--brand-blue-rgb), .06); }
.cost-result-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; }
#cost-result-label { flex: 1; font-size: 13px; line-height: var(--text-leading-ui); }
#cost-total { font-size: 28px; line-height: 1.3; font-weight: 600; color: var(--brand-blue); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cost-currency { font-size: 11px; color: var(--text-secondary); }
.cost-result #cost-capacity { margin: 6px 0; font-size: 13px; line-height: 1.5; font-weight: 600; }
#cost-assumptions, .cost-disclaimer, #cost-reasoning-volume, #cost-request-price, #cost-free-note { font-size: 12px; line-height: 1.5; }
.cost-result .cost-disclaimer { margin-top: 6px; }
.cost-result-details { margin-top: 6px; border-top: 1px solid var(--border); }
.cost-result-details > summary { padding-bottom: 8px; }
.cost-breakdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 2px 0 10px; }
.cost-breakdown > div { min-width: 0; font-size: 12px; }
.cost-breakdown dt { color: var(--text-secondary); }
.cost-breakdown dd { margin: 3px 0 0; font-variant-numeric: tabular-nums; }
.cost-breakdown small { display: block; margin-top: 2px; font-size: 11px; color: var(--text-secondary); overflow-wrap: anywhere; }
.cost-result #cost-free-note { margin-top: 6px; }
.cost-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 0 12px; margin-top: 12px; border-top: 1px solid var(--border); }
.cost-billing { min-width: 0; font-size: 12px; }
.cost-billing[open] { flex-basis: 100%; }
.cost-billing p { margin: 6px 0 12px; line-height: 1.6; }
.cost-integration-link { display: flex; align-items: center; min-height: 44px; font-size: 13px; color: var(--brand-blue); }
.cost-calculator :is(input, select, summary, a):focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px; }
@media (max-width: 768px) {
  .cost-calculator { padding: 12px; scroll-margin-top: 84px; }
  .cost-heading { gap: 8px; margin-bottom: 8px; }
  .cost-heading h3 { font-size: 18px; }
  .cost-modes { margin-bottom: 10px; }
  .cost-modes label { font-size: 12px; padding-inline: 4px; }
  .cost-calculator-layout { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .cost-calculator .guide-model-choice { gap: 8px; margin-bottom: 10px; }
  .cost-fields { gap: 10px; }
  .cost-result { padding: 12px; }
  .cost-footer { margin-top: 8px; }
  .cost-calculator :is(input, select, summary, a) { scroll-margin-block: 84px 16px; }
  /* Keep the chapter links in document flow so they cannot cover this region. */
  body[data-page="model"] .model-section-nav { position: static; top: auto; }
  .model-content-section { scroll-margin-top: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  .cost-calculator *, .cost-calculator *::before, .cost-calculator *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
