/* Gostudy — Global University Discovery (Feature 1 sliders + Feature 2 world map) */
:root {
  --navy-900: #0a1f3c; --navy-800: #0f2a4f; --navy-700: #16365e; --navy-600: #1e4d8b;
  --blue-500: #2f6fed; --blue-100: #e7eefb;
  --gold: #f5b301; --red: #e0152b;
  --green: #1aa260; --green-bg: #e6f6ee;
  --amber: #d98a00; --amber-bg: #fdf2dc;
  --red-bg: #fdeaec;
  --bg: #eef2f8; --panel: #ffffff; --border: #dde5f0;
  --text: #0f2036; --muted: #5d6b82;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15,32,54,.06), 0 8px 24px rgba(15,32,54,.06);
  --head-h: 60px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans KR", sans-serif;
  color: var(--text); background: var(--bg);
}

/* ---------- top bar ---------- */
.topbar {
  height: var(--head-h); display: flex; align-items: center; gap: 16px; padding: 0 18px;
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900)); color: #fff;
  position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 10px rgba(10,31,60,.25);
}
.brand { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.brand-logo { height: 36px; width: auto; background: #fff; border-radius: 9px; padding: 4px 11px; display: block; }
.brand-fallback { display: flex; align-items: center; gap: 9px; }
.brand-emblem { height: 30px; width: 30px; background: #fff; border-radius: 8px; padding: 2px; }
.brand-word { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.brand-word b { color: var(--red); background: #fff; padding: 0 2px; border-radius: 4px; }
.brand-sub { font-size: 13px; color: #c7d6ef; font-weight: 500; padding-left: 14px; margin-left: 4px; border-left: 1px solid rgba(255,255,255,.18); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.fx-note { font-size: 11px; color: #9fb6da; line-height: 1.2; text-align: right; }
.cur-select, .nav-link, .wa-btn {
  font: inherit; font-size: 13px; font-weight: 600; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.1); color: #fff;
  padding: 7px 12px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.cur-select { padding: 7px 8px; }
.cur-select option { color: #000; }
.nav-link:hover, .wa-btn:hover { background: rgba(255,255,255,.2); }
.wa-btn { background: #25d366; border-color: #25d366; color: #06381f; }
.wa-btn:hover { filter: brightness(1.05); }

/* ---------- filter bar ---------- */
.filters {
  position: sticky; top: var(--head-h); z-index: 40; background: var(--panel);
  border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 14px 18px; display: flex; flex-wrap: wrap; gap: 18px 26px; align-items: flex-end;
}
.f-group { display: flex; flex-direction: column; gap: 6px; min-width: 210px; flex: 1 1 210px; }
.f-group.f-narrow { flex: 0 0 auto; min-width: 132px; }   /* University / Field / Sort — kept compact */
@media (min-width: 721px) {   /* desktop: compact other controls; Countries stays on the budget row but takes the leftover width (widest), with "›" for any overflow */
  .filters { gap: 14px 18px; }
  .f-group.f-narrow { min-width: 118px; }
  .f-group.f-narrow .f-select { max-width: 155px; }
  .f-group.f-budget { flex: 0 1 260px; min-width: 230px; }
  .f-group.f-countries { flex: 1 1 300px; min-width: 230px; }   /* only growing element → absorbs remaining width */
}
.f-label { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .2px; display: flex; justify-content: space-between; gap: 8px; }
.f-label b { color: var(--navy-600); font-size: 13px; }
input[type=range] { width: 100%; accent-color: var(--blue-500); height: 22px; }
.f-select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--text); font-weight: 600;
}
/* university name search (full-width row) */
.f-unisearch { flex: 0 0 auto; min-width: 150px; }
.f-unisearch input.f-select { width: 100%; box-sizing: border-box; }
.uni-req-hint { font-size: 12px; color: var(--muted); display: inline-block; }
.uni-req-hint button { background: none; border: none; cursor: pointer; font: inherit; font-weight: 700; color: var(--blue-500); padding: 0; }
.uni-req-hint button:hover { text-decoration: underline; }
/* mobile floating university-search button + popup (hidden on desktop) */
.uni-fab { display: none; }
.uni-pop { display: none; }
.link-btn { background: none; border: none; cursor: pointer; font: inherit; font-weight: 800; color: var(--blue-500); padding: 0; }
.link-btn:hover { text-decoration: underline; }
/* field/major search autocomplete */
.ac-wrap { position: relative; }
.ac-wrap input.f-select { width: 100%; box-sizing: border-box; }
.ac-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 28px rgba(15,32,54,.16); max-height: 320px; overflow-y: auto; padding: 5px;
}
.ac-item {
  display: block; width: 100%; text-align: left; border: none; background: none; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text); padding: 8px 10px; border-radius: 8px;
}
.ac-item:hover { background: #f3f7ff; }
.ac-item.ac-raw { color: var(--blue-500); border-bottom: 1px solid var(--border); border-radius: 0; margin-bottom: 3px; }
/* quick category chips (click to filter) */
.cat-bar { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--border); }
.cat-bar::-webkit-scrollbar { display: none; }
.cat { flex: 0 0 auto; font-size: 13px; font-weight: 700; border: 1px solid var(--border); background: #fff; color: var(--navy-700); border-radius: 999px; padding: 7px 14px; cursor: pointer; white-space: nowrap; }
.cat:hover { border-color: var(--blue-500); }
.cat.on { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
@media (max-width: 720px) { .cat-bar { padding: 8px 12px; } .cat { font-size: 12px; padding: 6px 11px; } }
.f-countries { position: relative; }
.country-chips { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 24px 2px 0; }
.country-chips::-webkit-scrollbar { display: none; }
.cc { flex: 0 0 auto; }   /* keep chips on one row (scroll horizontally instead of wrapping) */
/* clickable "›" — scrolls the chips right; shown only when there's more (JS toggles .scroll-more) */
.cc-arrow { display: none; position: absolute; right: 0; bottom: 2px; height: 34px; width: 34px;
  align-items: center; justify-content: flex-end; padding-right: 2px; border: none; cursor: pointer;
  color: var(--blue-500); font-weight: 800; font-size: 20px; line-height: 1;
  background: linear-gradient(to right, rgba(255,255,255,0), var(--panel) 45%); }
.f-countries.scroll-more .cc-arrow { display: flex; }
.cc {
  font-size: 12px; font-weight: 700; border: 1px solid var(--border); background: #fff;
  border-radius: 999px; padding: 6px 11px; cursor: pointer; color: var(--muted); user-select: none;
}
.cc.on { background: var(--navy-700); color: #fff; border-color: var(--navy-700); }
.f-reset { font: inherit; font-size: 12px; font-weight: 700; color: var(--blue-500); background: none; border: none; cursor: pointer; padding: 8px 0; }
/* compact budget chip — mobile only (desktop shows the slider inline) */
.budget-chip { display: none; align-items: center; gap: 5px; font: inherit; font-weight: 700; font-size: 13px; color: var(--navy-700); background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; cursor: pointer; align-self: flex-end; }
.budget-chip .bc-caret { color: var(--muted); font-size: 11px; }

/* ---------- summary ---------- */
.summary { padding: 12px 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.summary .count-big { font-size: 17px; font-weight: 800; color: var(--navy-800); }
.summary .count-big em { color: var(--green); font-style: normal; }
.summary .sub { color: var(--muted); font-size: 13px; }
.view-toggle { margin-left: auto; display: none; gap: 4px; background: #e4ebf5; border-radius: 999px; padding: 3px; }
.view-toggle button { font: inherit; font-weight: 700; font-size: 13px; border: none; background: none; padding: 6px 14px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.view-toggle button.active { background: #fff; color: var(--navy-800); box-shadow: var(--shadow); }

/* ---------- main split ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 0 18px 28px; align-items: start; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; min-width: 0; }
.map-wrap { position: sticky; top: calc(var(--head-h) + 96px); height: calc(100vh - var(--head-h) - 120px); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); z-index: 0; }   /* z-index:0 contains Leaflet's internal high z-indexes so they can't show through overlays */
#map { width: 100%; height: 100%; }

/* ---------- inline university detail (replaces the list, mini-map + city guide on the right) ---------- */
.split.detail-open { display: block; }
.split.detail-open .results, .split.detail-open .map-wrap { display: none; }
.detail-inline { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.detail-inline[hidden] { display: none; }
.di-main { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 22px 22px; min-width: 0; }
.di-back { background: none; border: none; color: var(--blue-500); font: inherit; font-weight: 700; cursor: pointer; padding: 0; margin-bottom: 10px; }
.di-back:hover { text-decoration: underline; }
.di-name { color: var(--text); font-size: 22px; margin: 2px 0 0; line-height: 1.2; }
.di-main .mh-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.di-main .modal-body { padding: 14px 0 0; }
.di-foot { display: flex; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.di-foot .btn { flex: 1 1 auto; justify-content: center; }
/* right column: sticky mini-map + city guide */
.di-side { position: sticky; top: calc(var(--head-h) + 96px); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mini-map { height: 300px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); z-index: 0; }
/* coloured POI markers on the mini-map */
.poi-pin { background: none; border: none; }
.poi-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(10,31,60,.45); display: flex; align-items: center; justify-content: center; font-size: 13px; }
.poi-dot.big { width: 34px; height: 34px; font-size: 17px; border-width: 3px; }
.poi-pop .pp-name { font-weight: 800; color: var(--navy-800); }
.poi-pop .pp-note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.poi-pop .pp-gmap { display: inline-block; margin-top: 7px; font-size: 12px; font-weight: 700; color: var(--blue-500); text-decoration: none; }
.poi-pop .pp-gmap:hover { text-decoration: underline; }
/* legend under the mini-map */
.mini-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 2px 2px 0; }
.mini-legend[hidden] { display: none; }
.ml-item { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ml-dot { width: 17px; height: 17px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; border: 1.5px solid #fff; box-shadow: 0 1px 2px rgba(10,31,60,.3); }
.city-info { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.city-info[hidden] { display: none; }
.ci-head { font-weight: 800; font-size: 15px; color: var(--text); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ci-pop { font-size: 12px; font-weight: 700; color: var(--muted); }
.ci-blurb { font-size: 13px; color: var(--muted); margin: 6px 0 12px; line-height: 1.45; }
.ci-rows { display: flex; flex-direction: column; gap: 11px; }
.ci-row { display: flex; gap: 9px; align-items: flex-start; }
.ci-ic { flex: 0 0 auto; font-size: 14px; line-height: 1.5; }
.ci-lab { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); }
.ci-val { font-size: 13px; color: var(--text); line-height: 1.4; }
.map-legend { position: absolute; bottom: 12px; left: 12px; z-index: 500; background: rgba(255,255,255,.95); border-radius: 10px; padding: 8px 10px; font-size: 11px; box-shadow: var(--shadow); }
.map-legend span { display: flex; align-items: center; gap: 6px; margin: 2px 0; font-weight: 600; color: var(--text); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--green); } .dot.amber { background: var(--amber); } .dot.red { background: var(--red); }

/* ---------- card ---------- */
.card { position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px; transition: transform .12s, box-shadow .12s; }
/* one-line "what is this school known for" — strength/special point */
.card-tagline { font-size: 13px; line-height: 1.4; color: var(--text); font-weight: 600; margin-top: -2px; }
.d-tagline { font-size: 14px; line-height: 1.45; color: var(--text); font-weight: 600; margin-top: 7px; padding-left: 11px; border-left: 3px solid var(--blue-500); }
/* shopping-style discount tag, shown when the student's profile qualifies them */
.sale-inline { background: var(--red); color: #fff; font-weight: 800; font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 6px; flex: 0 0 auto; white-space: nowrap; }
.cost-strike { color: var(--muted); text-decoration: line-through; font-weight: 700; font-size: 15px; }
.nav-link, .wa-btn, .cur-select { white-space: nowrap; }
/* account / sign-in menu */
.acct-wrap { position: relative; }
.acct-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 70; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 28px rgba(15,32,54,.18); padding: 8px; min-width: 200px; }
.acct-menu-email { font-size: 12px; color: var(--muted); padding: 6px 8px; word-break: break-all; }
.acct-menu button { display: block; width: 100%; text-align: left; border: none; background: none; cursor: pointer; font: inherit; font-weight: 700; color: var(--text); padding: 8px; border-radius: 8px; }
.acct-menu button:hover { background: #f3f7ff; }
.pf-account { font-size: 12.5px; color: var(--muted); background: #f3f7ff; border: 1px solid var(--blue-100); border-radius: 10px; padding: 9px 11px; }
.pf-account b { color: var(--navy-700); }
/* verified partner blue check (Instagram-style) */
.verified-check { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; margin-left: 5px; border-radius: 50%; background: #1d9bf0; color: #fff; font-size: 11px; font-weight: 900; line-height: 1; vertical-align: middle; cursor: pointer; flex: 0 0 auto; box-shadow: 0 1px 3px rgba(29,155,240,.4); }
.mh-title .verified-check, h2 .verified-check { width: 20px; height: 20px; font-size: 13px; }
/* B2B partner type segmented toggle */
.seg { display: flex; gap: 8px; }
.seg-btn { flex: 1; font: inherit; font-weight: 700; font-size: 13px; padding: 10px 8px; border: 1px solid var(--border); background: #fff; color: var(--muted); border-radius: 10px; cursor: pointer; }
.seg-btn.on { border-color: var(--blue-500); background: var(--blue-50, #eef4ff); color: var(--blue-500); }
.or-div { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; color: var(--muted); font-size: 12px; }
.or-div::before, .or-div::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(15,32,54,.12); }
.card.flash { outline: 3px solid var(--blue-500); outline-offset: 1px; }
.card-top { display: flex; gap: 10px; align-items: flex-start; }
.card-flag { font-size: 26px; line-height: 1; }
.card-titles { flex: 1; min-width: 0; }
.card-name { font-weight: 800; font-size: 16px; color: var(--navy-800); line-height: 1.2; display: flex; align-items: center; gap: 5px; min-width: 0; }
.card-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.card-name .verified-check { margin-left: 0; }
.card-loc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #eef2f8; color: var(--navy-700); }
.badge.partner { background: var(--gold); color: var(--navy-900); }
.badge.rank { background: var(--blue-100); color: var(--navy-600); }
.cost-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding-top: 4px; border-top: 1px dashed var(--border); }
.cost-big { font-size: 22px; font-weight: 800; }
.cost-cur { font-size: 12px; color: var(--muted); font-weight: 600; }
.fit { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.fit.within { background: var(--green-bg); color: var(--green); }
.fit.stretch { background: var(--amber-bg); color: var(--amber); }
.fit.over { background: var(--red-bg); color: var(--red); }
.within .cost-big { color: var(--green); } .stretch .cost-big { color: var(--amber); } .over .cost-big { color: var(--red); }
.cost-break { font-size: 11.5px; color: var(--muted); }
.sch-line { font-size: 12.5px; color: var(--navy-700); background: #f3f7ff; border: 1px solid var(--blue-100); border-radius: 8px; padding: 6px 9px; }
.sch-line b { color: var(--blue-500); }
.sch-line.locked { color: var(--muted); background: #f6f8fb; }
.prog-line { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.prog-line b { color: var(--text); }
.prog-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prog-match { color: var(--green); font-weight: 700; }
.prog-match .pm-more { color: var(--muted); font-weight: 600; }
.card-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; }
.trust { font-size: 11px; color: var(--green); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.trust.pending { color: var(--amber); }
.btn { font: inherit; font-weight: 700; font-size: 13px; border-radius: 9px; cursor: pointer; border: 1px solid var(--border); background: #fff; color: var(--navy-700); padding: 8px 12px; }
.btn.primary { background: var(--blue-500); border-color: var(--blue-500); color: #fff; }
.btn.primary:hover { background: var(--navy-600); }
.btn.mini { padding: 6px 10px; font-size: 12px; }
.card-foot .spacer { margin-left: auto; }

.empty-results { grid-column: 1/-1; text-align: center; color: var(--muted); padding: 50px 20px; }

/* favorite (★) + like (♥) */
.fav-btn { flex: 0 0 auto; background: none; border: none; cursor: pointer; font-size: 22px; line-height: 1; color: #c7d0de; padding: 0 2px; transition: transform .1s; }
.fav-btn:hover { transform: scale(1.15); }
.fav-btn.on { color: var(--gold); }
.like-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; color: var(--muted); padding: 5px 10px; }
.like-btn:hover { border-color: var(--red); color: var(--red); }
.like-btn.on { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.badge.pop { background: #ffe9d6; color: #c2410c; }
.badge.dl-open { background: var(--green-bg); color: var(--green); }
.badge.dl-closed { background: #fde8e8; color: var(--red); }
.badge.dl-roll { background: #eef2f8; color: var(--muted); }
.badge.dl-est { background: #fff4e0; color: #9a6a00; }
/* deadline banner in the detail modal */
.d-deadline { display: flex; flex-direction: column; gap: 2px; padding: 11px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 13px; }
.d-deadline b { font-size: 14px; }
.d-deadline span { font-size: 12px; opacity: .9; }
.d-deadline.open { background: var(--green-bg); color: var(--green); }
.d-deadline.closed { background: #fde8e8; color: var(--red); }
.d-deadline.roll { background: #f3f7ff; color: var(--navy-700); }
.d-deadline.est { background: #fff4e0; color: #8a5d00; }

/* saved bar (above results) */
.saved-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff; border: 1px solid var(--blue-100); border-radius: 12px; padding: 10px 14px; margin: 0 18px 4px; box-shadow: var(--shadow); }
.saved-bar .lbl { font-weight: 800; color: var(--navy-800); }
.saved-bar .spacer { margin-left: auto; }
.pp-msg.ok { color: var(--green); } .pp-msg.err { color: var(--red); }
.pa-hint { margin: 0 0 12px; font-size: 12.5px; color: var(--blue-500); font-weight: 600; }
.pa-scores { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }
.pa-scores b { color: var(--navy-700); }
.gs-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--navy-800); color: #fff; font-weight: 700; font-size: 14px; padding: 12px 20px; border-radius: 999px; box-shadow: 0 8px 24px rgba(10,31,60,.35); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200; }
.gs-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.btn.mini.primary, .btn.primary.mini { background: var(--blue-500); border-color: var(--blue-500); color: #fff; }

/* compare table */
.cmp-wrap { overflow-x: auto; }
table.cmp { border-collapse: collapse; width: 100%; font-size: 13px; min-width: 480px; }
table.cmp th, table.cmp td { border: 1px solid var(--border); padding: 9px 11px; text-align: left; vertical-align: top; }
table.cmp thead th { background: var(--navy-700); color: #fff; font-size: 12.5px; position: sticky; top: 0; }
table.cmp tbody th { background: #f3f7ff; color: var(--navy-700); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
table.cmp .best { color: var(--green); font-weight: 800; }

/* ---------- detail modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10,31,60,.55); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100; overflow: auto; }
.modal { background: #fff; border-radius: 16px; max-width: 720px; width: 100%; box-shadow: 0 20px 60px rgba(10,31,60,.4); overflow: hidden; }
.modal-head { background: linear-gradient(180deg, var(--navy-800), var(--navy-900)); color: #fff; padding: 20px 24px; position: relative; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-head .mh-sub { color: #c7d6ef; font-size: 13px; margin-top: 4px; }
.modal-close { position: absolute; top: 14px; right: 16px; background: rgba(255,255,255,.15); border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.modal-body { padding: 20px 24px; }

/* personalized cost estimate */
.d-estimate { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.d-estimate.single { grid-template-columns: 1fr; }
.d-est-card { border-radius: 12px; padding: 14px 16px; border: 1px solid var(--border); }
.d-est-card.pay { background: var(--green-bg); border-color: #bfe6d0; }
.d-est-card.allin { background: #f3f7ff; border-color: var(--blue-100); }
.d-est-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); }
.d-est-big { font-size: 27px; font-weight: 800; line-height: 1.1; margin-top: 3px; }
.d-est-card.pay .d-est-big { color: var(--green); }
.d-est-card.allin .d-est-big { color: var(--navy-700); }
.d-est-big small { font-size: 13px; font-weight: 600; color: var(--muted); }
.d-est-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.d-est-strike { color: var(--muted); text-decoration: line-through; font-size: 14px; font-weight: 600; margin-right: 6px; }
.d-break { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 6px; }
.d-brow { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 13px; font-size: 13px; }
.d-brow + .d-brow { border-top: 1px solid var(--border); }
.d-brow .lbl { color: var(--muted); font-weight: 600; }
.d-brow .val { font-weight: 700; color: var(--text); }
.d-brow .sub { color: var(--muted); font-weight: 500; font-size: 11.5px; margin-left: 6px; }
.d-footnote { font-size: 11px; color: var(--muted); margin: 0 2px 16px; line-height: 1.4; }

/* scholarship eligibility block */
.d-block { border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.d-block.sch { background: #fff; border: 1px solid var(--blue-100); }
.d-block h4 { margin: 0 0 8px; font-size: 13px; color: var(--navy-700); display: flex; align-items: center; gap: 6px; }
.elig { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; padding: 8px 0; }
.elig .tag { flex: 0 0 auto; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; margin-top: 1px; }
.elig.ok .tag { background: var(--green-bg); color: var(--green); }
.elig.no .tag { background: var(--amber-bg); color: var(--amber); }
.elig .txt { color: var(--text); line-height: 1.45; }
.elig .txt b { color: var(--navy-700); }
.d-note { font-size: 12px; color: var(--muted); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); line-height: 1.5; }
.d-note.warn { color: var(--amber); font-weight: 600; }
/* compact scholarship block (no price repeat; tier ladder as chips) */
.sch-line { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--text); }
.sch-line.muted { color: var(--muted); }
.sch-line b { color: var(--navy-700); }
.sch-ok { color: var(--green); }
.sch-mid { color: var(--amber); }
.sch-tiers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.sch-tiers .st { font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: #f3f7ff; border: 1px solid var(--blue-100); color: var(--muted); }
.sch-tiers .st.on { background: var(--green-bg); border-color: var(--green); color: var(--green); font-weight: 800; }
.sch-caveat { margin: 9px 0 0; font-size: 11.5px; color: var(--muted); }
.d-block.plain { background: #fafcff; border: 1px solid var(--border); }
.d-block h4 .muted-mini { font-weight: 600; font-size: 11px; color: var(--muted); text-transform: none; letter-spacing: 0; }
.liv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; margin-top: 4px; }
.liv-grid > div { display: flex; flex-direction: column; gap: 2px; }
.liv-k { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.liv-v { font-size: 14px; font-weight: 700; color: var(--navy-700); }

/* quick-facts strip (the few things a student scans first) */
.d-quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.d-quick .qf { font-size: 12.5px; background: #f3f7ff; border: 1px solid var(--blue-100); color: var(--navy-700); border-radius: 999px; padding: 6px 11px; font-weight: 600; }
.d-quick .qf .fit-ok { color: var(--green); } .d-quick .qf .fit-no { color: var(--amber); }
.d-quick .qf.warn { background: #fff4e0; border-color: #ffe2a8; color: #8a5d00; }
.kv .kv-note { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
/* visa financial-proof — scannable block instead of a paragraph */
.vf-box { display: flex; flex-direction: column; gap: 6px; background: #f7faff; border: 1px solid var(--blue-100); border-radius: 11px; padding: 11px 13px; margin-top: 3px; }
.vf-amt { font-size: 16px; font-weight: 800; color: var(--navy-800); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.vf-amt .vf-usd { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.vf-row { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text); line-height: 1.4; }
.vf-row .vf-ic { flex: 0 0 auto; }
.vf-row b { font-weight: 700; color: var(--navy-700); }
.vf-caveat { font-size: 11.5px; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 6px; margin-top: 1px; }

/* progressive-disclosure accordions (native <details>) */
details.acc { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
details.acc > summary { list-style: none; cursor: pointer; padding: 13px 16px; font-weight: 700; font-size: 14px; color: var(--navy-800); display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fafcff; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary:hover { background: #f1f5fb; }
details.acc > summary .chev { color: var(--muted); transition: transform .2s; font-size: 12px; }
details.acc[open] > summary .chev { transform: rotate(90deg); }
details.acc[open] > summary { border-bottom: 1px solid var(--border); }
details.acc > summary .sum-note { margin-left: auto; font-weight: 600; font-size: 12px; color: var(--muted); }
.acc-body { padding: 14px 16px; }
.acc-body .kv-grid { gap: 13px 22px; }

.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 22px; }
.kv { font-size: 13px; } .kv .k { color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; } .kv .v { margin-top: 3px; line-height: 1.45; }
.kv.full { grid-column: 1/-1; }
.kv .fit-ok { color: var(--green); font-weight: 700; } .kv .fit-no { color: var(--amber); font-weight: 700; }
.modal h3, .detail-inline h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .3px; margin: 18px 0 9px; color: var(--muted); }
@media (max-width: 560px) { .d-estimate { grid-template-columns: 1fr; } }
.prog-search { width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; padding: 8px 11px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
.prog-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 240px; overflow-y: auto; }
.prog-chip { font-size: 12px; background: #eef2f8; border-radius: 8px; padding: 5px 9px; color: var(--navy-700); }
.prog-chip.on { background: var(--green-bg); color: var(--green); font-weight: 800; border: 1px solid var(--green); }
.prog-empty { font-size: 12.5px; color: var(--muted); }
.modal-foot { display: flex; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); background: #fafcff; }
.modal-foot a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.btn.ghost { background: #fff; border: 1px solid var(--border); color: var(--navy-700); }
.btn.ghost:hover { background: #f1f5fb; }

/* My info / profile form */
.prof-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.prof-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--navy-700); }
.prof-field.prof-col2 { grid-column: 1 / -1; }
.prof-field span { font-weight: 500; color: var(--muted); }
.prof-field b { color: var(--blue-500); float: right; }
.prof-field input, .prof-field select { font: inherit; font-weight: 500; color: var(--text); padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: #fff; }
.prof-field input[type=range] { padding: 0; accent-color: var(--blue-500); }
.prof-hint { font-weight: 500; font-size: 11.5px; color: var(--muted); }
/* progressive "other test scores" picker */
.scores-block { display: flex; flex-direction: column; gap: 8px; }
.prof-sublabel { font-size: 12px; font-weight: 700; color: var(--navy-700); }
.prof-sublabel span { font-weight: 500; color: var(--muted); }
.score-rows { display: flex; flex-direction: column; gap: 8px; }
.score-rows:empty { display: none; }
.score-row { display: flex; align-items: center; gap: 8px; }
.score-row .sr-label { flex: 0 0 78px; font-size: 12px; font-weight: 700; color: var(--navy-700); }
.score-row select, .score-row input { flex: 1 1 auto; font: inherit; font-weight: 500; color: var(--text); padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: #fff; }
.score-row .sr-del { flex: 0 0 auto; width: 30px; height: 30px; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1; }
.score-row .sr-del:hover { border-color: var(--red); color: var(--red); }
select.score-add { font: inherit; font-weight: 600; color: var(--blue-500); padding: 9px 11px; border: 1px dashed var(--blue-200, #b9d2ff); border-radius: 9px; background: #f7faff; cursor: pointer; }
.prof-consent { display: flex; gap: 9px; align-items: flex-start; margin-top: 16px; font-size: 12.5px; font-weight: 500; color: var(--text); line-height: 1.5; cursor: pointer; }
.prof-consent input { margin-top: 2px; flex: 0 0 auto; width: 17px; height: 17px; accent-color: var(--blue-500); }
.prof-consent .muted-mini { color: var(--muted); }
.saved-hint { font-size: 12px; font-weight: 600; color: var(--muted); }
.dob-row { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; }
.dob-row select { font: inherit; font-weight: 500; padding: 10px 8px; border: 1px solid var(--border); border-radius: 9px; background: #fff; }
.nav-link.has-info { background: var(--gold); border-color: var(--gold); color: var(--navy-900); }
@media (max-width: 560px) { .prof-grid { grid-template-columns: 1fr; } }

/* ---------- My Journey dashboard ---------- */
.jrn-head { background: linear-gradient(180deg, #f3f8ff, #fff); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.jrn-prog-top { font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 7px; }
.jrn-prog-top b { font-size: 22px; color: var(--blue-500); font-weight: 800; }
.jrn-bar { height: 9px; background: #e6edf8; border-radius: 999px; overflow: hidden; }
.jrn-bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue-500), #4f8dff); border-radius: 999px; transition: width .25s; }
.jrn-acct { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 13px; font-size: 13px; font-weight: 600; color: var(--text); flex-wrap: wrap; }
.jrn-signin { margin-top: 10px; font-size: 12.5px; color: var(--muted); background: #fff7e6; border: 1px solid #ffe2a8; border-radius: 9px; padding: 8px 11px; }
.jrn-sec { margin-bottom: 18px; }
.jrn-sec h3 { font-size: 14px; margin: 0 0 10px; color: var(--navy-800); display: flex; align-items: center; gap: 8px; }
.jrn-count { background: var(--blue-100); color: var(--blue-500); font-size: 12px; font-weight: 800; border-radius: 999px; padding: 1px 9px; }
.jrn-todo { display: flex; flex-direction: column; gap: 8px; }
.jrn-check { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; color: var(--text); cursor: pointer; line-height: 1.4; }
.jrn-check input { margin-top: 2px; flex: 0 0 auto; width: 16px; height: 16px; accent-color: var(--blue-500); cursor: pointer; }
.jrn-check.done span { color: var(--muted); text-decoration: line-through; }
.jrn-check em { color: var(--green); font-style: normal; font-weight: 700; text-decoration: none; }
.jrn-empty { text-align: center; color: var(--muted); font-size: 13.5px; padding: 18px; border: 1px dashed var(--border); border-radius: var(--radius); }
.jrn-empty .btn { margin-top: 10px; }
.jrn-school { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.jrn-school-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.jrn-school-name { background: none; border: none; font: inherit; font-weight: 800; font-size: 14.5px; color: var(--navy-800); cursor: pointer; text-align: left; padding: 0; }
.jrn-school-name:hover { color: var(--blue-500); text-decoration: underline; }
.jrn-school-prog { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.jrn-school-prog .jrn-bar { flex: 1; }
.jrn-pct { font-size: 12px; font-weight: 800; color: var(--blue-500); flex: 0 0 auto; }
.jrn-app { margin-top: 10px; }
.jrn-app summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--blue-500); }
.jrn-app-body { display: flex; flex-direction: column; gap: 8px; padding: 10px 2px 2px; }
.jrn-grp-t { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); margin-top: 4px; }
.jrn-counsel { margin-top: 10px; align-self: flex-start; }
/* My Journey = full-screen page, not a centered popup */
#journey.overlay { padding: 0; align-items: stretch; background: var(--bg); overflow-y: auto; }
.jrn-modal { max-width: 860px; width: 100%; margin: 0 auto; min-height: 100vh; border-radius: 0; box-shadow: none; display: flex; flex-direction: column; }
.jrn-modal .modal-body { flex: 1; }
/* roadmap stepper */
.jrn-road { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; counter-reset: rd; }
.jrn-road li { counter-increment: rd; flex: 1 1 auto; min-width: 110px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px 9px 30px; position: relative; font-size: 12.5px; font-weight: 600; color: var(--navy-700); }
.jrn-road li::before { content: counter(rd); position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; border-radius: 50%; background: var(--blue-500); color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
/* document rows + upload */
.doc-note { font-size: 12px; color: var(--muted); background: #fff7e6; border: 1px solid #ffe2a8; border-radius: 9px; padding: 8px 11px; margin: 4px 0 8px; line-height: 1.45; }
.doc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 0; }
.doc-row .jrn-check { flex: 1; }
.doc-custom { flex: 1; font-size: 13.5px; font-weight: 600; color: var(--text); }
.doc-up { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.doc-btn { font-size: 12px; font-weight: 700; color: var(--blue-500); background: #f3f7ff; border: 1px solid var(--blue-100); border-radius: 8px; padding: 5px 10px; cursor: pointer; white-space: nowrap; }
.doc-btn:hover { border-color: var(--blue-500); }
.doc-file { font-size: 12px; font-weight: 700; text-decoration: none; border-radius: 8px; padding: 5px 9px; }
.doc-file.pending { background: #fff4e0; color: #8a5d00; } .doc-file.reviewed { background: var(--green-bg); color: var(--green); } .doc-file.issue { background: #fde8e8; color: var(--red); }
.doc-del { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; }
.doc-del:hover { color: var(--red); }
.doc-hint { font-size: 11.5px; color: var(--muted); }
.doc-add { display: inline-block; margin-top: 8px; font-size: 12.5px; font-weight: 700; color: var(--blue-500); background: #f7faff; border: 1px dashed var(--blue-200, #b9d2ff); border-radius: 9px; padding: 8px 12px; cursor: pointer; }
.disclaimer { font-size: 11.5px; color: var(--muted); padding: 0 24px 18px; line-height: 1.5; }

/* leaflet popup tweaks */
.leaflet-popup-content { margin: 10px 12px; font-family: inherit; }
.pop-name { font-weight: 800; color: var(--navy-800); }
.pop-cost { font-weight: 700; margin-top: 3px; }
.pop-btn { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--blue-500); cursor: pointer; }

@media (max-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .map-wrap { position: relative; top: 0; height: 60vh; }
  .view-toggle { display: flex; }
  .split.show-list .map-wrap { display: none; }
  /* narrow tablets / small laptops: trim the header so it never overflows */
  .topbar { gap: 10px; }
  .topbar-right { gap: 8px; min-width: 0; }
  .fx-note { display: none; }
  .wa-btn .wa-label { display: none; }   /* WhatsApp = icon only */
  .wa-btn { padding: 8px 11px; }
  .split.show-map .results { display: none; }
  .brand-sub { display: none; }
  /* inline detail stacks: info first, then mini-map + city guide */
  .detail-inline { grid-template-columns: minmax(0, 1fr); }
  .di-side { position: relative; top: 0; }
}

/* ---------- AI advisor full-screen ---------- */
.aichat-overlay { position: fixed; inset: 0; z-index: 1200; background: #fff; display: flex; flex-direction: column; }
.aichat-bar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: linear-gradient(180deg, var(--navy-800), var(--navy-900)); color: #fff; font-weight: 700; font-size: 14px; }
.aichat-bar button { background: rgba(255,255,255,.15); border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; font-size: 16px; cursor: pointer; }
.aichat-overlay iframe { flex: 1; width: 100%; border: 0; }

/* ---------- mobile bottom nav ---------- */
.bottom-nav { display: none; }
@media (max-width: 720px) {
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
    background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -2px 12px rgba(15,32,54,.08);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .bottom-nav button {
    flex: 1; background: none; border: none; cursor: pointer; padding: 8px 0 9px;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 11px; font-weight: 700; color: var(--muted);
  }
  .bottom-nav button .bn-ic { font-size: 19px; line-height: 1; }
  .bottom-nav button.active { color: var(--blue-500); }
  body { padding-bottom: 60px; }   /* clear the fixed nav */
  .map-wrap { height: calc(60vh - 30px); }
}

/* ---------- mobile (Airbnb-clean) ---------- */
@media (max-width: 720px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .fx-note, .nav-partner, .nav-ai { display: none; }   /* secondary on mobile (AI is in bottom nav) */
  .view-toggle { display: none; }                       /* List/Map handled by bottom nav */
  .wa-btn .wa-label { display: none; }            /* WhatsApp = icon only */
  .wa-btn { padding: 8px 10px; }
  #authBtn .pf-label { display: none; }           /* sign-in/account = icon only on mobile */
  .nav-link, .cur-select { font-size: 12px; padding: 7px 9px; }
  .brand-logo { height: 30px; padding: 3px 8px; }
  .filters { padding: 10px 12px; gap: 9px 8px; align-items: flex-end; }
  .f-label { font-size: 11px; }
  .f-group { flex: 1 1 100%; min-width: 0; }
  .f-group.f-narrow { flex: 1 1 0; min-width: 0; }   /* field + sort + budget chip all share ONE row */
  .f-group.f-narrow .f-select { min-width: 0; }       /* let the selects shrink so the chip fits */
  .f-unisearch { display: none; }                     /* on mobile, university search lives in the floating 🔍 button */
  /* floating university-search button (above the bottom nav) */
  .uni-fab { display: flex; align-items: center; justify-content: center; position: fixed; right: 16px; bottom: 72px; z-index: 85;
    width: 48px; height: 48px; border-radius: 50%; border: none; cursor: pointer; font-size: 20px;
    background: var(--blue-500); color: #fff; box-shadow: 0 6px 18px rgba(15,32,54,.28); }
  .uni-fab.on { background: var(--navy-800); }
  .uni-pop { display: block; position: fixed; right: 12px; left: 12px; bottom: 128px; z-index: 86;
    background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(15,32,54,.22); padding: 12px; }
  .uni-pop[hidden] { display: none; }
  .uni-pop-row { display: flex; gap: 8px; align-items: center; }
  .uni-pop-row input { flex: 1; min-width: 0; }
  .uni-pop-row button { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 15px; }
  .uni-pop .uni-req-hint { margin-top: 9px; }
  .budget-chip { display: inline-flex; padding: 9px 10px; flex: 0 0 auto; }
  .filters { gap: 9px 6px; }
  .f-budget { display: none; order: 5; }          /* hidden until the chip is tapped */
  .filters.show-budget .f-budget { display: flex; }
  .f-countries { order: 6; }
  .f-countries .country-chips { -webkit-overflow-scrolling: touch; }
  .cc { font-size: 12px; padding: 6px 11px; }
  .f-reset { display: none; }                     /* removed on mobile */
  .summary { padding: 12px; }
  .saved-bar { margin: 0 12px 4px; }
  .split { padding: 0 12px 24px; }
  .results { grid-template-columns: minmax(0, 1fr); }
  .overlay { padding: 0; align-items: flex-end; }       /* modals slide up like a sheet */
  .modal { max-width: 100%; border-radius: 18px 18px 0 0; max-height: 94vh; display: flex; flex-direction: column; }
  .modal-body { overflow-y: auto; }
  .modal-head { position: sticky; top: 0; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; justify-content: center; }
  .d-estimate { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: 1fr; }
}

/* very narrow phones (≤374px: iPhone SE1/old Android/Galaxy Fold cover) —
   collapse the profile chip to its icon so the header fits without overflow */
@media (max-width: 374px) {
  .topbar { gap: 6px; }
  .topbar-right { gap: 6px; }
  .pf-label { display: none; }
  .cur-select { padding: 7px 7px; }
}
