:root {
  --bg: #fbf7f5; --surface: #ffffff; --text: #241b1f; --muted: #6f6266; --border: #ece3e0;
  --brand: #d6336c; --brand-ink: #ffffff; --brand-soft: #fde8ef; --danger: #c92a2a;
  --ok: #2b8a3e; --warn: #b7791f; --radius: 14px; --shadow: 0 1px 2px rgba(36,27,31,.06), 0 4px 16px rgba(36,27,31,.05);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #17121a; --surface: #221b25; --text: #f3ecef; --muted: #b3a6ad; --border: #352b38;
          --brand: #f06595; --brand-soft: #3a2230; --danger: #ff6b6b; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 1.2rem; color: var(--text); }
.logo { color: var(--brand); }
.logo.big { font-size: 3rem; text-align: center; }
.topbar nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); font-weight: 500; }
.topbar nav a.active { color: var(--brand); }
.topbar nav a.btn { color: var(--brand-ink); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.narrow { max-width: 460px; margin: 24px auto; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }
.muted { color: var(--muted); } .small { font-size: .875rem; }
.inline { display: inline; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: .95rem; }
label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; }
label.check input { margin-top: 4px; }
.hint { font-weight: 400; font-size: .8rem; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.row input[type=number] { width: 90px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
legend { font-weight: 500; font-size: .95rem; margin-bottom: 8px; width: 100%; }
.pill { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 400; }
.pill:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--brand); background: var(--brand);
  color: var(--brand-ink); font: inherit; font-weight: 600; border-radius: 999px; padding: 10px 20px; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.small { padding: 6px 14px; font-size: .9rem; }
.btn.big { padding: 14px 28px; font-size: 1.05rem; }
button.link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
button.link:hover { color: var(--brand); text-decoration: underline; }
button.link.danger, .link.danger { color: var(--danger); }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid var(--border); background: var(--surface); }
.flash-success { border-color: var(--ok); }
.flash-error { border-color: var(--danger); color: var(--danger); }
.flash-match { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; text-align: center; font-size: 1.1rem; }
.errors { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); border-radius: 10px; padding: 10px 14px 10px 32px; }

.gate { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.gate-card { max-width: 520px; text-align: center; }
.gate-actions { display: flex; flex-direction: column; gap: 10px; margin: 20px 0 8px; }

.hero { text-align: center; padding: 48px 0 32px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 600px; margin: 0 auto 24px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.filters input[type=number] { width: 76px; } .filters input[name=city] { width: 150px; }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.person { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.person-photo { display: block; aspect-ratio: 4 / 5; background: var(--brand-soft); }
.person-body { padding: 14px 16px 4px; flex: 1; }
.person-body h3 a { color: var(--text); }
.person-actions { display: flex; gap: 10px; padding: 12px 16px 16px; }
.person-actions form, .person-actions .btn { flex: 1; } .person-actions form .btn { width: 100%; }
.bio { white-space: pre-line; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 2px 0 0; }

.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar.cover { width: 100%; height: 100%; border-radius: 0; }
.avatar.placeholder { display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 1.2rem; }
.avatar.placeholder.cover { font-size: 4rem; aspect-ratio: 4 / 5; }

.gallery { display: grid; gap: 10px; }
.gallery img { width: 100%; border-radius: 10px; display: block; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.photo-grid.admin { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.photo { margin: 0; }
.photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.photo figcaption { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.upload { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .upload input { flex: 1; min-width: 0; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding: 2px 8px; border-radius: 999px; background: var(--border); }
.badge.approved { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.pending { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.rejected { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.plain { list-style: none; padding: 0; margin: 0; } .plain li { padding: 6px 0; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.danger-zone input { flex: 1; min-width: 160px; }
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 14px; }
.empty { text-align: center; padding: 40px 20px; }

.match-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.match-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; color: var(--text); padding: 14px 16px; min-width: 0; }
.match-row > div { min-width: 0; }
.match-row:hover { border-color: var(--brand); text-decoration: none; }

.chat { padding: 0; display: flex; flex-direction: column; height: calc(100vh - 170px); min-height: 420px; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-who { display: flex; align-items: center; gap: 12px; color: var(--text); }
.menu { position: relative; } .menu summary { list-style: none; font-size: 1.5rem; padding: 0 8px; }
.menu summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; right: 0; top: 36px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; display: grid; gap: 10px; min-width: 200px; box-shadow: var(--shadow); z-index: 3; }
.messages { list-style: none; margin: 0; padding: 16px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.messages li { max-width: 75%; }
.messages li p { margin: 0; padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.messages li time { display: block; font-size: .72rem; color: var(--muted); margin: 2px 8px 0; }
.messages .mine { align-self: flex-end; text-align: right; }
.messages .mine p { background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 6px; text-align: left; }
.messages .theirs p { background: var(--bg); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.messages .system { align-self: center; max-width: 90%; text-align: center; color: var(--muted); font-size: .9rem; }
.compose { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--border); }
.compose textarea { resize: none; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { display: block; font-size: 1.8rem; font-weight: 700; }
.report { margin-bottom: 12px; display: grid; gap: 10px; }
.report.urgent { border-color: var(--danger); }
.report input { width: 220px; }
blockquote { margin: 0; padding: 8px 14px; border-left: 3px solid var(--border); color: var(--muted); }
.convo li { padding: 3px 0; font-size: .9rem; }

.prose { max-width: 760px; margin: 0 auto; } .prose h2 { margin-top: 1.4em; }
.notice { background: var(--brand-soft); padding: 8px 12px; border-radius: 8px; font-size: .9rem; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px 40px; border-top: 1px solid var(--border); }
.footer p { margin: 4px 0; }
