:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0a0b;
  --bg-glow-1: rgba(232, 70, 92, .11);
  --bg-glow-2: rgba(255, 116, 139, .06);
  --surface: #151113;
  --surface-2: #1d1719;
  --surface-3: #241b1e;
  --ink: #f7eef1;
  --muted: #b9adb1;
  --line: #34272c;
  --line-strong: #4a343b;
  --accent: #e84c66;
  --accent-hover: #f45d76;
  --accent-2: #ff8197;
  --accent-soft: rgba(232, 76, 102, .13);
  --accent-soft-2: rgba(255, 129, 151, .09);
  --danger: #ff5d62;
  --notice-bg: #211719;
  --notice-ink: #e8cbd1;
  --input-bg: #0f0c0d;
  --nav-bg: rgba(18, 13, 15, .94);
  --nav-active: rgba(232, 76, 102, .16);
  --shadow: 0 18px 55px rgba(0, 0, 0, .28);
  --shadow-soft: 0 8px 28px rgba(0, 0, 0, .18);
  --radius: 20px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #fff8fa;
  --bg-glow-1: rgba(224, 55, 84, .12);
  --bg-glow-2: rgba(255, 126, 151, .12);
  --surface: #ffffff;
  --surface-2: #fff0f3;
  --surface-3: #ffe7ed;
  --ink: #261b1f;
  --muted: #77686d;
  --line: #ead7dd;
  --line-strong: #dcbcc6;
  --accent: #d93655;
  --accent-hover: #c72f4c;
  --accent-2: #ef5d78;
  --accent-soft: rgba(217, 54, 85, .10);
  --accent-soft-2: rgba(239, 93, 120, .09);
  --danger: #c93742;
  --notice-bg: #fff1f4;
  --notice-ink: #6f3c49;
  --input-bg: #ffffff;
  --nav-bg: rgba(255, 249, 251, .94);
  --nav-active: rgba(217, 54, 85, .10);
  --shadow: 0 18px 50px rgba(120, 53, 72, .10);
  --shadow-soft: 0 8px 28px rgba(120, 53, 72, .08);
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  transition: background-color .22s ease;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, var(--bg-glow-1), transparent 30rem),
    radial-gradient(circle at 100% 22%, var(--bg-glow-2), transparent 34rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: color .22s ease, background .22s ease;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

::selection {
  background: var(--accent);
  color: white;
}

.app-shell {
  width: min(1100px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 18px 110px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -4px -4px 22px;
  padding: 10px 4px;
  background: linear-gradient(to bottom, var(--bg) 72%, transparent);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: white;
  background: linear-gradient(145deg, var(--accent), #a81f3a);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 8px 24px rgba(213, 45, 76, .22);
  font: 700 24px/1 Georgia, serif;
}

.brand strong {
  display: block;
  letter-spacing: .01em;
}

.brand small {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 10px;
  margin-top: 2px;
}

.prototype-badge,
.theme-toggle {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  border-radius: 10px;
  color: var(--muted);
  box-shadow: var(--shadow-soft);
}

.prototype-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-weight: 700;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.theme-toggle:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.theme-icon {
  color: var(--accent-2);
  font-size: 15px;
}

.hero,
.panel,
.chat-shell {
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero {
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  min-height: 520px;
}

.hero-copy {
  position: relative;
  padding: clamp(32px, 6vw, 72px);
}

.hero-copy::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -55px;
  bottom: -55px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 68%);
  pointer-events: none;
}

.eyebrow {
  color: var(--accent-2);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .15em;
  font-size: 12px;
}

h1, h2, h3 { margin: 0; }

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -.04em;
  font-size: clamp(48px, 8vw, 86px);
  line-height: .96;
  margin: 18px 0 24px;
}

h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: clamp(30px, 5vw, 48px);
  letter-spacing: -.025em;
}

h3 { font-size: 18px; }

.lede {
  color: var(--muted);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.65;
  max-width: 650px;
}

.hero-side {
  padding: 28px;
  display: flex;
  align-items: end;
  background:
    radial-gradient(circle at 78% 15%, rgba(255, 100, 127, .18), transparent 38%),
    linear-gradient(145deg, #221116, #100b0d 72%);
  color: white;
  border-left: 1px solid var(--line);
}

html[data-theme="light"] .hero-side {
  background:
    radial-gradient(circle at 80% 15%, rgba(255,255,255,.65), transparent 32%),
    linear-gradient(145deg, #dc4865, #a8213c);
}

.sample-card {
  width: 100%;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.07);
  backdrop-filter: blur(14px);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
}

.sample-card p {
  line-height: 1.55;
  color: rgba(255,255,255,.78);
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ffb0bf, #e44f6b);
  color: #321219;
  border: 1px solid rgba(255,255,255,.2);
  font-weight: 900;
}

.row { display: flex; align-items: center; gap: 12px; }
.stack { display: grid; gap: 16px; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 17px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  box-shadow: 0 7px 20px rgba(216, 54, 84, .16);
  transition: background .18s ease, transform .18s ease, border-color .18s ease;
}

.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn.secondary {
  color: var(--ink);
  background: var(--surface-2);
  border-color: var(--line);
  box-shadow: none;
}

.btn.secondary:hover {
  background: var(--surface-3);
}

.btn.ghost {
  color: var(--accent-2);
  background: transparent;
  border-color: var(--line);
  box-shadow: none;
}

.btn.ghost:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.btn.danger {
  background: var(--danger);
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, 1fr);
}

.panel {
  padding: 24px;
}

.panel p {
  color: var(--muted);
  line-height: 1.6;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 12px 0 20px;
}

.section-head p {
  color: var(--muted);
  margin: 8px 0 0;
}

.field {
  display: grid;
  gap: 7px;
  margin: 14px 0;
}

label {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  background: var(--input-bg);
  color: var(--ink);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: 10px;
}

.choice {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 10px;
  padding: 13px;
  text-align: left;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.choice:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.choice.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.choice small { color: var(--muted); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 800;
  font-size: 12px;
}

.notice {
  border-left: 3px solid var(--accent);
  padding: 14px 16px;
  background: var(--notice-bg);
  border-radius: 0 10px 10px 0;
  color: var(--notice-ink);
  line-height: 1.5;
}

.match-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface-2);
}

.match-card small { color: var(--muted); }

.chat-shell {
  overflow: hidden;
}

.chat-top {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.messages {
  min-height: 390px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    radial-gradient(circle at 90% 8%, var(--accent-soft-2), transparent 23rem),
    var(--bg);
}

.message {
  max-width: 78%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 5px;
  background: var(--surface-2);
  color: var(--ink);
  line-height: 1.45;
  box-shadow: 0 4px 14px rgba(0,0,0,.05);
}

.message.mine {
  margin-left: auto;
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  border-radius: 16px 16px 5px 16px;
}

.chat-compose {
  border-top: 1px solid var(--line);
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  background: var(--surface);
}

.allowance {
  color: var(--muted);
  font-size: 12px;
  padding: 0 20px 16px;
  background: var(--surface);
}

.feedback-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feedback-scale button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
}

.feedback-scale button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(920px, calc(100% - 24px));
  display: grid;
  grid-template-columns: repeat(5,1fr);
  gap: 4px;
  padding: 8px;
  background: var(--nav-bg);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(0,0,0,.28);
}

.bottom-nav button {
  border: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 10px;
  padding: 9px 8px;
  display: grid;
  justify-items: center;
  gap: 3px;
  font-size: 11px;
}

.bottom-nav button span {
  font-size: 18px;
}

.bottom-nav button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.bottom-nav button.active {
  background: var(--nav-active);
  color: var(--accent-2);
}

.toast {
  position: fixed;
  z-index: 50;
  right: 18px;
  top: 18px;
  transform: translateY(-20px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 16px;
  background: var(--surface-3);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: .2s ease;
  box-shadow: var(--shadow);
}

.toast.show {
  transform: none;
  opacity: 1;
}

@media (max-width: 760px) {
  .app-shell { padding: 12px 12px 105px; }
  .prototype-badge { display: none; }
  .theme-label { display: none; }
  .theme-toggle { width: 40px; justify-content: center; padding: 8px; }
  .hero { grid-template-columns: 1fr; }
  .hero-copy { padding: 36px 24px; }
  .hero-side { min-height: 280px; border-left: 0; border-top: 1px solid var(--line); }
  .grid { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .match-card { grid-template-columns: auto 1fr; }
  .match-card .btn { grid-column: 1/-1; }
  .choice-grid { grid-template-columns: 1fr; }
  .bottom-nav button { font-size: 9px; }
  .message { max-width: 88%; }
}


/* Pilot V2 additions */
.hidden { display: none !important; }

.logo-mark {
  overflow: hidden;
  padding: 0;
  background: #151113;
}
.logo-mark img { width: 100%; height: 100%; display: block; }

.brand-sinhala {
  font-family: "Noto Sans Sinhala", "Nirmala UI", system-ui, sans-serif;
  font-size: 17px;
  letter-spacing: 0;
}

.session-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.session-pill .persona-avatar { width: 27px; height: 27px; font-size: 12px; }

.compact { min-height: 38px; padding: 8px 12px; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 36px 4px 4px;
  color: var(--muted);
  font-size: 12px;
}
.site-footer strong { color: var(--ink); font-weight: 800; }

.auth-shell {
  min-height: 62vh;
  display: grid;
  place-items: center;
  padding: 36px 0;
}
.auth-card { width: min(620px, 100%); }
.auth-card h2 { margin-top: 12px; }
.auth-card > p { color: var(--muted); line-height: 1.65; }

.google-btn {
  width: 100%;
  min-height: 52px;
  margin: 18px 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  font-weight: 850;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.google-btn:hover { transform: translateY(-1px); border-color: var(--accent); background: var(--surface-3); }
.google-g {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: white;
  color: #3c4043;
  font-weight: 900;
}

.privacy-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 20px 0;
}
.privacy-mini div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.privacy-mini strong, .privacy-mini span { display: block; }
.privacy-mini span { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.45; }

.microcopy { color: var(--muted); font-size: 12px; line-height: 1.55; }

.step-number {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  margin-bottom: 16px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 900;
}

.profile-layout {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 18px;
}

.persona-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.persona-card {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
}
.persona-card:hover { border-color: var(--line-strong); }
.persona-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.persona-card strong, .persona-card small { display: block; }
.persona-card small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.persona-avatar {
  flex: 0 0 auto;
  width: 50px; height: 50px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.32), transparent 34%),
    linear-gradient(145deg, var(--avatar-a), var(--avatar-b));
  color: white;
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--avatar-b) 28%, transparent);
}
.persona-avatar span {
  font: 900 22px/1 Georgia, serif;
  text-shadow: 0 1px 8px rgba(0,0,0,.20);
}
.persona-avatar.large { width: 72px; height: 72px; border-radius: 22px; }
.persona-avatar.large span { font-size: 30px; }

.premium-avatar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 11px;
  align-items: center;
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
}
.premium-avatar strong, .premium-avatar small { display: block; }
.premium-avatar strong { color: var(--ink); }
.premium-avatar small { margin-top: 3px; line-height: 1.35; }
.lock-dot {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--surface-3);
  color: var(--accent-2);
}
.future-pill {
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 10px;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.form-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.chip-grid, .chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span, .soft-chip {
  display: inline-flex;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.chip-check input:checked + span {
  border-color: var(--accent);
  color: var(--accent-2);
  background: var(--accent-soft);
}
.soft-chip { cursor: default; }

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.consent-row input { width: auto; margin-top: 4px; }
.consent-row strong, .consent-row small { display: block; }
.consent-row small { margin-top: 4px; color: var(--muted); line-height: 1.4; }

.home-grid {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 18px;
}
.match-panel h3 { margin-top: 10px; font-size: 24px; }
.big-action { width: 100%; min-height: 50px; margin-top: 10px; }
.profile-preview .btn { margin-top: 18px; }
.home-statuses { display: flex; flex-wrap: wrap; gap: 8px; }
.mini-head { margin-top: 28px; }

.queue-card {
  width: min(720px, 100%);
  margin: 52px auto;
  text-align: center;
  padding: 48px 32px;
}
.queue-card h2 { margin: 14px 0; }
.queue-card > p { max-width: 560px; margin: 0 auto 22px; }
.center { justify-content: center; }

.queue-orbit {
  position: relative;
  width: 84px; height: 84px;
  margin: 0 auto 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  animation: queueSpin 7s linear infinite;
}
.queue-orbit span {
  position: absolute;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
}
.queue-orbit span:nth-child(1) { top: 4px; left: 35px; }
.queue-orbit span:nth-child(2) { right: 7px; bottom: 16px; background: var(--accent-2); }
.queue-orbit span:nth-child(3) { left: 8px; bottom: 18px; background: var(--line-strong); }
@keyframes queueSpin { to { transform: rotate(360deg); } }

.chat-empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
}
.messages { overflow-y: auto; max-height: 56vh; }
.message { display: grid; gap: 5px; }
.message small { font-size: 9px; color: var(--muted); }
.message.mine small { color: rgba(255,255,255,.72); }
.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}

.feedback-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.feedback-wide { grid-column: 1 / -1; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.pilot-metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.pilot-metric span, .pilot-metric strong { display: block; }
.pilot-metric span { color: var(--muted); font-size: 11px; }
.pilot-metric strong { margin-top: 7px; font-size: 28px; }

.admin-block { margin-top: 18px; }
.table-wrap { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}
th { color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-size: 10px; }

.empty-state { text-align: center; padding: 38px 24px; }
.empty-state p { max-width: 560px; margin: 8px auto 18px; }

@media (max-width: 860px) {
  .profile-layout, .home-grid, .feedback-layout { grid-template-columns: 1fr; }
  .feedback-wide { grid-column: auto; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .site-footer { flex-direction: column; }
}

@media (max-width: 620px) {
  .topbar { align-items: flex-start; }
  .session-pill span:last-child { display: none; }
  .admin-shortcut { display: none !important; }
  .privacy-mini, .form-two { grid-template-columns: 1fr; }
  .persona-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .premium-avatar { grid-template-columns: auto 1fr; }
  .future-pill { display: none; }
}


/* Pilot V2.1: bilingual UI, presence and installable PWA */
.language-toggle {
  min-height: 38px;
  min-width: 46px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  color: var(--ink);
  font-weight: 850;
  box-shadow: var(--shadow-soft);
}
.language-toggle:hover { border-color: var(--accent); background: var(--surface-2); }

.nav-label { font: inherit; font-weight: 700; }

@media (min-width: 761px) {
  .landing-hero { grid-template-columns: 1fr 1fr; min-height: 560px; }
  .landing-hero .hero-copy { display: flex; flex-direction: column; justify-content: center; }
  .landing-hero .hero-side { align-items: center; }
  .landing-hero .sample-card { max-width: 430px; margin: 0 auto; }
}

.install-panel {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 22px;
}
.install-panel h3 { margin-bottom: 6px; }
.install-panel p { margin: 0; }
.install-panel .btn { min-width: 170px; }
.install-icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 22px;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}
.meta-chip, .presence-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
.presence-badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #7b7074;
}
.presence-badge.online { color: #a7e8bd; border-color: rgba(83, 201, 125, .32); background: rgba(66, 170, 104, .10); }
.presence-badge.online::before { background: #54ce82; box-shadow: 0 0 8px rgba(84, 206, 130, .55); }

.match-card .conversation-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 5px; }
.chat-person-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

html[data-language="si"] body {
  font-family: "Noto Sans Sinhala", "Nirmala UI", Inter, ui-sans-serif, system-ui, sans-serif;
}
html[data-language="si"] h1,
html[data-language="si"] h2 {
  font-family: "Noto Sans Sinhala", "Nirmala UI", Georgia, serif;
  letter-spacing: -.02em;
  line-height: 1.15;
}
html[data-language="si"] .eyebrow { letter-spacing: .08em; }

@media (max-width: 760px) {
  .language-toggle { width: 42px; min-width: 42px; padding: 7px; font-size: 11px; }
  .install-panel { grid-template-columns: 1fr; }
  .install-panel .btn { width: 100%; }
}


/* Pilot V2.3: focused mobile navigation */
.mobile-bottom-nav,
.mobile-menu-layer {
  display: none;
}

.gender-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.gender-choice {
  position: relative;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.gender-choice:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.gender-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gender-choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.gender-symbol {
  font-size: 21px;
  color: var(--accent-2);
  line-height: 1;
}

.gender-choice strong {
  font-size: 13px;
}

body.menu-open {
  overflow: hidden;
}

@media (max-width: 760px) {
  .app-shell {
    padding-bottom: 132px;
  }

  .desktop-bottom-nav {
    display: none !important;
  }

  .mobile-bottom-nav:not(.hidden) {
    position: fixed;
    z-index: 32;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(430px, calc(100% - 22px));
    height: 72px;
    display: grid;
    grid-template-columns: 1fr 112px 1fr;
    align-items: end;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: color-mix(in srgb, var(--nav-bg) 94%, transparent);
    backdrop-filter: blur(22px);
    box-shadow: 0 18px 48px rgba(0,0,0,.35);
  }

  .mobile-nav-side {
    min-height: 54px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--muted);
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    padding: 6px 8px;
  }

  .mobile-nav-side.active,
  .mobile-nav-side:hover {
    background: var(--nav-active);
    color: var(--accent-2);
  }

  .mobile-nav-side b,
  .mobile-match-button b {
    font-size: 10px;
    line-height: 1;
    font-weight: 800;
  }

  .mobile-nav-icon {
    font-size: 20px;
    line-height: 1;
  }

  .mobile-match-button {
    position: relative;
    align-self: end;
    height: 88px;
    margin-top: -28px;
    border: 0;
    background: transparent;
    color: var(--accent-2);
    display: grid;
    justify-items: center;
    align-content: end;
    gap: 5px;
    padding: 0 0 4px;
  }

  .match-orb {
    position: relative;
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background:
      radial-gradient(circle at 34% 24%, rgba(255,255,255,.34), transparent 28%),
      linear-gradient(145deg, var(--accent-2), var(--accent));
    border: 5px solid color-mix(in srgb, var(--nav-bg) 96%, transparent);
    box-shadow:
      0 10px 28px rgba(232,76,102,.35),
      0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
    transition: transform .18s ease, box-shadow .18s ease;
  }

  .mobile-match-button:active .match-orb {
    transform: scale(.94);
    box-shadow: 0 5px 18px rgba(232,76,102,.28);
  }

  .match-orb i {
    position: absolute;
    width: 25px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.92);
    border-radius: 9px;
  }

  .match-orb i::after {
    content: "";
    position: absolute;
    bottom: -5px;
    width: 7px;
    height: 7px;
    border-left: 2px solid rgba(255,255,255,.92);
    border-bottom: 2px solid rgba(255,255,255,.92);
    transform: rotate(-35deg);
    background: transparent;
  }

  .match-orb i:nth-child(1) {
    left: 13px;
    top: 18px;
  }

  .match-orb i:nth-child(1)::after {
    left: 5px;
  }

  .match-orb i:nth-child(2) {
    right: 12px;
    top: 27px;
    opacity: .72;
  }

  .match-orb i:nth-child(2)::after {
    right: 5px;
    transform: rotate(125deg);
  }

  .match-orb em {
    position: absolute;
    top: 12px;
    right: 12px;
    color: white;
    font-size: 11px;
    font-style: normal;
  }

  .mobile-menu-layer:not(.hidden) {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    align-items: end;
  }

  .mobile-menu-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(5,3,4,.58);
    backdrop-filter: blur(5px);
  }

  .mobile-menu-sheet {
    position: relative;
    width: min(100%, 520px);
    margin: 0 auto;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    background:
      radial-gradient(circle at 50% 0%, var(--accent-soft), transparent 17rem),
      var(--surface);
    box-shadow: 0 -18px 50px rgba(0,0,0,.30);
    animation: mobileSheetIn .2s ease-out;
  }

  @keyframes mobileSheetIn {
    from { transform: translateY(24px); opacity: .4; }
    to { transform: translateY(0); opacity: 1; }
  }

  .mobile-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
  }

  .mobile-menu-head h3 {
    margin-top: 4px;
    font-size: 22px;
  }

  .mobile-menu-close {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
  }

  .mobile-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 9px;
  }

  .mobile-menu-grid button {
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface-2);
    color: var(--ink);
    text-align: left;
  }

  .mobile-menu-grid button span {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent-2);
    font-size: 17px;
  }

  .mobile-menu-grid button b {
    font-size: 12px;
    line-height: 1.25;
  }
}

@media (min-width: 761px) {
  .mobile-bottom-nav,
  .mobile-menu-layer {
    display: none !important;
  }
}


/* Consolidated mobile profile + controller rules */
.profile-mobile-back {
  display: none;
}

.profile-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
  }

  body {
    margin: 0;
  }

  .app-shell {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 auto;
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: 132px;
    overflow-x: clip;
  }

  #app {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
  }

  #app > * {
    max-width: 100%;
    min-width: 0;
  }

  .topbar {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .topbar-actions,
  .brand {
    min-width: 0;
  }

  .profile-section-head,
  .profile-head-actions,
  .profile-layout,
  .profile-layout > .panel,
  .profile-layout .field,
  .persona-grid,
  .persona-card,
  .premium-avatar,
  .gender-choice-grid,
  .gender-choice,
  .chip-grid,
  .consent-row,
  .profile-layout .actions {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .profile-layout {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-bottom: calc(130px + env(safe-area-inset-bottom));
    overflow-x: clip;
  }

  .profile-layout > .panel {
    overflow-x: clip;
  }

  .profile-layout *,
  .profile-section-head * {
    min-width: 0;
    box-sizing: border-box;
  }

  .profile-layout input,
  .profile-layout textarea,
  .profile-layout select {
    width: 100%;
    max-width: 100%;
  }

  .persona-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .persona-card {
    display: flex;
  }

  .persona-card > span:last-child,
  .premium-avatar > div,
  .consent-row > span,
  .profile-section-head > div {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .persona-card strong,
  .persona-card small,
  .premium-avatar strong,
  .premium-avatar small,
  .profile-section-head h2,
  .profile-section-head p,
  .status {
    overflow-wrap: anywhere;
  }

  .status {
    max-width: 100%;
    white-space: normal;
  }

  .premium-avatar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .future-pill {
    display: none;
  }

  .gender-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chip-check span,
  .soft-chip {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .profile-mobile-back {
    display: inline-flex;
    min-height: 38px;
    padding: 8px 12px;
  }

  .profile-section-head {
    gap: 14px;
  }

  .profile-head-actions {
    justify-content: space-between;
  }

  body.pilot-onboarded .mobile-bottom-nav {
    position: fixed !important;
    z-index: 1000 !important;
    left: 12px !important;
    right: 12px !important;
    bottom: max(12px, env(safe-area-inset-bottom)) !important;
    transform: none !important;
    width: auto !important;
    max-width: 430px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: grid !important;
  }
}

@media (min-width: 761px) {
  .profile-mobile-back {
    display: none;
  }
}


/* Admin profile diagnostics */
.admin-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.admin-block-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.admin-profile-table {
  min-width: 1180px;
}

.admin-state {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 800;
}

.admin-state.ok {
  color: #a7e8bd;
  background: rgba(66, 170, 104, .10);
  border-color: rgba(83, 201, 125, .32);
}

.admin-state.warn {
  color: #ffb5c1;
  background: rgba(232, 76, 102, .10);
  border-color: rgba(232, 76, 102, .30);
}


/* Conversation restart / delete controls */
.conversation-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.btn.danger-text {
  color: var(--danger);
}

.btn.danger-text:hover {
  border-color: var(--danger);
  background: var(--accent-soft);
}

@media (max-width: 760px) {
  .conversation-card-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .conversation-card-actions .btn {
    flex: 1 1 auto;
  }
}


/* Pilot audit hardening: responsiveness, readability and legal links */
img,
video,
iframe {
  max-width: 100%;
  height: auto;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
}

.brand small {
  font-size: 12px;
  letter-spacing: .12em;
}

.bottom-nav button,
.persona-card small,
.future-pill,
.message small,
.pilot-metric span,
th,
.meta-chip,
.presence-badge,
.language-toggle,
.mobile-nav-side b,
.mobile-match-button b,
.admin-state {
  font-size: 12px;
}

.site-footer a,
.inline-link {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 800;
}

.site-footer a:hover,
.inline-link:hover {
  text-decoration: underline;
}

.footer-links {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.legal-page-shell {
  padding-bottom: 48px;
}

.legal-page {
  width: min(820px, 100%);
  margin: 28px auto 0;
}

.legal-page .panel {
  margin-top: 16px;
}

.legal-page h1 {
  font-size: clamp(38px, 7vw, 64px);
}

.legal-page h2 {
  margin-top: 10px;
  font-size: clamp(25px, 4vw, 34px);
}

.legal-page p,
.legal-page li {
  color: var(--muted);
  line-height: 1.7;
}

.legal-page ul {
  padding-left: 22px;
}

@media (min-width: 761px) and (max-width: 860px) {
  .landing-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .landing-hero .hero-side {
    border-left: 0;
    border-top: 1px solid var(--line);
    min-height: 260px;
  }

  .landing-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .topbar {
    align-items: center;
    gap: 8px;
  }

  .brand {
    gap: 8px;
    max-width: calc(100% - 94px);
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 11px;
  }

  .brand-sinhala {
    font-size: 16px;
  }

  .brand small {
    letter-spacing: .08em;
  }

  .topbar-actions {
    gap: 6px;
  }

  .language-toggle,
  .theme-toggle {
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    padding: 7px;
  }

  .landing-hero .hero-copy {
    padding: 28px 20px;
  }

  .landing-hero h1 {
    font-size: clamp(38px, 12vw, 52px);
    line-height: 1;
    margin: 16px 0 20px;
  }

  .landing-hero .lede {
    font-size: 16px;
    line-height: 1.55;
  }

  .landing-hero .actions {
    gap: 8px;
    margin-top: 22px;
  }

  .landing-hero .actions .btn {
    flex: 1 1 100%;
  }

  .hero-side {
    min-height: 240px;
    padding: 20px;
  }

  .sample-card {
    padding: 20px;
  }

  .landing-grid {
    gap: 14px;
  }

  .landing-grid .panel,
  .install-panel {
    padding: 20px;
  }

  .install-panel {
    gap: 16px;
  }
}


/* Pilot notification opt-in */
.notification-panel {
  margin: 0 0 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background:
    radial-gradient(circle at 0 0, var(--accent-soft), transparent 18rem),
    var(--surface);
}

.notification-panel .row {
  min-width: 0;
}

.notification-panel h3 {
  margin-bottom: 5px;
}

.notification-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.notification-panel .actions {
  margin: 0;
  justify-content: flex-end;
}

.notification-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 900;
  font-size: 18px;
}

.notification-panel.enabled .notification-icon {
  border: 1px solid rgba(84, 206, 130, .35);
}

@media (max-width: 760px) {
  .notification-panel {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .notification-panel .actions {
    width: 100%;
    justify-content: stretch;
  }

  .notification-panel .actions .btn {
    flex: 1 1 auto;
  }
}
