/* ── THMC loan application: shared core (brand guide v1.0) ── */
.thmc-app {
  --signal:#1DBBF0; --signal-hover:#1AACDD; --signal-link:#0F8FBD;
  --ink:#000; --deep:#101418; --paper:#fff; --mute:#6E767C; --rule:#D8DCDF; --wash:#F4F6F7;
  --error:#C8322B; --error-wash:#FDF0EF;
  --display:'Urbanist', system-ui, -apple-system, "Segoe UI", sans-serif;
  --body:'Figtree', system-ui, -apple-system, "Segoe UI", sans-serif;
  --data:'Roboto Mono', ui-monospace, monospace;
  font-family: var(--body); font-size: 16px; line-height: 1.6; color: var(--ink);
  -webkit-font-smoothing: antialiased; text-align: left;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
}
.thmc-app *, .thmc-app *::before, .thmc-app *::after { box-sizing: border-box; margin: 0; padding: 0; }
.thmc-app [hidden] { display: none !important; }
.thmc-app button, .thmc-app input, .thmc-app select, .thmc-app textarea { font-family: inherit; text-shadow: none; box-shadow: none; min-width: 0; max-width: 100%; }
.thmc-app button { touch-action: manipulation; }
.thmc-app ul, .thmc-app ol { list-style: none; }
.thmc-app .accent { color: var(--signal); }
.thmc-app .eyebrow { display: block; font: 700 12px/1.2 var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--mute); }
.thmc-app .title { font: 600 32px/1.15 var(--display); letter-spacing: -.01em; color: var(--ink); margin: 8px 0 8px; }
.thmc-app .sub { color: var(--mute); font-size: 15px; line-height: 1.5; max-width: 34em; margin-bottom: 28px; }
.thmc-app .subhead { font: 600 20px/1.3 var(--display); margin: 8px 0 16px; }
.thmc-app .rule { border: none; border-top: 1px solid var(--rule); margin: 28px 0; }
.thmc-app .hint { font-size: 13px; color: var(--mute); margin-top: 6px; line-height: 1.45; }

/* fields */
.thmc-app .field { margin-bottom: 22px; }
.thmc-app .row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px; }
.thmc-app .row > .field { margin-bottom: 0; }
.thmc-app .row-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 22px; }
.thmc-app .row-3 > .field { margin-bottom: 0; }
.thmc-app .lbl { display: block; font: 600 14px/1.35 var(--display); color: var(--ink); margin-bottom: 8px; }
.thmc-app .lbl .opt { font: 400 13px var(--body); color: var(--mute); margin-left: 4px; }
.thmc-app .inp {
  width: 100%; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 4px;
  font: 16px/1.4 var(--body); color: var(--ink); background: var(--paper);
  outline: none; -webkit-appearance: none; appearance: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.thmc-app .inp::placeholder { color: #9AA1A6; }
.thmc-app .inp:hover { border-color: var(--mute); }
.thmc-app .inp:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(29,187,240,.35); }
.thmc-app .inp { height: auto; min-height: 48px; margin: 0; }
.thmc-app .inp.money { font-family: var(--data); font-size: 16px; }
.thmc-app textarea.inp { min-height: 96px; resize: vertical; line-height: 1.5; }
.thmc-app select.inp {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23000' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; cursor: pointer;
}
.thmc-app .inp.is-error { border-color: var(--error); box-shadow: 0 0 0 3px rgba(200,50,43,.12); }
.thmc-app input[type="file"] { width: 100%; font: 14px var(--body); color: var(--mute); }
.thmc-app input[type="file"]::file-selector-button {
  font: 700 12px var(--display); letter-spacing: .1em; text-transform: uppercase; padding: 10px 16px; margin-right: 12px;
  background: transparent; color: var(--ink); border: 1px solid var(--ink); border-radius: 3px; cursor: pointer;
}
.thmc-app input[type="file"]::file-selector-button:hover { background: var(--ink); color: var(--paper); }
.thmc-app .file-clear { display: inline-block; margin-top: 8px; padding: 6px 0; background: none; border: none; font: 600 13px var(--display); color: var(--signal-link); cursor: pointer; min-height: 32px; }
.thmc-app .file-clear:hover { text-decoration: underline; }

/* chips (radio-backed) */
.thmc-app .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.thmc-app .chip { position: relative; cursor: pointer; display: block; }
.thmc-app .chips.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.thmc-app .chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.thmc-app .chip span {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 16px; border: 1px solid var(--rule); border-radius: 3px; background: var(--paper); text-align: center;
  font: 600 15px/1.3 var(--display); color: var(--ink); transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.thmc-app .chip:hover span { border-color: var(--ink); }
.thmc-app .chip input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.thmc-app .chip input:focus-visible + span { outline: 2px solid var(--signal); outline-offset: 2px; }
.thmc-app .is-error .chip span { border-color: var(--error); }
.thmc-app .chip-stop input:checked + span { background: var(--error); border-color: var(--error); color: var(--paper); }
.thmc-app .chip-stop:hover span { border-color: var(--error); }

/* segmented control (radio-backed) */
.thmc-app .seg { display: flex; border: 1px solid var(--ink); border-radius: 3px; overflow: hidden; }
.thmc-app .seg label { flex: 1; position: relative; cursor: pointer; border-left: 1px solid var(--ink); display: flex; }
.thmc-app .seg label:first-child { border-left: none; }
.thmc-app .seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.thmc-app .seg span { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 48px; padding: 12px 8px; font: 700 12px/1.2 var(--display); letter-spacing: .1em; text-transform: uppercase; background: var(--paper); color: var(--ink); transition: background .15s ease, color .15s ease; }
.thmc-app .seg input:checked + span { background: var(--ink); color: var(--paper); }
.thmc-app .seg input:focus-visible + span { outline: 2px solid var(--signal); outline-offset: -4px; }

/* switch row (checkbox-backed) */
.thmc-app .switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 14px 0; margin: 0; font-weight: 400; border-top: 1px solid var(--rule); cursor: pointer; }
.thmc-app .switch-row + .switch-row { border-top: 1px solid var(--rule); }
.thmc-app .switch-row.last { border-bottom: 1px solid var(--rule); margin-bottom: 22px; }
.thmc-app .switch-row b { display: block; font: 600 15px/1.35 var(--display); }
.thmc-app .switch-row small { display: block; font: 400 13px/1.4 var(--body); color: var(--mute); }
.thmc-app .switch-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.thmc-app .track { position: relative; width: 48px; height: 26px; flex-shrink: 0; background: var(--rule); border-radius: 13px; transition: background .15s ease; }
.thmc-app .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); transition: transform .15s ease, background .15s ease; }
.thmc-app .switch-row input:checked + .track { background: var(--ink); }
.thmc-app .switch-row input:checked + .track::after { transform: translateX(22px); background: var(--signal); }
.thmc-app .switch-row input:focus-visible + .track { outline: 2px solid var(--signal); outline-offset: 2px; }

/* conditional panel */
.thmc-app .panel { margin: -6px 0 22px; padding: 20px 24px; background: var(--wash); border-left: 3px solid var(--signal); border-radius: 0 4px 4px 0; }
.thmc-app .panel .field:last-child, .thmc-app .panel .row:last-child { margin-bottom: 0; }

/* sliders */
.thmc-app .rng { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; cursor: pointer; --fill: 50%; }
.thmc-app .rng::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(to right, var(--signal) var(--fill), var(--rule) var(--fill)); }
.thmc-app .rng::-moz-range-track { height: 4px; background: var(--rule); }
.thmc-app .rng::-moz-range-progress { height: 4px; background: var(--signal); }
.thmc-app .rng::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; background: var(--ink); border: 3px solid var(--paper); box-shadow: 0 0 0 1px var(--ink); border-radius: 0; }
.thmc-app .rng::-moz-range-thumb { width: 16px; height: 16px; background: var(--ink); border: 3px solid var(--paper); box-shadow: 0 0 0 1px var(--ink); border-radius: 0; }
.thmc-app .rng:focus { outline: none; }
.thmc-app .rng:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--ink), 0 0 0 4px var(--signal); }
.thmc-app .rng { height: 36px; }
@media (pointer: coarse) {
  .thmc-app .rng::-webkit-slider-thumb { width: 30px; height: 30px; margin-top: -13px; }
  .thmc-app .rng::-moz-range-thumb { width: 24px; height: 24px; }
}
.thmc-app .ticks { display: flex; justify-content: space-between; font: 12px/1.45 var(--data); letter-spacing: .06em; color: var(--mute); margin-top: 2px; }
.thmc-app .rng-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.thmc-app .rng-head .lbl { margin: 0; }
.thmc-app .rng-val { font: 500 22px/1 var(--data); }
.thmc-app .rng-val em { font: 700 11px var(--display); letter-spacing: .16em; text-transform: uppercase; font-style: normal; color: var(--mute); margin-left: 8px; }

/* buttons */
.thmc-app .nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 32px; }
.thmc-app .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 14px 28px; margin: 0; width: auto; height: auto; box-shadow: none;
  border-radius: 3px; border: 1px solid transparent; font: 700 14px/1 var(--display); letter-spacing: .1em; text-transform: uppercase;
  cursor: pointer; transition: background .15s ease, color .15s ease;
}
.thmc-app .btn:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.thmc-app .btn-primary { flex: 1; background: var(--signal); color: var(--paper); }
.thmc-app .btn-primary:hover { background: var(--signal-hover); }
.thmc-app .btn-primary:disabled { background: var(--rule); color: var(--mute); cursor: not-allowed; }
.thmc-app .btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); padding: 14px 20px; }
.thmc-app .btn-ghost:hover { background: var(--ink); color: var(--paper); }
.thmc-app .spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: var(--paper); border-radius: 50%; animation: thmc-spin .6s linear infinite; display: none; }
.thmc-app .btn.loading .spinner { display: block; }
@keyframes thmc-spin { to { transform: rotate(360deg); } }

/* banner, review, consent */
.thmc-app .banner-err { background: var(--error-wash); border: 1px solid rgba(200,50,43,.25); border-radius: 4px; padding: 12px 16px; margin-bottom: 24px; font-size: 14px; color: var(--error); }
.thmc-app .review { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; margin-bottom: 8px; }
.thmc-app .review .wide { grid-column: span 2; }
.thmc-app .review-l { display: block; font: 700 11px/1.2 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--mute); margin-bottom: 4px; }
.thmc-app .review-v { font-size: 15px; word-break: break-word; }
.thmc-app .review-v.mono { font: 14px var(--data); }
.thmc-app .consent { font-size: 13px; color: var(--mute); line-height: 1.6; margin-top: 24px; max-width: 42em; }

/* success */
.thmc-app .success { text-align: center; padding: 48px 32px; background: none; border: none; box-shadow: none; border-radius: 0; }
.thmc-app .success-icon { width: 56px; height: 56px; margin: 0 auto 24px; background: var(--ink); color: var(--signal); display: flex; align-items: center; justify-content: center; }
.thmc-app .success .title { margin-bottom: 12px; }
.thmc-app .success .sub { margin: 0 auto 28px; max-width: 26em; }
.thmc-app .success-score { display: inline-flex; align-items: center; gap: 16px; background: var(--deep); border-radius: 12px; padding: 16px 28px; }
.thmc-app .success-score b { font: 800 44px/1 var(--display); letter-spacing: -.03em; color: var(--signal); }
.thmc-app .success-score span { font: 700 11px/1.5 var(--display); letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.7); text-align: left; }
.thmc-app .next { background: var(--wash); border-radius: 12px; padding: 24px; text-align: left; margin-top: 28px; }
.thmc-app .next h4 { font: 700 11px var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--mute); margin-bottom: 16px; }
.thmc-app .next li { list-style: none; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; font-size: 15px; line-height: 1.45; }
.thmc-app .next li:last-child { margin-bottom: 0; }
.thmc-app .next li b { width: 22px; height: 22px; flex-shrink: 0; margin-top: 1px; background: var(--ink); color: var(--paper); font: 800 12px var(--display); display: flex; align-items: center; justify-content: center; }

/* steps */
.thmc-app .step { display: none; }
.thmc-app .step.is-active { display: block; }

@media (max-width: 640px) {
  .thmc-app .title { font-size: 26px; }
  .thmc-app .sub { margin-bottom: 22px; }
  .thmc-app .row, .thmc-app .row-3, .thmc-app .review { grid-template-columns: 1fr; gap: 0; margin-bottom: 0; }
  .thmc-app .row > .field, .thmc-app .row-3 > .field { margin-bottom: 22px; }
  .thmc-app .review { gap: 14px; }
  .thmc-app .review .wide { grid-column: auto; }
  .thmc-app .chips { display: grid; grid-template-columns: 1fr 1fr; }
  .thmc-app .chips.grid { grid-template-columns: 1fr 1fr; }
  .thmc-app .panel { padding: 16px; margin-left: -4px; margin-right: -4px; }
  /* Thumb-reach action bar: Back / Continue stay pinned to the bottom of the screen */
  .thmc-app .nav {
    position: sticky; bottom: 0; z-index: 4; margin: 24px -20px 0; padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    background: var(--paper); border-top: 1px solid var(--rule); flex-wrap: nowrap;
  }
  .thmc-app .nav .btn-ghost { flex: 0 0 auto; padding: 14px 16px; }
  .thmc-app .success { padding: 32px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .thmc-app *, .thmc-app *::before, .thmc-app *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

/* ── v2 additions ─────────────────────────── */
.thmc-app input[type="date"].inp { min-height: 48px; }
.thmc-app .tools { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px 16px; margin: -8px 0 12px; }
.thmc-app .tools button { background: none; border: none; padding: 6px 0; font: 600 13px var(--display); color: var(--signal-link); cursor: pointer; min-height: 32px; }
.thmc-app .tools button:hover { text-decoration: underline; }
.thmc-app .draft-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; background: var(--deep); color: var(--paper); border-radius: 12px; padding: 16px 20px; margin-bottom: 24px; }
.thmc-app .draft-bar p { flex: 1 1 260px; font-size: 15px; line-height: 1.45; }
.thmc-app .draft-bar .btn { min-height: 44px; padding: 12px 20px; flex: 0 0 auto; }
.thmc-app .draft-bar .btn-ghost { color: var(--paper); border-color: rgba(255,255,255,.55); }
.thmc-app .draft-bar .btn-ghost:hover { background: var(--paper); color: var(--ink); }
.thmc-app .estimate { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; background: var(--wash); border-radius: 4px; padding: 14px 16px; margin: -6px 0 22px; }
.thmc-app .estimate span { font: 700 11px var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--mute); }
.thmc-app .estimate b { font: 500 20px var(--data); }
.thmc-app .estimate small { display: block; font: 400 12px var(--body); color: var(--mute); letter-spacing: 0; text-transform: none; margin-top: 2px; }
.thmc-app .notice { margin: -6px 0 22px; padding: 16px 18px; border-left: 4px solid var(--error); background: var(--error-wash); border-radius: 0 4px 4px 0; font-size: 15px; line-height: 1.5; color: #8A241E; }
.thmc-app .notice b { color: var(--error); }
.thmc-app .unit { display: flex; gap: 8px; align-items: stretch; }
.thmc-app .unit .seg { flex: 0 0 104px; }
.thmc-app details.more { margin: 0 0 22px; }
.thmc-app details.more summary { cursor: pointer; font: 600 14px var(--display); color: var(--signal-link); padding: 8px 0; list-style: none; }
.thmc-app details.more summary::-webkit-details-marker { display: none; }
.thmc-app details.more summary::before { content: '+ '; }
.thmc-app details.more[open] summary::before { content: '− '; }
.thmc-app details.more[open] summary { margin-bottom: 12px; }
.thmc-app .section-label { display: block; font: 700 12px var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--mute); margin: 32px 0 16px; padding-top: 24px; border-top: 1px solid var(--rule); }
.thmc-app .section-label.first { margin-top: 0; padding-top: 0; border-top: none; }
.thmc-app .docs-note { margin: 16px auto 0; max-width: 30em; font-size: 14px; color: #B35A16; }
.thmc-app .success .actions { margin-top: 24px; display: flex; justify-content: center; }
.thmc-app .success .actions .btn { flex: 0 1 auto; }
/* Score tiers (display only) */
.thmc-app .tone-top { color: var(--signal); }
.thmc-app .tone-strong { color: #3FBF7F; }
.thmc-app .tone-good { color: #F5B942; }
.thmc-app .tone-improve { color: #F08A3E; }
.thmc-app .checklist { list-style: none; display: grid; gap: 8px; text-align: left; width: 100%; }
.thmc-app .checklist li { display: flex; gap: 10px; align-items: center; font-size: 14px; color: rgba(255,255,255,.75); }
.thmc-app .checklist li::before { content: ''; width: 16px; height: 16px; flex-shrink: 0; border: 1.5px solid rgba(255,255,255,.4); }
.thmc-app .checklist li.done { color: var(--paper); }
.thmc-app .checklist li.done::before { background: var(--signal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 28 28'%3E%3Cpath d='M5 14l7 7L23 7' stroke='%23000' stroke-width='4' fill='none'/%3E%3C/svg%3E") center no-repeat; border-color: var(--signal); }
