/* NetSheet.org — the calculator (shared by try-it.html and logged-in/netsheet-calculator.html)
   Markup comes from js/netsheet-calc.js. Loaded after css/site.css (public) or css/app.css (app);
   both define the same tokens (--ink, --rule, --green, --highlight, ...). Everything the calculator
   draws is styled here so the two pages look and behave the same. */

.nsc {
  container-type: inline-size;
  container-name: nsc;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
}
.nsc *, .nsc *::before, .nsc *::after { box-sizing: border-box; }

/* ------------------------------------------------------------- layout */

.calc-workspace {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(20rem, 5fr);
  grid-template-areas: "form result" "after result";
  gap: 0 clamp(1.75rem, 3.5vw, 3rem);
  align-items: start;
}
.calc-form { grid-area: form; min-width: 0; }
.calc-result { grid-area: result; min-width: 0; align-self: stretch; }
.calc-after { grid-area: after; min-width: 0; }
.result-sticky { position: sticky; top: 1.5rem; isolation: isolate; }

@container nsc (max-width: 900px) {
  .calc-workspace { grid-template-columns: minmax(0, 1fr); grid-template-areas: "form" "result" "after"; }
  .calc-result { margin-top: 2rem; }
  .result-sticky { position: static; }
}

/* ------------------------------------------------------ seller / buyer */

/* Equal-width segments with even padding all round (symmetric pill) */
.seg {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; gap: 4px; max-width: 100%;
  background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 999px;
}
.seg-item { position: relative; cursor: pointer; margin: 0; min-width: 0; }
.seg-item input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.seg-item span {
  display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 1.1rem;
  border-radius: 999px; font-weight: 600; font-size: 0.95rem; color: var(--ink-2); white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.seg-item:hover input:not(:checked) + span { background: var(--green-soft); color: var(--ink); }
.seg-item input:checked + span { background: var(--green); color: #fff; }
.seg-item input:focus-visible + span { outline: 3px solid var(--highlight); outline-offset: 2px; }

/* ------------------------------------------------------------- the form */

.nsc .form-section { padding: 1.5rem 0 0.4rem; margin: 0; background: none; border-top: 1px solid var(--rule); }
.nsc .form-section:first-of-type { border-top: 0; padding-top: 0; }
.nsc .form-section h2 {
  font-size: 1.25rem; font-weight: 650; line-height: 1.2; margin: 0 0 1rem; color: var(--ink);
  font-stretch: 90%; font-variation-settings: "wdth" 90; letter-spacing: -0.005em;
  display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap;
}
.nsc .form-section h2 .label-note { font-stretch: 100%; font-variation-settings: "wdth" 100; }
.nsc .section-note { color: var(--muted); font-size: 0.9rem; margin: -0.55rem 0 1rem; max-width: 62ch; }

.nsc .field { margin: 0 0 1.1rem; min-width: 0; }
.nsc .field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 1rem; }
.nsc label { display: block; font-weight: 600; font-size: 0.93rem; color: var(--ink); margin: 0 0 0.35rem; line-height: 1.35; }
.nsc .label-note { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.nsc .hint { display: block; font-size: 0.875rem; color: var(--muted); margin: 0.35rem 0 0; line-height: 1.4; }

.nsc-input {
  display: block; width: 100%; min-height: 46px; margin: 0;
  font: inherit; font-size: 1rem; line-height: 1.3; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem; box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.nsc-input::placeholder { color: #8a988f; opacity: 1; }
.nsc-input:hover { border-color: #9fb1a6; }
.nsc-input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(30, 91, 66, 0.18); }
.nsc-input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(163, 49, 42, 0.12); }
select.nsc-input {
  appearance: none; -webkit-appearance: none; padding-right: 2.3rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%2333463c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 16px;
}
select.nsc-input.needs-value { border-color: #d9b84a; background-color: #fffbea; }
textarea.nsc-input { resize: vertical; min-height: 5rem; }
input[type="date"].nsc-input { appearance: none; -webkit-appearance: none; }
input[type="date"].nsc-input::-webkit-date-and-time-value { text-align: left; }
input[type="number"].nsc-input { -moz-appearance: textfield; appearance: textfield; }
input[type="number"].nsc-input::-webkit-outer-spin-button,
input[type="number"].nsc-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.nsc .money { font-variant-numeric: tabular-nums; }

.nsc .input-affix { position: relative; }
.nsc .input-affix .affix { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; line-height: 1; }
.nsc .input-affix .nsc-input { padding-left: 1.7rem; }
.nsc .input-affix .affix-end { left: auto; right: 0.8rem; }
.nsc .input-affix.has-end .nsc-input { padding-left: 0.8rem; padding-right: 2.2rem; }

.nsc .check { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; font-size: 0.95rem; color: var(--ink-2); cursor: pointer; margin: 0 0 1rem; min-height: 28px; }
.nsc .check input[type="checkbox"] { -webkit-appearance: checkbox; appearance: auto; width: 18px; height: 18px; margin: 0.15rem 0 0; accent-color: var(--green); flex: none; }
.nsc .check .label-note { display: inline; }

.nsc .tag {
  display: inline-block; margin-left: 0.35rem; font-size: 0.75rem; font-weight: 600; line-height: 1.5;
  color: var(--green); background: var(--green-soft); padding: 0 0.5rem; border-radius: 999px; vertical-align: 0.08em;
}

.nsc .field-error { color: var(--danger); font-size: 0.875rem; font-weight: 500; margin: 0.35rem 0 0; }
.nsc .calc-error { margin-bottom: 1rem; }
.nsc .notice { border-radius: var(--radius-sm); padding: 0.7rem 0.9rem; font-size: 0.95rem; line-height: 1.45; border: 1px solid; }
.nsc .notice-error { background: var(--danger-soft); border-color: #efc9c6; color: #6e1f1a; }

.nsc .btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 46px; }
.nsc .btn svg { width: 18px; height: 18px; flex: none; }
.nsc .btn-block { width: 100%; }
.nsc .btn.is-loading { opacity: 0.7; pointer-events: none; cursor: progress; }

/* Listing auto-fill */
.autofill-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.6rem; }
.autofill-row .btn { white-space: nowrap; }
.autofill-paste { margin-top: 0.7rem; }
.autofill-paste summary { cursor: pointer; color: var(--green); font-weight: 600; font-size: 0.93rem; width: fit-content; }
.autofill-paste[open] summary { margin-bottom: 0.6rem; }
.autofill-paste textarea { margin-bottom: 0.6rem; }
.autofill-status:empty { display: none; }
.autofill-status.is-error { color: var(--danger); }

/* Address combobox */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 0.3rem;
  list-style: none; background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  box-shadow: 0 18px 36px -18px rgba(19, 36, 27, 0.45); max-height: min(22rem, 60vh); overflow-y: auto;
}
.combo-option {
  display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 0.55rem; align-items: baseline;
  padding: 0.55rem 0.6rem; border-radius: 4px; cursor: pointer; min-height: 44px;
}
.combo-option svg { width: 16px; height: 16px; color: var(--muted); grid-row: span 2; align-self: center; }
.combo-option .combo-main { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-option .combo-sub { grid-column: 2; font-size: 0.85rem; color: var(--muted); }
.combo-option:hover, .combo-option.is-active { background: var(--green-soft); }
.combo-option.is-active svg { color: var(--green); }
.combo-credit { font-size: 0.72rem; color: var(--muted); padding: 0.35rem 0.6rem 0.15rem; text-align: right; }

.address-hint.is-located strong { color: var(--green); font-weight: 600; }
.address-hint.is-located::before {
  content: ""; display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--green);
  margin-right: 0.45rem; vertical-align: 0.1em;
}

.address-map {
  height: 0; overflow: hidden; border-radius: var(--radius-sm); border: 1px solid var(--rule); margin-top: 0.6rem;
  opacity: 0; position: relative; transition: height 420ms cubic-bezier(.2, .8, .2, 1), opacity 300ms;
}
.address-map.is-open { height: 200px; opacity: 1; }
.address-map .leaflet-container { height: 100%; width: 100%; font: inherit; }
.address-map .map-caption {
  position: absolute; left: 0.6rem; bottom: 0.5rem; z-index: 500; max-width: calc(100% - 1.2rem);
  background: rgba(255, 255, 255, 0.94); border-radius: 999px; padding: 0.2rem 0.65rem;
  font-size: 0.8rem; font-weight: 600; color: var(--green); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* County / city / property block, shown once a state is chosen */
.nsc .jurisdiction {
  margin: 0 0 1.1rem; padding: 1rem 1rem 0.1rem;
  background: var(--paper); border: 1px solid var(--rule); border-left: 3px solid var(--leaf); border-radius: var(--radius-sm);
}
#county-help.is-required { color: #6b5208; }
.nsc .customs-note { margin: -0.2rem 0 0.95rem; font-size: 0.875rem; color: var(--ink-2); line-height: 1.45; }

/* Commission slider */
.nsc .commission-slide { margin-top: -0.4rem; }
.nsc .range { display: block; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; }
.nsc .range:focus-visible { outline: 3px solid var(--highlight); outline-offset: -6px; border-radius: 8px; }
.nsc .range::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(to right, var(--green) 0 var(--fill, 60%), #d5dfd9 var(--fill, 60%)); }
.nsc .range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--paper); border: 2px solid var(--green); box-shadow: 0 1px 3px rgba(19, 36, 27, 0.25); }
.nsc .range::-moz-range-track { height: 6px; border-radius: 999px; background: #d5dfd9; }
.nsc .range::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--green); }
.nsc .range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--paper); border: 2px solid var(--green); }
.nsc .range-scale { display: flex; justify-content: space-between; margin-top: -0.55rem; font-variant-numeric: tabular-nums; }
.nsc .range-scale > span:nth-child(2) { color: var(--ink-2); font-weight: 600; }

/* Auto-filled fields */
.auto-field .label-line { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.35rem; min-height: 1.5rem; }
.auto-field .label-line label { margin: 0; min-width: 0; }
.auto-chip {
  flex: none; font-size: 0.72rem; font-weight: 600; line-height: 1; padding: 0.25rem 0.45rem; border-radius: 999px;
  color: var(--green); background: var(--green-soft); letter-spacing: 0.01em;
}
.auto-field.is-edited .auto-chip { color: #5a4608; background: var(--warn-soft, #fdf6dc); }
.info-btn {
  flex: none; width: 28px; height: 28px; margin: -4px 0 -4px -2px; padding: 0; border: 0; background: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer;
}
.info-btn svg { width: 16px; height: 16px; }
.info-btn:hover, .info-btn[aria-expanded="true"] { color: var(--green); background: var(--green-soft); }
.auto-field:not(.is-edited) .nsc-input { background-color: #f6faf7; }
.auto-field:not(.is-edited) .nsc-input:focus { background-color: var(--paper); }
.auto-field.is-edited .nsc-input { border-color: #cdb35a; }
.auto-field.is-edited .nsc-input:focus { border-color: var(--green); }
.auto-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 0.6rem; margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--muted); line-height: 1.4; min-height: 1.2em; }
.auto-meta-text { min-width: 0; }
.reset-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--green); cursor: pointer; text-decoration: underline; text-underline-offset: 0.18em; min-height: 24px; }
.reset-btn:hover { color: var(--green-hover); }
.auto-info {
  margin-top: 0.5rem; padding: 0.7rem 0.8rem; font-size: 0.85rem; line-height: 1.45; color: var(--ink-2);
  background: #f7faf8; border: 1px solid var(--rule); border-radius: var(--radius-sm);
}
.auto-info p { margin: 0 0 0.4rem; }
.auto-info p:last-child { margin-bottom: 0; }
.auto-info .info-lines { list-style: none; margin: 0; padding: 0; }
.auto-info .info-lines li { padding: 0.35rem 0; border-top: 1px dashed var(--rule); display: grid; gap: 0.1rem; }
.auto-info .info-lines li:first-child { border-top: 0; padding-top: 0; }
.auto-info .info-head { display: flex; justify-content: space-between; gap: 0.75rem; }
.auto-info .info-head strong { font-weight: 600; color: var(--ink); }
.auto-info .info-basis, .auto-info .info-meta { color: var(--muted); }
.auto-info a { color: var(--green); font-weight: 600; }
.auto-info .info-line { margin-top: 0.45rem; }

/* "verify with your title company" — informational, not a warning */
.nsc .verify, .ledger .verify {
  display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; color: #6b5a1c; font-weight: 500; line-height: 1.35;
}
.nsc .verify::before, .ledger .verify::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #c9a82c; flex: none; }

/* Custom fee rows */
.custom-fees { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.custom-fees:empty { display: none; }
.custom-fee-item { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(6.5rem, 0.8fr) 46px; gap: 0.6rem; align-items: end; }
.custom-fee-item label { font-size: 0.85rem; }
.fee-remove {
  width: 46px; height: 46px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--paper); color: var(--muted); cursor: pointer;
}
.fee-remove:hover { color: var(--danger); border-color: var(--danger); }
.fee-remove svg { width: 18px; height: 18px; }
.nsc .btn-add { margin-bottom: 1rem; }

.more-options > summary { cursor: pointer; font-weight: 600; color: var(--green); margin-bottom: 0; padding: 0.2rem 0 0.9rem; list-style-position: outside; }
.more-options > summary .label-note { display: block; font-size: 0.85rem; margin-top: 0.1rem; }
.more-options[open] > summary { margin-bottom: 0.5rem; }

.nsc .form-submit { padding-top: 1.5rem; border-top: 1px solid var(--rule); margin-top: 0.5rem; }
.nsc .form-submit .btn { min-height: 52px; font-size: 1.05rem; }
.nsc .form-submit .hint { text-align: center; margin-top: 0.55rem; }

/* ------------------------------------------------------- the paper sheet */

.nsc .sheet { position: relative; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-sheet); border: 1px solid var(--rule); }
.nsc .sheet-stack::before {
  content: ""; position: absolute; inset: 10px -10px -10px 10px; z-index: -1;
  background: #e8eeea; border: 1px solid var(--rule); border-radius: var(--radius);
}
.nsc .result-sheet:focus { outline: none; }
.nsc .result-sheet + .result-sheet { margin-top: 1.75rem; }
.nsc .sheet-head { display: block; padding: 1.15rem 1.5rem 1rem; border-bottom: 1px solid var(--rule); }
.nsc .sheet-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.85rem; min-height: 32px; }
.nsc .sheet-brand { min-width: 0; display: flex; align-items: center; }
.nsc .sheet-logo { max-width: 160px; max-height: 44px; width: auto; height: auto; display: block; }
.nsc .brand-fallback { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 650; font-size: 0.98rem; color: var(--ink); }
.nsc .brand-fallback svg { width: 24px; height: 24px; flex: none; }
.nsc .brand-fallback .tld { color: var(--muted); font-weight: 500; }
.nsc .result-date { color: var(--muted); font-size: 0.875rem; margin: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nsc .sheet-title { font-size: 1.1rem; font-weight: 650; margin: 0; line-height: 1.3; font-stretch: 100%; font-variation-settings: "wdth" 100; letter-spacing: -0.005em; color: var(--ink); }
.nsc .sheet-sub { color: var(--muted); font-size: 0.9rem; margin: 0.15rem 0 0; overflow-wrap: anywhere; white-space: normal; }
.nsc .sheet-body { padding: 0.3rem 1.5rem 1.25rem; }
.nsc .sheet-foot { padding: 0.9rem 1.5rem 1.1rem; border-top: 1px solid var(--rule); }
.nsc .sheet-disclaimer { font-size: 0.85rem; color: var(--muted); margin: 0; }
.nsc .sheet-notice {
  margin: 0.75rem 0 0.25rem; padding: 0.55rem 0.75rem; font-size: 0.875rem; line-height: 1.45;
  color: #5a4608; background: #fdf6dc; border: 1px solid #eedc9a; border-radius: var(--radius-sm);
}

/* The ledger (also used by logged-in/netsheet-preview.html) */
.ledger { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ledger td { padding: 0.55rem 0; border-bottom: 1px dashed var(--rule); vertical-align: baseline; }
.ledger td:first-child { padding-right: 0.75rem; overflow-wrap: anywhere; }
.ledger td:last-child { text-align: right; white-space: nowrap; padding-left: 1rem; }
.ledger .line-label { font-weight: 500; }
.ledger .deduct td:last-child { color: var(--ink-2); }
.ledger .deduct td:last-child::before { content: "\2212\00a0"; color: var(--muted); }
.ledger .credit td:last-child::before { content: "+\00a0"; color: var(--muted); }
.ledger .lead td { font-weight: 650; }
.ledger .lead .line-label { font-weight: 650; }
.ledger .rate { display: block; color: var(--muted); font-size: 0.8rem; line-height: 1.35; margin-top: 0.15rem; font-weight: 400; }
.ledger .verify { display: flex; margin-top: 0.15rem; }
.ledger .line-tag {
  display: inline-block; margin-left: 0.4rem; font-size: 0.7rem; font-weight: 600; line-height: 1.5; padding: 0 0.4rem;
  border-radius: 999px; color: #5a4608; background: #fdf6dc; vertical-align: 0.1em;
}
.ledger .group td, .ledger .group td:last-child { text-align: left; }
.ledger .group td {
  padding: 1rem 0 0.3rem; border-bottom: 1px solid var(--rule-strong);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.ledger tfoot .subtotal td { border-top: 1px solid var(--ink); border-bottom: 0; font-weight: 600; padding-top: 0.65rem; }
.ledger .total td { border-bottom: 0; border-top: 1px solid var(--rule); padding-top: 0.9rem; font-weight: 650; font-size: 1.15rem; }
.ledger .total td:last-child span {
  background: linear-gradient(transparent 12%, var(--highlight) 12%, var(--highlight) 88%, transparent 88%);
  padding: 0 0.3rem; border-bottom: 3px double var(--ink);
}
.ledger-empty td { color: var(--muted); }
.ledger-empty td:last-child { color: #9aa8a0; }
.ledger-empty .total td { color: var(--ink-2); }
.ledger-empty .total td:last-child { color: #9aa8a0; font-weight: 400; }
.nsc .empty-note { font-size: 0.875rem; color: var(--muted); margin: 0.9rem 0 0.25rem; }

.nsc .assumptions { margin-top: 0.9rem; font-size: 0.875rem; color: var(--ink-2); }
.nsc .assumptions summary { cursor: pointer; font-weight: 600; color: var(--green); }
.nsc .assumptions ul { margin: 0.5rem 0 0 1.1rem; padding: 0; }
.nsc .assumptions li { margin-bottom: 0.3rem; }

/* ------------------------------------------------ small screens: net bar */

.calc-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1020;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.97); border-top: 1px solid var(--rule);
  box-shadow: 0 -10px 24px -18px rgba(19, 36, 27, 0.35);
  transform: translateY(110%); transition: transform 0.18s ease, visibility 0.18s; visibility: hidden;
  font-family: var(--font);
}
.calc-bar.is-shown { transform: none; visibility: visible; }
.calc-bar-net { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; background: none; border: 0; padding: 0.2rem 0; text-align: left; color: var(--ink); font: inherit; cursor: pointer; }
.calc-bar-net small { color: var(--muted); font-size: 0.8rem; }
.calc-bar-net strong { font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc-bar .btn { min-height: 44px; flex: none; }
body.has-calc-bar { padding-bottom: 4.5rem; }

/* Toasts */
.calc-toasts { position: fixed; top: 1rem; right: 1rem; z-index: 10000; display: grid; gap: 0.5rem; width: min(380px, calc(100vw - 2rem)); font-family: var(--font); }
.calc-toast {
  display: grid; grid-template-columns: minmax(0, 1fr) 32px; gap: 0.5rem; align-items: center;
  padding: 0.5rem 0.5rem 0.5rem 0.9rem; min-height: 50px; border-radius: var(--radius-sm); border: 1px solid; font-size: 0.95rem; line-height: 1.45;
  box-shadow: 0 16px 30px -18px rgba(19, 36, 27, 0.45); animation: ns-toast-in 180ms ease-out;
  background: #eef3f6; border-color: #d3dfe6; color: #213845;
}
.calc-toast.is-success { background: var(--ok-soft); border-color: #c4dccd; color: #1c4a33; }
.calc-toast.is-error { background: var(--danger-soft); border-color: #efc9c6; color: #6e1f1a; }
.calc-toast-close { width: 32px; height: 32px; border: 0; background: none; color: inherit; opacity: 0.7; cursor: pointer; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.calc-toast-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }
.calc-toast-close svg { width: 16px; height: 16px; }
/* Address → Zillow lookup card (searching, found, done, empty) */
.listing-lookup { position: relative; overflow: hidden; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.75rem 0.85rem; align-items: start; margin-top: 0.7rem; padding: 0.85rem 1rem; border: 1px solid var(--rule); border-radius: var(--radius, 10px); background: var(--paper, #fff); opacity: 0; transform: translateY(-6px); transition: opacity 0.28s ease, transform 0.28s cubic-bezier(.2, .8, .2, 1), border-color 0.28s ease, background 0.28s ease; }
.listing-lookup[hidden] { display: none; }
.listing-lookup.is-open { opacity: 1; transform: none; }
.listing-lookup .lookup-icon { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--green-soft); color: var(--green); flex: none; }
.listing-lookup .lookup-icon svg { width: 20px; height: 20px; }
.listing-lookup .lookup-text { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; font-size: 0.9rem; color: var(--muted); }
.listing-lookup .lookup-text strong { color: var(--ink); font-size: 0.97rem; }
.listing-lookup .lookup-price { color: var(--ink); font-size: 0.95rem; }
.listing-lookup .lookup-price b { font-size: 1.12rem; color: var(--green); font-variant-numeric: tabular-nums; }
.listing-lookup .lookup-facts { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.15rem; }
.listing-lookup .lookup-fact { padding: 0.12rem 0.55rem; border-radius: 999px; background: var(--page, #f2f5f3); border: 1px solid var(--rule); font-size: 0.8rem; color: var(--ink); animation: ns-pop 320ms cubic-bezier(.2, .8, .2, 1) both; }
.listing-lookup .lookup-fact:nth-child(2) { animation-delay: 60ms; } .listing-lookup .lookup-fact:nth-child(3) { animation-delay: 120ms; } .listing-lookup .lookup-fact:nth-child(4) { animation-delay: 180ms; } .listing-lookup .lookup-fact:nth-child(5) { animation-delay: 240ms; }
.listing-lookup .lookup-ask { margin-top: 0.3rem; color: var(--ink); font-weight: 600; }
.listing-lookup .lookup-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.listing-lookup .lookup-actions .btn { min-height: 42px; }
.listing-lookup.is-searching { border-color: var(--leaf, #8dbfa5); }
.listing-lookup.is-searching .lookup-icon { animation: ns-lookup-pulse 1.1s ease-in-out infinite; }
.listing-lookup .lookup-scan { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--green) 45%, var(--highlight, #f5dc5a) 55%, transparent); background-size: 200% 100%; animation: ns-lookup-scan 1.2s linear infinite; }
.listing-lookup.is-found { border-color: var(--green); box-shadow: 0 10px 28px -20px rgba(19, 36, 27, 0.55); }
.listing-lookup.is-found .lookup-icon { animation: ns-zoom-badge 420ms cubic-bezier(.2, .8, .2, 1); }
.listing-lookup.is-done { border-color: var(--leaf, #8dbfa5); background: var(--green-soft); }
.listing-lookup.is-done .lookup-icon { background: var(--green); color: #fff; animation: ns-zoom-badge 420ms cubic-bezier(.2, .8, .2, 1); }
.listing-lookup.is-empty { background: var(--page, #f2f5f3); }
.listing-lookup.is-empty .lookup-icon { background: var(--paper, #fff); color: var(--muted); }
@keyframes ns-lookup-pulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(30, 91, 66, 0.35); } 50% { transform: scale(1.06); box-shadow: 0 0 0 8px rgba(30, 91, 66, 0); } }
@keyframes ns-lookup-scan { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .listing-lookup, .listing-lookup .lookup-icon, .listing-lookup .lookup-scan, .listing-lookup .lookup-fact { animation: none !important; transition: none; } }
@media (max-width: 520px) { .listing-lookup .lookup-actions .btn { flex: 1 1 auto; justify-content: center; } }

@keyframes ns-toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ----------------------------------------------------------- animations */

@keyframes ns-fill-flash { 0% { box-shadow: 0 0 0 0 rgba(30, 91, 66, 0.5); background-color: var(--green-soft); } 100% { box-shadow: 0 0 0 8px rgba(30, 91, 66, 0); } }
.nsc-input.is-filled { animation: ns-fill-flash 800ms ease-out; }
@keyframes ns-pop { 0% { opacity: 0.4; transform: translateY(4px); } 100% { opacity: 1; transform: none; } }
.jurisdiction.is-located { animation: ns-pop 360ms cubic-bezier(.2, .8, .2, 1); }
@keyframes ns-zoom-badge { 0% { transform: scale(0.5); opacity: 0; } 70% { transform: scale(1.1); opacity: 1; } 100% { transform: none; } }
.tag.is-zoom { animation: ns-zoom-badge 460ms cubic-bezier(.2, .9, .3, 1.3); }
@keyframes ns-address-glow { 0% { box-shadow: 0 0 0 0 rgba(30, 91, 66, 0.4); } 100% { box-shadow: 0 0 0 10px rgba(30, 91, 66, 0); } }
#property-address.is-located { animation: ns-address-glow 700ms ease-out; }
@keyframes ns-pin-drop { 0% { transform: translateY(-30px); opacity: 0; } 70% { transform: translateY(3px); opacity: 1; } 100% { transform: none; } }
.address-map .leaflet-marker-icon { animation: ns-pin-drop 520ms cubic-bezier(.2, .8, .2, 1) both; }
@keyframes ns-row-changed { 0% { background: #fff6c9; } 100% { background: transparent; } }
@keyframes ns-row-new { 0% { background: var(--green-soft); opacity: 0; } 35% { opacity: 1; } 100% { background: transparent; } }
.ledger tr.is-changed td { animation: ns-row-changed 1000ms ease-out; }
.ledger tr.is-new td { animation: ns-row-new 650ms ease-out; }

@media (prefers-reduced-motion: reduce) {
  .nsc-input.is-filled, .jurisdiction.is-located, .tag.is-zoom, #property-address.is-located,
  .address-map .leaflet-marker-icon, .ledger tr.is-changed td, .ledger tr.is-new td, .calc-toast { animation: none; }
  .address-map, .calc-bar, .seg-item span { transition: none; }
}

/* ------------------------------------------------------------ narrow */

@container nsc (max-width: 560px) {
  .nsc .field-row { grid-template-columns: minmax(0, 1fr); }
  .custom-fee-item { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 46px; padding-bottom: 0.75rem; border-bottom: 1px dashed var(--rule); }
  .custom-fee-item .fee-name { grid-column: 1 / -1; }
  .autofill-row { grid-template-columns: minmax(0, 1fr); }
  .nsc .sheet-head, .nsc .sheet-body, .nsc .sheet-foot { padding-inline: 1rem; }
  .nsc .sheet-stack::before { inset: 8px -6px -8px 6px; }
  .seg { display: grid; width: 100%; }
  .seg-item span { padding: 0 0.5rem; font-size: 0.9rem; }
  .address-map.is-open { height: 170px; }
}
@media (max-width: 420px) {
  .seg-item span { font-size: 0.85rem; padding: 0 0.35rem; }
}
