/* ==========================================================================
   Sisonke — core stylesheet (no frameworks)
   ========================================================================== */

@font-face {
  font-family: "Bricolage";
  src: url("../fonts/bricolage-latin.woff2") format("woff2-variations"), url("../fonts/bricolage-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage";
  src: url("../fonts/bricolage-latin-ext.woff2") format("woff2-variations"), url("../fonts/bricolage-latin-ext.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* brand (overridable from Admin → Settings → Branding) */
  --brand: #d6247a;
  --brand-2: #ff5a5f;
  --deep: #5b1a6e;
  --gold: #f5b841;

  --grad: linear-gradient(135deg, var(--brand-2) 0%, var(--brand) 52%, var(--deep) 100%);
  --grad-soft: linear-gradient(135deg, color-mix(in srgb, var(--brand-2) 22%, transparent), color-mix(in srgb, var(--deep) 22%, transparent));

  --font-display: "Bricolage", ui-sans-serif, system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --r-xl: 28px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --r-pill: 999px;

  --side-w: 300px;
  --tab-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* dark (default) */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #160b1c;
  --bg-2: #1e1026;
  --surface: rgba(255, 255, 255, .055);
  --surface-2: rgba(255, 255, 255, .09);
  --surface-solid: #241430;
  --line: rgba(255, 255, 255, .1);
  --line-strong: rgba(255, 255, 255, .18);
  --text: #f7eef4;
  --muted: #b7a3bf;
  --faint: #7f6b88;
  --ok: #3ccf91;
  --warn: #f5b841;
  --danger: #ff5c7a;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, .7);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fbf5f8;
  --bg-2: #f4e9ef;
  --surface: #ffffff;
  --surface-2: #f6edf2;
  --surface-solid: #ffffff;
  --line: rgba(60, 20, 70, .1);
  --line-strong: rgba(60, 20, 70, .2);
  --text: #26122e;
  --muted: #6f5a78;
  --faint: #a493ab;
  --ok: #128a5b;
  --warn: #b7791f;
  --danger: #d6264d;
  --shadow: 0 18px 40px -22px rgba(70, 20, 80, .35);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--safe-top); }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 2.4vw + .9rem, 2.2rem); font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 1em; }
code { font-size: .9em; background: var(--surface-2); padding: .1em .4em; border-radius: 6px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.grow { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; border-radius: 6px; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic-fill { fill: currentColor; stroke: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- wordmark ---------- */
.wordmark {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  font: 750 1.35rem/1 var(--font-display); letter-spacing: -.03em;
}
.wordmark img { width: 32px; height: 32px; }
.wordmark-lg { font-size: 2rem; }
.wordmark-lg img { width: 44px; height: 44px; }

/* ---------- buttons ---------- */
.btn {
  --h: 46px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--h); padding: 0 20px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: var(--surface-2); color: var(--text);
  font-weight: 650; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .15s var(--ease), filter .15s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 26px -12px var(--brand); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-gold { background: linear-gradient(135deg, #ffd978, var(--gold) 60%, #d9902a); color: #2b1600; }
.btn-sm { --h: 36px; padding: 0 14px; font-size: .88rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.btn-icon { --h: 42px; width: var(--h); padding: 0; }

/* ---------- forms ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field small { color: var(--faint); font-size: .8rem; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 140px; }
.field.w-port { flex: 0 0 96px; }
.input {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--text);
  transition: border-color .15s, background .15s;
}
.input:focus { outline: none; border-color: var(--brand-2); background: var(--surface-2); }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 38px; }
.input[type="color"] { padding: 4px; min-height: 44px; width: 64px; }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: .92rem; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); margin-top: 1px; flex: none; }

/* segmented radio (gender, show me) */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  padding: 10px 16px; border-radius: var(--r-pill); border: 1px solid var(--line-strong);
  cursor: pointer; font-weight: 600; font-size: .92rem; transition: .15s;
}
.seg input:checked + label { background: var(--grad); border-color: transparent; color: #fff; }
.seg input:focus-visible + label { outline: 2px solid var(--brand-2); outline-offset: 2px; }

/* interest chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span, .tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); font-size: .9rem; cursor: pointer; user-select: none; transition: .15s;
}
.tag { cursor: default; background: var(--surface); }
.chip input:checked + span { border-color: var(--brand-2); background: color-mix(in srgb, var(--brand) 22%, transparent); }
.chip input:focus-visible + span { outline: 2px solid var(--brand-2); }

/* switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch b { display: block; font-weight: 600; }
.switch small { color: var(--muted); }
.switch input { appearance: none; width: 48px; height: 28px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line-strong); position: relative; flex: none; cursor: pointer; transition: .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch input:checked { background: var(--grad); border-color: transparent; }
.switch input:checked::after { transform: translateX(20px); }

/* range */
input[type="range"] { width: 100%; accent-color: var(--brand); }

/* ---------- flash ---------- */
.flash-stack { display: grid; gap: 8px; margin-bottom: 18px; }
.flash { padding: 12px 16px; border-radius: var(--r-md); font-size: .92rem; border: 1px solid; }
.flash-success { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.flash-error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.flash-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-pill); font-size: .75rem; font-weight: 700; background: var(--surface-2); }
.badge-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.badge-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge-danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.badge-brand { color: #fff; background: var(--grad); }
.verified { color: #4fa8ff; }

/* ==========================================================================
   Guest pages (landing, auth, installer)
   ========================================================================== */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px); }
.auth-art {
  position: relative; overflow: hidden; background: var(--grad); color: #fff;
  display: flex; align-items: flex-end; padding: 56px;
}
.auth-art::before {
  content: ""; position: absolute; inset: -30% -10% auto auto; width: 70%; aspect-ratio: 1;
  border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.28), transparent 65%);
}
.auth-art-inner { position: relative; max-width: 460px; }
.auth-art .wordmark { color: #fff; }
.auth-art-line { font: 600 clamp(1.8rem, 3vw, 2.8rem)/1.08 var(--font-display); letter-spacing: -.03em; margin: 28px 0 0; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: calc(32px + var(--safe-top)) 24px calc(32px + var(--safe-bottom)); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { margin-bottom: 8px; }
.lede { color: var(--muted); font-size: 1rem; }
.auth-switch { margin-top: 22px; text-align: center; color: var(--muted); font-size: .92rem; }
.auth-switch a { color: var(--text); font-weight: 650; }
.actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

.install-steps { list-style: none; margin: 36px 0 0; padding: 0; display: grid; gap: 12px; }
.install-steps li { display: flex; align-items: center; gap: 12px; opacity: .6; font-weight: 600; }
.install-steps li span { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.7); display: grid; place-items: center; font-size: .8rem; }
.install-steps li.current, .install-steps li.done { opacity: 1; }
.install-steps li.current span { background: #fff; color: var(--brand); border-color: #fff; }
.install-steps li.done span { background: rgba(255,255,255,.25); border-color: transparent; }
.req-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 2px; }
.req-list li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.req-list b { width: 22px; flex: none; }
.req-list .pass b { color: var(--ok); }
.req-list .fail b { color: var(--danger); }
.req-list small { display: block; color: var(--muted); }
.summary { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 0 0 18px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; word-break: break-all; }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: calc(28px + var(--safe-top)) 24px 28px; min-height: 0; }
  .auth-art-line { font-size: 1.5rem; margin-top: 14px; }
  .install-steps { display: none; }
}

/* ---------- landing ---------- */
.landing { min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; }
.landing-nav { display: flex; align-items: center; justify-content: space-between; padding: calc(18px + var(--safe-top)) clamp(18px, 4vw, 48px) 18px; }
.landing-nav nav { display: flex; gap: 10px; }
.hero {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); align-items: center;
  gap: clamp(24px, 5vw, 80px); padding: 24px clamp(18px, 4vw, 48px) 64px; max-width: 1240px; width: 100%; margin: 0 auto;
}
.hero h1 {
  font-size: clamp(2.6rem, 6.4vw, 5.6rem); font-weight: 800; line-height: .95; letter-spacing: -.045em; margin-bottom: 22px;
}
.hero p { font-size: clamp(1rem, 1.2vw, 1.2rem); color: var(--muted); max-width: 46ch; }
.hero .actions { margin-top: 26px; }
.hero .btn { --h: 54px; padding: 0 28px; font-size: 1.02rem; }

.stack { position: relative; height: min(560px, 70vh); min-height: 420px; }
.stack-card {
  position: absolute; inset: 0 auto auto 50%; width: min(330px, 78vw); aspect-ratio: 3 / 4.3;
  border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 22px; color: #fff;
  transform-origin: 50% 110%;
}
.stack-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 45%, rgba(10,0,15,.75)); }
.stack-card > * { position: relative; z-index: 1; }
.stack-card b { font: 700 1.6rem/1.1 var(--font-display); }
.stack-card span { opacity: .85; font-size: .92rem; }
.stack-card .face { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; }
.stack-card:not(:last-child) > b, .stack-card:not(:last-child) > span { opacity: 0; }
.stack-card:nth-child(1) { transform: translateX(-50%) rotate(-9deg) translate(-40px, 26px); background: #3a1d4a; }
.stack-card:nth-child(2) { transform: translateX(-50%) rotate(5deg) translate(34px, 8px); background: #6b2150; }
.stack-card:nth-child(3) { transform: translateX(-50%); background: #2a1435; animation: nudge 5s var(--ease) infinite; }
@keyframes nudge {
  0%, 70%, 100% { transform: translateX(-50%) rotate(0); }
  78% { transform: translateX(-50%) translateX(24px) rotate(4deg); }
  86% { transform: translateX(-50%) translateX(-6px) rotate(-1deg); }
}
.stamp {
  position: absolute; top: 28px; left: 22px; z-index: 2; padding: 4px 12px; border: 3px solid var(--ok); color: var(--ok);
  font: 800 1.3rem/1 var(--font-display); border-radius: 8px; transform: rotate(-14deg); letter-spacing: .02em;
}
.landing-feats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.landing-feats div { background: var(--bg); padding: 28px clamp(18px, 4vw, 48px); }
.landing-feats h3 { font-size: 1.1rem; margin-bottom: 6px; }
.landing-feats p { color: var(--muted); margin: 0; max-width: 34ch; }
.landing-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 22px clamp(18px, 4vw, 48px) calc(22px + var(--safe-bottom)); color: var(--faint); font-size: .86rem; border-top: 1px solid var(--line); }
.landing-foot a { color: var(--muted); margin-left: 16px; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; text-align: left; padding-top: 8px; }
  .stack { height: 360px; min-height: 0; order: -1; margin-bottom: 12px; }
  .stack-card { width: min(250px, 62vw); }
  .landing-feats { grid-template-columns: 1fr; }
}

/* ---------- static pages / errors ---------- */
.page-plain { max-width: 760px; margin: 0 auto; padding: calc(28px + var(--safe-top)) 22px 60px; }
.page-plain .prose { white-space: pre-line; color: var(--muted); }
.error-page { min-height: 100dvh; display: grid; place-items: center; text-align: center; padding: 24px; }
.error-code { font: 800 clamp(5rem, 18vw, 9rem)/1 var(--font-display); background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: -.05em; }

/* ==========================================================================
   App shell — desktop behaves like a website, mobile like a native app
   ========================================================================== */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--bg-2);
}
.side-head {
  display: flex; align-items: center; gap: 12px; padding: 18px 18px; background: var(--grad); color: #fff; text-decoration: none;
}
.side-head .avatar { border: 2px solid rgba(255,255,255,.7); }
.side-head b { display: block; font: 650 1.02rem/1.2 var(--font-display); }
.side-head small { opacity: .85; }
.side-nav { display: grid; gap: 2px; padding: 14px 10px; }
.side-nav a, .side-nav button {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r-md);
  text-decoration: none; color: var(--muted); font-weight: 600; border: 0; background: none; width: 100%; text-align: left; cursor: pointer;
}
.side-nav a:hover, .side-nav button:hover { background: var(--surface); color: var(--text); }
.side-nav a.active { background: var(--surface-2); color: var(--text); }
.side-nav a.active .ic { color: var(--brand-2); }
.side-foot { margin-top: auto; padding: 16px; display: grid; gap: 10px; }
.side-promo { border-radius: var(--r-lg); padding: 16px; background: var(--grad-soft); border: 1px solid var(--line); }
.side-promo b { font-family: var(--font-display); display: block; margin-bottom: 4px; }
.side-promo p { color: var(--muted); font-size: .85rem; margin: 0 0 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
#view { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 32px clamp(18px, 3vw, 40px) 48px; }
#view.is-loading { opacity: .55; transition: opacity .15s; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none;
  display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 700; font-size: .95rem;
}
.avatar-sm { width: 34px; height: 34px; font-size: .8rem; }
.avatar-lg { width: 96px; height: 96px; font-size: 1.6rem; }

.tabbar { display: none; }

@media (max-width: 899px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 30;
    padding: calc(10px + var(--safe-top)) 16px 10px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .wordmark { font-size: 1.25rem; }
  .topbar .wordmark img { width: 28px; height: 28px; }
  .topbar-actions { display: flex; gap: 6px; }
  .topbar-actions a { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
  .topbar-actions a.gold { color: var(--gold); }
  #view { padding: 18px 16px calc(var(--tab-h) + var(--safe-bottom) + 24px); }
  .page-head { margin-bottom: 16px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(var(--tabs, 4), 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--tab-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
    background: color-mix(in srgb, var(--bg-2) 88%, transparent);
    backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
    border-top: 1px solid var(--line);
  }
  .tabbar a { display: grid; place-items: center; align-content: center; gap: 2px; color: var(--faint); text-decoration: none; font-size: .68rem; font-weight: 600; }
  .tabbar a .ic { width: 26px; height: 26px; }
  .tabbar a.active { color: var(--brand-2); }
  .tabbar a.active .ic { fill: color-mix(in srgb, var(--brand-2) 25%, transparent); }
  /* native feel: no text selection on chrome, momentum scrolling */
  .tabbar, .topbar { user-select: none; -webkit-user-select: none; }
  body.app { overscroll-behavior-y: none; }
}

/* standalone PWA tweaks */
@media (display-mode: standalone) {
  body.app { user-select: none; -webkit-user-select: none; }
  body.app input, body.app textarea { user-select: text; -webkit-user-select: text; }
}

/* ---------- discover ---------- */
.discover { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 32px; align-items: start; }
.profile-card {
  position: relative; aspect-ratio: 3 / 4.2; border-radius: var(--r-xl); overflow: hidden; background: var(--surface-solid);
  box-shadow: var(--shadow); color: #fff;
}
.profile-card img { width: 100%; height: 100%; object-fit: cover; }
.profile-card .ph-empty { position: absolute; inset: 0; display: grid; place-items: center; background: var(--grad); font: 800 4.5rem/1 var(--font-display); }
.profile-card .meta { position: absolute; inset: auto 0 0 0; padding: 70px 20px 20px; background: linear-gradient(transparent, rgba(12,2,18,.85)); }
.profile-card .meta b { font: 700 1.7rem/1.1 var(--font-display); }
.profile-card .meta b small { font-weight: 400; font-size: 1.4rem; }
.profile-card .meta p { margin: 6px 0 0; opacity: .85; font-size: .92rem; }
.swipe-actions { display: flex; justify-content: center; gap: 16px; margin-top: 18px; }
.swipe-btn { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); background: var(--surface); }
.swipe-btn.sm { width: 48px; height: 48px; }
.swipe-btn.nope { color: var(--danger); }
.swipe-btn.super { color: #4fa8ff; }
.swipe-btn.like { color: var(--ok); }
.swipe-btn.rewind { color: var(--gold); }
.swipe-btn .ic { width: 28px; height: 28px; }
.swipe-btn.sm .ic { width: 22px; height: 22px; }
@media (max-width: 899px) {
  .discover { grid-template-columns: 1fr; gap: 20px; }
  .profile-card { max-width: 440px; margin: 0 auto; width: 100%; }
}

.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.checklist li .dot { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; flex: none; }
.checklist li.done { color: var(--muted); }
.checklist li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.checklist li.done .dot .ic { width: 14px; height: 14px; stroke-width: 3; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 10px 0 16px; }
.progress span { display: block; height: 100%; background: var(--grad); border-radius: inherit; }

.empty { text-align: center; padding: 48px 20px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-xl); }
.empty .ic { width: 44px; height: 44px; color: var(--brand-2); margin-bottom: 10px; }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 40ch; margin: 0 auto 18px; }

.likes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.likes-grid .ghost { aspect-ratio: 3/4; border-radius: var(--r-lg); background: var(--grad-soft); border: 1px solid var(--line); filter: blur(.5px); }

/* ---------- profile ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.slot {
  position: relative; aspect-ratio: 3 / 4; border-radius: var(--r-md); overflow: hidden;
  border: 1.5px dashed var(--line-strong); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; color: var(--faint);
}
.slot.filled { border-style: solid; border-color: transparent; cursor: grab; }
.slot.filled img { width: 100%; height: 100%; object-fit: cover; }
.slot.locked { cursor: not-allowed; opacity: .45; }
.slot.dragging { opacity: .4; }
.slot.over { outline: 2px solid var(--brand-2); }
.slot .del {
  position: absolute; right: 6px; bottom: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.slot .del .ic { width: 16px; height: 16px; }
.slot .first { position: absolute; left: 6px; top: 6px; }
.slot .pend { position: absolute; left: 6px; bottom: 6px; }
.slot.uploading::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.45) ; }
.slot.uploading::before { content: ""; position: absolute; width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .8s linear infinite; z-index: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.slot .plus { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; }
.slot .plus .ic { width: 18px; height: 18px; stroke-width: 2.6; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: 24px; align-items: start; }
@media (max-width: 960px) { .two-col { grid-template-columns: 1fr; } }

.profile-hero { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.profile-hero h1 { margin: 0; }
@media (max-width: 560px) {
  .profile-hero { flex-wrap: wrap; }
  .profile-hero > .btn { width: 100%; }
}
.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.facts li { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.facts .ic { color: var(--brand-2); width: 20px; height: 20px; }

/* ---------- premium ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.plan { position: relative; border-radius: var(--r-lg); padding: 22px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.plan::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; border-radius: var(--r-lg) var(--r-lg) 0 0; background: var(--plan, var(--brand)); }
.plan.current { border-color: var(--plan); box-shadow: 0 0 0 1px var(--plan) inset; }
.plan h3 { font-size: 1.25rem; margin: 6px 0 0; }
.plan .price { font: 750 1.8rem/1.1 var(--font-display); margin: 6px 0; }
.plan .price small { font: 500 .85rem var(--font-body); color: var(--muted); }
.plan p { color: var(--muted); font-size: .9rem; margin: 0 0 12px; flex: 1; }
.matrix-wrap { overflow-x: auto; margin-top: 22px; border: 1px solid var(--line); border-radius: var(--r-lg); }
.matrix { width: 100%; border-collapse: collapse; min-width: 560px; }
.matrix th, .matrix td { padding: 12px 14px; text-align: center; border-bottom: 1px solid var(--line); font-size: .9rem; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix thead th { font-family: var(--font-display); font-size: .95rem; }
.matrix tr:last-child td { border-bottom: 0; }
.matrix .yes { color: var(--ok); }
.matrix .no { color: var(--faint); }

/* ---------- settings ---------- */
.range-out { font-weight: 700; color: var(--text); }

/* ==========================================================================
   Admin
   ========================================================================== */
.admin .sidebar { background: var(--bg-2); }
.admin-brand { display: flex; align-items: center; justify-content: space-between; padding: 18px; border-bottom: 1px solid var(--line); }
.admin-brand small { color: var(--faint); font-weight: 600; }
.admin #view { max-width: 1200px; }
.admin .topbar-title { font: 650 1.05rem var(--font-display); }
.admin-menu-toggle { display: none; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.stat b { display: block; font: 750 2rem/1 var(--font-display); margin-bottom: 6px; }
.stat span { color: var(--muted); font-size: .88rem; }
.stat.hot { background: var(--grad); color: #fff; border: 0; }
.stat.hot span { color: rgba(255,255,255,.85); }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.bars div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bars i { display: block; width: 100%; min-height: 3px; border-radius: 6px 6px 2px 2px; background: var(--grad); }
.bars small { color: var(--faint); font-size: .66rem; white-space: nowrap; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .who { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.table .who b { display: block; }
.table .who small { color: var(--muted); }
.table tr.clickable:hover td { background: var(--surface); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .input { min-height: 42px; }
.toolbar .search { flex: 1 1 220px; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--text); border-bottom-color: var(--brand-2); }

.limits { display: grid; gap: 0; }
.limit-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.limit-row:last-child { border-bottom: 0; }
.limit-row b { display: block; font-weight: 600; }
.limit-row small { color: var(--muted); }
.limit-row .src { font-size: .7rem; margin-left: 6px; }
.limit-ctrl { display: flex; align-items: center; gap: 12px; }
.limit-ctrl .input { width: 96px; min-height: 40px; text-align: center; }
.limit-ctrl .check { font-size: .85rem; white-space: nowrap; }
.limit-row .switch { border: 0; padding: 0; }

.addon-list { display: grid; gap: 12px; }
.addon { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.addon .glyph { width: 52px; height: 52px; border-radius: var(--r-md); background: var(--grad-soft); display: grid; place-items: center; color: var(--brand-2); }
.addon h3 { margin: 0 0 2px; }
.addon p { margin: 0; color: var(--muted); font-size: .9rem; }
.addon .err { color: var(--danger); font-size: .85rem; margin-top: 6px; }
.addon-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dropzone { display: grid; place-items: center; gap: 8px; text-align: center; padding: 28px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); cursor: pointer; transition: .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand-2); background: var(--surface); }
.dropzone .ic { width: 36px; height: 36px; color: var(--brand-2); }
@media (max-width: 640px) {
  .addon { grid-template-columns: 44px minmax(0, 1fr); }
  .addon .glyph { width: 44px; height: 44px; }
  .addon-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

.photo-queue { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.photo-queue figure { margin: 0; border-radius: var(--r-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.photo-queue img { aspect-ratio: 3/4; object-fit: cover; width: 100%; }
.photo-queue figcaption { padding: 10px; display: grid; gap: 8px; }
.photo-queue .row { display: flex; gap: 6px; }
.photo-queue .row form { flex: 1; }

@media (max-width: 899px) {
  .admin .sidebar {
    display: flex; position: fixed; inset: 0 auto 0 0; width: min(300px, 84vw); z-index: 60;
    transform: translateX(-102%); transition: transform .25s var(--ease); padding-top: var(--safe-top);
  }
  .admin.menu-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .admin.menu-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; }
  .admin-menu-toggle { display: grid; }
  .admin #view { padding-bottom: calc(32px + var(--safe-bottom)); }
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translate(-50%, 20px); opacity: 0;
  background: var(--surface-solid); color: var(--text); border: 1px solid var(--line-strong);
  padding: 12px 18px; border-radius: var(--r-pill); box-shadow: var(--shadow); z-index: 100; transition: .25s var(--ease);
  max-width: calc(100vw - 32px); font-size: .92rem;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--danger); color: var(--danger); }
@media (max-width: 899px) { body.app .toast { bottom: calc(var(--tab-h) + var(--safe-bottom) + 14px); } }

/* ==========================================================================
   Phase 2 — swipe deck, likes, matches
   ========================================================================== */
.side-nav .badge { margin-left: auto; }
.tab-ic { position: relative; display: grid; }
.tab-dot { position: absolute; top: -1px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand-2); border: 2px solid var(--bg-2); }

.deck-layout { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 300px); gap: 36px; justify-content: center; align-items: start; }
.deck-wrap { display: flex; flex-direction: column; gap: 18px; }
.deck { position: relative; height: min(640px, calc(100dvh - 190px)); min-height: 440px; }
.deck-actions { display: flex; justify-content: center; align-items: center; gap: 18px; }
.deck-wrap.is-empty .deck-actions { visibility: hidden; }
.swipe-btn { cursor: pointer; color: inherit; transition: transform .15s var(--ease), background .15s, box-shadow .15s; box-shadow: var(--shadow); }
.swipe-btn:hover { transform: scale(1.08); }
.swipe-btn:active { transform: scale(.92); }
.swipe-btn.like:hover { background: color-mix(in srgb, var(--ok) 16%, transparent); }
.swipe-btn.nope:hover { background: color-mix(in srgb, var(--danger) 16%, transparent); }
.swipe-btn.super:hover { background: rgba(79, 168, 255, .16); }
.swipe-btn.locked { opacity: .55; }

.deck-side .card + .card { margin-top: 14px; }
.meter { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; margin: 0; font-size: .92rem; }
.meter dt { color: var(--muted); }
.meter dd { margin: 0; font-weight: 700; text-align: right; }
.keys ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr; gap: 8px; font-size: .88rem; color: var(--muted); }
kbd { display: inline-grid; place-items: center; min-width: 28px; height: 26px; padding: 0 6px; margin-right: 6px; border-radius: 7px; border: 1px solid var(--line-strong); border-bottom-width: 2px; font: 600 .78rem var(--font-body); color: var(--text); }

.deck-loading, .deck-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; gap: 6px; padding: 24px; }
.deck-empty h2 { margin: 18px 0 4px; }
.deck-empty p, .deck-loading p { color: var(--muted); max-width: 32ch; margin: 0 0 14px; }
.deck-loading[hidden], .deck-empty[hidden] { display: none; }
.pulse { position: relative; width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 8px; }
.pulse img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; position: relative; z-index: 1; border: 3px solid var(--bg); background: var(--grad); }
.pulse::before, .pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--brand); opacity: .5; animation: ripple 2.4s ease-out infinite; }
.pulse::after { animation-delay: 1.2s; }
@keyframes ripple { from { transform: scale(1); opacity: .45; } to { transform: scale(2.6); opacity: 0; } }

.sw-card {
  position: absolute; inset: 0; border-radius: var(--r-xl); overflow: hidden; background: var(--surface-solid);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .75); color: #fff; touch-action: none; user-select: none; -webkit-user-select: none;
  transition: transform .3s var(--ease); will-change: transform; cursor: grab;
}
.sw-card:active { cursor: grabbing; }
.sw-card.is-next { transform: scale(.94); pointer-events: none; }
.sw-card.is-next .sw-meta, .sw-card.is-next .sw-bars, .sw-card.is-next .sw-flag { opacity: 0; }
.sw-card.sw-in { animation: swIn .42s var(--ease); }
@keyframes swIn { from { transform: translateY(-40px) scale(.9) rotate(-6deg); opacity: 0; } }
.sw-card.bump-left { animation: bumpL .22s; }
.sw-card.bump-right { animation: bumpR .22s; }
@keyframes bumpL { 50% { transform: perspective(900px) rotateY(-5deg); } }
@keyframes bumpR { 50% { transform: perspective(900px) rotateY(5deg); } }

.sw-photo, .sw-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.sw-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.25), transparent 18%, transparent 50%, rgba(10, 0, 16, .88)); }
.sw-bars { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 4px; z-index: 2; }
.sw-bars i { flex: 1; height: 4px; border-radius: 4px; background: rgba(255,255,255,.35); }
.sw-bars i.on { background: #fff; }

.sw-stamp {
  position: absolute; top: 78px; z-index: 3; padding: 4px 14px; border: 4px solid; border-radius: 10px; opacity: 0;
  font: 800 2.1rem/1 var(--font-display); letter-spacing: .02em; pointer-events: none;
}
.sw-stamp.like { left: 26px; color: var(--ok); border-color: var(--ok); transform: rotate(-16deg); }
.sw-stamp.nope { right: 26px; color: var(--danger); border-color: var(--danger); transform: rotate(16deg); }
.sw-stamp.super { left: 50%; top: auto; bottom: 34%; color: #4fa8ff; border-color: #4fa8ff; transform: translateX(-50%) rotate(-8deg); font-size: 1.7rem; white-space: nowrap; }
.sw-flag { position: absolute; top: 24px; left: 12px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: #2f8ff0; font-weight: 700; font-size: .82rem; }
.sw-flag .ic { width: 16px; height: 16px; }

.sw-meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 20px 22px; z-index: 2; }
.sw-name { font: 750 1.9rem/1.1 var(--font-display); letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-right: 52px; }
.sw-name span { font-weight: 400; }
.sw-name .verified { width: 24px; height: 24px; }
.sw-active { display: flex; align-items: center; gap: 6px; font-size: .85rem; margin-top: 6px; }
.sw-active i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.sw-line { display: flex; align-items: center; gap: 8px; margin-top: 6px; opacity: .9; font-size: .95rem; }
.sw-line .ic { width: 18px; height: 18px; }
.sw-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sw-chip { padding: 5px 11px; border-radius: 99px; background: rgba(255,255,255,.16); backdrop-filter: blur(6px); font-size: .82rem; }
.sw-chip.shared, .tag.shared { background: color-mix(in srgb, var(--brand) 55%, transparent); border-color: transparent; }
.sw-info { position: absolute; right: 18px; bottom: 24px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #fff; color: #1e1026; display: grid; place-items: center; cursor: pointer; }
.sw-info .ic { width: 20px; height: 20px; stroke-width: 2.6; }

.sw-details {
  position: absolute; inset: 0; z-index: 4; overflow-y: auto; padding: 26px 22px 30px; background: var(--surface-solid); color: var(--text);
  transform: translateY(102%); transition: transform .3s var(--ease); touch-action: pan-y;
}
.sw-card.expanded .sw-details { transform: none; }
.sw-card.expanded { cursor: default; }
.sw-details h3 { font-size: 1.5rem; margin-bottom: 12px; }
.sw-bio { white-space: pre-line; color: var(--text); }
.sw-details .facts { margin: 14px 0; }
.sw-details .chips { margin: 14px 0; }
.sw-close { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; }

/* modals */
.sx-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: rgba(10, 2, 16, .72); backdrop-filter: blur(10px); opacity: 0; transition: opacity .25s; }
.sx-modal.open { opacity: 1; }
.sx-modal-inner { width: 100%; max-width: 380px; text-align: center; display: grid; gap: 10px; padding: 28px 24px; border-radius: var(--r-xl); background: var(--surface-solid); border: 1px solid var(--line); transform: translateY(16px) scale(.97); transition: transform .3s var(--ease); }
.sx-modal.open .sx-modal-inner { transform: none; }
.sx-modal p { color: var(--muted); margin: 0 0 8px; }
.sx-modal.match { background: var(--grad); }
.sx-modal.match .sx-modal-inner { background: transparent; border: 0; color: #fff; }
.sx-modal.match p { color: rgba(255,255,255,.88); }
.sx-modal.match .btn-ghost { border-color: rgba(255,255,255,.5); color: #fff; }
.mm-title { font: 800 clamp(2.4rem, 9vw, 3.4rem)/1 var(--font-display); letter-spacing: -.04em; margin: 0; transform: rotate(-4deg); }
.mm-pics { display: flex; justify-content: center; margin: 18px 0 22px; }
.mm-pics img { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; border: 4px solid #fff; box-shadow: var(--shadow); }
.mm-pics img + img { margin-left: -22px; }
.sx-modal.open .mm-pics img:first-child { animation: inL .5s var(--ease); }
.sx-modal.open .mm-pics img:last-child { animation: inR .5s var(--ease); }
@keyframes inL { from { transform: translateX(-60px); opacity: 0; } }
@keyframes inR { from { transform: translateX(60px); opacity: 0; } }
.mm-crown { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 6px; display: grid; place-items: center; background: linear-gradient(135deg, #ffd978, var(--gold)); color: #2b1600; }
.mm-crown .ic { width: 30px; height: 30px; }

/* likes & matches */
.likes-grid, .match-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.like-tile, .match-tile { position: relative; aspect-ratio: 3 / 4; border-radius: var(--r-lg); overflow: hidden; background: var(--grad-soft); color: #fff; text-decoration: none; display: block; }
.like-tile > a { position: absolute; inset: 0; text-decoration: none; color: #fff; }
.like-tile img, .match-tile img { width: 100%; height: 100%; object-fit: cover; }
.like-tile::after, .match-tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 50%, rgba(10,0,16,.85)); pointer-events: none; }
.like-name { position: absolute; left: 12px; bottom: 12px; right: 12px; z-index: 1; font: 700 1.05rem/1.2 var(--font-display); }
.match-tile small { position: absolute; left: 12px; bottom: -2px; z-index: 1; opacity: .8; font-size: .75rem; transform: translateY(-10px); }
.match-tile .like-name { bottom: 26px; }
.match-tile .badge, .like-tile .super-badge { position: absolute; top: 10px; left: 10px; z-index: 1; }
.match-tile .avatar { width: 100%; height: 100%; border-radius: 0; font-size: 2.5rem; }
.super-badge { background: #2f8ff0; color: #fff; }
.super-badge .ic { width: 14px; height: 14px; }
.like-actions { position: absolute; z-index: 2; right: 8px; top: 8px; display: grid; gap: 8px; }
.like-actions .swipe-btn { width: 40px; height: 40px; background: rgba(20, 8, 26, .7); backdrop-filter: blur(6px); border-color: rgba(255,255,255,.2); }
.like-actions .swipe-btn .ic { width: 20px; height: 20px; }
.like-tile.blurred img { filter: blur(14px) saturate(1.2); transform: scale(1.25); image-rendering: auto; }
.likes-grid.locked { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

/* person */
.person { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 28px; align-items: start; }
.person-photos { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--r-xl); aspect-ratio: 3 / 4; background: var(--surface); scrollbar-width: none; }
.person-photos::-webkit-scrollbar { display: none; }
.person-photos img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: start; }
@media (max-width: 860px) {
  .person { grid-template-columns: 1fr; gap: 18px; }
  .person-photos { margin: -18px -16px 0; border-radius: 0; }
}

/* mobile: the deck fills the screen between top bar and tab bar */
@media (max-width: 899px) {
  .deck-layout { grid-template-columns: 1fr; gap: 0; }
  .deck-side { display: none; }
  .main:has(#view[data-page="discover"] .deck-wrap) { height: 100dvh; }
  #view[data-page="discover"]:has(.deck-wrap) { display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 10px 10px calc(var(--tab-h) + var(--safe-bottom) + 10px); }
  #view[data-page="discover"] .deck-layout { flex: 1; min-height: 0; display: flex; align-items: stretch; }
  #view[data-page="discover"] .deck-wrap { flex: 1; min-height: 0; gap: 12px; }
  #view[data-page="discover"] .deck { flex: 1; height: auto; min-height: 0; }
  .sw-card { border-radius: var(--r-lg); }
  .deck-actions { gap: 14px; }
}

/* ==========================================================================
   Phase 3 — messages & chat
   ========================================================================== */
.avatar-md { width: 56px; height: 56px; }
.avatar-xl { width: 76px; height: 76px; font-size: 1.4rem; }

.new-matches { margin-bottom: 24px; }
.nm-row { display: flex; gap: 16px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.nm-row::-webkit-scrollbar { display: none; }
.nm { display: grid; justify-items: center; gap: 6px; text-decoration: none; font-weight: 600; font-size: .88rem; flex: none; width: 82px; text-align: center; }
.nm .avatar { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--brand-2); }
.nm span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 82px; }

.inbox { list-style: none; padding: 0; margin: 0; }
.inbox a { display: flex; align-items: center; gap: 14px; padding: 12px 10px; border-radius: var(--r-md); text-decoration: none; }
.inbox a:hover { background: var(--surface); }
.inbox-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.inbox-main b { display: flex; align-items: center; gap: 6px; font-weight: 650; }
.inbox-main .verified { width: 18px; height: 18px; }
.inbox-preview { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; }
.inbox a.unread .inbox-preview { color: var(--text); font-weight: 600; }
.inbox-meta { display: grid; justify-items: end; gap: 6px; flex: none; }
.inbox-meta small { color: var(--faint); font-size: .75rem; }

/* chat */
.chat { display: flex; flex-direction: column; height: calc(100dvh - 64px); max-width: 760px; margin: -32px auto -48px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); background: var(--bg); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg-2) 88%, transparent); backdrop-filter: blur(14px); }
.chat-back { display: none; }
.chat-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-decoration: none; }
.chat-who b { display: flex; align-items: center; gap: 6px; font: 650 1.02rem var(--font-display); }
.chat-who .verified { width: 18px; height: 18px; }
.chat-who small { color: var(--muted); font-size: .8rem; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 18px 16px 8px; overscroll-behavior: contain; }
.chat-intro { display: grid; justify-items: center; gap: 8px; padding: 18px 0 26px; text-align: center; color: var(--muted); font-size: .9rem; }
.chat-intro p { margin: 0; }
.chat-list { display: flex; flex-direction: column; gap: 3px; }
.day { align-self: center; margin: 14px 0 8px; font-size: .75rem; font-weight: 600; color: var(--faint); }
.msg { display: flex; flex-direction: column; max-width: min(78%, 480px); }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.bubble { padding: 10px 14px; border-radius: 20px; line-height: 1.42; word-wrap: break-word; overflow-wrap: anywhere; font-size: .97rem; }
.msg.theirs .bubble { background: var(--surface-2); border-bottom-left-radius: 6px; }
.msg.mine .bubble { background: var(--grad); color: #fff; border-bottom-right-radius: 6px; }
.bubble a { color: inherit; text-decoration: underline; }
.msg.pending { opacity: .65; }
.msg.failed .bubble { outline: 2px solid var(--danger); }
.msg .meta { font-size: .7rem; color: var(--faint); margin: 3px 6px 8px; }
.bubble.photo { padding: 0; overflow: hidden; background: none !important; }
.bubble.photo img { width: 240px; max-width: 100%; max-height: 320px; object-fit: cover; border-radius: 18px; background: var(--surface-2); min-height: 120px; }
.bubble.voice { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.vp { width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: rgba(255,255,255,.22); color: inherit; flex: none; }
.msg.theirs .vp { background: var(--grad); color: #fff; }
.vp .ic { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.vbar { flex: 1; height: 4px; border-radius: 4px; background: rgba(255,255,255,.3); overflow: hidden; }
.msg.theirs .vbar { background: var(--line-strong); }
.vbar i { display: block; height: 100%; width: 0; background: currentColor; transition: width .2s linear; }
.bubble.voice small { font-size: .78rem; opacity: .85; font-variant-numeric: tabular-nums; }

.typing { display: inline-flex; gap: 4px; padding: 12px 14px; border-radius: 20px; border-bottom-left-radius: 6px; background: var(--surface-2); margin-top: 4px; }
.typing[hidden] { display: none; }
.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; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.composer { position: relative; display: flex; align-items: flex-end; gap: 6px; padding: 10px 12px calc(10px + var(--safe-bottom)); border-top: 1px solid var(--line); background: var(--bg-2); }
.composer textarea { flex: 1; min-height: 44px; max-height: 140px; resize: none; border-radius: 22px; padding: 11px 16px; line-height: 1.4; }
.composer .btn-icon { flex: none; }
.chat [data-send-btn] { display: none; }
.chat.has-text [data-send-btn] { display: inline-flex; }
.chat.has-text [data-record] { display: none; }
.recorder { position: absolute; inset: 0; display: flex; align-items: center; gap: 12px; padding: 0 14px calc(var(--safe-bottom)); background: var(--bg-2); }
.recorder[hidden] { display: none; }
.recorder [data-rec-time] { flex: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }

.sheet { border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface-solid); color: var(--text); padding: 26px 22px; width: min(440px, calc(100vw - 24px)); max-height: 90dvh; }
.sheet::backdrop { background: rgba(10, 2, 16, .7); backdrop-filter: blur(6px); }
.sheet-close { position: absolute; top: 12px; right: 12px; }
.radio-list { display: grid; gap: 10px; }
.radio-list .check input { accent-color: var(--brand); }

.evidence { display: grid; gap: 10px; max-height: 520px; overflow-y: auto; }
.ev { padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); }
.ev.ev-them { border-left: 3px solid var(--danger); }
.ev small { color: var(--muted); }
.ev p { margin: 4px 0 0; white-space: pre-line; }

@media (max-width: 899px) {
  /* chat is full-screen on phones: hide the app chrome */
  .shell:has(#view[data-page="chat"]) .topbar,
  .shell:has(#view[data-page="chat"]) .tabbar { display: none; }
  .main:has(#view[data-page="chat"]) { height: 100dvh; }
  #view[data-page="chat"] { padding: 0; display: flex; flex-direction: column; min-height: 0; }
  #view[data-page="chat"] > .flash-stack { margin: 8px; }
  .chat { flex: 1; min-height: 0; height: auto; margin: 0; border: 0; }
  .chat-head { padding-top: calc(10px + var(--safe-top)); }
  .chat-back { display: inline-flex; }
}
@media (min-width: 900px) {
  #view[data-page="chat"] { padding-top: 0; padding-bottom: 0; }
  .chat { height: 100dvh; margin: 0 auto; }

}
#view[data-page="chat"] > .ann { display: none; }
