/* Xevendi mockup — Mortgages and Market pages. Uses tokens from styles.css only. */

.mg-page { padding-bottom: 64px; }
.mg-sec { margin-top: 56px; scroll-margin-top: calc(var(--header-h) + 16px); }
.mg-h3 { font-family: var(--font-display); font-size: 1.125rem; margin: 28px 0 8px; }
.mg-h3:focus { outline: none; }

.mg-nav { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; margin-top: 8px; scrollbar-width: thin; }
.mg-nav .chip { white-space: nowrap; text-decoration: none; }

/* calculator layout: inputs left, result card right */
.mg-page .calc { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; margin-top: 20px; align-items: start; }
@media (min-width: 800px) { .mg-page .calc { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 40px; } }
.mg-page .calc-in { display: grid; gap: 16px; }
.mg-page .field { display: grid; gap: 6px; font-weight: 500; font-size: .875rem; color: var(--text-2); }
.mg-page .field .input, .mg-page .field .select { width: 100%; }
.mg-page .err { min-height: 0; font-size: .8125rem; color: var(--red-700); font-weight: 400; }
.mg-page .err:empty { display: none; }
.mg-page .input[aria-invalid="true"] { border-color: var(--red-600); }
.mg-page .calc-out {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 24px; display: grid; gap: 12px; position: sticky; top: calc(var(--header-h) + 16px);
}
@media (max-width: 799px) { .mg-page .calc-out { position: static; } }
.mg-page .calc-label { font-size: .875rem; color: var(--text-2); margin: 0; }
.mg-page .calc-big { font-family: var(--font-display); font-size: var(--fs-price-detail); font-weight: 700; line-height: 1.1; margin: 0; color: var(--text-1); overflow-wrap: anywhere; }
.mg-page .calc-dl { display: grid; gap: 10px; margin: 4px 0 0; }
.mg-page .calc-dl > div { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.mg-page .calc-dl dt { color: var(--text-2); font-size: .875rem; }
.mg-page .calc-dl dd { margin: 0; font-weight: 600; text-align: right; }
.mg-why { margin: 0; color: var(--text-1); line-height: 1.5; }
.mg-page .fine { font-size: .8125rem; color: var(--text-3); margin: 0; }
.mg-page .check { display: flex; gap: 10px; align-items: flex-start; font-size: .9375rem; }
.mg-page .check input { margin-top: 3px; accent-color: var(--cta); }

/* monthly cost: stacked bar + legend */
.mg-bar { display: flex; height: 18px; border-radius: var(--r-pill); overflow: hidden; background: var(--line); gap: 2px; }
.mg-seg { min-width: 3px; flex-basis: 0; }
.mg-legend { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.mg-legend li { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: center; font-size: .9375rem; }
.mg-sw { width: 12px; height: 12px; border-radius: 3px; }
.mg-c0 { background: var(--sea-600); }
.mg-c1 { background: var(--clay-500); }
.mg-c2 { background: var(--amber-600); }
.mg-c3 { background: var(--green-600); }
.mg-c4 { background: var(--stone-500); }
.mg-c5 { background: var(--clay-200); }

/* rates and costs tables */
.mg-page .table-wrap { overflow-x: auto; margin-top: 16px; }
.mg-page .table .r { text-align: right; }
.mg-page .table--costs th { font-weight: 500; }
.mg-page .note { background: var(--amber-50); border-radius: var(--r-md); padding: 12px 16px; color: var(--amber-800); margin: 16px 0 0; font-size: .9375rem; }

/* lead form */
.mg-lead { display: grid; gap: 16px; max-width: 640px; margin-top: 20px; }
.mg-page .row2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 560px) { .mg-page .row2 { grid-template-columns: 1fr 1fr; } }
.mg-done { max-width: 640px; margin-top: 20px; padding: 20px 24px; background: var(--green-50); border-radius: var(--r-md); color: var(--green-700); }
.mg-done[hidden], .mg-lead[hidden] { display: none; }
.mg-done h3 { margin-top: 0; }

/* steps */
.mg-steps { list-style: none; counter-reset: mgstep; margin: 20px 0 0; padding: 0; display: grid; gap: 0; max-width: 720px; }
.mg-steps li { counter-increment: mgstep; position: relative; padding: 0 0 24px 56px; }
.mg-steps li::before {
  content: counter(mgstep); position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--sea-50); color: var(--sea-700); font-weight: 700; font-variant-numeric: tabular-nums;
}
.mg-steps li:not(:last-child)::after { content: ""; position: absolute; left: 17px; top: 40px; bottom: 4px; width: 2px; background: var(--line); }
.mg-steps h3 { font-size: 1.0625rem; margin: 4px 0 4px; }
.mg-steps p { margin: 0; color: var(--text-2); line-height: 1.55; }

/* market */
.mg-areasel { max-width: 360px; margin-top: 24px; }
.mg-sample { margin: 24px 0 12px; color: var(--text-3); font-size: .875rem; display: flex; gap: 8px; align-items: center; }
.mg-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 20px; }
@media (min-width: 800px) { .mg-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mg-tile { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; background: var(--bg); display: grid; gap: 4px; align-content: start; }
.mg-tile dt { font-size: .8125rem; color: var(--text-2); }
.mg-tile dd { margin: 0; font-family: var(--font-display); font-size: var(--fs-price-card); font-weight: 700; color: var(--text-1); }
.mg-tile dd small { font-family: var(--font-ui); font-size: .75rem; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.mg-trend-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.mg-toggle { display: flex; gap: 8px; }
.mg-fig { margin: 16px 0 8px; }
.mg-chart { width: 100%; height: auto; display: block; }
.mg-grid { stroke: var(--line); stroke-width: 1; }
.mg-ax { fill: var(--text-3); font-size: 12px; font-family: var(--font-ui); }
.mg-line { fill: none; stroke: var(--sea-600); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.mg-fill { fill: var(--sea-50); opacity: .7; }
.mg-dot { fill: var(--sea-600); stroke: var(--bg); stroke-width: 2; }
.mg-sortbtn {
  all: unset; cursor: pointer; font: inherit; font-weight: 600; white-space: nowrap; padding: 4px 2px; border-radius: var(--r-xs);
}
.mg-sortbtn:hover { color: var(--cta); }
.mg-sortbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mg-compare a { color: var(--link); }
.mg-list { margin: 16px 0 0; padding-left: 20px; display: grid; gap: 12px; max-width: 760px; line-height: 1.55; color: var(--text-2); }
.mg-list b { color: var(--text-1); }
#mk-series { margin-top: 12px; }
#mk-showtable { margin-top: 8px; }
