/* Work mode: calm, high-contrast, one-handed tool screens */
body.work { padding-bottom: 96px; }
body.work .site-footer { margin-top: var(--space-8); }

.tool-head { padding: var(--space-4) 0 var(--space-5); }
.tool-head h1 { font-size: clamp(2rem, 1.5rem + 2vw, 2.8rem); margin: 0.6rem 0 0.4rem; }
.tool-head h1 .script { font-size: 1.1em; }
.tool-head p { color: var(--ink-soft); max-width: 60ch; }

.stage-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-5);
}
.stage-progress a, .stage-progress span {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  text-decoration: none; font-weight: 700; font-size: 0.8125rem;
  padding: 0.5rem 0.25rem; border-radius: var(--r-sm);
  color: var(--ink-soft);
}
.stage-progress i {
  display: block; width: 100%; height: 8px; border-radius: var(--r-pill);
  background: var(--cream-deep);
}
.stage-progress .is-done i, .stage-progress .is-current i { background: var(--stage); }
.stage-progress .is-current { color: var(--ink); background: var(--white); box-shadow: 0 3px 0 var(--edge); }
.stage-progress .is-locked { opacity: 0.55; }

.tool-grid { display: grid; gap: var(--space-5); }
@media (min-width: 1000px) {
  .tool-grid--split { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); align-items: start; }
  .tool-grid--split > .sticky-col { position: sticky; top: 1rem; }
}

.panel {
  background: var(--white);
  border-radius: var(--r-md);
  box-shadow: 0 5px 0 var(--edge);
  padding: clamp(1.1rem, 3vw, 1.6rem);
}
.panel + .panel { margin-top: var(--space-5); }
.panel__head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.panel__head h2 { font-size: 1.35rem; letter-spacing: -0.01em; }
.panel__num {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--stage, var(--green)); color: var(--ink); font-weight: 700;
}
.panel__intro { color: var(--ink-soft); margin: -0.4rem 0 1rem; font-size: var(--text-sm); }

.stage--walk .panel__num, .panel.stage--walk .panel__num { --stage: var(--lemon); }

/* Fields */
.fields { display: grid; gap: 1rem; }
.fields--2 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.field { display: grid; gap: 0.35rem; }
.field > span, .field legend { font-weight: 700; font-size: var(--text-sm); }
.field small { color: var(--ink-soft); font-size: 0.875rem; line-height: 1.4; }
.field input, .field select, .field textarea, .input {
  width: 100%;
  min-height: 50px;
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--white);
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--green-tint); }
.field.is-proposed input, .field.is-proposed select { border-color: var(--lemon-deep); background: var(--lemon-tint); }
.input-affix { position: relative; }
.input-affix input { padding-left: 1.8rem; }
.input-affix::before { content: attr(data-prefix); position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%); color: var(--ink-soft); font-weight: 700; }
.input-affix--suffix input { padding-left: 0.9rem; padding-right: 2.2rem; }
.input-affix--suffix::before { display: none; }
.input-affix--suffix::after { content: attr(data-suffix); position: absolute; right: 0.9rem; top: 50%; transform: translateY(-50%); color: var(--ink-soft); font-weight: 700; }

fieldset.field { border: 0; padding: 0; margin: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span {
  display: inline-flex; align-items: center; min-height: 46px;
  padding: 0.5rem 1rem; border-radius: var(--r-pill);
  border: 2px solid var(--line); background: var(--white);
  font-weight: 700; font-size: var(--text-sm); cursor: pointer;
}
.seg input:checked + span { border-color: var(--ink); background: var(--green-tint); }
.seg input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 46px; padding: 0.5rem 1rem;
  border-radius: var(--r-pill); border: 2px solid var(--line);
  background: var(--white); font-weight: 700; font-size: var(--text-sm); cursor: pointer;
}
.chip-btn:hover { border-color: var(--ink); }
.chip-btn[aria-pressed="true"] { background: var(--lemon-tint); border-color: var(--lemon-deep); }

/* Stepper */
.stepper { display: flex; align-items: center; gap: 0.4rem; }
.stepper button {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--white);
  font-weight: 700; font-size: 1.25rem; cursor: pointer; line-height: 1;
}
.stepper output { min-width: 2ch; text-align: center; font-weight: 700; font-size: 1.15rem; }
.stepper-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem 1rem; }
.stepper-grid .field > span { font-size: 0.875rem; }

/* Area items */
.area-list { display: grid; gap: 0.85rem; margin-top: 1rem; }
.area-item { border: 2px solid var(--line); border-radius: var(--r-md); padding: 1rem; background: var(--cream); }
.area-item.is-proposed { border-color: var(--lemon-deep); background: var(--lemon-tint); }
.area-item__head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.8rem; }
.area-item__head input { flex: 1; min-height: 44px; font-weight: 700; }
.area-item__icon { font-size: 1.4rem; }
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid var(--line); background: var(--white); cursor: pointer; font-size: 1.1rem;
}
.icon-btn:hover { border-color: var(--berry); color: var(--berry-deep); }
.proposed-note { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.8rem; font-size: var(--text-sm); font-weight: 700; }

.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.6rem; margin-top: 1rem; }
.total { background: var(--cream); border-radius: var(--r-sm); padding: 0.7rem 0.9rem; line-height: 1.3; }
.total strong { display: block; font-size: 1.35rem; }
.total span { font-size: 0.8125rem; color: var(--ink-soft); font-weight: 700; }

/* Details / accordions */
details.fold { border-top: 2px dashed var(--line); padding: 0.4rem 0; }
details.fold:first-of-type { border-top: 0; }
details.fold summary {
  cursor: pointer; font-weight: 700; min-height: 48px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; list-style: none;
}
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary::after { content: "+"; font-size: 1.4rem; color: var(--ink-soft); }
details.fold[open] summary::after { content: "–"; }
details.fold .fields { padding: 0.25rem 0 1rem; }

/* Sticky action bar */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--white);
  border-top: 2px solid var(--line);
  padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom, 0px));
}
.action-bar .container { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.save-state { font-size: 0.875rem; font-weight: 700; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 0.4rem; }
.save-state::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.save-state.is-saving::before { background: var(--lemon); }
.action-bar .btn { min-height: 50px; }

/* Messages */
.notice { border-radius: var(--r-sm); padding: 0.85rem 1rem; font-size: var(--text-sm); font-weight: 600; line-height: 1.45; }
.notice--info { background: var(--aqua-tint); }
.notice--warn { background: var(--tangerine-tint); }
.notice--ok { background: var(--green-tint); }
.notice--berry { background: var(--berry-tint); }
.notice + .notice { margin-top: 0.6rem; }
.notice a { font-weight: 700; }

.empty { text-align: center; padding: var(--space-7) var(--space-4); }
.empty img { width: 110px; margin: 0 auto var(--space-4); }
.empty h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.empty p { color: var(--ink-soft); margin: 0 auto var(--space-5); max-width: 40ch; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--white); border-radius: var(--r-pill);
  padding: 0.7rem 1.2rem; font-weight: 700; z-index: 40; box-shadow: 0 4px 0 #0B2226;
  max-width: calc(100% - 2rem); text-align: center;
}

/* Confidence tag */
.conf { display: inline-block; padding: 0.05rem 0.55rem; border-radius: var(--r-pill); font-size: 0.75rem; font-weight: 700; background: var(--cream-deep); vertical-align: middle; }
.conf--High { background: var(--green-tint); }
.conf--Medium { background: var(--lemon-tint); }
.conf--Low, .conf--Low–Medium { background: var(--tangerine-tint); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th, .table td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 0.8125rem; color: var(--ink-soft); }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }

@media print {
  body.work { padding-bottom: 0; }
}

/* Toolbox home */
.profile-strip { margin-bottom: var(--space-5); }
.account-list { display: grid; gap: var(--space-4); margin-bottom: var(--space-5); }
@media (min-width: 900px) { .account-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } .account-list > .empty { grid-column: 1 / -1; } }
.account-card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.75rem; }
.account-card__name { font-size: 1.3rem; }
.account-card .stage-progress { margin-bottom: 0.9rem; }
.account-card .notice { margin-bottom: 0.9rem; }
.account-card__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.backup h2 { font-size: 1.3rem; margin-bottom: 0.4rem; }
.backup p { margin-bottom: 1rem; }

/* Scope */
.scope-title { font-size: 1.5rem; margin-bottom: 0.25rem; }
.task-list { display: grid; }
.task-row {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem;
  padding: 0.75rem 0; border-top: 1px solid var(--line);
}
.task-row:first-child { border-top: 0; }
@media (min-width: 640px) { .task-row { grid-template-columns: minmax(0, 1fr) 190px; align-items: center; } .task-row--periodic { grid-template-columns: minmax(0, 1fr) 300px; } }
.task-row__check { display: flex; gap: 0.7rem; align-items: flex-start; cursor: pointer; line-height: 1.45; }
.task-row__check input { width: 24px; height: 24px; margin: 0; flex-shrink: 0; accent-color: var(--green-deep); }
.task-row.is-off .task-row__check span { color: var(--ink-soft); text-decoration: line-through; }
.task-row__pair { display: grid; grid-template-columns: 1fr 90px; gap: 0.5rem; }
.freq-select { min-height: 44px; padding: 0.4rem 0.6rem; font-size: 0.9375rem; }
.add-line { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.add-line .input { min-height: 46px; }
.print-root { display: none; }

/* Test results */
.result-panel { border-top: 10px solid var(--tangerine); }
.result-kicker { font-weight: 700; color: var(--ink-soft); }
.result-price { font-size: clamp(2.6rem, 2rem + 3vw, 3.6rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.flags { margin-top: 1rem; }
.band-check { margin-top: 1.25rem; padding-top: 1rem; border-top: 2px dashed var(--line); }
.band-check__label { margin-bottom: 0.6rem; }
.band-track { position: relative; height: 30px; border-radius: var(--r-pill); background: var(--cream); }
.band-range { position: absolute; top: 0; bottom: 0; border-radius: var(--r-pill); border: 2px dashed var(--ink-soft); background: var(--cream-deep); }
.band-you { position: absolute; top: -5px; width: 18px; height: 40px; margin-left: -9px; border-radius: 9px; background: var(--tangerine); box-shadow: 0 3px 0 var(--tangerine-deep); }
.band-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.8125rem; font-weight: 700; margin: 0.6rem 0; }
.band-key { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.band-key--range { background: var(--cream-deep); border: 2px dashed var(--ink-soft); }
.band-key--you { background: var(--tangerine); margin-left: 0.6rem; }
.band-msg { font-size: var(--text-sm); }
.math { margin-top: 1rem; border-top: 2px dashed var(--line); }
.math-steps { margin: 0.75rem 0 0.5rem; padding-left: 1.2rem; display: grid; gap: 0.4rem; font-size: var(--text-sm); }

/* Win */
.proposal-text { min-height: 200px !important; }
.doc-preview { margin-top: 1.25rem; border: 2px solid var(--line); border-radius: var(--r-md); padding: clamp(1rem, 4vw, 2.25rem); background: var(--white); }
.doc { font-size: 0.975rem; line-height: 1.6; }
.doc h1 { font-size: 1.9rem; margin: 0.25rem 0; }
.doc h2 { font-size: 1.2rem; margin: 1.6rem 0 0.5rem; padding-bottom: 0.3rem; border-bottom: 3px solid var(--green); }
.doc h3 { font-size: 1rem; margin: 1rem 0 0.35rem; }
.doc p { margin: 0 0 0.6rem; }
.doc ul { padding-left: 1.2rem; margin: 0 0 0.6rem; }
.doc table { width: 100%; border-collapse: collapse; margin-bottom: 0.75rem; font-size: 0.9rem; }
.doc td, .doc th { text-align: left; padding: 0.45rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc td.num { text-align: right; white-space: nowrap; }
.doc .doc-cover { border-bottom: 3px solid var(--ink); padding-bottom: 0.75rem; }
.doc .doc-meta { color: var(--ink-soft); }
.doc .doc-price { font-weight: 700; font-size: 1.1rem; }
.doc .doc-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 2rem; }
.doc .doc-sign div { border-top: 2px solid var(--ink); padding-top: 0.3rem; font-size: 0.8125rem; color: var(--ink-soft); }
.followup { border-top: 1px solid var(--line); padding: 0.75rem 0; }
.followup.is-due .task-row__check strong { color: var(--berry-deep); }
.email-draft { white-space: pre-wrap; font-family: var(--font-sans); background: var(--cream); border-radius: var(--r-sm); padding: 0.9rem; font-size: 0.9375rem; margin: 0.5rem 0 0.75rem; }

.bar-price { font-size: 1.2rem; margin-right: auto; margin-left: 0.25rem; }
@media (max-width: 420px) { .action-bar .container:has(.bar-price) .save-state { font-size: 0; gap: 0; } }
