
/* NSV Advisors DSCR calculator. Deal inputs on the left, loan options on the right. */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --line: #dde3ea;
  --line-strong: #c6cfd9;
  --ink: #142235;
  --muted: #5d6b7c;
  --faint: #8794a3;
  --accent: #1d3f6e;
  --accent-ink: #ffffff;
  --accent-soft: #e6edf6;
  --good: #1b7a4b;
  --good-soft: #e3f3ea;
  --bad: #b3372b;
  --bad-soft: #fbe8e5;
  --warn: #8a5a00;
  --warn-soft: #fbf1dc;
  --star: #9a6b00;
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-num: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f151d; --surface: #161f2a; --surface-2: #1b2532; --line: #2a3646; --line-strong: #3a4859;
    --ink: #e7edf4; --muted: #a2afbf; --faint: #7a8899; --accent: #8fb4e8; --accent-ink: #0f151d; --accent-soft: #1f2f45;
    --good: #5fcf96; --good-soft: #163428; --bad: #f08a7e; --bad-soft: #3a1d1a; --warn: #e8bb62; --warn-soft: #3a2e14; --star: #e8bb62;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f151d; --surface: #161f2a; --surface-2: #1b2532; --line: #2a3646; --line-strong: #3a4859;
  --ink: #e7edf4; --muted: #a2afbf; --faint: #7a8899; --accent: #8fb4e8; --accent-ink: #0f151d; --accent-soft: #1f2f45;
  --good: #5fcf96; --good-soft: #163428; --bad: #f08a7e; --bad-soft: #3a1d1a; --warn: #e8bb62; --warn-soft: #3a2e14; --star: #e8bb62;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 14px; line-height: 1.45; }
.wrap { max-width: 1480px; margin: 0 auto; padding-block: 20px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* header */
.top { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.brand-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(24px, 3vw, 32px); margin: 2px 0 4px; letter-spacing: -.01em; text-wrap: balance; }
.contact { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 12.5px; }
.contact b { color: var(--ink); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); background: var(--surface); padding: 8px 14px; border-radius: 8px; font-weight: 500; font-size: 13.5px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 6px 8px; }
.btn.ghost:hover { color: var(--ink); border-color: var(--line); }
.btn.danger { color: var(--bad); }
.btn svg { width: 16px; height: 16px; flex: none; }

.banner { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 9px 14px; margin-bottom: 14px; font-size: 13px; }
.banner .btn { padding: 4px 10px; font-size: 12.5px; }

/* main grid */
.main { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1040px) { .main { grid-template-columns: minmax(0, 1fr); } }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-h { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-h h2 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; margin: 0; color: var(--muted); font-weight: 600; }
.deal { padding: 6px 16px 16px; display: grid; gap: 4px; }
.group-label { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 12px 0 2px; }
.field { display: grid; gap: 3px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 500; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inp { width: 100%; border: 1px solid var(--line); background: var(--surface-2); border-radius: 7px; padding: 7px 9px; font-size: 14px; min-width: 0; }
.inp:hover { border-color: var(--line-strong); }
.inp:focus { border-color: var(--accent); background: var(--surface); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 13.5px; }
.affix { position: relative; }
.affix .inp { padding-left: 20px; }
.affix.suf .inp { padding-left: 9px; padding-right: 24px; }
.affix span { position: absolute; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 12.5px; pointer-events: none; }
.affix span.pre { left: 9px; }
.affix span.suf { right: 9px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; border-radius: 6px; padding: 6px 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); font-weight: 600; }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.hint.warn { color: var(--warn); }
.tti { margin-top: 10px; display: flex; justify-content: space-between; align-items: baseline; padding: 9px 11px; background: var(--accent-soft); border-radius: 8px; font-size: 12.5px; }
.tti b { font-family: var(--font-num); font-size: 14px; }

/* comparison table */
.cmp-wrap { overflow-x: auto; border-radius: var(--radius); }
table.cmp { border-collapse: separate; border-spacing: 0; width: 100%; min-width: max-content; }
.cmp th, .cmp td { border-bottom: 1px solid var(--line); padding: 6px 10px; vertical-align: middle; }
.cmp td { min-width: 168px; width: 190px; }
.cmp .lab { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted); min-width: 176px; width: 176px; border-right: 1px solid var(--line); }
.cmp thead th { background: var(--surface); padding: 10px; border-bottom: 1px solid var(--line-strong); text-align: left; }
.cmp thead th.lab { z-index: 2; }
.colhead { display: flex; align-items: center; gap: 4px; }
.colhead input { font-weight: 600; font-size: 14px; border-color: transparent; background: transparent; padding: 5px 6px; }
.colhead input:hover { border-color: var(--line); }
.icon-btn { border: 0; background: transparent; color: var(--faint); padding: 5px; border-radius: 6px; display: inline-flex; }
.icon-btn:hover { color: var(--ink); background: var(--surface-2); }
.icon-btn.rm:hover { color: var(--bad); }
.icon-btn svg { width: 15px; height: 15px; }
.cmp tr.sec td, .cmp tr.sec th { background: var(--surface-2); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); padding: 7px 10px; border-bottom: 1px solid var(--line); }
.cmp tr.sec th.lab { background: var(--surface-2); color: var(--accent); }
.cmp .cell-inp { display: flex; gap: 6px; }
.cmp .cell-inp > * { flex: 1; min-width: 0; }
.cmp select.inp { padding: 6px 6px; font-size: 13px; }
.out { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 13.5px; }
.out.big { font-size: 15.5px; font-weight: 600; }
.sub { display: block; font-size: 11px; color: var(--faint); font-family: var(--font-body); }
.res td, .res th { background: var(--surface); }
.res.total td { background: var(--accent-soft); }
.res.total th.lab { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-body); font-size: 11px; font-weight: 600; border-radius: 99px; padding: 2px 8px; margin-left: 6px; vertical-align: 1px; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.muted { background: var(--surface-2); color: var(--muted); }
.star { color: var(--star); font-family: var(--font-body); font-size: 11px; font-weight: 600; margin-left: 6px; white-space: nowrap; }
.neg { color: var(--bad); }
.pos { color: var(--good); }
.addcol { min-width: 120px; width: 120px; text-align: center; vertical-align: top; }
.addbtn { border: 1.5px dashed var(--line-strong); background: transparent; color: var(--muted); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; font-weight: 600; width: 100%; }
.addbtn:hover { border-color: var(--accent); color: var(--accent); }
.foot-note { color: var(--muted); font-size: 12px; margin-top: 10px; line-height: 1.5; }

/* saved drawer */
.drawer { margin-bottom: 16px; }
.saved-list { list-style: none; margin: 0; padding: 0; }
.saved-list li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.saved-list li:last-child { border-bottom: 0; }
.saved-meta { min-width: 0; }
.saved-meta b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.saved-meta span { font-size: 12px; color: var(--muted); }
.empty { padding: 16px; color: var(--muted); font-size: 13px; }
.confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 20; max-width: calc(100% - 32px); }
@media (prefers-reduced-motion: no-preference) { .toast { animation: rise .2s ease-out; } @keyframes rise { from { opacity: 0; transform: translate(-50%, 6px); } } }

/* NSV additions */
.contact a { color: var(--muted); text-decoration: none; }
.contact a:hover { color: var(--accent); text-decoration: underline; }
.rates { margin-bottom: 18px; }
.rates .asof { font-size: 12px; color: var(--muted); }
.rates-wrap { overflow-x: auto; }
table.rt { border-collapse: collapse; width: 100%; max-width: 640px; font-size: 13.5px; }
.rt th, .rt td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.rt thead th { font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.rt th[scope=row], .rt thead th:first-child { text-align: left; color: var(--ink); font-weight: 600; font-size: 13px; }
.rt td { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent); }
.rt tbody tr:last-child th, .rt tbody tr:last-child td { border-bottom: 0; }
.rates-note { padding: 10px 16px 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.ratecell { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.ratecell .pill { margin-left: 6px; }
.linkbtn { border: 0; background: none; padding: 3px 0 0; color: var(--accent); font-size: 11.5px; text-decoration: underline; display: block; }
.disc { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11.5px; line-height: 1.5; }
.disc p { margin: 0 0 6px; max-width: 900px; }
.disc b { color: var(--muted); }
@media (max-width: 640px) {
  .wrap { padding-top: 14px; }
  .actions { width: 100%; }
  .actions .btn { flex: 1 1 calc(50% - 8px); justify-content: center; padding: 9px 10px; }
  .cmp .lab { min-width: 104px; width: 104px; font-size: 12px; padding: 6px 8px; }
  .cmp td { min-width: 126px; width: 130px; padding: 6px 6px; }
  .cmp thead th { padding: 8px 6px; }
  .colhead input { font-size: 13px; }
  .cmp .cell-inp { flex-direction: column; gap: 4px; }
  .inp { font-size: 16px; }
  .num { font-size: 15px; }
  .rt th, .rt td { padding: 7px 8px; font-size: 12.5px; }
  .addcol { min-width: 84px; width: 84px; }
  .addbtn { padding: 8px 6px; }
}
