/* ===== Theme (from the standalone Offer Page) ===== */
:root {
  --bg: #eef2f8; --bg2: #dfe7f3; --card: #ffffff; --ink: #0f1b2d; --muted: #5f6f86; --line: #e2e8f1;
  --accent: #2f6bff; --accent2: #7b5cff; --accent-soft: rgba(47,107,255,.10); --up: #0f9d68; --down: #e0443e;
  --field: #f6f8fc; --track: #e3e8f1; --shadow: 0 1px 2px rgba(15,27,45,.05), 0 12px 32px rgba(15,27,45,.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --bg2: #121a33; --card: #141b2e; --ink: #e8edf7; --muted: #93a0b8; --line: #243049;
    --accent: #5b8cff; --accent2: #9d84ff; --accent-soft: rgba(91,140,255,.14); --up: #34d399; --down: #ff6b6b;
    --field: #0f1527; --track: #26314b; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020; --bg2: #121a33; --card: #141b2e; --ink: #e8edf7; --muted: #93a0b8; --line: #243049;
  --accent: #5b8cff; --accent2: #9d84ff; --accent-soft: rgba(91,140,255,.14); --up: #34d399; --down: #ff6b6b;
  --field: #0f1527; --track: #26314b; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); min-height: 100vh;
  background: radial-gradient(1200px 600px at 10% -10%, var(--bg2), transparent 60%), var(--bg);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; }
a { color: var(--accent); }
h1:focus { outline: none; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px 48px; }
.num { font-variant-numeric: tabular-nums; }

/* ===== Hero ===== */
.hero { margin: 24px 0 18px; padding: 20px 26px; border-radius: 18px; color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent2)); box-shadow: 0 16px 40px rgba(47,107,255,.25);
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.hero h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.hero p { margin: 2px 0 0; opacity: .88; font-size: 13.5px; }
.stats { display: flex; gap: 30px; flex-wrap: wrap; }
.stat .k { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; opacity: .8; }
.stat .v { font-size: 21px; font-weight: 700; margin-top: 2px; }
.stat .s { font-size: 12px; opacity: .85; }

/* ===== Offer Page controls ===== */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px; padding: 18px 22px; margin-bottom: 18px; }
.ctl .top { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; font-size: 14px; }
.ctl .top b { color: var(--accent); font-variant-numeric: tabular-nums; }
.ctl .hint, .fld .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.field { display: flex; align-items: center; background: var(--field); border: 1px solid var(--line); border-radius: 10px; height: 40px; padding: 0 10px; width: 130px; flex: none; }
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field span { color: var(--muted); }
.field input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--ink); text-align: right; outline: none; }
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; min-width: 60px; height: 8px; border-radius: 99px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, var(--accent) 0, var(--accent2) var(--p, 50%), var(--track) var(--p, 50%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--field); border: 1px solid var(--line); border-radius: 12px; margin-top: 10px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-weight: 600; font-size: 13px; padding: 7px 4px; border-radius: 9px; }
.seg button:hover { color: var(--ink); background: var(--accent-soft); }
.seg button.on { color: #fff; background: linear-gradient(120deg, var(--accent), var(--accent2)); box-shadow: 0 4px 14px rgba(47,107,255,.35); }
.resetbar { display: flex; justify-content: space-between; align-items: center; margin: -8px 0 12px; }
.link { font: inherit; font-size: 13px; font-weight: 600; color: var(--accent); background: none; border: 0; cursor: pointer; padding: 4px 6px; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ===== Offer cards ===== */
.offers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.offer { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s, border-color .12s; position: relative; }
.offer:hover { transform: translateY(-2px); }
.offer.sel { border: 2px solid var(--accent); box-shadow: 0 14px 36px rgba(47,107,255,.25); }
.offer .head { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); background: var(--field); }
.offer.sel .head { background: linear-gradient(135deg, var(--accent-soft), transparent 80%), var(--card); }
.offer .term { font-weight: 700; font-size: 15px; }
.offer .pay { font-size: 12px; color: var(--muted); }
.offer .amt { font-size: 25px; font-weight: 700; color: var(--accent); margin-top: 4px; letter-spacing: -.01em; }
.offer .check { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 50%; display: none; place-items: center;
  color: #fff; font-size: 13px; background: linear-gradient(120deg, var(--accent), var(--accent2)); }
.offer.sel .check { display: grid; }
.offer dl { margin: 0; padding: 8px 16px 4px; flex: 1; }
.offer dl div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.offer dl div:last-child { border-bottom: 0; }
.offer dt { color: var(--muted); }
.offer dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.offer dd.total { font-weight: 700; }
.offer .go { margin: 10px 16px 16px; border: 0; border-radius: 10px; padding: 10px; font: inherit; font-weight: 700; font-size: 13.5px; color: #fff; cursor: pointer;
  background: linear-gradient(120deg, var(--accent), var(--accent2)); box-shadow: 0 6px 16px rgba(47,107,255,.28); }
.offer .go:active { transform: translateY(1px); }

/* ===== Pre-payment schedule ===== */
.sched { margin-top: 22px; padding: 18px 22px; }
.sched h2 { margin: 0; font-size: 17px; } .sched h2 span { font-size: 13px; font-weight: 500; color: var(--muted); }
.sched p { margin: 4px 0 12px; color: var(--muted); font-size: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--field); }
th:first-child, td:first-child { text-align: left; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: var(--accent-soft); }
td.save { color: var(--up); font-weight: 600; }
tr.full td { font-weight: 700; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--card); padding: 9px 16px; border-radius: 10px; font-size: 13.5px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; }
.toast.on { opacity: 1; }
.flash { animation: flash .45s ease; } @keyframes flash { from { opacity: .35; } to { opacity: 1; } }

/* ===== Deal form (home page) ===== */
.formcard { padding: 20px 22px 22px; margin-bottom: 18px; }
.sechead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.sechead h2 { margin: 0; font-size: 17px; }
.sechead p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 22px; }
.fld { display: flex; flex-direction: column; min-width: 0; }
.fld.wide { grid-column: span 2; }
.fld > label, .fld > .lbl { font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.fld > label.req::after { content: " *"; color: var(--down); }
.inp, .inbox { background: var(--field); border: 1px solid var(--line); border-radius: 10px; height: 40px; width: 100%; color: var(--ink); }
.inp { padding: 0 12px; font: inherit; font-weight: 600; outline: none; }
.inp::placeholder, .inbox input::placeholder { color: var(--muted); opacity: .6; font-weight: 500; }
.inp:focus, .inbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inbox { display: flex; align-items: center; gap: 6px; padding: 0 12px; }
.inbox span { color: var(--muted); }
.inbox input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--ink); outline: none; }
.termrow { display: flex; gap: 8px; }
.termrow .inbox { flex: 1; min-width: 70px; }
.termrow .seg { margin-top: 0; height: 40px; padding: 3px; flex: none; width: 138px; }
.termrow .seg button { padding: 0 4px; }
.readout { height: 40px; display: flex; align-items: center; padding: 0 12px; border-radius: 10px; border: 1px dashed var(--line); font-weight: 700; color: var(--accent); }
.inp.invalid, .inbox:has(.invalid) { border-color: var(--down); }
.inp.invalid:focus, .inbox:has(.invalid):focus-within { box-shadow: 0 0 0 3px rgba(224,68,62,.15); }
.validation-message { color: var(--down); font-size: 12px; font-weight: 600; margin-top: 5px; }
.actions { display: flex; justify-content: flex-end; align-items: center; gap: 16px; }
.formerr { color: var(--down); font-size: 13.5px; font-weight: 600; }
.primary { border: 0; border-radius: 12px; padding: 12px 30px; font: inherit; font-weight: 700; font-size: 15px; color: #fff; cursor: pointer;
  background: linear-gradient(120deg, var(--accent), var(--accent2)); box-shadow: 0 6px 16px rgba(47,107,255,.28); }
.primary:hover { box-shadow: 0 8px 22px rgba(47,107,255,.38); }
.primary:active { transform: translateY(1px); }

@media (max-width: 1100px) {
  .offers { grid-template-columns: repeat(3, 1fr); }
  .controls, .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .offers, .controls, .grid { grid-template-columns: 1fr; }
  .fld.wide { grid-column: auto; }
}

/* ===== Blazor ===== */
.blazor-error-boundary {
  background: #b32121; padding: 1rem 1rem 1rem 1.25rem; color: white;
}
.blazor-error-boundary::after { content: "An error has occurred." }
