/* "BC360 Tools" grammar — Grace's True Rate spec v0 §3 (PROVISIONAL tokens, swap here after the brand gate).
   Ink on white 18.9:1 · Signal #C2410C on white ≈5.2:1 · Muted #4B5563 ≈7.6:1 · no gold, no serif in the tool body. */
body.tool {
  --t-paper: #FFFFFF;
  --t-fill: #EEF2F7;
  --t-signal: #C2410C;
  --t-muted: #4B5563;
  --t-err-bg: #FDECEC;
  --t-line: #D5DBE3;
  --focus: #C2410C;
  background: var(--t-paper);
}
.tool main h1, .tool main h2, .tool main h3 { font-family: var(--sans); letter-spacing: -.015em; }
.tool main h1 { font-size: clamp(1.9rem, 6.5vw, 2.75rem); font-weight: 800; }
.tool main h2 { font-size: 1.25rem; font-weight: 700; margin: 0 0 .25rem; }
.tool .lead { color: var(--t-muted); font-size: 1.0625rem; }
.tool-wrap { max-width: 40rem; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }

.cur-pick { display: flex; align-items: center; gap: .75rem; margin: 1rem 0 1.25rem; }
.cur-pick label { font-weight: 600; }
select, .in input {
  font: 400 1.0625rem/1.3 var(--sans); color: var(--ink);
  background: var(--t-fill); border: 1px solid var(--t-line); border-radius: 8px;
  min-height: 3rem; padding: .6rem .75rem;
}
select { padding-right: 2rem; }

/* Result card: shown FIRST */
.result {
  border: 2px solid var(--ink); border-radius: 12px; padding: 1.25rem; margin-bottom: 2rem;
  background: var(--t-paper);
}
.result:focus { outline: 3px solid var(--t-signal); outline-offset: 3px; }
.r-row { padding: .75rem 0; border-bottom: 1px solid var(--t-line); }
.r-row:last-child { border-bottom: 0; }
.r-label { font-size: .9375rem; color: var(--t-muted); margin: 0; }
.r-val { font: 700 1.75rem/1.2 var(--sans); margin: .15rem 0 0; font-variant-numeric: tabular-nums; }
.r-hero .r-val { font-size: 2.5rem; color: var(--t-signal); }
.r-sub { font-size: .9375rem; color: var(--t-muted); margin: .15rem 0 0; }
.r-need { font-size: .9375rem; color: var(--t-muted); font-style: italic; margin: .15rem 0 0; }
.r-gap { margin: .5rem 0 0; }
.empty { color: var(--t-muted); margin: 0; }

/* Sections and fields */
fieldset { border: 0; padding: 0; margin: 0 0 2rem; }
legend { padding: 0; margin-bottom: .25rem; }
legend h2 { display: flex; gap: .5rem; align-items: baseline; }
.sec { font-weight: 800; color: var(--t-signal); }
.f { margin-top: 1rem; }
.f label { display: block; font-weight: 600; margin-bottom: .35rem; }
.f .hint { display: block; font-weight: 400; font-size: .9375rem; color: var(--t-muted); }
.in { display: flex; align-items: stretch; max-width: 22rem; }
.in .cur, .in .unit {
  display: inline-flex; align-items: center; padding: 0 .75rem; min-width: 2.5rem; justify-content: center;
  background: #E2E8F0; border: 1px solid var(--t-line); font-weight: 600;
}
.in .cur { border-radius: 8px 0 0 8px; border-right: 0; }
.in .unit { border-radius: 0 8px 8px 0; border-left: 0; }
.in input { flex: 1; min-width: 0; width: 100%; }
.in .cur:not([hidden]) + input { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.in input:has(+ .unit) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.in input:focus-visible { outline: 3px solid var(--t-signal); outline-offset: 2px; }
.in input[aria-invalid="true"] { border: 2px solid var(--ink); }
.err {
  margin: .4rem 0 0; padding: .5rem .7rem; border-radius: 6px; max-width: 22rem;
  background: var(--t-err-bg); color: var(--ink); font-size: .9375rem; font-weight: 600;
}
.helper {
  background: var(--t-fill); border-left: 4px solid var(--ink); border-radius: 6px;
  padding: .9rem 1rem; margin-top: 1rem; color: var(--ink); font-size: .9375rem;
}
.total { margin-top: 1rem; font-weight: 700; }
.warn { margin-top: .5rem; font-size: .9375rem; color: var(--ink); }
.explain { margin-top: .75rem; font-size: .9375rem; color: var(--t-muted); }
.optional { font-weight: 400; color: var(--t-muted); font-size: .9375rem; }

.job-out { margin-top: 1.25rem; border: 2px solid var(--ink); border-radius: 12px; padding: 1rem 1.25rem; }
.job-out .r-val { color: var(--t-signal); font-size: 2rem; }

.assumptions { color: var(--t-muted); font-size: .9375rem; border-top: 1px solid var(--t-line); padding-top: 1.25rem; }
.assumptions ol { padding-left: 1.2rem; }
.assumptions li { margin-bottom: .35rem; }

.tool .btn { background: var(--t-signal); border-color: var(--t-signal); color: #fff; }
.tool .btn:hover { background: #9A3412; border-color: #9A3412; }
.tool .btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.tool .btn-ghost:hover { background: var(--t-fill); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0 0; }
#copy-text { width: 100%; min-height: 9rem; margin-top: .75rem; font: .875rem/1.4 var(--sans); }

.next { border-top: 1px solid var(--t-line); padding-top: 1.5rem; margin-top: 1rem; }

.tr-sticky {
  position: sticky; top: 0; z-index: 6; background: var(--ink); color: #fff;
  padding: .55rem 1.25rem; font-size: .9375rem; display: flex; justify-content: space-between; gap: 1rem;
}
.tr-sticky strong { font-variant-numeric: tabular-nums; }
@media (min-width: 60rem) { .tr-sticky { display: none !important; } }

@media print {
  .tr-sticky, .actions, .next, .cur-pick { display: none !important; }
  .result, .job-out { border-color: #000; }
}
