/* =====================================================================
   MATCHCLICK DESIGN SYSTEM
   One stylesheet for the whole app. Colours, fonts and sizes are all
   variables at the top - change them here and the whole app follows.
   ===================================================================== */

/* Fonts are served from our own site (faster, works offline, no Google Fonts privacy issue). */
@font-face { font-family: "Figtree"; src: url("./fonts/figtree.woff2") format("woff2"); font-weight: 300 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("./fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }

:root {
  /* Sea & earth palette */
  --lagoon-900: #06363B;   /* deep water - sidebar, headings */
  --lagoon-800: #0A474D;
  --lagoon-700: #0B5C61;
  --tide:       #0B7F78;   /* primary actions */
  --tide-hover: #096B65;
  --tide-bright:#12A39A;
  --shallows:   #6FDCC8;   /* highlight on dark backgrounds */
  --seaglass:   #E6F2EF;   /* page background */
  --foam:       #F3F9F7;
  --surface:    #FFFFFF;
  --ink:        #0D2E33;
  --muted:      #557073;
  --line:       #D3E4E0;
  --kelp:       #3E6B4F;   /* earthy secondary */
  --kelp-soft:  #E1ECDF;
  --sand:       #EFE7D6;
  --sand-ink:   #6B5A33;
  --signal:     #F2A93B;   /* urgent */
  --signal-soft:#FDF0D9;
  --danger:     #B93A27;
  --danger-soft:#FBE6E1;

  --font-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 26px;
  --shadow-lift: 0 1px 2px rgba(6, 54, 59, .06), 0 8px 24px -12px rgba(6, 54, 59, .22);
  --sidebar: 264px;
  --tabbar: 68px;
  --focus: 0 0 0 3px rgba(18, 163, 154, .35);

  color-scheme: light;
}

/* Light is the default. Dark only applies when the user picks it in Settings. */
:root[data-theme="dark"] {
  --seaglass: #04252A; --foam: #072E33; --surface: #0A3439; --ink: #E2F2EF; --muted: #95B6B2;
  --line: #17494E; --kelp-soft: #12392F; --sand: #3A3322; --sand-ink: #E9D9AE; --signal-soft: #3E2E10;
  --danger-soft: #3D1A14; --lagoon-900: #021A1D; --shadow-lift: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  color: var(--ink); background: var(--seaglass); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
/* Logos: dark-text version on light backgrounds, white version in dark mode. */
.logo-for-dark { display: none !important; }
[data-theme="dark"] .logo-for-light { display: none !important; }
[data-theme="dark"] .logo-for-dark { display: block !important; }
svg:not([width]) { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
a { color: var(--tide); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--tide-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; }

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); margin: 0 0 .4em; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.4rem); font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.06rem; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
small, .small { font-size: .875rem; }
.muted { color: var(--muted); }
.lede { font-size: 1.08rem; color: var(--muted); max-width: 60ch; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* ------------------------------------------------------------ layout */
.app { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30;
  background: var(--lagoon-900); color: #CFE9E4; display: flex; flex-direction: column;
  padding: 22px 16px 18px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 26px; color: #fff; text-decoration: none; }
.sidebar .brand img { height: 38px; width: auto; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  color: #BFDCD7; text-decoration: none; font-weight: 550; position: relative;
}
.nav a svg { width: 21px; height: 21px; flex: none; }
.nav a:hover { background: rgba(111, 220, 200, .08); color: #fff; }
.nav a.active { background: rgba(111, 220, 200, .14); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--shallows); }
.nav .badge { margin-left: auto; }
.sidebar .me {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 10px 0;
  border-top: 1px solid rgba(255,255,255,.08); color: #fff; text-decoration: none;
}
.sidebar .me .who { min-width: 0; }
.sidebar .me .who b { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .me .who span { font-size: .8rem; color: #8FB9B3; }
.sidebar .admin-link { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; padding: 8px 12px; font-size: .85rem; color: var(--shallows); text-decoration: none; border-radius: 10px; }

.sidebar .admin-link svg { width: 18px; height: 18px; }
.sidebar .admin-link:hover { background: rgba(111, 220, 200, .08); }

.main { margin-left: var(--sidebar); min-height: 100vh; }
.page { max-width: 1080px; margin: 0 auto; padding: 36px 40px 64px; }
.page.wide { max-width: 1320px; }
.page.full { max-width: none; padding: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--muted); }

.topbar, .tabbar { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
  .page { padding: 18px 16px 40px; }
  .page-head { margin-bottom: 18px; }
  .topbar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--seaglass) 88%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
  }
  .topbar .icon-logo { width: 32px; height: 32px; }
  .topbar .full-logo { height: 30px; width: auto; }
  .topbar .spacer { flex: 1; }
  .topbar .title { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; flex: 1; }
  .tabbar {
    display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: .68rem; font-weight: 600; color: var(--muted); text-decoration: none; position: relative;
  }
  .tabbar a svg { width: 23px; height: 23px; }
  .tabbar a.active { color: var(--tide); }
  .tabbar a.active svg { stroke-width: 2.3; }
  .tabbar .badge { position: absolute; top: 7px; left: 50%; margin-left: 5px; }
}

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 0 20px; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  font-weight: 650; font-size: .95rem; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s;
  background: var(--surface); color: var(--ink); border-color: var(--line);
}
.btn:hover { border-color: var(--tide-bright); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--tide); color: #fff; border-color: var(--tide); }
.btn-primary:hover { background: var(--tide-hover); border-color: var(--tide-hover); color: #fff; }
.btn-dark { background: var(--lagoon-900); color: #fff; border-color: var(--lagoon-900); }
.btn-dark:hover { background: var(--lagoon-700); color: #fff; }
.btn-soft { background: color-mix(in srgb, var(--tide-bright) 12%, var(--surface)); color: var(--tide); border-color: transparent; }
.btn-soft:hover { background: color-mix(in srgb, var(--tide-bright) 20%, var(--surface)); color: var(--tide-hover); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); border-color: transparent; }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .875rem; }
.btn-lg { min-height: 54px; padding: 0 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-icon { width: 42px; min-height: 42px; padding: 0; }
.btn-icon.btn-sm { width: 36px; min-height: 36px; }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.btn.is-busy::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }

.btn-google { background: var(--surface); color: var(--ink); border-color: var(--line); width: 100%; min-height: 50px; }
.btn-google svg { width: 20px; height: 20px; }

/* ------------------------------------------------------------ forms */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: .875rem; font-weight: 650; color: var(--ink); }
.field .hint { font-size: .8rem; color: var(--muted); font-weight: 400; }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea, textarea.input {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.field textarea, textarea.input { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--tide-bright); box-shadow: var(--focus); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group .input, .input-group input { flex: 1; min-width: 0; }
.password-box { position: relative; }
.password-box input { padding-right: 96px !important; font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .02em; }
.password-box .tools { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: flex; gap: 2px; }
.password-box .tools button { width: 38px; height: 38px; border: 0; background: transparent; color: var(--muted); border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.password-box .tools button:hover { background: var(--foam); color: var(--tide); }
.password-box .tools svg { width: 18px; height: 18px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; cursor: pointer; }
.switch + .switch { border-top: 1px solid var(--line); }
.switch .text b { display: block; font-weight: 600; }
.switch .text small { color: var(--muted); }
.switch input { appearance: none; -webkit-appearance: none; width: 48px; height: 28px; flex: none; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked { background: var(--tide); }
.switch input:checked::after { transform: translateX(20px); }

.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--tide); margin-top: 2px; flex: none; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 52px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; transition: all .15s; }
.choice input:checked + span { border-color: var(--tide); background: color-mix(in srgb, var(--tide-bright) 12%, var(--surface)); color: var(--tide); }
.choice input:focus-visible + span { box-shadow: var(--focus); }

/* ------------------------------------------------------------ surfaces */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px; }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2, .panel-head h3 { margin: 0; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush .panel-head { padding: 18px 22px 0; }
.section { margin-top: 34px; }
.section > h2 { margin-bottom: 14px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
@media (min-width: 901px) {
  .account-summary-grid { align-items: stretch; }
  .account-summary-grid > .panel + .panel { margin-top: 0; }
}
.grid-main { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 22px; align-items: start; }
.stack { display: grid; gap: 12px; }
.cluster { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
@media (max-width: 900px) { .grid-2, .grid-main { grid-template-columns: minmax(0, 1fr); } }

/* rows inside a panel */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 22px; text-decoration: none; color: inherit; border-top: 1px solid var(--line); }
.list > .row:first-child, .list > li:first-child > .row { border-top: 0; }
a.row:hover, .row.link:hover { background: var(--foam); }
.row .body { flex: 1; min-width: 0; }
.row .title { font-weight: 650; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { color: var(--muted); font-size: .9rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub.wrap, .row .title.wrap { white-space: normal; }
.row .meta { color: var(--muted); font-size: .8rem; white-space: nowrap; text-align: right; }

/* ------------------------------------------------------------ small things */
.avatar { border-radius: 50%; object-fit: cover; flex: none; background: var(--foam); }
.avatar-initials { display: inline-grid; place-items: center; font-family: var(--font-display); font-weight: 700; color: #fff; }
.tone-0 { background: #0B7F78; } .tone-1 { background: #3E6B4F; } .tone-2 { background: #1F6F8B; }
.tone-3 { background: #8A6A2E; } .tone-4 { background: #5B4E8C; } .tone-5 { background: #A24F3D; }
.avatar-hidden { display: inline-grid; place-items: center; color: var(--muted); background: var(--line); }

.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--signal); color: #3A2600; font-size: .72rem; font-weight: 800; line-height: 1; }
.badge:empty, .badge[data-count="0"] { display: none; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--foam); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.plain::before { display: none; }
.pill-tide { background: color-mix(in srgb, var(--tide-bright) 13%, var(--surface)); color: var(--tide); border-color: transparent; }
.pill-kelp { background: var(--kelp-soft); color: var(--kelp); border-color: transparent; }
.pill-sand { background: var(--sand); color: var(--sand-ink); border-color: transparent; }
.pill-signal { background: var(--signal-soft); color: #8A5300; border-color: transparent; }
.pill-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill-bot { background: #EDE7F6; color: #5B3F9E; border-color: transparent; }
.pill-bot::before { display: none; }
[data-theme="dark"] .pill-signal { color: var(--signal); }
[data-theme="dark"] .pill-bot { background: #2B2440; color: #C9B8F2; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-size: .9rem; font-weight: 550; cursor: pointer; text-decoration: none; }
.chip:hover { border-color: var(--tide-bright); color: var(--tide); }
.chip svg { width: 16px; height: 16px; }
.chip.selected { background: var(--tide); border-color: var(--tide); color: #fff; }

.tag { display: inline-block; padding: 3px 10px; border-radius: 8px; background: var(--kelp-soft); color: var(--kelp); font-size: .82rem; font-weight: 600; }

.flash { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--tide-bright); }
.flash.error { border-left-color: var(--danger); }
.flash.success { border-left-color: var(--kelp); }
.flash.warn { border-left-color: var(--signal); }
.flash svg { width: 20px; height: 20px; flex: none; margin-top: 2px; color: var(--tide); }
.flash.error svg { color: var(--danger); }
.flash .grow { flex: 1; }

.empty { text-align: center; padding: 44px 24px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; color: var(--tide-bright); margin: 0 auto 12px; }
.empty h3 { color: var(--ink); }
.empty .btn { margin-top: 10px; }

.segmented { display: inline-flex; padding: 4px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 6%, transparent); gap: 2px; }
.segmented a, .segmented button { padding: 8px 16px; border-radius: 999px; border: 0; background: transparent; color: var(--muted); font-weight: 650; font-size: .9rem; text-decoration: none; cursor: pointer; }
.segmented .active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(6,54,59,.12); }

.meter { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--kelp), var(--tide-bright)); transition: width .6s; }

.stars { display: inline-flex; gap: 4px; direction: rtl; }
.stars input { display: none; }
.stars label { cursor: pointer; color: var(--line); }
.stars label svg { width: 34px; height: 34px; fill: currentColor; stroke: none; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: var(--signal); }
.stars-static { color: var(--signal); font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.stars-static svg { width: 15px; height: 15px; fill: currentColor; stroke: none; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; font-weight: 550; }

/* ------------------------------------------------------------ dialog & toast */
dialog.modal { border: 0; padding: 0; border-radius: 22px; width: min(480px, calc(100vw - 24px)); background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(2, 26, 29, .5); }
dialog.modal::backdrop { background: rgba(2, 26, 29, .55); backdrop-filter: blur(3px); }
dialog.modal .modal-body { padding: 24px; }
dialog.modal .modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 24px 22px; flex-wrap: wrap; }
@media (max-width: 600px) {
  dialog.modal { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}

.toast-wrap { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: 24px; display: grid; gap: 8px; width: min(420px, calc(100vw - 24px)); pointer-events: none; }
@media (max-width: 900px) { .toast-wrap { bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); } }
.toast { background: var(--lagoon-900); color: #EAF7F4; padding: 13px 18px; border-radius: 14px; box-shadow: var(--shadow-lift); font-weight: 550; animation: toast-in .25s ease-out; pointer-events: auto; }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ SIGNATURE: the request composer + sonar ripple */
.composer {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: var(--radius-l); padding: 28px; color: #E6F6F3;
  background: radial-gradient(120% 140% at 100% 0%, #0E7E77 0%, var(--lagoon-800) 45%, var(--lagoon-900) 100%);
}
.composer h2 { color: #fff; font-size: 1.5rem; margin-bottom: 4px; }
.composer p { color: #A9D7D0; margin-bottom: 18px; }
.composer textarea {
  width: 100%; min-height: 120px; resize: vertical; border-radius: 18px; border: 1.5px solid rgba(111,220,200,.25);
  background: rgba(2, 26, 29, .35); color: #fff; padding: 16px 18px; font-size: 1.08rem; line-height: 1.5;
}
.composer textarea::placeholder { color: #7FB0AA; }
.composer textarea:focus { outline: none; border-color: var(--shallows); box-shadow: 0 0 0 3px rgba(111,220,200,.25); }
.composer .ideas { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 18px; }
.composer .ideas button { border: 1px solid rgba(111,220,200,.3); background: rgba(111,220,200,.08); color: #CDEEE8; border-radius: 999px; padding: 7px 13px; font-size: .86rem; cursor: pointer; }
.composer .ideas button:hover { background: rgba(111,220,200,.18); color: #fff; }
.composer .actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.composer .actions .btn-primary { background: var(--shallows); border-color: var(--shallows); color: var(--lagoon-900); }
.composer .actions .btn-primary:hover { background: #8BE6D5; border-color: #8BE6D5; }
.composer .actions small { color: #8FC2BB; }

.sonar { position: absolute; z-index: -1; right: -90px; top: -90px; width: 360px; height: 360px; pointer-events: none; }
.sonar i { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid rgba(111,220,200,.35); transform: scale(.25); opacity: 0; }
.sonar.live i { animation: sonar 3.6s cubic-bezier(.2,.6,.3,1) infinite; }
.sonar.live i:nth-child(2) { animation-delay: 1.2s; }
.sonar.live i:nth-child(3) { animation-delay: 2.4s; }
.sonar .dot { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--shallows); box-shadow: 0 0 0 6px rgba(111,220,200,.18); }
@media (max-width: 700px) {
  .composer { padding: 22px 18px; }
  .composer .sonar { right: -190px; top: -190px; }
  .composer .sonar .dot { display: none; }
}
.composer.sending .sonar i { animation: sonar 1.4s cubic-bezier(.2,.6,.3,1) infinite; }
.composer.sending .sonar i:nth-child(2) { animation-delay: .45s; }
.composer.sending .sonar i:nth-child(3) { animation-delay: .9s; }
@keyframes sonar { 0% { transform: scale(.25); opacity: .9; } 100% { transform: scale(1.15); opacity: 0; } }

/* Status sonar on request details */
.searching { display: flex; align-items: center; gap: 18px; }
.searching .sonar { position: relative; right: auto; top: auto; width: 64px; height: 64px; flex: none; z-index: 0; }
.searching .sonar i { border-color: var(--tide-bright); }
.searching .sonar .dot { background: var(--tide); box-shadow: 0 0 0 5px rgba(18,163,154,.18); width: 10px; height: 10px; margin: -5px 0 0 -5px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .sonar i { opacity: .4 !important; transform: scale(.6) !important; }
  .sonar i:nth-child(2) { transform: scale(.85) !important; }
  .sonar i:nth-child(3) { transform: scale(1.05) !important; }
}

/* ------------------------------------------------------------ request cards (incoming) */
.ask {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 20px 22px; display: grid; gap: 14px;
}
.ask.urgent { border-color: color-mix(in srgb, var(--signal) 60%, var(--line)); box-shadow: inset 4px 0 0 var(--signal); }
.ask .who { display: flex; gap: 12px; align-items: center; }
.ask .quote { font-size: 1.12rem; font-family: var(--font-display); font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }
.ask .why { font-size: .9rem; color: var(--muted); background: var(--foam); border-radius: 12px; padding: 10px 14px; }
.ask .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* timeline on request details */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.steps li { display: grid; grid-template-columns: 22px 1fr; gap: 12px; position: relative; padding-bottom: 18px; }
.steps li::before { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.steps li:last-child::before { display: none; }
.steps li .mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.steps li.done .mark { background: var(--tide); border-color: var(--tide); color: #fff; }
.steps li.now .mark { border-color: var(--tide-bright); box-shadow: 0 0 0 4px rgba(18,163,154,.18); }
.steps li .mark svg { width: 12px; height: 12px; }
.steps li b { display: block; font-weight: 650; }
.steps li span { color: var(--muted); font-size: .9rem; }

/* ------------------------------------------------------------ chat */
.chat-shell { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: 100vh; }
.chat-shell .chat-list { border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
.chat-shell .chat-list .head { padding: 26px 22px 12px; }
@media (max-width: 1100px) { .chat-shell { grid-template-columns: 290px minmax(0, 1fr); } }
@media (max-width: 900px) {
  .chat-shell { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - var(--tabbar) - env(safe-area-inset-bottom)); }
  .chat-shell .chat-list { display: none; }
  body.in-thread { height: 100%; min-height: 0; overflow: hidden; }
  body.in-thread .tabbar, body.in-thread .topbar { display: none; }
  body.in-thread .main {
    position: fixed; z-index: 1; left: var(--chat-vv-left, 0px); top: var(--chat-vv-top, 0px);
    width: var(--chat-vv-width, 100vw); height: var(--chat-vh, 100dvh); min-height: 0;
    margin: 0; padding: 0; overflow: hidden;
  }
  body.in-thread .page.full { width: 100%; height: 100%; min-height: 0; padding: 0; overflow: hidden; }
  body.in-thread .chat-shell { width: 100%; height: 100%; min-height: 0; }
  body.in-thread .thread { height: 100%; min-height: 0; overflow: hidden; }
  body.in-thread .thread-head { flex: 0 0 auto; }
  body.in-thread .thread-context, body.in-thread .share-bar, body.in-thread .reply-preview,
  body.in-thread .compose, body.in-thread .closed-note { flex: 0 0 auto; }
  body.in-thread .messages { flex: 1 1 0; min-height: 0; overscroll-behavior: contain; }
}

.starters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 28px; }
.starter {
  display: grid; gap: 6px; align-content: start; text-align: left; padding: 18px; border-radius: var(--radius-m);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; min-height: 132px;
}
.starter:hover { border-color: var(--tide-bright); color: var(--ink); }
.starter .ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 6px; }
.starter .ico svg { width: 22px; height: 22px; }
.starter b { font-family: var(--font-display); font-size: 1.05rem; }
.starter span { font-size: .88rem; color: var(--muted); }
.starter.random .ico { background: var(--sand); color: var(--sand-ink); }
.starter.best .ico { background: var(--kelp-soft); color: var(--kelp); }
.starter.ai { background: linear-gradient(150deg, var(--lagoon-800), var(--lagoon-900)); border-color: transparent; color: #fff; }
.starter.ai span { color: #9FD0C8; }
.starter.ai .ico { background: rgba(111,220,200,.16); color: var(--shallows); }
.starter.ai:hover { color: #fff; }
@media (max-width: 700px) {
  .starters { grid-template-columns: 1fr; gap: 8px; }
  .starter { min-height: 0; grid-template-columns: 42px 1fr; column-gap: 14px; align-items: center; padding: 14px; }
  .starter .ico { grid-row: span 2; margin: 0; }
}

.thread { display: flex; flex-direction: column; height: 100%; min-height: 0; min-width: 0; background: var(--seaglass); }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line); padding-top: calc(12px + env(safe-area-inset-top)); }
.thread-head .body { flex: 1; min-width: 0; }
.thread-head .name { font-weight: 700; font-family: var(--font-display); font-size: 1.05rem; display: flex; gap: 8px; align-items: center; }
.thread-head .status { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-head .back { display: none; }
@media (max-width: 900px) { .thread-head .back { display: inline-flex; } }
.thread-context { padding: 10px 18px; background: var(--foam); border-bottom: 1px solid var(--line); font-size: .88rem; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.thread-context b { color: var(--ink); }
.thread-context span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Centre the invitation notice while a connection is awaiting a response. */
.thread.has-pending-invite .messages { display: none; }
/* A Find People DIRECT invite shows its single opening message first,
   then centres the response notice in the remaining chat space. */
.thread.has-pending-intro .messages {
  display: flex;
  flex: 0 1 auto;
  min-height: 0;
  max-height: 42%;
  overflow-y: auto;
}
.thread.has-pending-intro .connection-invite {
  flex: 1 1 auto;
  min-height: 0;
  justify-content: center;
}
.thread.has-pending-invite .connection-invite {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  gap: 12px;
}
.thread.has-pending-invite .connection-invite p {
  max-width: 520px;
  margin: 0;
}
.thread.has-pending-invite .connection-invite-icon {
  font-size: 2rem;
  line-height: 1;
}
.thread.has-pending-invite .connection-invite-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.messages { flex: 1; overflow-y: auto; padding: 20px 18px 10px; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; }
.day-sep { align-self: center; font-size: .75rem; color: var(--muted); margin: 12px 0 6px; font-weight: 600; }
.bubble { max-width: min(76%, 560px); padding: 10px 14px 6px; border-radius: 20px; position: relative; word-wrap: break-word; overflow-wrap: anywhere; line-height: 1.42; }
.bubble .time { display: block; font-size: .68rem; opacity: .65; text-align: right; margin-top: 2px; }
.bubble .message-receipt { display: inline-block; margin-left: 5px; font-size: .78rem; letter-spacing: -3px; opacity: .75; white-space: nowrap; }
.bubble .message-receipt.is-read { color: #FFFFFF; opacity: 1; }
.online-dot { display: inline-block; width: 8px; height: 8px; margin: 0 7px 1px 0; border-radius: 50%; background: #2BA66A; vertical-align: middle; box-shadow: 0 0 0 2px var(--surface); }
.thread-head .status.online { color: var(--kelp); font-weight: 650; }
.thread-head .status.online::before { content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 6px 1px 0; border-radius: 50%; background: #2BA66A; }
.bubble.image-message { background: transparent !important; border: 0 !important; padding: 0 !important; box-shadow: none !important; color: var(--ink) !important; }
.bubble.image-message .time { color: var(--muted) !important; }
.bubble.image-message .message-receipt.is-read { color: var(--kelp) !important; }
.bubble.image-message .chat-image-wrap { position: relative; }
.bubble.me { align-self: flex-end; background: var(--tide); color: #fff; border-bottom-right-radius: 6px; }
.bubble.them { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble + .bubble.me, .bubble + .bubble.them { margin-top: 2px; }
.bubble.me + .bubble.them, .bubble.them + .bubble.me { margin-top: 10px; }
.bubble.system { align-self: center; max-width: 92%; background: transparent; border: 1px dashed var(--line); color: var(--muted); font-size: .88rem; text-align: center; border-radius: 14px; white-space: pre-line; margin: 8px 0; }
.bubble.system .safety-guidelines-link { display: inline-block; margin-top: 5px; color: var(--tide); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.bubble.ai { align-self: center; max-width: 88%; background: var(--kelp-soft); color: var(--ink); border-radius: 16px; margin: 8px 0; }
.bubble.ai .label, .bubble.card .label { display: flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 800; color: var(--kelp); margin-bottom: 2px; }
.bubble.ai .label svg { width: 14px; height: 14px; }
.bubble img.photo { border-radius: 14px; max-height: 320px; width: auto; margin: 2px 0 2px; cursor: zoom-in; }
.bubble audio { width: 250px; max-width: 100%; height: 40px; margin: 4px 0; }
.bubble.card { background: var(--surface); color: var(--ink); border: 1.5px solid var(--tide-bright); min-width: 240px; }
/* Recommended member card: keep identity details on one line where possible,
   with the profile link on its own line. Location is deliberately not rendered. */
.bubble.card .profile-recommendation-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 10px;
  row-gap: 2px;
  min-width: 0;
  margin: 3px 0 5px;
}
.bubble.card .profile-recommendation-name { display: inline; min-width: 0; }
.bubble.card .profile-recommendation-username { display: inline; color: var(--muted); font-size: .84rem; }
.bubble.card .profile-recommendation-link { display: flex; width: fit-content; margin-top: 2px; }
.chat-shell .chat-list .chat-list-avatar { width: 42px; height: 42px; max-width: 42px; max-height: 42px; flex: 0 0 42px; }

.bubble.me.card { border-color: var(--tide); }
.bubble.card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 6px 0 2px; font-size: .9rem; }
.bubble.card dt { color: var(--muted); }
.bubble.card dd { margin: 0; font-weight: 600; word-break: break-word; }
.bubble.me .time { color: #DDF3F0; }
.bubble.card .time, .bubble.ai .time { color: var(--muted); }
.bubble a { color: inherit; }
.bubble.them a, .bubble.card a { color: var(--tide); }
.bubble .map-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; }

.quick-replies { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 18px 4px; }
.quick-replies button { border: 1.5px solid var(--tide-bright); color: var(--tide); background: var(--surface); padding: 8px 14px; border-radius: 999px; font-weight: 600; cursor: pointer; font-size: .9rem; }
.quick-replies button:hover { background: var(--tide); color: #fff; border-color: var(--tide); }

.messages > .typing { display: none !important; }
.typing { align-self: flex-start; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; display: none; gap: 4px; }
.typing.on { display: inline-flex; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
.typing-status { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; width: fit-content; max-width: 80%; min-height: 34px; margin: 4px auto 2px 0; padding: 8px 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 18px 18px 18px 5px; font-size: .78rem; }
.typing-status[hidden] { display: none !important; }
.typing-status span { margin-right: 2px; }
.thread-head .status.online .online-place::before { content: " · "; }
.typing-status i { width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing-status i:nth-of-type(2) { animation-delay: .2s; }
.typing-status i:nth-of-type(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.share-bar { display: flex; gap: 8px; padding: 8px 14px 0; overflow-x: auto; scrollbar-width: none; }
.share-bar::-webkit-scrollbar { display: none; }
.share-bar .chip { padding: 6px 12px; font-size: .82rem; white-space: nowrap; flex: none; }
.share-bar .chip.done { opacity: .55; }

.compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); }
.compose .box { flex: 1; display: flex; align-items: flex-end; background: var(--surface); border: 1.5px solid var(--line); border-radius: 24px; padding: 4px 4px 4px 16px; min-width: 0; }
.compose .box:focus-within { border-color: var(--tide-bright); box-shadow: var(--focus); }
.compose textarea { flex: 1; border: 0; background: transparent; resize: none; padding: 9px 0; max-height: 140px; min-height: 22px; line-height: 1.4; outline: none; min-width: 0; }
.compose .icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; flex: none; }
.compose .icon-btn:hover { color: var(--tide); background: var(--foam); }
.compose .icon-btn svg { width: 22px; height: 22px; }
.compose .send { background: var(--tide); color: #fff; width: 46px; height: 46px; }
.compose .send:hover { background: var(--tide-hover); color: #fff; }
.compose .rec-on { background: var(--danger); color: #fff; animation: pulse 1.2s infinite; }
.compose .rec-on:hover { background: var(--danger); color: #fff; }
.rec-status { display: none; align-items: center; gap: 10px; flex: 1; padding: 0 6px; font-weight: 650; color: var(--danger); }
.recording .rec-status { display: flex; }
.recording .box { display: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(185,58,39,.15); } }
.closed-note { text-align: center; padding: 16px; color: var(--muted); border-top: 1px solid var(--line); background: var(--surface); }

.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: var(--shadow-lift); display: none; }
.menu.open .menu-pop { display: block; }
.menu-pop button, .menu-pop a { display: flex; gap: 10px; align-items: center; width: 100%; padding: 10px 12px; border: 0; background: transparent; border-radius: 10px; text-align: left; cursor: pointer; color: var(--ink); text-decoration: none; font-size: .93rem; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--foam); }
.menu-pop svg { width: 18px; height: 18px; color: var(--muted); }
.menu-pop .danger, .menu-pop .danger svg { color: var(--danger); }
.menu-pop .chat-action-blue, .menu-pop .chat-action-blue svg { color: #2878C7; }
.menu-pop .chat-action-blue:hover { background: rgba(40,120,199,.10); }
.pic-picker .pic-ai-toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
.pic-picker .pic-ai-options { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(2,20,22,.92); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-height: 92vh; border-radius: 10px; }

/* ------------------------------------------------------------ auth & onboarding */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-art {
  position: relative; overflow: hidden; isolation: isolate; color: #DDF2EE; padding: 48px 56px; display: flex; flex-direction: column;
  background: radial-gradient(90% 80% at 85% 15%, #11968D 0%, var(--lagoon-800) 46%, var(--lagoon-900) 100%);
}
.auth-art .brand img { height: 40px; width: auto; }
.auth-art .pitch { margin-top: auto; max-width: 30rem; }
.auth-art .pitch h1 { color: #fff; font-size: clamp(2rem, 1.4rem + 2vw, 3.1rem); line-height: 1.05; letter-spacing: -0.03em; margin-bottom: 18px; }
.auth-art .pitch p { color: #A6D5CE; font-size: 1.06rem; }
.auth-art .examples { display: grid; gap: 10px; margin-top: 30px; }
.auth-art .examples div { background: rgba(2,26,29,.3); border: 1px solid rgba(111,220,200,.18); border-radius: 16px; padding: 12px 16px; font-size: .95rem; color: #E1F4F0; display: flex; gap: 12px; align-items: baseline; }
.auth-art .examples em { font-style: normal; color: var(--shallows); font-size: .8rem; font-weight: 700; white-space: nowrap; }
.auth-art .sonar { width: 640px; height: 640px; right: -220px; top: -200px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-form .inner { width: 100%; max-width: 410px; }
.auth-form h1 { font-size: 2rem; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 22px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 26px 22px 30px; }
  .auth-art .pitch { margin-top: 30px; }
  .auth-art .examples, .auth-art .pitch p { display: none; }
  .auth-art .pitch h1 { font-size: 1.85rem; margin: 0; }
  .auth-form { align-items: flex-start; padding: 28px 20px 48px; }
}

.onboard { min-height: 100vh; background: var(--seaglass); }
.onboard-top { display: flex; align-items: center; justify-content: space-between; padding: 20px 28px; max-width: 760px; margin: 0 auto; }
.onboard-top img { height: 32px; width: auto; }
.onboard-top a, .topbar a { display: flex; align-items: center; }
.progress { display: flex; gap: 6px; }
.progress i { width: 34px; height: 6px; border-radius: 6px; background: var(--line); }
.progress i.done { background: var(--tide); }
.progress i.now { background: var(--tide-bright); }
.onboard-card { max-width: 620px; margin: 10px auto 60px; background: var(--surface); border-radius: var(--radius-l); border: 1px solid var(--line); padding: 36px; }
.onboard-card h1 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem); }
@media (max-width: 700px) { .onboard-top { padding: 16px; } .onboard-card { margin: 0; border-radius: 0; border: 0; padding: 22px 18px 40px; min-height: calc(100vh - 64px); } }

.pic-picker { display: grid; grid-template-columns: 180px 1fr; gap: 24px; align-items: start; }
.pic-picker .preview { width: 180px; height: 180px; border-radius: 50%; overflow: hidden; background: var(--foam); border: 4px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line); position: relative; display: grid; place-items: center; }
.pic-picker .preview img, .pic-picker .preview .avatar { width: 100%; height: 100%; object-fit: cover; }
.pic-picker .preview .loading { position: absolute; inset: 0; background: rgba(6,54,59,.65); color: #fff; display: none; place-items: center; text-align: center; font-weight: 650; font-size: .9rem; padding: 20px; }
.pic-picker .preview.busy .loading { display: grid; }
@media (max-width: 600px) { .pic-picker { grid-template-columns: 1fr; justify-items: center; } }

.upload-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px; border: 2px dashed var(--line); border-radius: 18px; text-align: center; cursor: pointer; color: var(--muted); }
.upload-drop:hover, .upload-drop.drag { border-color: var(--tide-bright); background: var(--foam); color: var(--tide); }
.upload-drop svg { width: 28px; height: 28px; }
.upload-drop input { display: none; }

details.more { border-top: 1px solid var(--line); padding-top: 14px; }
details.more summary { cursor: pointer; font-weight: 650; color: var(--tide); list-style: none; display: flex; align-items: center; gap: 8px; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary { margin-bottom: 14px; }

/* ------------------------------------------------------------ landing */
.landing { background: var(--surface); }
.landing-hero {
  position: relative; overflow: hidden; isolation: isolate; min-height: 92vh; display: flex; flex-direction: column; padding: 26px 6vw 60px; color: #DDF2EE;
  background: radial-gradient(70% 90% at 80% 20%, #129A90 0%, var(--lagoon-800) 45%, var(--lagoon-900) 100%);
}
.landing-hero nav { display: flex; align-items: center; justify-content: space-between; }
.landing-hero nav img { height: 38px; width: auto; }
.landing-hero .copy { margin: auto 0; max-width: 46rem; padding-top: 60px; }
.landing-hero h1 { color: #fff; font-size: clamp(2.6rem, 1.6rem + 4.4vw, 5.4rem); line-height: .98; letter-spacing: -0.045em; font-weight: 750; margin-bottom: 24px; }
.landing-hero .copy p { font-size: clamp(1.05rem, 1rem + .3vw, 1.25rem); color: #A9D7D0; max-width: 36rem; margin-bottom: 30px; }
.landing-hero .btn-primary { background: var(--shallows); border-color: var(--shallows); color: var(--lagoon-900); }
.landing-hero .btn-primary:hover { background: #8BE6D5; border-color: #8BE6D5; color: var(--lagoon-900); }
.landing-hero .btn-ghost { color: #D5EEEA; }
.landing-hero .btn-ghost:hover { color: #fff; background: rgba(255,255,255,.08); }
.landing-hero .sonar { width: 900px; height: 900px; right: -260px; top: -180px; }
.landing-feed { position: absolute; right: 6vw; bottom: 60px; width: 340px; display: grid; gap: 10px; z-index: 1; }
.landing-feed div { background: rgba(2,26,29,.45); border: 1px solid rgba(111,220,200,.2); border-radius: 18px; padding: 14px 16px; backdrop-filter: blur(8px); font-size: .95rem; color: #E6F6F3; }
.landing-feed b { display: block; color: var(--shallows); font-size: .8rem; margin-bottom: 2px; }
@media (max-width: 1100px) { .landing-feed { display: none; } }
.landing-how { max-width: 1080px; margin: 0 auto; padding: 80px 6vw; display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.landing-how h3 { font-size: 1.3rem; }
.landing-how p { color: var(--muted); }
.landing-how .n { font-family: var(--font-display); font-size: 3rem; font-weight: 750; color: var(--tide-bright); line-height: 1; margin-bottom: 12px; }
@media (max-width: 800px) { .landing-how { grid-template-columns: 1fr; padding: 50px 22px; gap: 30px; } }
.landing-foot { text-align: center; padding: 30px; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------ admin */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 700; color: var(--muted); font-size: .8rem; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--foam); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat b { display: block; font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }
.admin-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.admin-tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 650; border-bottom: 2.5px solid transparent; margin-bottom: -1px; }
.admin-tabs a.active { color: var(--tide); border-bottom-color: var(--tide); }
.score { font-variant-numeric: tabular-nums; font-weight: 750; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: .82rem; background: var(--foam); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
pre.code { padding: 12px; white-space: pre-wrap; max-height: 360px; overflow: auto; }

.mobile-only { display: none; }
@media (max-width: 900px) { .desktop-only { display: none !important; } .mobile-only { display: initial; } }

/* ------------------------------------------------------------ social points */
.impact-hero { padding: 30px; }
.impact-top { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.impact-hero .level-name { display: inline-block; font-weight: 800; color: var(--shallows); font-size: .95rem; }
.impact-score { font-family: var(--font-display); font-weight: 750; font-size: clamp(2.6rem, 2rem + 3vw, 4.2rem); line-height: 1; color: #fff; letter-spacing: -0.03em; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.impact-score small { font-size: 1rem; font-weight: 600; color: #9FD0C8; letter-spacing: 0; }
.impact-hero .rank-line { color: #E6F6F3; font-weight: 600; margin: 0; }
.rank-badge { flex: none; width: 96px; height: 96px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: var(--signal); color: #3A2600; box-shadow: 0 0 0 6px rgba(242,169,59,.2); }
.rank-badge small { font-weight: 700; font-size: .8rem; }
.rank-badge b { font-family: var(--font-display); font-size: 1.9rem; line-height: 1; }
.impact-progress { height: 10px; border-radius: 999px; background: rgba(255,255,255,.12); margin-top: 22px; overflow: hidden; }
.impact-progress i { display: block; height: 100%; background: var(--shallows); border-radius: inherit; }
.impact-next { color: #9FD0C8; margin: 8px 0 0; font-size: .9rem; }
.impact-next b { color: #fff; }
.impact-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid rgba(111,220,200,.18); }
.impact-stats b { display: block; font-family: var(--font-display); font-size: 1.5rem; color: #fff; }
.impact-stats span { color: #9FD0C8; font-size: .82rem; }
@media (max-width: 600px) { .impact-stats { grid-template-columns: repeat(2, 1fr); } .rank-badge { width: 72px; height: 72px; } .rank-badge b { font-size: 1.4rem; } }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 10px; margin-top: 12px; }
.badge-tile { display: grid; gap: 4px; padding: 14px; border-radius: 14px; border: 1px dashed var(--line); color: var(--muted); }
.badge-tile b { color: var(--muted); font-size: .92rem; }
.badge-tile span:last-child { font-size: .78rem; }
.badge-tile .badge-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--foam); margin-bottom: 4px; }
.badge-tile.earned { border: 1px solid transparent; background: var(--kelp-soft); color: var(--ink); }
.badge-tile.earned b { color: var(--ink); }
.badge-tile.earned .badge-icon { background: var(--signal); color: #3A2600; }
.leader-rank { width: 28px; text-align: center; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.leader-rank.top { color: var(--signal); }

.impact-card { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); margin-top: 18px; }
.impact-card:hover { border-color: var(--tide-bright); color: var(--ink); }
.impact-card .medal { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--kelp-soft); color: var(--kelp); flex: none; }
.impact-card .body { flex: 1; min-width: 0; }
.impact-card b { font-family: var(--font-display); }
.sidebar .points { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--shallows); font-weight: 700; }
.sidebar .points svg { width: 12px; height: 12px; }
.composer .outreach-opt { display: flex; gap: 10px; align-items: flex-start; color: #CDEEE8; font-size: .88rem; margin: -4px 0 16px; cursor: pointer; }
.composer .outreach-opt input { accent-color: var(--shallows); width: 18px; height: 18px; margin-top: 1px; flex: none; }
.who .pill-kelp svg { width: 13px; height: 13px; }


/* ------------------------------------------------------------ feel like an app */
html, body { max-width: 100%; overflow-x: hidden; overflow-x: clip; }
body { overscroll-behavior-x: none; -webkit-tap-highlight-color: transparent; }
a, button, .btn, .chip, .row, label, summary, select { touch-action: manipulation; }
.tabbar, .topbar, .sidebar, .btn, .chip, .segmented, .thread-head, .share-bar, .quick-replies { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
img { -webkit-user-drag: none; }
.page, .main, .panel, .composer, .ask { min-width: 0; }
.table-wrap { max-width: 100%; }
pre, .code { overflow-wrap: anywhere; }

@media (max-width: 900px) {
  /* Only the page content scrolls; the top bar and tabs stay put, no rubber-banding sideways. */
  html, body { overscroll-behavior-y: none; }
  body.app { position: relative; }
  .tabbar a { -webkit-user-select: none; user-select: none; transition: color .1s; }
  .tabbar a:active svg { transform: scale(.92); }
  .tabbar a svg { transition: transform .1s; }
  .btn:active, .chip:active, .row:active, .starter:active { opacity: .75; }
  .page-head h1 { font-size: 1.7rem; }
  .composer { border-radius: 22px; }
}

/* Page switches: a quick cross-fade, with the tabs and top bar staying still. */
.tabbar { view-transition-name: tabbar; }
.topbar { view-transition-name: topbar; }
.sidebar { view-transition-name: sidebar; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .14s; }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }

/* Loading bar while a page is on its way */
.turbo-progress-bar { height: 3px; background: var(--shallows); box-shadow: 0 0 8px rgba(111,220,200,.6); }

/* ------------------------------------------------------------ public pages */
.public { background: var(--surface); }
.public-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 6vw; position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.public-nav.on-dark { position: absolute; left: 0; right: 0; background: transparent; border: 0; backdrop-filter: none; }
.public-nav .brand img { height: 36px; width: auto; }
.public-nav nav { display: flex; align-items: center; gap: 22px; }
.public-nav nav > a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; }
.public-nav.on-dark nav > a:not(.btn) { color: #D5EEEA; }
.public-nav.on-dark .btn-primary { background: var(--shallows); border-color: var(--shallows); color: var(--lagoon-900); }
@media (max-width: 760px) { .hide-sm { display: none; } .public-nav nav { gap: 14px; } .public-nav .brand img { height: 30px; } }

.public-main { max-width: 1080px; margin: 0 auto; padding: 56px 6vw 80px; }
.public-main.narrow { max-width: 760px; }
.public-main h1 { font-size: clamp(2.1rem, 1.5rem + 2.6vw, 3.4rem); letter-spacing: -0.035em; line-height: 1.04; margin-bottom: 18px; }
.public-main .lede { font-size: 1.15rem; max-width: 62ch; margin-bottom: 28px; }
.prose { max-width: 68ch; }
.prose h2 { margin-top: 40px; font-size: 1.5rem; }
.prose p, .prose li { color: var(--ink); line-height: 1.65; }
.prose ul { padding-left: 20px; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.example-list { display: grid; gap: 10px; margin: 18px 0 8px; }
.example-list div { background: var(--foam); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; font-size: 1.02rem; }
.example-list div::before { content: "\201C"; color: var(--tide-bright); font-weight: 800; margin-right: 2px; }
.example-list div::after { content: "\201D"; color: var(--tide-bright); font-weight: 800; }
.find-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 22px; }
.find-grid a { display: block; padding: 18px 20px; border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; }
.find-grid a:hover { border-color: var(--tide-bright); color: var(--ink); }
.find-grid b { display: block; font-family: var(--font-display); font-size: 1.08rem; margin-bottom: 4px; }
.find-grid span { color: var(--muted); font-size: .9rem; }
.faq { border-top: 1px solid var(--line); margin-top: 16px; }
.faq details { border-bottom: 1px solid var(--line); padding: 16px 0; }
.faq summary { cursor: pointer; font-weight: 700; font-size: 1.05rem; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--tide); font-size: 1.4rem; line-height: 1; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: 10px 0 0; color: var(--muted); max-width: 68ch; }
.cta-band { margin-top: 56px; padding: 40px; border-radius: var(--radius-l); background: radial-gradient(120% 140% at 100% 0%, #0E7E77 0%, var(--lagoon-800) 45%, var(--lagoon-900) 100%); color: #DDF2EE; }
.cta-band h2 { color: #fff; font-size: 1.9rem; }
.cta-band p { color: #A9D7D0; }
.cta-band .btn-primary { background: var(--shallows); border-color: var(--shallows); color: var(--lagoon-900); }
.store-badge { display: inline-flex; align-items: center; padding: 10px 16px; border-radius: 12px; background: var(--lagoon-900); color: #fff; font-weight: 700; font-size: .85rem; text-decoration: none; }
.public-foot { border-top: 1px solid var(--line); padding: 48px 6vw 30px; background: var(--foam); }
.public-foot .cols { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; }
.public-foot h4 { font-size: .95rem; margin-bottom: 12px; }
.public-foot a:not(.store-badge) { display: block; color: var(--muted); text-decoration: none; padding: 4px 0; font-size: .93rem; }
.public-foot a:hover { color: var(--tide); }
.public-foot .foot-logo { height: 32px; width: auto; margin-bottom: 12px; }
.public-foot .copy { max-width: 1080px; margin: 34px auto 0; }
@media (max-width: 760px) { .public-foot .cols { grid-template-columns: 1fr 1fr; } }
.section-alt { background: var(--foam); }
.landing-block { max-width: 1080px; margin: 0 auto; padding: 72px 6vw; }
.landing-block > h2 { font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.4rem); letter-spacing: -0.03em; }
.points-pitch { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.points-pitch .levels { display: grid; gap: 8px; }
.points-pitch .levels div { display: flex; justify-content: space-between; padding: 12px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-weight: 650; }
.points-pitch .levels span { color: var(--muted); font-weight: 500; }
@media (max-width: 800px) { .points-pitch { grid-template-columns: 1fr; } .cta-band { padding: 28px 22px; } }


/* ------------------------------------------------------------ message replies + emoji picker */
.reply-preview { display:flex; align-items:center; gap:12px; margin:0 14px; padding:9px 12px; border-left:3px solid var(--tide-bright); background:var(--foam); border-radius:10px 10px 0 0; min-width:0; }
.reply-preview[hidden], .emoji-picker[hidden] { display:none !important; }
.reply-preview-copy { display:flex; flex-direction:column; gap:2px; min-width:0; flex:1; font-size:.8rem; }
.reply-preview-copy b { color:var(--tide); }
.reply-preview-copy span:last-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); }
.reply-preview > button { border:0; background:transparent; color:var(--muted); font-size:1.4rem; cursor:pointer; padding:2px 8px; }
.quoted-message { display:flex; flex-direction:column; gap:2px; padding:6px 9px; margin:0 0 7px; border-left:3px solid var(--tide-bright); border-radius:5px; background:rgba(0,0,0,.07); font-size:.78rem; min-width:0; }
.bubble.them .quoted-message, .bubble.ai .quoted-message { background:var(--foam); }
.quoted-message span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; opacity:.85; }
.reply-action { display:block; margin:5px 0 0 auto; padding:2px 0 0; border:0; background:transparent; color:inherit; opacity:.68; font-size:.72rem; cursor:pointer; }
.reply-action:hover { opacity:1; text-decoration:underline; }
.emoji-wrap { position:relative; flex:none; }
.emoji-button { font-size:1.25rem; }
.emoji-picker { position:absolute; z-index:80; right:0; bottom:calc(100% + 9px); width:min(280px, calc(100vw - 32px)); padding:9px; display:grid; grid-template-columns:repeat(7,1fr); gap:4px; background:var(--surface); border:1px solid var(--line); border-radius:15px; box-shadow:var(--shadow-lift); }
.emoji-picker button { border:0; background:transparent; border-radius:8px; padding:6px 2px; font-size:1.25rem; cursor:pointer; }
.emoji-picker button:hover { background:var(--foam); }
.recording .emoji-wrap { display:none; }
@media (hover:hover) { .reply-action { opacity:0; } .bubble:hover .reply-action, .reply-action:focus-visible { opacity:.8; } }

/* Keep the composer container as the single visible focus ring. */
.compose textarea:focus-visible { outline: none; box-shadow: none; }


/* ------------------------------------------------------------ mobile chat header stability
   Keep the conversation header and other person's avatar from shrinking
   or flickering when the on-screen keyboard changes the visual viewport. */
@media (max-width: 900px) {
  body.in-thread .thread-head {
    flex: 0 0 auto;
    position: relative;
    z-index: 10;
  }
  body.in-thread .thread-head #otherAvatar {
    display: block;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    position: relative;
    transform: translateZ(0);
    backface-visibility: hidden;
  }
  body.in-thread .thread-head #otherAvatar .avatar {
    display: block;
    width: 42px;
    height: 42px;
  }
}


/* Chat header: keep the hidden-profile silhouette centred on mobile and desktop. */
.thread-head #otherAvatar .avatar-hidden {
  display: grid;
  place-items: center;
  align-content: center;
  justify-content: center;
  line-height: 0;
  overflow: hidden;
}
.thread-head #otherAvatar .avatar-hidden svg {
  display: block;
  width: 65% !important;
  height: 65% !important;
  max-width: none;
  margin: 0;
  flex: none;
}


/* Desktop chat header: give the hidden-profile silhouette a definite size.
   Percentage SVG sizing can collapse inside the desktop flex header. */
@media (min-width: 901px) {
  .thread-head #otherAvatar .avatar-hidden svg {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px;
    min-height: 28px;
  }
}

/* ------------------------------------------------------------ MatchClick 2.1.1 refinements */
.input-disabled,
.field input:disabled {
  opacity: .48;
  cursor: not-allowed;
  background: var(--foam);
}
.username-cooldown { margin: 2px 0 10px; color: var(--muted); }

/* Four consistent discovery starters on the Chats page. */
.starters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.starter.people .ico { background: var(--foam); color: var(--tide); }
@media (max-width: 700px) {
  .starters { grid-template-columns: 1fr; }
}

/* Contacts: keep the identity and controls aligned at narrow widths. */
.contact-row { gap: 10px; padding: 12px 16px; }
.contact-row > .avatar,
.contact-row > .avatar-initials,
.contact-row > .avatar-hidden { flex: 0 0 46px; }
.contact-row .body { min-width: 0; }
.contact-row .body b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.contact-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.contact-actions svg { width: 17px; height: 17px; }
.contact-actions .action-icon { display: none; }
@media (max-width: 600px) {
  .contact-row { gap: 8px; padding: 11px 10px; }
  .contact-actions { gap: 4px; }
  .contact-actions .btn { min-width: 34px; min-height: 34px; padding: 6px; }
  .contact-actions .action-label { display: none; }
  .contact-actions .action-icon { display: inline; font-size: 1.2rem; line-height: 1; }
  .contact-row .sub { font-size: .78rem; }
}

/* Message actions: desktop dropdown and mobile long-press menu. */
.message-actions { position: absolute; top: 3px; right: 6px; z-index: 12; }
.message-actions-toggle {
  display: grid; place-items: center; width: 25px; height: 23px; padding: 0;
  border: 0; border-radius: 7px; background: rgba(255,255,255,.88); color: #34434a;
  font-size: 17px; line-height: 1; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.message-actions-menu {
  display: none; position: fixed; top: 0; left: 0; right: auto; bottom: auto; z-index: 1001; box-sizing: border-box;
  min-width: 160px; max-width: calc(100vw - 16px);
  max-height: min(240px, 45vh); overflow: auto; padding: 7px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
  color: var(--ink); box-shadow: var(--shadow-lift);
}
.message-menu-open .message-actions-menu { display: block; }
.message-actions-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink);
  text-align: left; font-size: .92rem; cursor: pointer; white-space: nowrap;
}
.message-actions-menu button:hover { background: var(--foam); }
@media (hover: hover) and (pointer: fine) {
  .message-actions-toggle { opacity: 0; transition: opacity .12s ease; }
  .bubble:hover .message-actions-toggle,
  .message-actions-toggle:focus-visible,
  .message-menu-open .message-actions-toggle { opacity: 1; }
}
@media (pointer: coarse) {
  .message-actions-toggle { display: none; }
  .message-actions-menu { min-width: 160px; }
}
.forwarded-label {
  display: block; margin: 0 24px 5px 0; font-size: .68rem; line-height: 1.25;
  font-weight: 400; color: #59636a; opacity: .9;
}
.bubble.me .forwarded-label { color: rgba(255,255,255,.76); }

.btn:disabled { opacity: .42; cursor: not-allowed; pointer-events: none; }
.bubble.has-message-actions { padding-right: 36px; }


/* Chats page: equal discovery cards on desktop and a compact mobile disclosure. */
.starters > form { display: flex; min-width: 0; margin: 0; }
.starters > form > .starter { flex: 1 1 auto; width: 100%; height: 100%; box-sizing: border-box; }
.starters > a.starter { height: 100%; box-sizing: border-box; }
.connect-with-people > summary { display: none; }
.connect-with-people:not([open]) > .starters { display: grid; }

@media (max-width: 700px) {
  .connect-with-people { margin-bottom: 24px; }
  .connect-with-people > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-m);
    background: var(--surface); color: var(--ink); font-weight: 700; cursor: pointer;
    list-style: none;
  }
  .connect-with-people > summary::-webkit-details-marker { display: none; }
  .connect-with-people > summary::marker { content: ""; }
  .connect-with-people .connect-chevron { width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-top: -4px; transition: transform .18s ease; }
  .connect-with-people[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .connect-with-people[open] .connect-chevron { transform: rotate(225deg); margin-top: 4px; }
  .connect-with-people:not([open]) > .starters { display: none; }
  .connect-with-people[open] > .starters { margin: 0; padding-top: 10px; }
}


/* Chats page: desktop cards are always visible; mobile alone uses the disclosure. */
@media (min-width: 701px) {
  details.connect-with-people > .starters {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
  }
  details.connect-with-people > summary { display: none !important; }
}
.starters > form { display: flex; min-width: 0; margin: 0; }
.starters > form > .starter,
.starters > a.starter {
  width: 100%; height: 100%; min-width: 0; box-sizing: border-box;
}
.starters > form > .starter { flex: 1 1 auto; }
@media (max-width: 700px) {
  details.connect-with-people > summary { display: flex; }
  details.connect-with-people:not([open]) > .starters { display: none; }
  details.connect-with-people[open] > .starters { display: grid; grid-template-columns: 1fr; }
}


/* Message reactions, optimistic media uploads and the standalone voice player. */
.message-reaction-picker {
  display: none; position: fixed; top: 0; left: 0; right: auto; bottom: auto; z-index: 1002; box-sizing: border-box;
  align-items: center; gap: 3px; padding: 5px 7px; max-width: calc(100vw - 16px);
  overflow-x: auto; overflow-y: auto; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-lift); white-space: nowrap;
}
.message-menu-open .message-reaction-picker { display: flex; }
.message-reaction-picker button {
  flex: 0 0 34px; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink); font-size: 21px; display: grid; place-items: center; cursor: pointer;
}
.message-reaction-picker button:hover { background: var(--foam); transform: scale(1.08); }
.message-reactions {
  position: absolute; right: 8px; bottom: -13px; z-index: 3; display: flex; gap: 4px;
  max-width: calc(100% - 16px); flex-wrap: wrap; justify-content: flex-end;
}
.bubble:has(.message-reactions) { margin-bottom: 14px; }
.reaction-chip {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 15px; line-height: 1.2;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.reaction-chip small { font-size: 11px; color: var(--muted); }
.reaction-chip.mine { border-color: var(--tide-bright); background: var(--foam); }

.chat-image-wrap { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.chat-image-wrap .photo { display: block; max-width: 100%; }
.upload-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 7px; padding: 10px; border-radius: 14px; background: rgba(10,18,22,.38); color: #fff;
  line-height: 1.25; text-align: center;
}
.upload-status { font-size: .78rem; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.upload-overlay button {
  padding: 5px 12px; border: 1px solid rgba(255,255,255,.7); border-radius: 999px;
  background: rgba(0,0,0,.25); color: #fff; cursor: pointer;
}
.upload-spinner {
  display: inline-block; width: 24px; height: 24px; border: 3px solid rgba(255,255,255,.35);
  border-top-color: currentColor; border-radius: 50%; animation: mc-upload-spin .8s linear infinite;
}
.upload-spinner[hidden] { display: none; }
@keyframes mc-upload-spin { to { transform: rotate(360deg); } }
.upload-failed .upload-spinner { display: none; }

/* Voice notes keep the original compact, light audio-control appearance.
   The surrounding message bubble remains transparent; only the player is pill-shaped. */
.bubble.voice-message-row,
.bubble.voice-message-row.me,
.bubble.voice-message-row.them {
  align-self: flex-end; max-width: min(92%, 620px); width: fit-content; min-width: 0;
  padding: 0 !important; margin-top: 5px !important; margin-bottom: 10px !important;
  border: 0 !important; border-radius: 0 !important; background: transparent !important;
  box-shadow: none !important; color: var(--ink); overflow: visible;
}
.bubble.voice-message-row.them { align-self: flex-start; }
.bubble.voice-message-row .message-actions { top: -5px; right: 0; }
.bubble.voice-message-row.has-message-actions { padding-right: 0 !important; }
.voice-player {
  display: flex; align-items: center; gap: 12px; position: relative;
  width: min(100%, 300px); min-width: 0; box-sizing: border-box;
  min-height: 56px; padding: 6px 13px; border: 0; border-radius: 999px;
  background: #F1F2F3; color: #17191B;
}
.voice-play {
  width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center;
  padding: 0; border: 0; border-radius: 0; background: transparent; color: #111;
  font-size: 19px; line-height: 1; cursor: pointer;
}
.voice-play:disabled { opacity: 1; cursor: default; }
.voice-play .upload-spinner { width: 22px; height: 22px; color: #111; }
.voice-play-icon { display: block; transform: translateX(1px); }
.voice-pause-icon { display: block; font-size: 19px; }
.voice-track { flex: 1 1 auto; min-width: 55px; }
.voice-time { color: #202326; font-size: 16px; line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; }
.voice-progress {
  position: absolute; inset: 0; z-index: 0; display: block;
  width: 100%; height: 100%; flex: none; overflow: hidden;
  border-radius: inherit; background: transparent; cursor: pointer;
}
.voice-player > :not(.voice-progress) { position: relative; z-index: 1; }
.voice-volume, .voice-more {
  display: grid; place-items: center; padding: 0; border: 0; background: transparent;
  color: #17191B; width: 44px; height: 44px; border-radius: 10px; cursor: pointer;
  flex: 0 0 44px; touch-action: manipulation;
}
.voice-volume svg { width: 23px; height: 23px; fill: currentColor; display: block; }
.voice-more { width: 44px; flex-basis: 44px; font-size: 25px; line-height: 1; }
.voice-more-wrap { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; }
.voice-play, .voice-volume, .voice-more { touch-action: manipulation; }
.voice-volume:hover, .voice-more:hover { background: rgba(0,0,0,.06); }
.voice-more-wrap { position: relative; width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; }
.voice-more-wrap.open { z-index: 10051; }
.voice-more-menu {
  display: none; position: fixed; z-index: 10050;
  width: 228px; min-width: 0; max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px); overflow-y: auto;
  padding: 6px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); box-shadow: 0 8px 26px rgba(0,0,0,.22);
  overscroll-behavior: contain;
}
.voice-more-wrap.open .voice-more-menu { display: block; }
.voice-more-menu button {
  display: flex; align-items: center; gap: 13px;
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 0; border-radius: 8px; background: transparent;
  color: inherit; text-align: left; cursor: pointer; font-size: .94rem;
}
.voice-more-menu button:hover, .voice-more-menu button.selected { background: var(--foam); color: var(--tide); }
.voice-menu-item svg { width: 21px; height: 21px; flex: 0 0 21px; fill: currentColor; }
.voice-menu-item span { flex: 1; }
.voice-menu-chevron { margin-left: auto; font-size: 23px; font-weight: 400; line-height: 1; }
.voice-menu-back { border-bottom: 1px solid var(--line) !important; border-radius: 0 !important; margin-bottom: 4px; font-weight: 600; }
.voice-menu-back span { font-size: 24px; line-height: 1; }
.voice-more-menu .voice-speed-option { justify-content: space-between; min-height: 42px; padding: 9px 13px; }
.voice-more-menu .voice-speed-option.selected { font-weight: 600; }
.voice-speed-option span { margin-left: auto; }
/* Subtle sender-specific player backgrounds; controls and behaviour stay unchanged. */
.voice-message-row.me .voice-player {
  --voice-base-color: #D4ECE7;
  --voice-progress-color: #A8D8CE;
  --voice-progress: 0%;
  background-color: var(--voice-base-color);
  background-image: linear-gradient(90deg,
    var(--voice-progress-color) 0%,
    var(--voice-progress-color) var(--voice-progress),
    var(--voice-base-color) var(--voice-progress),
    var(--voice-base-color) 100%);
}
.voice-message-row.them .voice-player {
  --voice-base-color: #E9EAEC;
  --voice-progress-color: #D3D7DA;
  --voice-progress: 0%;
  background-color: var(--voice-base-color);
  background-image: linear-gradient(90deg,
    var(--voice-progress-color) 0%,
    var(--voice-progress-color) var(--voice-progress),
    var(--voice-base-color) var(--voice-progress),
    var(--voice-base-color) 100%);
}
.voice-player audio { display: none !important; }
.voice-player audio.voice-native-fallback {
  display: block !important; flex: 1 1 100%; width: 100%; min-width: 0;
  height: 42px; margin: 0; border-radius: 8px;
}
.voice-player.has-native-fallback { flex-wrap: wrap; width: min(100%, 340px); border-radius: 16px; }
.voice-player.has-native-fallback > :not(audio) { display: none !important; }
.voice-message-row .time { display: block; margin-top: 3px !important; color: var(--muted); }
@media (max-width: 600px) {
  .message-reaction-picker button { flex-basis: 32px; width: 32px; height: 32px; font-size: 20px; }
  .voice-player { gap: 9px; width: min(100%, 300px); min-height: 56px; padding: 6px 12px; }
  .voice-play { width: 44px; height: 44px; flex-basis: 44px; }
  .voice-volume { width: 44px; height: 44px; flex-basis: 44px; }
  .voice-more-wrap { width: 44px; height: 44px; flex-basis: 44px; }
  .voice-more { width: 44px; height: 44px; flex-basis: 44px; }
  .voice-time { font-size: 15px; }
  .voice-more-menu { min-width: 0; width: 228px; max-width: calc(100vw - 16px); }
}


/* On mobile, the shared town/country replaces the redundant Online label. The green dot remains. */
@media (max-width: 900px) {
  .thread-head .status.online.location-shared .online-label { display: none; }
  .thread-head .status.online.location-shared .online-place::before { content: ""; }
}

/* Safety guidelines page */
.safety-guidelines { max-width: 820px; }
.safety-guidelines h2 { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); }
.safety-guidelines h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.safety-guidelines h3 { margin-top: 12px; }
.safety-guidelines li { margin: 7px 0; }
