/* Extracted verbatim from index.html's inline <style>.
   Tokens and system rules now come from house.css, loaded first. */
* { box-sizing: border-box; }
  body {
    margin: 0; background: var(--paper); color: var(--ink);
    font-family: var(--sans); font-size: 15px; line-height: 1.45;
    -webkit-font-smoothing: antialiased;
  }
  .wrap { max-width: 1440px; margin: 0 auto; padding: 28px 26px 80px; }

  header.masthead {
    display: flex; align-items: baseline; gap: 16px;
    border-bottom: 1px solid var(--line-strong); padding-bottom: 16px; margin-bottom: 20px;
  }
  .mark {
    font-family: var(--mono); font-weight: 700; font-size: 20px; letter-spacing: -.02em;
    padding: 4px 10px; border: 1.5px solid var(--ink); border-radius: 6px;
  }
  .masthead h1 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
  .masthead .sub { color: var(--muted); font-size: 13px; margin-left: auto; }

  /* ---- full-width two-column split: numbers | listing ---- */
  .split { display: grid; grid-template-columns: 1.42fr 1fr; gap: 26px; align-items: start; }
  @media (max-width: 1040px) { .split { grid-template-columns: 1fr; } }
  .col-head {
    font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
    color: #5a544b; margin: 2px 2px 12px; display: flex; align-items: baseline; gap: 10px;
  }
  .col-head .sub { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); font-size: 12px; margin-left: auto; }

  /* ---- inputs (compact grid) ---- */
  .inputs-card {
    border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
    padding: 16px; box-shadow: var(--shadow); margin-bottom: 18px;
  }
  .inp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; }
  @media (max-width: 560px) { .inp-grid { grid-template-columns: repeat(2, 1fr); } }
  .f { display: flex; flex-direction: column; gap: 3px; }
  .f > label { font-size: 11px; color: var(--muted); font-weight: 600; }
  .f .in { display: flex; align-items: center; gap: 5px; }
  .f .in input {
    width: 100%; text-align: right; font-family: var(--mono); font-size: 14px;
    padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 6px;
    background: #FEFEFC; color: var(--ink); font-variant-numeric: tabular-nums;
  }
  .f .in input:focus { outline: 2px solid var(--ring); outline-offset: 1px; border-color: var(--ring); }
  .f .in .unit { font-size: 12px; color: var(--muted); white-space: nowrap; }
  .slider-row { margin-top: 14px; }
  .slider-row .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
  .slider-row .top b { font-family: var(--mono); font-weight: 600; }
  input[type="range"] { width: 100%; accent-color: var(--ink); }

  /* ---- results ---- */
  .tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
  @media (max-width: 560px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
  .tile {
    background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
    padding: 12px 14px; box-shadow: var(--shadow);
  }
  .tile .k { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
  .tile .v { font-family: var(--mono); font-size: 22px; font-weight: 600; margin-top: 5px; letter-spacing: -.02em;
             font-variant-numeric: tabular-nums; }
  .tile .v small { font-size: 12px; color: var(--muted); font-weight: 500; }
  .help {
    display: inline-flex; align-items: center; justify-content: center;
    width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--line-strong);
    background: transparent; color: var(--muted); font-size: 10px; font-weight: 700;
    cursor: pointer; margin-left: 3px; padding: 0; line-height: 1; vertical-align: middle; font-family: var(--sans);
  }
  .help:hover { border-color: var(--ink); color: var(--ink); }

  /* ---- info popover (non-fullscreen) ---- */
  .info-pop {
    position: fixed; z-index: 40; width: 300px; max-width: calc(100vw - 24px);
    background: var(--panel); border: 1px solid var(--line-strong); border-radius: 10px;
    box-shadow: 0 12px 40px rgba(20,25,31,.22); padding: 14px 16px 15px;
  }
  .info-pop[hidden] { display: none; }
  .info-close { position: absolute; top: 7px; right: 10px; border: 0; background: none; color: var(--muted); font-size: 17px; cursor: pointer; line-height: 1; }
  .info-title { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
  .info-pop p { font-size: 13px; line-height: 1.5; color: #33383f; margin: 0 0 9px; }
  .info-pop p.cmp { font-weight: 600; }
  .info-pop p.cmp .neg { color: var(--neg); }
  .info-pop p.cmp .pos { color: var(--pos); }
  .info-pop p.note { font-size: 12px; color: var(--muted); margin-bottom: 0; }

  .section-label {
    font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
    font-weight: 700; margin: 0 0 12px; display: flex; align-items: baseline; gap: 10px;
  }
  .section-label .hint { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); font-size: 12px; }

  /* ---- signature: rate strip ---- */
  .strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 26px; }
  @media (max-width: 620px) { .strip { grid-template-columns: repeat(3, 1fr); } }
  .rate-card {
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
    padding: 12px 12px 14px; text-align: center; position: relative; box-shadow: var(--shadow);
    transition: transform .12s ease;
  }
  .rate-card.base { border-color: var(--ring); box-shadow: 0 0 0 1.5px var(--ring), var(--shadow); transform: translateY(-3px); }
  .rate-card .badge {
    position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
    font-size: 9px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700;
    background: var(--ink); color: #fff; padding: 2px 7px; border-radius: 20px;
  }
  .rate-card .rate { font-family: var(--mono); font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
  .rate-card .split-line { border-top: 1px dashed var(--line-strong); margin-top: 9px; padding-top: 9px; }
  .rate-card .row { display: flex; justify-content: space-between; align-items: baseline; margin: 3px 0; }
  .rate-card .row .lab { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
  .rate-card .row .num { font-family: var(--mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

  .pos { color: var(--pos); }
  .neg { color: var(--neg); }
  .zero { color: var(--muted); }

  /* ---- income statement ---- */
  .seg { display: inline-flex; margin-left: auto; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
  .seg button { font-family: var(--sans); font-size: 12px; font-weight: 600; padding: 5px 12px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
  .seg button.on { background: var(--ink); color: #fff; }
  table.stmt { width: 100%; border-collapse: collapse; font-size: 13px; }
  table.stmt th, table.stmt td { padding: 6px 10px; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
  table.stmt th.lbl, table.stmt td.lbl { text-align: left; font-family: var(--sans); }
  table.stmt thead th { font-family: var(--sans); font-weight: 700; font-size: 12px; border-bottom: 1.5px solid var(--line-strong); }
  table.stmt td.indent { padding-left: 20px; color: #3a3f47; }
  table.stmt tr.grp td { font-family: var(--sans); font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; padding-top: 12px; }
  table.stmt tr.sub td { border-top: 1px solid var(--line); font-weight: 600; }
  table.stmt tr.sub td.lbl { font-weight: 700; }
  table.stmt tr.total td { border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); font-weight: 700; font-size: 14px; }
  table.stmt tr.perwk td { font-weight: 700; }
  table.stmt th.base, table.stmt td.base { background: #F7F4EC; }
  table.stmt th .yr { display: block; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

  /* ---- chart + breakeven ---- */
  .lower { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; margin-bottom: 26px; }
  @media (max-width: 620px) { .lower { grid-template-columns: 1fr; } }
  .card {
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
    padding: 18px; box-shadow: var(--shadow);
  }
  svg.chart { width: 100%; height: auto; display: block; }
  .legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--muted); }
  .legend .swatch { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

  .be-item { padding: 14px 0; border-bottom: 1px dashed var(--line-strong); }
  .be-item:last-child { border-bottom: 0; padding-bottom: 0; }
  .be-item .k { font-size: 12px; color: var(--muted); }
  .be-item .v { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 3px;
                font-variant-numeric: tabular-nums; }
  .be-item .note { font-size: 12px; color: var(--muted); margin-top: 3px; }

  footer.foot { margin-top: 30px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
  footer.foot code { font-family: var(--mono); }

  /* ---- amortization ---- */
  .amort-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 16px; }
  @media (max-width: 620px) { .amort-charts { grid-template-columns: 1fr; } }
  .amort-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
  @media (max-width: 560px) { .amort-stats { grid-template-columns: 1fr; } }
  .astat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); }
  .astat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
  .astat .v { font-family: var(--mono); font-size: 20px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
  .astat .v small { font-size: 11px; color: var(--muted); font-weight: 500; }
  .chart-legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); margin-top: 8px; }
  .chart-legend .sw { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
  .chart-legend .sq { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
  .amort-toggle { font-family: var(--sans); font-size: 13px; font-weight: 600; cursor: pointer; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); }
  .amort-tablewrap { overflow-x: auto; margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; }
  .amort-tablewrap[hidden] { display: none; }
  table.amort { width: 100%; border-collapse: collapse; font-size: 12.5px; }
  table.amort th, table.amort td { padding: 6px 10px; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
  table.amort th { font-family: var(--sans); font-weight: 700; font-size: 10.5px; color: var(--muted); border-bottom: 1.5px solid var(--line-strong); text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; background: var(--panel); }
  table.amort td.yr, table.amort th.yr { text-align: left; }
  table.amort tbody tr:nth-child(even) { background: #FCFBF8; }

  /* ---- deals bar ---- */
  .deals {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
    padding: 10px 14px; margin-bottom: 22px; box-shadow: var(--shadow);
  }
  .deals-save { display: flex; gap: 8px; align-items: center; }
  #dealName {
    font-family: var(--sans); font-size: 13px; padding: 7px 10px; width: 200px;
    border: 1px solid var(--line-strong); border-radius: 6px; background: #FEFEFC; color: var(--ink);
  }
  #dealName:focus { outline: 2px solid var(--ring); outline-offset: 1px; }
  .deals button {
    font-family: var(--sans); font-size: 13px; font-weight: 600; cursor: pointer;
    padding: 7px 12px; border-radius: 6px; border: 1px solid var(--ink); background: var(--ink); color: #fff;
  }
  .deals button.ghost { background: transparent; color: var(--ink); }
  .deals button:disabled { opacity: .4; cursor: not-allowed; }
  .deals-list { display: flex; gap: 8px; flex: 1; overflow-x: auto; padding: 2px 0; min-width: 0; }
  .deals-empty { color: var(--muted); font-size: 13px; }
  .deal-chip {
    display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
    border: 1px solid var(--line-strong); border-radius: 20px; padding: 5px 6px 5px 12px; background: #FCFBF8;
  }
  .deal-chip.sel { border-color: var(--ring); box-shadow: 0 0 0 1px var(--ring); }
  .deal-chip.editing { background: var(--ink); color: #fff; border-color: var(--ink); }
  .deal-chip.editing .x, .deal-chip.editing .inb { color: rgba(255,255,255,.75); }
  .deal-chip input[type="checkbox"] { accent-color: var(--ink); }
  .deal-chip .inb { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
  .deal-chip .inb input { accent-color: var(--pos, #2a7); margin: 0; }
  .deals button[hidden] { display: none; }
  .deal-chip .nm { font-size: 13px; font-weight: 600; cursor: pointer; }
  .deal-chip .x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
  .deal-chip .x:hover { color: var(--neg); }

  /* ---- listing column ---- */
  .listing-panel {
    border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
    padding: 16px; box-shadow: var(--shadow);
  }
  .listing-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  #listingUrl {
    flex: 1; min-width: 180px; font-family: var(--sans); font-size: 13px; padding: 8px 11px;
    border: 1px solid var(--line-strong); border-radius: 6px; background: #FEFEFC; color: var(--ink);
  }
  #listingUrl:focus { outline: 2px solid var(--ring); outline-offset: 1px; }
  #fetchListing, #clearListing {
    font-family: var(--sans); font-size: 13px; font-weight: 600; cursor: pointer;
    padding: 8px 14px; border-radius: 6px; border: 1px solid var(--ink); background: var(--ink); color: #fff;
  }
  #clearListing { background: transparent; color: var(--ink); }
  #fetchListing:disabled { opacity: .5; cursor: progress; }
  .listing-status { font-size: 12px; color: var(--muted); width: 100%; }
  .listing-status.err { color: var(--neg); }
  .listing-empty { color: var(--muted); font-size: 13px; padding: 18px 2px 6px; }

  .listing-result { margin-top: 14px; }
  .hero {
    width: 100%; height: 300px; object-fit: cover; border-radius: 10px;
    border: 1px solid var(--line); background: #F2EFE7; cursor: zoom-in; display: block;
  }
  .thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; }
  .thumbs img {
    height: 52px; width: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line);
    flex: 0 0 auto; cursor: pointer; background: #F2EFE7; opacity: .7;
  }
  .thumbs img.on { opacity: 1; border-color: var(--ring); }
  .listing-head { display: flex; align-items: baseline; gap: 12px; justify-content: space-between; margin-top: 8px; }
  .listing-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
  .listing-head a { font-size: 12px; color: var(--pos); text-decoration: none; white-space: nowrap; }
  .listing-price { font-size: 13px; color: #4a463f; margin-top: 2px; }
  .det-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
  .det { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
  .det b { font-family: var(--mono); font-size: 18px; font-weight: 700; display: block; letter-spacing: -.02em; }
  .det span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
  .listing-map { margin: 4px 0 2px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
  .listing-map[hidden] { display: none; }
  .listing-map iframe { width: 100%; height: 220px; border: 0; display: block; }
  .listing-map .maplink { display: block; font-size: 11px; color: var(--muted); text-align: right; padding: 4px 8px; background: #FCFBF8; text-decoration: none; }
  .listing-map .maplink:hover { color: var(--ink); }
  .listing-desc {
    font-size: 13.5px; line-height: 1.55; color: #33383f; white-space: pre-line; margin: 10px 0 0;
  }
  .listing-desc.clamped {
    display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
  }
  .more-btn {
    background: none; border: 0; color: var(--pos); font-weight: 700; font-size: 13px;
    cursor: pointer; padding: 6px 0 0; font-family: var(--sans);
  }

  /* ---- comparison modal ---- */
  .modal-backdrop {
    position: fixed; inset: 0; background: rgba(20,25,31,.4); display: flex;
    align-items: flex-start; justify-content: center; padding: 40px 20px; z-index: 20; overflow: auto;
  }
  .modal-backdrop[hidden] { display: none; }
  .modal { background: var(--paper); border-radius: 14px; max-width: 900px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
  .modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line-strong); }
  .modal-head h2 { margin: 0; font-size: 16px; }
  .modal-body { padding: 8px 22px 24px; overflow-x: auto; }
  table.cmp { width: 100%; border-collapse: collapse; font-size: 13px; }
  table.cmp th, table.cmp td { text-align: right; padding: 9px 12px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
  table.cmp td.metric, table.cmp th.metric { text-align: left; color: var(--muted); font-weight: 600; }
  table.cmp thead th { font-family: var(--sans); font-size: 13px; font-weight: 700; border-bottom: 1.5px solid var(--line-strong); }
  table.cmp td { font-family: var(--mono); }
  table.cmp tr.head-row td { background: transparent; }
