/* ABC Grand Broker Pricing — light professional, navy + gold */
:root {
  --navy: #10233f;
  --navy-deep: #0b1830;
  --gold: #c1962f;
  --gold-soft: #f3e8cf;
  --paper: #f5f3ee;
  --card: #ffffff;
  --ink: #1c2733;
  --muted: #6b7686;
  --line: #e4e0d6;
  --green: #146c43;
  --green-bg: #e8f4ec;
  --red: #9a3b2e;
  --red-bg: #f9ece9;
  --radius: 10px;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --shadow: 0 1px 2px rgba(16, 35, 63, .06), 0 8px 24px rgba(16, 35, 63, .07);
}

* { box-sizing: border-box; margin: 0; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.45;
}

/* ---------- top bar ---------- */
.topbar {
  background: var(--navy-deep);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 3px solid var(--gold);
}
.brand { display: flex; align-items: center; gap: 12px; }
.start-hint {
  background: var(--card); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 34px 30px;
  text-align: center; color: var(--muted);
}
.start-hint h3 {
  font-family: var(--font-display); font-size: 19px;
  color: var(--navy); margin-bottom: 8px;
}
.start-hint p { font-size: 13.5px; line-height: 1.6; max-width: 420px; margin: 0 auto; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 14px; letter-spacing: .12em; }
.brand-text span { font-size: 12px; color: #aab6c9; }
.sheet-info { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: #aab6c9; }
#refresh-btn {
  background: transparent;
  color: var(--gold);
  border: 1px solid rgba(193, 150, 47, .5);
  border-radius: 6px;
  padding: 5px 12px;
  font: inherit;
  cursor: pointer;
  transition: background .15s, color .15s;
}
#refresh-btn:hover { background: var(--gold); color: var(--navy-deep); }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  max-width: 1180px;
  margin: 28px auto;
  padding: 0 24px;
  align-items: start;
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  aside.panel.scenario { position: static; }
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.panel h2 {
  font-family: var(--font-display);
  font-size: 17px;
  margin-bottom: 16px;
  color: var(--navy);
}

/* ---------- scenario form ---------- */
.scenario { position: sticky; top: 20px; }
.field { display: block; margin-bottom: 14px; flex: 1; }
.field > span, .field-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: 5px;
}
.field-row { display: flex; gap: 12px; }
input[type="number"], input[type="text"], select {
  width: 100%;
  font: inherit;
  font-weight: 500;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfbf9;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(193, 150, 47, .18);
}
.input-wrap { position: relative; }
.input-wrap.prefix::before {
  content: attr(data-prefix);
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-weight: 600; pointer-events: none;
}
.input-wrap.prefix input { padding-left: 24px; }
.input-wrap.suffix::after {
  content: attr(data-suffix);
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-weight: 600; pointer-events: none;
}
.checkbox-field .check {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 500; color: var(--ink);
  text-transform: none; letter-spacing: 0;
  padding: 9px 0; cursor: pointer;
}
.checkbox-field input { width: 16px; height: 16px; accent-color: var(--navy); cursor: pointer; }

.segmented { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented button {
  flex: 1; font: inherit; font-weight: 600; padding: 8px 0;
  background: #fcfbf9; color: var(--muted); border: none; cursor: pointer;
  transition: background .15s, color .15s;
}
.segmented button.active { background: var(--navy); color: #fff; }
.segmented button:not(.active):hover { color: var(--navy); }

/* ---------- product tabs ---------- */
.product-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.product-tabs button {
  font: inherit; font-weight: 600; font-size: 13px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.product-tabs button:hover { border-color: var(--gold); color: var(--navy); }
.product-tabs button.active {
  background: var(--navy); border-color: var(--navy); color: #fff;
  box-shadow: var(--shadow);
}
.product-tabs .prog-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .05em;
  padding: 1px 6px; border-radius: 4px; margin-left: 6px;
  background: var(--gold-soft); color: var(--gold);
}
.product-tabs button.active .prog-badge { background: rgba(255,255,255,.15); color: var(--gold); }

/* ---------- hero ---------- */
.hero {
  background: linear-gradient(120deg, var(--navy-deep), var(--navy) 70%);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute; right: -40px; top: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(193,150,47,.25), transparent 70%);
}
.hero-label {
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--gold);
  margin-bottom: 8px;
}
.hero-main {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
}
.hero-arrow { color: var(--gold); font-size: .7em; }
#hero-earn { color: #7fd6a4; }
.hero-sub { margin-top: 8px; font-size: 13px; color: #aab6c9; }
.hero-deal {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  margin-top: 4px;
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
#hero-program { color: var(--gold); }

/* ---------- comparison cards ---------- */
.prog-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
}
.prog-card.winner { border-color: var(--gold); }
.prog-head {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  font: inherit; text-align: left;
  background: none; border: none; cursor: pointer;
  padding: 14px 18px;
  transition: background .12s;
}
.prog-head:hover { background: #faf8f2; }
.prog-head strong { font-size: 14.5px; color: var(--navy); }
.crown { font-size: 16px; }
.inv-badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  background: var(--navy); color: #fff;
  padding: 2px 8px; border-radius: 4px;
}
.prog-product { font-size: 12px; color: var(--muted); }
.prog-rate {
  margin-left: auto;
  font-family: var(--font-display); font-weight: 700; font-size: 19px;
  color: var(--navy); font-variant-numeric: tabular-nums;
}
.prog-earn { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.prog-earn.pos { color: var(--green); }
.prog-reason { margin-left: auto; font-size: 12.5px; color: var(--red); }
.ineligible-card { opacity: .72; }
.ineligible-card .prog-head { cursor: default; }
.expander { color: var(--muted); font-size: 11px; }
.prog-detail { border-top: 1px solid var(--line); padding: 16px 18px; }
.prog-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(220px, 2fr);
  gap: 20px;
}
@media (max-width: 760px) { .prog-detail-grid { grid-template-columns: 1fr; } }
.prog-detail h4 {
  font-size: 11.5px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.small { font-size: 11.5px; margin-top: 10px; }

/* ---------- ladder ---------- */
.ladder-card { padding-bottom: 8px; }
.ladder-head { display: flex; justify-content: space-between; align-items: baseline; }
.ladder-head .muted { font-family: var(--font-body); font-size: 12px; font-weight: 400; }
button.ghost {
  font: inherit; font-size: 12.5px; font-weight: 600;
  background: none; border: none; color: var(--gold);
  cursor: pointer; padding: 4px;
}
button.ghost:hover { text-decoration: underline; }

table.ladder { width: 100%; border-collapse: collapse; }
.ladder th {
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted);
  padding: 10px 10px 8px;
  border-bottom: 2px solid var(--line);
}
.ladder td { padding: 9px 10px; border-bottom: 1px solid #f0ede5; }
.ladder tbody tr { transition: background .12s; }
.ladder tbody tr:hover { background: #faf8f2; }
.ladder .rate { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--navy); }
.ladder .price { font-variant-numeric: tabular-nums; color: var(--muted); }
.ladder .credit { font-weight: 600; font-variant-numeric: tabular-nums; }
.credit.pos { color: var(--green); }
.credit.neg { color: var(--red); }
.chip {
  display: inline-block; font-size: 10.5px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; letter-spacing: .03em;
}
.chip.best { background: var(--green-bg); color: var(--green); }
.chip.capped { background: var(--gold-soft); color: var(--gold); }
.chip.cost { background: var(--red-bg); color: var(--red); }
tr.best-row { background: var(--green-bg) !important; }
tr.best-row td { border-bottom-color: #cfe6d8; }

/* ---------- breakdown ---------- */
.breakdown { margin-top: 18px; }
.adj-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.adj-table td { padding: 7px 8px; border-bottom: 1px solid #f0ede5; }
.adj-table td:last-child { text-align: right; font-weight: 600; }
.adj-table tr.total td { border-top: 2px solid var(--line); border-bottom: none; font-weight: 700; color: var(--navy); }
.adj-table td.adj-good { color: var(--green); }
.adj-table td.adj-bad { color: var(--red); }

/* ---------- states ---------- */
.ineligible {
  background: var(--red-bg);
  border: 1px solid #eccfc8;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 18px;
}
.ineligible h3 { color: var(--red); font-size: 15px; margin-bottom: 8px; }
.ineligible ul { margin: 0 0 8px 18px; }
.ineligible li { margin-bottom: 3px; }

.muted { color: var(--muted); }
.hidden { display: none !important; }

.disclaimer {
  margin-top: 22px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.55;
}
.disclaimer p { margin-bottom: 6px; }

/* ---------- login / modal ---------- */
.login-wrap, .modal-wrap {
  display: flex; justify-content: center; align-items: flex-start;
  padding: 80px 24px;
}
.modal-wrap {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(16, 35, 63, .45);
  padding-top: 10vh;
}
.login-card, .modal { width: 400px; max-width: 92vw; }
.login-card input {
  width: 100%; margin: 7px 0; font: inherit;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
}
.login-card button.primary { margin-top: 10px; }
.err { color: var(--red); font-size: 13px; margin-top: 8px; }
button.primary {
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--navy); color: #fff;
  border: none; border-radius: 8px; padding: 10px 20px;
  transition: background .15s;
}
button.primary:hover { background: var(--navy-deep); }
.save-row { display: flex; align-items: center; gap: 14px; margin-top: 16px; }

/* top-bar user controls */
#user-chip { color: var(--gold); font-weight: 600; }
#logout-btn, #nav-requests {
  background: transparent; color: #aab6c9;
  border: 1px solid rgba(170, 182, 201, .4);
  border-radius: 6px; padding: 5px 12px; font: inherit; font-size: 12.5px;
  cursor: pointer;
}
#logout-btn:hover, #nav-requests:hover { color: #fff; border-color: #fff; }
#nav-requests { color: var(--gold); border-color: rgba(193, 150, 47, .5); }

/* ladder request button */
.lock-btn {
  font: inherit; font-size: 11.5px; font-weight: 700;
  background: var(--gold-soft); color: #8a6410;
  border: 1px solid transparent; border-radius: 6px;
  padding: 4px 10px; cursor: pointer;
  transition: all .12s;
}
.lock-btn:hover { background: var(--gold); color: #fff; }

.revise-banner {
  max-width: 1180px; margin: 16px auto -8px; padding: 12px 18px;
  background: var(--gold-soft); border: 1px solid var(--gold);
  border-radius: var(--radius); font-size: 13.5px; color: #6b5210;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.rev-badge {
  font-size: 10.5px; font-weight: 700;
  background: #e8ecf3; color: var(--navy);
  border-radius: 4px; padding: 2px 6px;
}
.req-history {
  margin-top: 8px; padding-left: 12px;
  border-left: 3px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.req-history div { margin: 2px 0; }

/* request cards (broker + admin) */
.req-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 10px 0;
  background: var(--card);
}
.req-card.req-pending { border-color: var(--gold); }
.req-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.req-date { margin-left: auto; font-size: 11.5px; }
.req-card .small { font-size: 12.5px; margin-top: 4px; }
.req-final {
  margin-top: 8px; padding: 8px 12px; border-radius: 8px;
  background: var(--green-bg); color: var(--green); font-weight: 600;
  font-size: 13px;
}
.req-final.neg { background: var(--red-bg); color: var(--red); }
.req-actions {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-top: 10px; font-size: 12.5px;
}
.req-actions label { display: flex; gap: 6px; align-items: center; font-weight: 600; }
.req-actions input[type="number"] { width: 100px; }
.req-actions input[type="text"] { flex: 1; min-width: 180px; }
button.ghost {
  font: inherit; font-size: 12.5px; font-weight: 600;
  background: none; border: 1px solid var(--line); border-radius: 6px;
  color: var(--navy); cursor: pointer; padding: 6px 12px;
}
button.ghost:hover { border-color: var(--gold); color: var(--gold); }
