/* ============ Alma styles ============ */
:root {
  --crimson: #a51c30;
  --crimson-dark: #7f1425;
  --crimson-light: #fdf0f2;
  --logo-orange: #f5821f; /* the "A" in the Alma wordmark + logo mark — brand accent only, not a site-wide theme color */
  --ink: #1d1d1f;
  --ink-soft: #55565a;
  --line: #e6e2dc;
  --paper: #faf8f5;
  --card: #ffffff;
  --green: #1f7a4d;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 12, 8, 0.08), 0 8px 24px rgba(20, 12, 8, 0.07);
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Source Serif 4", Georgia, serif;
  --mobile-tabbar-height: 52px; /* the fixed bottom tab bar's own content+padding, NOT counting the safe-area inset below — that's added separately wherever this is used, so it always matches the tab bar's actual rendered height on notched phones */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

a { color: var(--crimson); text-decoration: none; }

/* ---------- Top nav ---------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 21px; font-weight: 700; color: var(--ink); }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; display: block; }
.brand-accent { color: var(--logo-orange); }
.brand-college {
  margin-left: 6px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--crimson);
  background: var(--crimson-light);
  border: 1px solid #f0d2d7;
  padding: 3px 9px;
  border-radius: 99px;
}

.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 14.5px;
}
.nav-links a:hover { background: var(--paper); color: var(--ink); }
.nav-links a.active { color: var(--crimson); background: var(--crimson-light); font-weight: 600; }
.nav-icon { display: none; } /* shown only in the mobile bottom tab bar, below */

.nav-user { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink-soft); }
#nav-username { font-weight: 600; color: var(--ink); text-decoration: none; padding: 6px 10px; border-radius: 8px; }
#nav-username:hover { color: var(--crimson); background: var(--paper); }
#nav-username.active { color: var(--crimson); background: var(--crimson-light); }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  padding: 11px 20px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--crimson); color: #fff; }
.btn-primary:hover { background: var(--crimson-dark); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: #c9c3ba; }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--paper); color: var(--ink); }
.btn-sm { font-size: 13px; padding: 7px 13px; }
.btn-lg { font-size: 17px; padding: 14px 28px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field { margin-bottom: 18px; }
.hint { font-size: 12.5px; color: var(--ink-soft); margin-top: 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(165, 28, 48, 0.25); border-color: var(--crimson); }
textarea { resize: vertical; min-height: 100px; }
input[readonly] { background: var(--paper); color: var(--ink-soft); cursor: not-allowed; }

.city-field { position: relative; }
.city-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow-y: auto;
}
.city-suggestion { padding: 9px 14px; font-size: 13.5px; cursor: pointer; }
.city-suggestion:hover, .city-suggestion.active { background: var(--crimson-light); color: var(--crimson); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check-pill { position: relative; }
.check-pill input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.check-pill span {
  display: inline-block;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 13.5px;
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
}
.check-pill input:checked + span { background: var(--crimson-light); border-color: var(--crimson); color: var(--crimson); font-weight: 600; }

/* ---------- Landing ---------- */
.landing { min-height: 100vh; display: flex; flex-direction: column; }
.landing-hero {
  flex: 1;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 48px;
  align-items: center;
  max-width: 1160px;
  margin: 0 auto;
  padding: 72px 32px;
}
.landing-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--crimson);
  background: var(--crimson-light);
  padding: 6px 14px;
  border-radius: 99px;
  margin-bottom: 20px;
}
.landing h1 {
  font-family: var(--font-display);
  font-size: clamp(38px, 5vw, 56px);
  line-height: 1.08;
  margin-bottom: 20px;
}
.landing h1 em { font-style: normal; color: var(--crimson); }
.landing-sub { font-size: 18px; line-height: 1.65; color: var(--ink-soft); margin-bottom: 32px; max-width: 52ch; }
.landing-ctas { display: flex; gap: 14px; flex-wrap: wrap; }
.landing-note { margin-top: 18px; font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 7px; }

.landing-visual {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.landing-visual .mini-map { height: 340px; }
.landing-visual-caption { padding: 16px 20px; font-size: 13.5px; color: var(--ink-soft); border-top: 1px solid var(--line); }
.landing-visual-col { display: flex; flex-direction: column; }
.landing-visual-quote { margin-top: 16px; text-align: center; font-size: 14px; font-style: italic; color: var(--ink-soft); }

.landing-values {
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 56px 32px;
}
.values-grid { max-width: 1160px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.value h3 { font-family: var(--font-display); font-size: 19px; margin: 12px 0 8px; }
.value p { font-size: 14.5px; line-height: 1.6; color: var(--ink-soft); }
.value-icon { font-size: 28px; }

/* ---------- Auth (HarvardKey mock) ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; background: linear-gradient(180deg, var(--paper) 0%, #f2ece4 100%); }
.auth-card { width: 460px; max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.auth-card-head { background: var(--crimson); color: #fff; padding: 26px 30px; }
.auth-card-head .key-title { font-family: var(--font-display); font-size: 24px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.auth-card-head .key-sub { font-size: 13px; opacity: 0.85; margin-top: 5px; }
.auth-card-body { padding: 30px; }
.auth-demo-note {
  background: #fff8e8;
  border: 1px solid #eadfb9;
  color: #6d5a17;
  font-size: 12.5px;
  line-height: 1.55;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 22px;
}
.auth-error { color: var(--crimson); font-size: 13.5px; margin: -6px 0 14px; }
.auth-footer { padding: 16px 30px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-soft); text-align: center; }

.terms-scroll {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 18px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  background: var(--paper);
}
.terms-scroll h3 { font-size: 15px; color: var(--ink); margin-bottom: 10px; }
.terms-scroll p { margin-bottom: 10px; }
.terms-scroll p:last-child { margin-bottom: 0; }
.terms-agree { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; line-height: 1.5; color: var(--ink); cursor: pointer; }
.terms-agree input { margin-top: 3px; flex-shrink: 0; }

.verify-steps { list-style: none; margin: 8px 0 4px; }
.verify-steps li { display: flex; align-items: center; gap: 12px; padding: 11px 0; font-size: 14.5px; color: var(--ink-soft); }
.verify-steps li .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.verify-steps li.done { color: var(--ink); }
.verify-steps li.done .dot { border-color: var(--green); background: var(--green); color: #fff; }
.verify-steps li.active .dot { border-color: var(--crimson); }
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--crimson-light); border-top-color: var(--crimson);
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Explore (map + list) ---------- */
.explore { display: grid; grid-template-columns: 440px 1fr; height: calc(100vh - 64px); }
.explore-list { overflow-y: auto; background: #fff; border-right: 1px solid var(--line); }
.explore-drag-handle { display: none; } /* shown only in the stacked mobile/tablet layout, below */
.explore-list-head { padding: 20px 22px 14px; position: sticky; top: 0; background: #fff; z-index: 5; border-bottom: 1px solid var(--line); }
.explore-list-head h2 { font-family: var(--font-display); font-size: 21px; margin-bottom: 4px; }
.explore-count { font-size: 13.5px; color: var(--ink-soft); }
.explore-filters { display: flex; gap: 10px; margin-top: 14px; }
.explore-filters input, .explore-filters select { font-size: 13.5px; padding: 8px 11px; }

.stay-cards { padding: 14px 16px 28px; display: flex; flex-direction: column; gap: 14px; }
.stay-card {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.stay-card:hover, .stay-card.highlight { border-color: var(--crimson); box-shadow: var(--shadow); }
.stay-thumb {
  height: 100px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: #fff;
}
.stay-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.stay-meta { font-size: 12.5px; color: var(--ink-soft); line-height: 1.55; }
.stay-tags { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 11px; font-weight: 600; background: var(--paper); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 99px; padding: 3px 8px; }
.tag.free { background: #e9f6ef; border-color: #bfe3cf; color: var(--green); }
.tag.house { background: var(--crimson-light); border-color: #f0d2d7; color: var(--crimson); }

.explore-map { position: relative; }
#map { position: absolute; inset: 0; }

.map-popup { font-family: var(--font-body); min-width: 210px; }
.map-popup h4 { font-size: 14.5px; margin-bottom: 2px; }
.map-popup .sub { font-size: 12px; color: var(--ink-soft); margin-bottom: 8px; }
.map-popup a { font-size: 13px; font-weight: 600; }

.pin {
  background: var(--crimson);
  color: #fff;
  border-radius: 99px;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 0 8px;
  height: 28px !important;
  width: auto !important;
}
.pin.pin-you { background: var(--green); }
.pin.pin-cluster { font-size: 13px; padding: 0 12px; height: 32px !important; cursor: pointer; }

/* ---------- Generic page shell ---------- */
.page { max-width: 880px; margin: 0 auto; padding: 44px 28px 80px; }
.page-wide { max-width: 1100px; }
.page h1 { font-family: var(--font-display); font-size: 32px; margin-bottom: 8px; }
.page-sub { color: var(--ink-soft); font-size: 15.5px; margin-bottom: 32px; line-height: 1.6; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: 0 1px 2px rgba(20,12,8,0.04); }
.card + .card { margin-top: 22px; }
.card h2 { font-family: var(--font-display); font-size: 20px; margin-bottom: 18px; }

.host-map-wrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-top: 8px; }
#host-map { height: 300px; }

/* ---------- Members / profile ---------- */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.member-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; text-align: center; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.member-card:hover { border-color: var(--crimson); box-shadow: var(--shadow); }
.avatar {
  width: 62px; height: 62px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff;
  margin-bottom: 12px;
}
.member-card h3 { font-size: 16px; }
.member-card .sub { font-size: 13px; color: var(--ink-soft); margin: 4px 0 10px; }

.profile-head { display: flex; gap: 22px; align-items: center; margin-bottom: 26px; }
.profile-head .avatar { width: 84px; height: 84px; font-size: 32px; margin: 0; }
.profile-head h1 { margin-bottom: 2px; }
.profile-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 18px 0; }
.fact { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.fact .k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-soft); }
.fact .v { font-size: 14.5px; font-weight: 600; margin-top: 3px; }
.bio-text { line-height: 1.7; font-size: 15px; color: #333; white-space: pre-wrap; }

.empty { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty .big { font-size: 40px; margin-bottom: 12px; }

/* ---------- Login code entry ---------- */
.code-input {
  font-size: 26px !important;
  letter-spacing: 0.45em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.dev-code {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-align: center;
  color: var(--ink);
  background: #fff;
  border: 1px dashed #d9c98a;
  border-radius: 8px;
  padding: 8px;
  margin: 8px 0 4px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Nav unread badge ---------- */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--crimson);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  vertical-align: 1px;
}

/* ---------- Messages ---------- */
.messages { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 64px); background: #fff; }
.convo-list { border-right: 1px solid var(--line); overflow-y: auto; }
.convo-list-head { padding: 20px 20px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.convo-list-head h2 { font-family: var(--font-display); font-size: 21px; }
.convo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--paper);
}
.convo:hover { background: var(--paper); }
.convo.active { background: var(--crimson-light); }
.avatar-sm { width: 42px; height: 42px; font-size: 15px; margin: 0; flex-shrink: 0; }
.convo-main { flex: 1; min-width: 0; }
.convo-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14.5px; }
.convo-time { font-size: 11.5px; color: var(--ink-soft); flex-shrink: 0; }
.convo-preview { font-size: 13px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.unread-dot {
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 99px; background: var(--crimson); color: #fff;
  font-size: 11.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.thread { display: flex; flex-direction: column; min-width: 0; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--line); }
.thread-scroll { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); }
.thread-intro {
  align-self: center;
  max-width: 46ch;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 18px;
  margin-top: 14px;
}
.msg { max-width: 68%; display: flex; flex-direction: column; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg-body {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.mine .msg-body { background: var(--crimson); color: #fff; border-bottom-right-radius: 4px; }
.msg.theirs .msg-body { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg-time { font-size: 10.5px; color: var(--ink-soft); margin: 3px 6px 0; }

.composer { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); background: #fff; }
.composer textarea { flex: 1; min-height: 44px; max-height: 140px; }

/* ---------- Profile references (comments) ---------- */
.comment-group-title {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 18px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.comment-group-title:first-child { margin-top: 0; }
.comment-count {
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--crimson);
  background: var(--crimson-light);
  border-radius: 99px;
  padding: 2px 9px;
}
.comment {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--paper);
}
.comment-head { display: flex; align-items: center; gap: 12px; }
.comment-who { flex: 1; min-width: 0; }
.comment-who a { color: var(--ink); }
.comment-who a:hover { color: var(--crimson); }
.comment-body { margin-top: 10px; font-size: 14.5px; line-height: 1.6; color: #333; white-space: pre-wrap; }
.comment-form { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 20px; }

/* ---------- Photos ---------- */
.avatar-photo { background: var(--line); overflow: hidden; }
.avatar-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar-xs { width: 26px; height: 26px; font-size: 10px; margin: 0; flex-shrink: 0; }
.stay-thumb-photo { padding: 0; overflow: hidden; }
.stay-thumb-photo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 10px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 20px; }
.gallery img { width: 100%; height: 200px; object-fit: cover; border-radius: 10px; display: block; }
.photo-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.photo-thumb { position: relative; width: 110px; height: 82px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb button {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.6); color: #fff;
  font-size: 14px; line-height: 1; cursor: pointer;
}
.avatar-edit { position: relative; cursor: pointer; display: inline-block; }
.avatar-edit .avatar-edit-hint {
  position: absolute; bottom: -2px; right: -2px;
  width: 28px; height: 28px; border-radius: 50%;
  background: #fff; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; box-shadow: var(--shadow);
}

/* ---------- Status chips & stay requests ---------- */
.chip {
  display: inline-flex; align-items: center;
  font-size: 11.5px; font-weight: 700;
  padding: 4px 11px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.chip-pending { background: #fff4dc; color: #8a6100; border: 1px solid #eeddb0; }
.chip-accepted { background: #e9f6ef; color: var(--green); border: 1px solid #bfe3cf; }
.chip-declined { background: #f4f1ee; color: var(--ink-soft); border: 1px solid var(--line); }
.chip-completed { background: var(--crimson-light); color: var(--crimson); border: 1px solid #f0d2d7; }

.req-row {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 0; border-bottom: 1px solid var(--paper);
}
.req-row:last-child { border-bottom: none; }
.req-peer { flex-shrink: 0; }
.req-main { flex: 1; min-width: 0; font-size: 14.5px; }
.req-note {
  margin-top: 8px; font-size: 13.5px; color: var(--ink-soft);
  background: var(--paper); border-left: 3px solid var(--line);
  padding: 8px 12px; border-radius: 0 8px 8px 0;
}
.req-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Trust & safety ---------- */
.profile-actions { display: flex; gap: 6px; align-self: flex-start; }
.blocked-note {
  background: #fff4dc; border: 1px solid #eeddb0; color: #6d5a17;
  font-size: 13.5px; padding: 10px 14px; border-radius: 10px; margin-bottom: 18px;
}
.report-form { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 20px; }

/* ---------- Cities & meetups ---------- */
.city-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.city-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.city-card:hover { border-color: var(--crimson); box-shadow: var(--shadow); }
.city-card h3 { font-family: var(--font-display); font-size: 19px; }

.meetup {
  display: flex; gap: 16px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 12px; background: var(--paper);
}
.meetup-past { opacity: 0.55; }
.meetup-when {
  flex-shrink: 0; width: 130px;
  font-size: 12.5px; font-weight: 700; color: var(--crimson);
  padding-top: 2px;
}
.meetup-main { flex: 1; min-width: 0; font-size: 14.5px; }
.meetup-details { font-size: 13.5px; color: var(--ink-soft); margin-top: 6px; line-height: 1.55; }
.meetup-attendees { display: flex; align-items: center; gap: 4px; margin-top: 10px; }

@media (max-width: 960px) {
  .meetup { flex-direction: column; gap: 8px; }
  .meetup-when { width: auto; }
  .req-row { flex-direction: column; }
  .req-actions { justify-content: flex-start; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 99px;
  box-shadow: var(--shadow);
  z-index: 2000;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .landing-hero { grid-template-columns: 1fr; padding: 48px 24px; }
  .values-grid { grid-template-columns: 1fr; }
  .explore {
    grid-template-columns: 1fr;
    grid-template-rows: 45% 55%;
    transition: grid-template-rows 0.25s ease;
  }
  .explore.list-expanded { grid-template-rows: 18% 82%; }
  .messages { grid-template-columns: 1fr; }
  .messages.has-thread .convo-list { display: none; }
  .messages:not(.has-thread) .thread { display: none; }
  .explore-list { order: 2; border-right: none; border-top: 1px solid var(--line); display: flex; flex-direction: column; }
  .explore-map { order: 1; }
  .explore-drag-handle {
    display: flex;
    justify-content: center;
    padding: 8px 0 4px;
    cursor: pointer;
    touch-action: none;
    flex-shrink: 0;
  }
  .explore-drag-handle .bar { width: 40px; height: 5px; border-radius: 99px; background: var(--line); }
  .explore-drag-handle:active .bar { background: #c9c3ba; }
  .nav-links a { padding: 8px 9px; font-size: 13px; }
  .form-row { grid-template-columns: 1fr; }
}

/* ---------- Mobile (phones) ----------
 * Everything above this point (and every rule outside this block) is the
 * original desktop/tablet styling, untouched. This block only adds
 * phone-width overrides — nothing here changes how the site looks or
 * behaves above 640px. */
@media (max-width: 640px) {
  /* Top nav: brand + account stay in the header; the 6 section links move
     to a fixed bottom tab bar (thumb-reachable, and there's no room for a
     6-item horizontal menu next to a name + sign-out button on a phone). */
  .topnav { height: auto; min-height: 56px; padding: 8px 14px; gap: 8px; flex-wrap: wrap; row-gap: 6px; }
  .brand { font-size: 16px; gap: 6px; }
  .brand-mark { font-size: 18px; }
  .brand-college { font-size: 10px; padding: 2px 7px; margin-left: 4px; }
  .nav-user { font-size: 12.5px; gap: 6px; margin-left: auto; }
  #nav-username { padding: 5px 8px; font-size: 12.5px; }
  .nav-user .btn.btn-sm { padding: 6px 10px; font-size: 11.5px; }

  .nav-links {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1300;
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 10px rgba(20, 12, 8, 0.06);
    justify-content: space-around;
    gap: 2px;
    min-height: var(--mobile-tabbar-height);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .nav-links a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-align: center;
    padding: 6px 2px;
    font-size: 10.5px;
    line-height: 1.2;
    border-radius: 10px;
    min-height: 44px; /* comfortable tap target even though the visible content is smaller */
    -webkit-tap-highlight-color: transparent;
  }
  .nav-links a:active { background: var(--paper); }
  .nav-icon { display: block; font-size: 18px; line-height: 1; }
  .nav-links a .nav-badge { margin-left: 2px; }

  /* Room at the bottom of scrollable content so the fixed tab bar never
     covers the last item — split-view pages (Explore/Messages) size
     themselves by height instead, handled separately below. Both use
     --mobile-tabbar-height + the same safe-area term the tab bar itself
     adds, so this stays correct on notched phones instead of guessing a
     flat pixel value that only happens to work on some devices. */
  .page { padding: 22px 16px calc(var(--mobile-tabbar-height) + 44px + env(safe-area-inset-bottom, 0px)); }
  .page h1 { font-size: 24px; }
  .page-sub { font-size: 14px; margin-bottom: 22px; }
  .card { padding: 18px; }
  .card + .card { margin-top: 16px; }

  .auth-wrap { padding: 20px 14px; }
  .auth-card-head { padding: 20px; }
  .auth-card-body { padding: 20px; }

  .explore, .messages {
    height: calc(100vh - 64px - var(--mobile-tabbar-height) - env(safe-area-inset-bottom, 0px));
    height: calc(100dvh - 64px - var(--mobile-tabbar-height) - env(safe-area-inset-bottom, 0px));
  }
  .explore-list-head { padding: 14px 16px 10px; }
  .explore-filters { flex-wrap: wrap; }

  .landing-hero { padding: 40px 18px; gap: 32px; }
  .landing-sub { font-size: 16px; }
  .landing-values { padding: 40px 18px; }
  .landing-visual .mini-map { height: 220px; }

  .member-grid, .city-grid { gap: 12px; }

  .stay-card { grid-template-columns: 90px 1fr; padding: 10px; gap: 10px; }
  .stay-thumb { height: 80px; font-size: 30px; }

  .profile-head { flex-direction: column; text-align: center; gap: 12px; }
  .profile-facts { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

  .gallery img { height: 150px; }

  /* iOS Safari zooms the whole page in when you focus a text field under
     16px — very disorienting mid-form. Nothing else about these fields
     changes, just the size that avoids triggering it. */
  input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea,
  .explore-filters input, .explore-filters select {
    font-size: 16px;
  }
  .city-suggestion { font-size: 14px; }

  /* :hover never fires on touch, so cards/rows gave zero feedback when
     tapped — mirror the hover treatment on :active instead. */
  .member-card:active, .city-card:active, .stay-card:active { border-color: var(--crimson); box-shadow: var(--shadow); }
  .convo:active { background: var(--paper); }
  .btn, .member-card, .city-card, .stay-card, .convo { -webkit-tap-highlight-color: transparent; }

  /* Small icon-only buttons are well under the ~44px comfortable tap
     target size — enlarge just on mobile rather than resizing them
     everywhere (they read fine at the smaller size on desktop, where a
     mouse cursor is far more precise than a fingertip). */
  .photo-thumb button { width: 30px; height: 30px; font-size: 17px; }
  .avatar-edit-hint { width: 34px; height: 34px; font-size: 15px; }

  /* Stack Host page's Save/Pause/Remove buttons full-width instead of a
     cramped inline row — easier to hit accurately one-handed. */
  .host-actions { flex-direction: column; }
  .host-actions .btn { width: 100%; }

  /* Give chat bubbles more of the (narrower) screen width. */
  .msg { max-width: 84%; }

  html, body { overflow-x: hidden; }
}
