:root,
html[data-theme="mist"] {
  color-scheme: light;
  --bg: #e9ebf3;
  --bg-2: #f6f7fb;
  --ink: #32344a;
  --muted: #6d7084;
  --line: rgba(50, 52, 74, 0.12);
  --lime: #7d82c4;
  --coral: #c9899a;
  --card: #f6f7fb;
  --shadow: 0 16px 40px rgba(50, 52, 80, 0.08);
  --on-accent: #ffffff;
  --on-danger: #fff8f5;
  --pass: #dfe1ea;
  --photo: #d4d6e0;
  --glow-1: rgba(125, 130, 196, 0.22);
  --glow-2: rgba(201, 137, 154, 0.16);
  --accent-soft: rgba(125, 130, 196, 0.16);
  --accent-line: rgba(125, 130, 196, 0.38);
  --on-photo: #f4f5fb;
  --on-photo-muted: #c8cad6;
  --overlay: rgba(36, 38, 56, 0.72);
  --tip: #f6f7fb;
  --chrome: #e9ebf3;
  --btn: #3e457e;
  --on-btn: #ffffff;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;

  /* Standardized Container Widths */
  --container-form: 390px;
  --container-app: 540px;
  --container-page: 720px;
  --container-admin: 960px;
  --layout-gutter: 16px;
}

html[data-theme="pastel"] {
  color-scheme: light;
  --bg: #f3eee6;
  --bg-2: #fffaf4;
  --ink: #3f372f;
  --muted: #7a7066;
  --line: rgba(63, 55, 47, 0.12);
  --lime: #8fa86e;
  --coral: #d4897a;
  --card: #fffaf4;
  --shadow: 0 16px 40px rgba(90, 72, 52, 0.08);
  --on-accent: #243018;
  --on-danger: #fff8f5;
  --pass: #e6ddd2;
  --photo: #ddd4c8;
  --glow-1: rgba(175, 190, 140, 0.32);
  --glow-2: rgba(220, 168, 154, 0.2);
  --accent-soft: rgba(143, 168, 110, 0.16);
  --accent-line: rgba(143, 168, 110, 0.38);
  --on-photo: #f7f1e8;
  --on-photo-muted: #d5cbbd;
  --overlay: rgba(48, 38, 30, 0.72);
  --tip: #fffaf4;
  --chrome: #f3eee6;
  --btn: #4f6b38;
  --on-btn: #ffffff;
}

html[data-theme="night"] {
  color-scheme: dark;
  --bg: #110e0c;
  --bg-2: #1b1612;
  --ink: #f4ead8;
  --muted: #b4a894;
  --line: rgba(244, 234, 216, 0.12);
  --lime: #d8ff3c;
  --coral: #ff4d2e;
  --card: #241e18;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --on-accent: #111111;
  --on-danger: #ffffff;
  --pass: #2a241e;
  --photo: #2c241c;
  --glow-1: rgba(216, 255, 60, 0.12);
  --glow-2: rgba(255, 77, 46, 0.16);
  --accent-soft: rgba(216, 255, 60, 0.1);
  --accent-line: rgba(216, 255, 60, 0.28);
  --on-photo: #f4ead8;
  --on-photo-muted: #b4a894;
  --overlay: rgba(10, 8, 6, 0.92);
  --tip: #1a1612;
  --chrome: #110e0c;
  --btn: #d8ff3c;
  --on-btn: #111111;
}

html[data-theme="slate"] {
  color-scheme: dark;
  --bg: #0b0f14;
  --bg-2: #141a22;
  --ink: #d7e0ea;
  --muted: #8b98a8;
  --line: rgba(167, 184, 204, 0.14);
  --lime: #7f9bb8;
  --coral: #b8899a;
  --card: #121820;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  --on-accent: #ffffff;
  --on-danger: #ffffff;
  --pass: #1c2430;
  --photo: #1a222c;
  --glow-1: rgba(127, 155, 184, 0.16);
  --glow-2: rgba(184, 137, 154, 0.12);
  --accent-soft: rgba(127, 155, 184, 0.14);
  --accent-line: rgba(127, 155, 184, 0.36);
  --on-photo: #e6edf5;
  --on-photo-muted: #a8b6c6;
  --overlay: rgba(8, 11, 16, 0.92);
  --tip: #141a22;
  --chrome: #0b0f14;
  --btn: #a9bfd4;
  --on-btn: #0c1218;
}

html[data-theme="dusk"] {
  color-scheme: dark;
  --bg: #3c365c;
  --bg-2: #4a4370;
  --ink: #f4f0fa;
  --muted: #c9c0dc;
  --line: rgba(244, 240, 250, 0.16);
  --lime: #d7c4ff;
  --coral: #f0a8bc;
  --card: #524a78;
  --shadow: 0 18px 48px rgba(28, 20, 52, 0.28);
  --on-accent: #2a2340;
  --on-danger: #fff8f5;
  --pass: #5c547f;
  --photo: #564e7c;
  --glow-1: rgba(215, 196, 255, 0.22);
  --glow-2: rgba(240, 168, 188, 0.16);
  --accent-soft: rgba(215, 196, 255, 0.2);
  --accent-line: rgba(215, 196, 255, 0.45);
  --on-photo: #f7f3fb;
  --on-photo-muted: #ddd4ee;
  --overlay: rgba(42, 35, 64, 0.78);
  --tip: #4a4370;
  --chrome: #3c365c;
  --btn: #efe8ff;
  --on-btn: #241c3a;
}

* { box-sizing: border-box; }
html {
  margin: 0;
  background-color: var(--bg);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100%;
}
body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: clip;
  background-color: var(--bg);
  background:
    radial-gradient(900px 420px at 10% -10%, var(--glow-1), transparent 55%),
    radial-gradient(700px 380px at 110% 0%, var(--glow-2), transparent 50%),
    var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

#app {
  --app-w: var(--container-app);
  width: 100%;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 0 calc(22px + env(safe-area-inset-bottom));
  box-sizing: border-box;
}
html[data-view="home"] #app {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
html[data-view="home"] #home-feature-root {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
html[data-tabs] #app {
  --tabbar-clearance: 88px;
  padding-bottom: calc(var(--tabbar-clearance) + env(safe-area-inset-bottom));
}
html[data-view="home"][data-tabs] #app {
  --tabbar-clearance: 62px;
}
html[data-view="chat"],
html[data-view="chat"] body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
html[data-view="chat"] body {
  position: fixed;
  inset: 0;
  width: 100%;
}
html[data-view="chat"] #app {
  position: fixed;
  top: var(--vvt, 0px);
  left: 0;
  right: 0;
  height: var(--vvh, 100dvh);
  min-height: 0;
  max-height: var(--vvh, 100dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}
html[data-view="chat"] #chat-feature-root {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
html.keyboard[data-view="chat"] #app {
  padding-bottom: 8px;
}
html[data-view="profile"] #app,
html[data-view="onboard"] #app,
html[data-view="person"] #app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

html[data-view="profile"][data-tabs] #app {
  --tabbar-clearance: 92px;
  padding-bottom: calc(var(--tabbar-clearance) + env(safe-area-inset-bottom) + 12px);
}

html[data-view="profile"] #profile-feature-root {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow-x: clip;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-padding-top: calc(env(safe-area-inset-top) + 56px);
  scroll-padding-bottom: calc(var(--tabbar-clearance, 92px) + env(safe-area-inset-bottom) + 16px);
}

html[data-view="support"] #app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

html[data-view="support"] #support-feature-root {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Auth: one page scroll (body), footer pinned on short viewports via flex + margin-top: auto */
html[data-view="login"] #app,
html[data-view="register"] #app,
html[data-view="forgot"] #app,
html[data-view="reset"] #app,
html[data-view="verify"] #app {
  width: 100%;
  min-height: var(--vvh, 100dvh);
  display: flex;
  flex-direction: column;
  padding: 0;
}
html[data-view="register"] #app,
html[data-view="forgot"] #app,
html[data-view="reset"] #app,
html[data-view="verify"] #app {
  padding-bottom: 0 !important;
}
html[data-view="login"][data-tabs] #app {
  padding-bottom: calc(var(--tabbar-clearance, 78px) + env(safe-area-inset-bottom)) !important;
}
html[data-view="login"] .auth-shell,
html[data-view="register"] .auth-shell,
html[data-view="forgot"] .auth-shell,
html[data-view="reset"] .auth-shell,
html[data-view="verify"] .auth-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--container-form, 390px);
  margin: 0 auto;
  padding: 8px 16px max(16px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}
html[data-view="login"][data-tabs] .auth-shell {
  padding-bottom: 4px;
}
.auth-panel {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}
#auth-feature-root {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.brand-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
.brand-divider {
  display: inline-block;
  color: var(--muted);
  opacity: 0.45;
  font-family: var(--sans, "IBM Plex Sans", -apple-system, sans-serif);
  font-size: 19px;
  font-weight: 300;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
  transform: translateY(-0.5px);
}
.brand-section {
  font-family: var(--serif, Fraunces, Georgia, serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.16s ease;
}
@media (max-width: 768px) {
  .brand-group {
    gap: 8px;
  }
  .brand-divider {
    font-size: 17px;
  }
  .brand-section {
    font-size: 17px;
  }
}
@media (min-width: 768px) {
  :root { --layout-gutter: 24px; }
  .brand-section {
    font-size: 21px;
  }
}

@media (min-width: 1025px) {
  :root { --layout-gutter: 28px; }
}
@media (min-width: 1025px) {
  .brand-section {
    font-size: 22px;
  }
}
.brand {
  position: relative;
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.04em;
  font-size: 24px;
  display: inline-flex;
  align-items: baseline;
}
.brand-name span { color: var(--lime); }
.brand .beta-wrap {
  position: absolute;
  left: calc(100% - 10px);
  top: -8px;
  display: inline-flex;
  outline: none;
  cursor: pointer;
  z-index: 100;
}
.brand .beta-label {
  position: absolute;
  left: calc(100% - 10px);
  top: -8px;
  white-space: nowrap;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 5px;
  line-height: 1.25;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  pointer-events: auto;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.brand .beta-wrap .beta-label {
  position: relative;
  left: auto;
  top: auto;
}
.brand .beta-wrap:hover .beta-label,
.brand .beta-wrap:focus-visible .beta-label,
.brand .beta-wrap.is-open .beta-label {
  border-color: var(--accent-line);
  color: var(--ink);
  transform: translateY(-1px);
}
.brand .beta-wrap:focus-visible .beta-label {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}
.beta-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: -16px;
  width: max-content;
  max-width: min(240px, calc(100vw - 32px));
  box-sizing: border-box;
  background: #ffffff;
  border: 1px solid #d2d5e0;
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22), 0 2px 6px rgba(0, 0, 0, 0.12);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
  pointer-events: none;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.48;
  color: #1a1c24;
  text-align: left;
  user-select: text;
}
.beta-popover::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 32px;
  width: 8px;
  height: 8px;
  background: #ffffff;
  border-left: 1px solid #d2d5e0;
  border-top: 1px solid #d2d5e0;
  transform: translateX(-50%) rotate(45deg);
}
.beta-popover::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}
.brand .beta-wrap:hover .beta-popover,
.brand .beta-wrap:focus-within .beta-popover,
.brand .beta-wrap.is-open .beta-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

html[data-theme="night"] .beta-popover,
html[data-theme="slate"] .beta-popover {
  background: #1e202a;
  border-color: #3e4256;
  color: #f0f1f6;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.65), 0 2px 8px rgba(0, 0, 0, 0.45);
}

html[data-theme="dusk"] .beta-popover {
  background: #4a4370;
  border-color: rgba(244, 240, 250, 0.2);
  color: #f4f0fa;
  box-shadow: 0 14px 36px rgba(28, 20, 52, 0.45);
}

html[data-theme="night"] .beta-popover::before,
html[data-theme="slate"] .beta-popover::before {
  background: #1e202a;
  border-color: #3e4256;
}

html[data-theme="dusk"] .beta-popover::before {
  background: #4a4370;
  border-color: rgba(244, 240, 250, 0.2);
}

html[data-theme="mist"] .brand .beta-label {
  background: #e2e5ef;
  border-color: rgba(50, 52, 74, 0.18);
  color: #4e5168;
}

html[data-theme="pastel"] .brand .beta-label {
  background: #eae3d7;
  border-color: rgba(63, 55, 47, 0.18);
  color: #5c534a;
}

html[data-theme="night"] .brand .beta-label {
  background: #201a15;
  border-color: rgba(244, 234, 216, 0.22);
  color: #d4c9b7;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

html[data-theme="slate"] .brand .beta-label {
  background: #141c26;
  border-color: rgba(167, 184, 204, 0.24);
  color: #b8cbe0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

html[data-theme="dusk"] .brand .beta-label {
  background: #4a4370;
  border-color: rgba(215, 196, 255, 0.35);
  color: #f4f0fa;
  box-shadow: 0 1px 4px rgba(28, 20, 52, 0.28);
}
a.brand,
.brand {
  text-decoration: none;
  border-bottom: none;
  box-shadow: none;
  color: inherit;
}
.nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.nav button, .nav a { position: relative; font-size: 13px; padding: 8px 10px; text-decoration: none; }
.pip {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}
.nav .pip {
  position: absolute;
  top: -4px;
  right: -4px;
}
.nav button, .nav a, .ghost, .solid, .danger {
  border: 0;
  border-radius: 999px;
  padding: 9px 13px;
}
.nav button, .nav a, .ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}
.nav button.active, .nav a.active { background: var(--ink); color: var(--bg); }
.solid { background: var(--btn, var(--lime)); color: var(--on-btn, var(--on-accent)); font-weight: 600; }
.danger { background: var(--coral); color: var(--on-danger); font-weight: 600; }
.ghost.slim, .solid.slim { padding: 7px 11px; font-size: 13px; }
.icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  max-width: 44px;
  max-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: inherit;
  padding: 0;
  flex-shrink: 0;
  box-sizing: border-box;
}
.icon-btn:focus-visible,
.tabbar a:focus-visible,
.avatar-link:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}
.avatar-slot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  max-width: 44px;
  max-height: 44px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.avatar-link {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  max-width: 44px;
  max-height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--photo);
  border: 1px solid var(--line);
  box-sizing: border-box;
  flex-shrink: 0;
}
.avatar-link.plus {
  -webkit-mask: radial-gradient(circle 11.5px at calc(100% - 9px) calc(100% - 9px), transparent 11px, #000 11.5px);
  mask: radial-gradient(circle 11.5px at calc(100% - 9px) calc(100% - 9px), transparent 11px, #000 11.5px);
}
.avatar-link img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  display: block;
}
.avatar-link:not(:has(img)) {
  color: var(--on-photo-muted, var(--muted));
}
.avatar-link.on { box-shadow: 0 0 0 2px var(--ink); }
.plus-mark {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lime) 0%, color-mix(in srgb, var(--lime) 65%, var(--coral)) 100%);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  pointer-events: none;
  box-sizing: border-box;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.22s ease;
}
html[data-theme="pastel"] .plus-mark {
  color: #ffffff;
}
.plus-mark svg {
  width: 10px;
  height: 10px;
  display: block;
}
.avatar-slot:hover .plus-mark,
.avatar-link:focus-visible ~ .plus-mark {
  transform: scale(1.12);
  filter: brightness(1.08);
}
.plus-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  vertical-align: middle;
  color: var(--muted);
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.plus-pill.on {
  color: var(--on-accent);
  background: var(--lime);
  border-color: var(--lime);
}

.avatar-btn {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.avatar-btn:focus-visible .avatar-link {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.badge-gem-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7d82c4 0%, #c4769c 100%);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(125, 130, 196, 0.5), 0 0 20px rgba(196, 118, 156, 0.25);
  flex-shrink: 0;
  animation: gemGlowBreathing 7s ease-in-out infinite alternate;
}

.badge-gem-icon::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: inherit;
  filter: blur(6px);
  opacity: 0.6;
  z-index: 0;
  pointer-events: none;
  animation: gemAuraSpread 7s ease-in-out infinite alternate;
}

.badge-gem-icon svg {
  position: relative;
  z-index: 1;
  width: 10.5px;
  height: 10.5px;
  display: block;
  animation: gemIconGlow 7s ease-in-out infinite alternate;
}

@keyframes gemGlowBreathing {
  0% {
    filter: brightness(0.95);
  }
  50% {
    filter: brightness(1.14);
  }
  100% {
    filter: brightness(0.98);
  }
}

@keyframes gemAuraSpread {
  0% {
    opacity: 0.35;
    transform: scale(0.92);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.22);
  }
  100% {
    opacity: 0.45;
    transform: scale(0.98);
  }
}

@keyframes gemIconGlow {
  0% {
    opacity: 0.88;
    transform: scale(0.98);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
  100% {
    opacity: 0.92;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .badge-gem-icon,
  .badge-gem-icon::before,
  .badge-gem-icon svg {
    animation: none !important;
  }
}

/* Theme adaptations */

html[data-theme="pastel"] .badge-gem-icon {
  background: linear-gradient(135deg, #c4824d 0%, #c66275 100%);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(196, 130, 77, 0.5), 0 0 20px rgba(198, 98, 117, 0.25);
}

html[data-theme="pastel"] .plus-mark {
  color: #ffffff;
}

html[data-theme="dusk"] .badge-gem-icon {
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.6), 0 0 22px rgba(236, 72, 153, 0.35);
}

html[data-theme="night"] .badge-gem-icon {
  background: linear-gradient(135deg, #eab308 0%, #f97316 100%);
  color: #1c1917;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.55), 0 0 22px rgba(249, 115, 22, 0.3);
}

html[data-theme="slate"] .badge-gem-icon {
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  color: #0f172a;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.55), 0 0 22px rgba(129, 140, 248, 0.3);
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  min-height: calc(54px + env(safe-area-inset-bottom));
  padding: 0 6px env(safe-area-inset-bottom) 6px;
  box-sizing: border-box;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  z-index: 20;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.tabbar,
.tabbar * {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.tabbar ::selection {
  background: transparent;
}
.tabbar a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: calc(54px + env(safe-area-inset-bottom));
  padding: 2px 0 env(safe-area-inset-bottom);
  box-sizing: border-box;
  gap: 2px;
  text-decoration: none;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  transition: color 0.16s ease, transform 0.12s ease;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-drag: none;
  user-drag: none;
}
.tabbar img,
.tabbar svg {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
}
.tabbar a::before {
  content: "";
  position: absolute;
  inset: 3px 3px;
  border-radius: 16px;
  background: transparent;
  pointer-events: none;
  z-index: 0;
  transition: background 0.16s ease, opacity 0.16s ease, transform 0.12s ease;
}
.tabbar a:hover::before {
  background: var(--accent-soft);
}
.tabbar a.on {
  color: var(--ink);
  font-weight: 600;
}
.tabbar a.on::before {
  background: var(--accent-soft);
}
.tabbar a:active::before {
  transform: scale(1.06);
}
.tabbar .nav-ico,
.tabbar .nav-lbl {
  position: relative;
  z-index: 1;
}
.tabbar .nav-ico {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tabbar .nav-ico svg {
  width: 20px;
  height: 20px;
}
.tabbar a.on .nav-ico {
  transform: scale(1.08);
}
.tabbar .nav-avatar {
  display: block;
  position: relative;
  top: 1px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px solid var(--line);
  background: var(--photo);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.tabbar .nav-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tabbar .nav-avatar--empty {
  display: grid;
  place-items: center;
  color: var(--on-photo-muted, var(--muted));
}
.tabbar .nav-avatar--empty svg {
  width: 11px;
  height: 11px;
  display: block;
}
.tabbar a.on .nav-avatar {
  border-color: var(--accent, var(--ink));
}
.tabbar .pip-slot {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  transform: translate(6px, -14px);
  pointer-events: none;
}
.tabbar .pip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--accent, #e53935);
  color: #fff;
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1;
}

@media (max-width: 360px) {
  .tabbar a {
    font-size: 9px;
    gap: 1.5px;
  }
  .tabbar a::before {
    inset: 2px 2px;
    border-radius: 14px;
  }
  .tabbar .nav-ico {
    width: 20px;
    height: 20px;
  }
  .tabbar .nav-ico svg {
    width: 18px;
    height: 18px;
  }
}

.filter-foot { display: flex; justify-content: flex-start; margin-top: 12px; }

.panel h2 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.05;
  font-size: clamp(24px, 5.5vw, 32px);
  margin: 0 0 clamp(16px, 3.5vw, 24px);
}
.lede { color: var(--muted); line-height: 1.45; margin: 0 0 clamp(20px, 4vw, 28px); font-size: 15px; }
.lede a, .hint a { color: var(--lime); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions.center { justify-content: center; }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.form input, .form select, .form textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  outline: none;
}
.form input:-webkit-autofill,
.form input:-webkit-autofill:hover,
.form input:-webkit-autofill:focus,
.form input:-webkit-autofill:active,
.form input:autofill,
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
input:autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-2) inset !important;
  box-shadow: 0 0 0 1000px var(--bg-2) inset !important;
  -webkit-text-fill-color: var(--ink) !important;
  caret-color: var(--ink);
  transition: background-color 50000s ease-in-out 0s;
}
.form textarea { min-height: 96px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.err { color: var(--coral); font-size: 13px; min-height: 1.2em; }
.hint { color: var(--muted); font-size: 12px; }


.match-list { display: grid; gap: 10px; }
.match-wrap {
  position: relative;
  display: grid;
}
.match-wrap .match { padding-right: 44px; }
.match-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.match-remove:hover,
.match-remove:focus-visible {
  color: var(--ink);
  border-color: var(--ink);
}
.match {
  position: relative;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  width: 100%;
  background: var(--bg-2);
  border-radius: 18px;
  padding: 10px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
a.solid, a.ghost { display: inline-block; text-align: center; text-decoration: none; }
.match img, .avatar {
  width: 64px; height: 64px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--photo);
}
.match-body { min-width: 0; }
.match-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.match h3 { margin: 0 0 4px; font-size: 16px; min-width: 0; }
.match-time {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
}
.match p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.match.locked { cursor: pointer; }
.locked-face {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  overflow: hidden;
  background: #2c2a27;
}
.locked-face i {
  display: block;
  width: 100%;
  height: 130%;
  margin-top: -8%;
  background:
    radial-gradient(circle at 50% 30%, #d2c6ba 0 14%, transparent 26%),
    radial-gradient(ellipse at 50% 70%, #8a7f74 0 32%, transparent 46%),
    linear-gradient(#4a4540, #1f1d1b);
  filter: blur(7px);
  transform: scale(1.4);
}
.bubble-quote {
  margin: 0 0 6px;
  padding: 6px 8px;
  border-left: 3px solid var(--lime);
  border-radius: 8px;
  background: rgba(127, 155, 184, 0.12);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.88;
}
.bubble.mine .bubble-quote {
  background: rgba(0, 0, 0, 0.14);
  border-left-color: var(--on-accent);
  color: var(--on-accent);
  opacity: 0.92;
}
.bubble-body { display: block; }

.toast-stack {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(92vw, 340px);
  transform: translateX(-50%);
  pointer-events: none;
}
html:is([data-view="deck"], [data-view="recommendations"]) .toast-stack,
html[data-view="person"] .toast-stack {
  top: calc(64px + env(safe-area-inset-top, 0px));
  bottom: auto;
}
.toast {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--lime);
  color: var(--on-accent);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  pointer-events: auto;
}
.toast.tap { cursor: pointer; }

.filters {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  margin-bottom: 12px;
}
.panel { animation: in 0.35s ease; }
html:is([data-view="deck"], [data-view="recommendations"]) .panel.deck-panel { animation: none; }
html[data-view="profile"] .panel { animation: none; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.consent-box {
  margin: 8px 0 4px;
  padding: 12px 14px;
  border: 1px solid var(--accent-line);
  border-radius: 16px;
  background: var(--accent-soft);
  display: grid;
  gap: 10px;
}
.consent-box .hint { margin: 0; }
.check { display: flex !important; align-items: center; gap: 8px; grid-template-columns: none !important; }
.check input { width: auto; }
.check a { color: var(--lime); }

.analytics-consent {
  position: fixed;
  z-index: 90;
  left: 16px;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid var(--accent-line);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(28, 30, 60, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: consentSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.analytics-consent.closing {
  animation: consentFadeDown 0.22s ease forwards;
  pointer-events: none;
}

.analytics-consent-content {
  flex: 1;
}

.analytics-consent p {
  margin: 0;
  font-size: 13px;
  line-height: 1.42;
  color: var(--ink);
}

.analytics-consent a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.analytics-consent a:hover {
  opacity: 0.8;
}

.analytics-consent-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.analytics-consent-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.analytics-consent-close:hover {
  color: var(--ink);
  background: var(--line);
}

/* Don't overlap auth forms and CTA buttons */
html[data-view="register"] .analytics-consent,
html[data-view="login"] .analytics-consent,
html[data-view="forgot"] .analytics-consent,
html[data-view="reset"] .analytics-consent,
html[data-view="verify"] .analytics-consent {
  display: none !important;
}

@media (max-width: 640px) {
  .analytics-consent {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
  }
  .analytics-consent-actions {
    width: 100%;
  }
  .analytics-consent-actions button {
    flex: 1;
  }
  .analytics-consent-close {
    position: absolute;
    top: 8px;
    right: 8px;
  }
}

@keyframes consentSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes consentFadeDown {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
}

.photos { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.photo-pick {
  aspect-ratio: 3/4;
  border-radius: 10px;
  border: 2px solid transparent;
  background-color: var(--photo);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  padding: 0;
}
.photo-pick.on { border-color: var(--lime); }

.bubble-photo {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 6px;
}
.bubble-photo img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  background: var(--bg-2);
}

body.legal-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.legal {
  width: min(var(--container-page), 100%);
  margin: 0 auto;
  padding: 32px 20px 32px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
body.legal-page .legal {
  min-height: auto;
  flex: 1;
}
.legal.admin { width: min(var(--container-admin), 100%); }

/* Support Screen Compact Container & Harmonization */
body.support-page .legal,
.legal.legal--support {
  width: min(var(--container-app, 540px), 100%);
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
  body.support-page .legal,
  .legal.legal--support {
    padding: 24px 28px 40px;
  }
}

.legal--support .support-title {
  font-family: var(--serif);
  font-size: clamp(26px, 5.5vw, 34px);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--ink);
  margin: clamp(12px, 3.5vw, 20px) 0 8px;
}

.legal--support .support-intro {
  margin: 0 0 clamp(18px, 4vw, 24px);
}

.legal--support .support-intro p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}
.legal h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 6.5vw, 40px);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: clamp(24px, 5vw, 36px) 0 clamp(16px, 3.5vw, 24px);
  color: var(--ink);
}
.legal h2 {
  font-family: var(--serif);
  font-size: clamp(20px, 4.5vw, 24px);
  margin: clamp(28px, 5.5vw, 40px) 0 clamp(10px, 2vw, 16px);
  color: var(--ink);
}
.legal p, .legal li {
  color: var(--muted);
  line-height: 1.6;
  font-size: 15px;
}
.legal p a,
.legal li a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal p a:hover,
.legal li a:hover {
  opacity: 0.8;
}

/* ==========================================================================
   Support Form
   ========================================================================== */
.support-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  max-width: 100%;
  margin-top: 0;
}

.support-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

/* Floating Input */
.field-floating {
  position: relative;
  display: flex;
  width: 100%;
}

.field-floating input {
  width: 100%;
  min-height: 56px;
  padding: 24px 16px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.25;
  box-sizing: border-box;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field-floating input:hover:not(:focus) {
  border-color: var(--accent-line);
}

.field-floating input:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--bg-2);
}

.field-floating input:-webkit-autofill,
.field-floating input:autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-2) inset !important;
  box-shadow: 0 0 0 1000px var(--bg-2) inset !important;
  -webkit-text-fill-color: var(--ink) !important;
  caret-color: var(--ink);
  transition: background-color 50000s ease-in-out 0s;
}

.field-floating .field-floating__label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 15px;
  pointer-events: none;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              top 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              font-size 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              color 0.18s ease;
  transform-origin: left top;
}

.field-floating input:focus ~ .field-floating__label,
.field-floating input:not(:placeholder-shown) ~ .field-floating__label,
.field-floating input:-webkit-autofill ~ .field-floating__label,
.field-floating input:autofill ~ .field-floating__label {
  top: 8px;
  transform: none;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.field-floating input:focus ~ .field-floating__label {
  color: var(--lime);
}

/* Textarea Field */
.textarea-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.textarea-field textarea {
  width: 100%;
  min-height: 136px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.45;
  box-sizing: border-box;
  resize: vertical;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.textarea-field textarea::placeholder {
  color: var(--muted);
  opacity: 0.65;
}

.textarea-field textarea:hover:not(:focus) {
  border-color: var(--accent-line);
}

.textarea-field textarea:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--bg-2);
}

.textarea-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  padding: 2px 4px 0;
}

/* Support Actions */
.support-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
  width: 100%;
}

.support-actions .btn {
  width: 100%;
  min-height: 52px;
  padding: 14px 24px;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Status Cards */
.card-status {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  margin: 16px 0;
  animation: statusFade 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.card-status .status-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.card-status h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.card-status p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
}

.card-status.ok {
  background: var(--bg-2);
  border: 1px solid var(--accent-line);
  color: var(--ink);
}

.card-status.ok .status-icon {
  color: var(--lime);
}

.card-status.err {
  background: rgba(201, 137, 154, 0.14);
  background: color-mix(in srgb, var(--coral) 14%, transparent);
  border: 1px solid rgba(201, 137, 154, 0.35);
  border: 1px solid color-mix(in srgb, var(--coral) 38%, transparent);
  color: var(--coral);
}

.card-status.err p {
  color: var(--coral);
}

@keyframes statusFade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Button Component (Design System UI Component)
   ========================================================================== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 14px 24px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 15.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  box-sizing: border-box;
  text-align: center;
  white-space: nowrap;
  transition: transform 0.12s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.18s ease,
              border-color 0.18s ease,
              color 0.18s ease,
              box-shadow 0.18s ease,
              opacity 0.18s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn.fullWidth,
.btn-full {
  width: 100%;
  display: flex;
}

.btn.slim {
  min-height: 38px;
  padding: 8px 16px;
  font-size: 13.5px;
}

.btn.solid {
  background: var(--btn, var(--lime));
  color: var(--on-btn, var(--on-accent));
  box-shadow: 0 4px 16px var(--accent-soft), 0 1px 2px rgba(0, 0, 0, 0.08);
  border: 1px solid transparent;
}

.btn > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
  vertical-align: middle;
}

.btn.solid span {
  color: inherit;
}

.btn.solid:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px var(--accent-soft), 0 2px 4px rgba(0, 0, 0, 0.12);
  filter: brightness(1.04);
}

.btn.danger,
.btn.solid.danger {
  background: var(--coral, #e11d48);
  background: linear-gradient(135deg, var(--coral, #e11d48), color-mix(in srgb, var(--coral, #e11d48) 75%, #000));
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(225, 29, 72, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn.danger:hover:not(:disabled),
.btn.solid.danger:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(225, 29, 72, 0.38);
  filter: brightness(1.05);
}

.btn.ghost {
  background: var(--card);
  background: color-mix(in srgb, var(--card) 60%, transparent);
  border-color: var(--line);
  color: var(--ink);
  backdrop-filter: blur(8px);
}

.btn.ghost:hover:not(:disabled) {
  background: var(--card);
  background: color-mix(in srgb, var(--line) 40%, var(--card));
  border-color: var(--accent-line);
  color: var(--ink);
}

.btn:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

@media (min-width: 768px) {
  .btn:not(.slim) {
    min-height: 56px;
    padding: 16px 26px;
    font-size: 16px;
  }
}

/* UI Checkbox Component */
.ui-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  padding: 6px 4px;
  border-radius: 8px;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.ui-checkbox:hover {
  background: var(--line);
}

.ui-checkbox .box-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.ui-checkbox input[type="checkbox"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 1;
}

.ui-checkbox .custom-box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  color: var(--on-accent);
}

html[data-theme="pastel"] .ui-checkbox .custom-box {
  color: #ffffff;
}

.ui-checkbox input[type="checkbox"]:focus-visible + .custom-box {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}

.ui-checkbox input[type="checkbox"]:checked + .custom-box {
  background: var(--lime);
  border-color: var(--lime);
}

.ui-checkbox .check-icon {
  width: 13px;
  height: 13px;
  transform: scale(0.6);
  opacity: 0;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease;
}

.ui-checkbox input[type="checkbox"]:checked + .custom-box .check-icon {
  transform: scale(1);
  opacity: 1;
}

.ui-checkbox__text {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.45;
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  user-select: none;
}

.legal-footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 20px;
  width: 100%;
  margin-top: auto;
  padding: 20px 20px max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  box-sizing: border-box;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  cursor: default;
}

@media (max-width: 480px) {
  .legal-footer-bar {
    gap: 8px 14px;
    padding: 18px 12px max(14px, env(safe-area-inset-bottom));
    font-size: 12.5px;
  }
}

.legal-footer-bar,
.legal-footer-bar * {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.legal-footer-bar ::selection {
  background: transparent;
}

.legal-footer-bar .badge-18 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--line);
  color: var(--muted);
  line-height: 1.2;
  cursor: default;
}

.legal-nav a,
.legal-footer-bar a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-drag: none;
  user-drag: none;
  outline: none;
}

.legal-nav a:hover,
.legal-footer-bar a:hover,
.legal-nav a[aria-current="page"],
.legal-footer-bar a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-nav a:focus-visible,
.legal-footer-bar a:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}

.legal .abbr {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 12px 0;
}
.legal .abbr h3 { margin: 0 0 6px; font-size: 18px; font-family: var(--serif); }


.prompt-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.prompt-card .q {
  color: var(--lime);
  font-size: 12px;
  margin: 0 0 6px;
}
.prompt-card p { margin: 0; line-height: 1.4; }

.match .unread {
  justify-self: end;
  align-self: center;
  background: var(--coral);
  color: #fff;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
  font-size: 11px;
  padding: 2px 6px;
}
.match.has-unread { grid-template-columns: 64px 1fr auto; }
.receipt { font-style: normal; letter-spacing: -0.08em; opacity: 0.7; }
.receipt.on { opacity: 1; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; margin-top: 10px; }
.filter-row label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.filter-row input,
.filter-row select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--ink);
}

.nudge {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.4;
}
.nudge .actions { margin-top: 10px; }
.openers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.openers .opener {
  text-align: left;
  white-space: normal;
  max-width: 100%;
}
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}
.admin-table th, .admin-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  letter-spacing: normal;
}
.admin-table th { color: var(--muted); font-weight: 500; }
.legal.admin .prompt-card p {
  font-family: var(--sans);
  letter-spacing: normal;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.task-board-wrap {
  margin: 28px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--card) 72%, transparent);
}
.task-board-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.task-board-head h2 { margin-top: 0; margin-bottom: 4px; }
.task-board-head .hint { max-width: 620px; margin: 0; }
.task-threshold { color: var(--muted); font-size: 13px; margin: 14px 0; }
.task-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.task-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
}
.task-card h3 { margin: 8px 0 6px; font-size: 17px; line-height: 1.2; }
.task-card p { margin: 0 0 10px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.task-score { color: var(--lime); font-weight: 700; }
.task-status { color: var(--muted); font-size: 12px; }
.task-meta { color: var(--muted); font-size: 12px; line-height: 1.35; }
.task-card.task-approved { border-color: var(--lime); }
.task-card.task-filtered, .task-card.task-duplicate { opacity: .72; }
.task-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.task-actions form { margin: 0; }
.plus-box {
  background: var(--bg-2);
  border: 1px solid var(--accent-line);
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 10px;
}
.plus-box label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.plus-box label.check {
  color: var(--ink);
  align-items: flex-start;
}
.plus-box input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  outline: none;
  color: var(--ink);
}
.plus-box .check input {
  width: auto;
  min-width: 18px;
  padding: 0;
  border-radius: 4px;
  background: var(--bg);
}
.plus-box .q { color: var(--lime); font-size: 12px; }
.plus-box.on { border-color: var(--lime); }
.ref-row { display: flex; gap: 8px; align-items: center; }
.ref-row input { flex: 1; width: auto; min-width: 0; }
.inline-grant { display: inline; margin-left: 6px; }
.inline-grant button { padding: 4px 8px; font-size: 11px; }

@media (min-width: 768px) {
  #app { padding: 0 0 40px; }
  html[data-tabs] #app { padding-bottom: 128px; }
  .avatar-slot,
  .avatar-link,
  .profile-slot,
  .icon-btn.profile-slot {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    max-width: 48px;
    max-height: 48px;
  }
  .avatar-link.plus {
    -webkit-mask: radial-gradient(circle 12px at calc(100% - 9.5px) calc(100% - 9.5px), transparent 11.5px, #000 12px);
    mask: radial-gradient(circle 12px at calc(100% - 9.5px) calc(100% - 9.5px), transparent 11.5px, #000 12px);
  }
  .plus-mark {
    width: 19px;
    height: 19px;
  }
  .plus-mark svg {
    width: 10.5px;
    height: 10.5px;
  }
  .tabbar {
    left: 50%;
    right: auto;
    bottom: 14px;
    width: min(calc(var(--container-app) - 32px), calc(100% - 32px));
    transform: translateX(-50%);
    min-height: 60px;
    padding: 3px;
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    background: color-mix(in srgb, var(--bg-2) 96%, transparent);
  }
  .tabbar a {
    min-height: 54px;
    padding: 3px 0;
    gap: 2.5px;
    font-size: 11.5px;
  }
  .tabbar a::before {
    inset: 3px 5px;
    border-radius: 16px;
  }
  .tabbar .nav-ico {
    width: 24px;
    height: 24px;
  }
  .tabbar .nav-ico svg {
    width: 22px;
    height: 22px;
  }
  .tabbar .nav-avatar {
    width: 22px;
    height: 22px;
  }
  .tabbar .pip-slot {
    transform: translate(7px, -15px);
  }
  .tabbar .pip {
    min-width: 16px;
    height: 16px;
    font-size: 9px;
  }
  .admin-grid { grid-template-columns: repeat(3, 1fr); }
  .legal { padding: 44px 28px 48px; }
  .filter-row { grid-template-columns: 1fr 1fr 1.4fr; }
  .beta-popover {
    left: -16px;
    max-width: 260px;
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.5;
  }
  .beta-popover::before {
    left: 32px;
  }
}

@media (min-width: 1025px) {
  .avatar-slot,
  .avatar-link,
  .profile-slot,
  .icon-btn.profile-slot {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    max-width: 50px;
    max-height: 50px;
  }
  .avatar-link.plus {
    -webkit-mask: radial-gradient(circle 12.5px at calc(100% - 10px) calc(100% - 10px), transparent 12px, #000 12.5px);
    mask: radial-gradient(circle 12.5px at calc(100% - 10px) calc(100% - 10px), transparent 12px, #000 12.5px);
  }
  .plus-mark {
    width: 20px;
    height: 20px;
  }
  .plus-mark svg {
    width: 11px;
    height: 11px;
  }
  .tabbar {
    bottom: 18px;
    width: min(calc(var(--container-app) - 32px), calc(100% - 32px));
    min-height: 66px;
    padding: 4px;
    border-radius: 24px;
  }
  .tabbar a {
    min-height: 58px;
    padding: 4px 0;
    gap: 3px;
    font-size: 12px;
  }
  .tabbar a::before {
    inset: 3px 6px;
    border-radius: 18px;
  }
  .tabbar .nav-ico {
    width: 26px;
    height: 26px;
  }
  .tabbar .nav-ico svg {
    width: 24px;
    height: 24px;
  }
  .tabbar .nav-avatar {
    width: 24px;
    height: 24px;
  }
  .tabbar .pip-slot {
    transform: translate(7px, -15px);
  }
  .tabbar .pip {
    min-width: 17px;
    height: 17px;
    font-size: 10px;
  }
  .tabbar a:hover .nav-ico {
    transform: translateY(-1px);
  }
  .tabbar a.on .nav-ico {
    transform: translateY(-1px) scale(1.08);
  }
}

@media (min-width: 1080px) {
  .admin-grid { grid-template-columns: repeat(4, 1fr); }
  .beta-popover {
    max-width: 290px;
    padding: 14px 18px;
    font-size: 13.5px;
    line-height: 1.55;
    border-radius: 11px;
  }
}

@media (max-width: 767px) {
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .ghost,
  .hero-actions .solid,
  .hero-actions button { width: 100%; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .filter-row label:last-child { grid-column: 1 / -1; }
  .photos { grid-template-columns: repeat(3, 1fr); }
  .task-board-wrap { padding: 14px; }
  .task-board-head { flex-direction: column; }
  .task-board-head form, .task-board-head button { width: 100%; }
}

@media (max-width: 420px) {
  .brand { font-size: 22px; }
  .row { grid-template-columns: 1fr; }
  .beta-popover {
    left: -12px;
    max-width: min(230px, calc(100vw - 28px));
    padding: 9px 13px;
    font-size: 12px;
    line-height: 1.45;
  }
  .beta-popover::before {
    left: 28px;
  }
}

/* ==========================================================================
   Delete Account Page
   ========================================================================== */
html[data-view="delete-account"] #app {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Likes route shell sizing (screen styles live with the Preact feature)
   ========================================================================== */
html[data-view="likes"] #app {
  display: flex;
  flex-direction: column;
}
html[data-view="likes"] #likes-feature-root,
html[data-view="matches"] #chat-feature-root {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}


.modal-back {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(10, 12, 16, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: modalFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: min(100%, 420px);
  max-height: min(88dvh, 640px);
  overflow: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px 20px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35), 0 2px 10px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  animation: modalCardPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalCardPop {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-card h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.report-reasons {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}
.report-reasons .check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}
.modal-card textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
}
.modal-card .actions {
  margin-top: 18px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (min-width: 720px) {
  .modal-back { place-items: center; }
}

/* Feed: fill viewport so swipe buttons sit above the tabbar without a black gap. */
html:is([data-view="deck"], [data-view="recommendations"]) body {
  overflow: hidden;
}
html:is([data-view="deck"], [data-view="recommendations"]) #app {
  height: var(--vvh, 100dvh);
  min-height: 0;
  max-height: var(--vvh, 100dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: calc(var(--tabbar-clearance, 88px) + env(safe-area-inset-bottom) + 8px);
}

html:is([data-view="deck"], [data-view="recommendations"])[data-tabs] #app {
  --tabbar-clearance: 96px;
}
html:is([data-view="deck"], [data-view="recommendations"]) #deck-feature-root {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
@media (min-width: 768px) {
  html:is([data-view="deck"], [data-view="recommendations"]) #app {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }
}

/* Mobile: floating pill + strong backdrop blur (flat — no drop shadow). */
@media (max-width: 767px) {
  html[data-tabs] #app {
    --tabbar-clearance: 78px;
  }
  html[data-view="home"][data-tabs] #app {
    --tabbar-clearance: 70px;
  }
  html[data-view="profile"][data-tabs] #app {
    --tabbar-clearance: 108px;
  }
  html:is([data-view="deck"], [data-view="recommendations"])[data-tabs] #app {
    --tabbar-clearance: 112px;
    padding-bottom: calc(var(--tabbar-clearance) + env(safe-area-inset-bottom) + 4px);
  }

  .tabbar {
    left: 50%;
    right: auto;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: min(calc(var(--container-app) - 32px), calc(100% - 32px));
    transform: translateX(-50%);
    min-height: 54px;
    padding: 4px 5px;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
    border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
    border-radius: 22px;
    box-shadow: none;
    background: color-mix(in srgb, var(--bg-2) 52%, transparent);
    backdrop-filter: blur(44px) saturate(190%);
    -webkit-backdrop-filter: blur(44px) saturate(190%);
  }

  .tabbar a {
    min-height: 46px;
    padding: 2px 0;
    gap: 3px;
    transform-origin: center;
    touch-action: manipulation;
    transition: color 0.16s ease, transform 150ms cubic-bezier(.2, .8, .2, 1);
  }

  .tabbar a::before {
    inset: 3px 2px;
    border-radius: 16px;
  }

  .tabbar a:hover::before {
    background: transparent;
  }

  .tabbar a.on::before {
    background: var(--accent-soft);
  }

  .tabbar a:active {
    transform: scale(.93);
  }

  .tabbar a:active::before {
    transform: scale(1.02);
  }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .tabbar a,
  .tabbar a::before {
    transition: none;
  }

  .tabbar a:active,
  .tabbar a:active::before {
    transform: none;
  }
}

@media (max-width: 360px) {
  html[data-tabs] #app {
    --tabbar-clearance: 74px;
  }
  html[data-view="home"][data-tabs] #app {
    --tabbar-clearance: 66px;
  }

  .tabbar {
    min-height: 50px;
    padding: 3px 4px;
    border-radius: 20px;
  }

  .tabbar a {
    min-height: 44px;
    gap: 2px;
  }

  .tabbar a::before {
    inset: 3px 1px;
    border-radius: 14px;
  }
}

/* Messenger refresh: chats keep the WIRING palette, but borrow the calm density
   and clear hierarchy people expect from a modern messenger. */
html[data-view="matches"] #app {
  display: flex;
  flex-direction: column;
}

.chat-list-page {
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: var(--container-app, 540px);
  margin: 0 auto;
  padding-inline: 16px;
  box-sizing: border-box;
}
.chat-list-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 4px 2px;
}
.chat-list-intro h1 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1;
  letter-spacing: -0.045em;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--lime);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.chat-list-lede {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.chat-count {
  display: grid;
  place-items: center;
  min-width: 72px;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--accent-line);
  border-radius: 24px;
  color: var(--lime);
  font-family: var(--serif);
  font-size: 28px;
  line-height: 0.85;
  background: var(--accent-soft);
}
.chat-count small {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 10px;
  line-height: 1;
}
.chat-list-card {
  min-height: 280px;
}
.chat-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  margin: 0 0 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--muted);
  background: var(--bg-2);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.chat-search:focus-within {
  border-color: var(--accent-line);
  background: var(--bg-2);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.chat-search svg { flex-shrink: 0; }
.chat-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  -webkit-appearance: none;
  appearance: none;
}
.chat-search input::-webkit-search-decoration,
.chat-search input::-webkit-search-cancel-button,
.chat-search input::-webkit-search-results-button,
.chat-search input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}
.chat-search input::placeholder { color: var(--muted); }
.chat-search kbd {
  flex-shrink: 0;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}
.match-list { gap: 4px; }
.match-wrap { border-radius: 20px; }
.match-wrap[hidden] { display: none; }
.match-wrap .match { padding-right: 48px; }
.match {
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  min-height: 78px;
  padding: 10px 12px;
  border-color: transparent;
  border-radius: 20px;
  background: transparent;
  transition: background 0.18s ease, transform 0.18s ease;
}
.match:hover,
.match:focus-visible {
  border-color: transparent;
  background: var(--bg-2);
  transform: translateY(-1px);
}
.match img, .match .avatar {
  width: 58px;
  height: 58px;
  border-radius: 18px;
}
.match h3 { margin-bottom: 5px; font-size: 15px; }
.match p { font-size: 13px; }
.match-time { font-size: 11px; }
.match.has-unread h3 { color: var(--lime); }
.match.has-unread p { color: var(--ink); font-weight: 550; }
.unread {
  right: 48px;
  bottom: 14px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border: 2px solid var(--card);
  line-height: 16px;
  background: var(--lime);
  color: var(--on-accent);
}
.match-remove {
  top: 50%;
  right: 8px;
  width: 32px;
  height: 32px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.match-wrap:hover .match-remove,
.match-wrap:focus-within .match-remove { opacity: 1; }
.match-remove:hover,
.match-remove:focus-visible {
  border-color: var(--line);
  background: var(--bg-2);
  color: var(--coral);
}
.match-remove svg {
  display: block;
  width: 18px;
  height: 18px;
  margin: auto;
  flex-shrink: 0;
}
@media (hover: none), (pointer: coarse) {
  .match-remove {
    opacity: 0.78;
    border-color: var(--line);
    background: color-mix(in srgb, var(--bg) 88%, var(--bg-2));
  }
}
.chat-empty,
.chat-no-results {
  display: grid;
  justify-items: center;
  padding: 58px 20px 64px;
  text-align: center;
}
.chat-empty-icon {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  margin-bottom: 18px;
  border-radius: 24px;
  background: var(--accent-soft);
  color: var(--lime);
}
.chat-empty-icon svg { width: 30px; height: 30px; }
.chat-empty h2,
.chat-no-results strong {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 24px;
  letter-spacing: -0.03em;
}
.chat-empty p,
.chat-no-results p {
  max-width: 360px;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.chat-empty .solid { display: inline-flex; align-items: center; gap: 8px; }
.chat-no-results { padding: 52px 20px; }
.chat-no-results[hidden] { display: none; }
.chat-no-results > span { margin-bottom: 12px; color: var(--muted); }
.chat-no-results p { margin-bottom: 0; }

html[data-view="chat"] #app {
  width: 100%;
  max-width: none;
  padding: 0;
  background: var(--bg);
}
.chat-screen {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(720px 340px at 12% 0%, var(--glow-1), transparent 62%),
    radial-gradient(680px 320px at 100% 45%, var(--glow-2), transparent 65%),
    var(--bg);
}
.chat-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-height: calc(72px + env(safe-area-inset-top));
  padding: max(10px, env(safe-area-inset-top)) max(16px, calc((100vw - 1120px) / 2)) 10px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-2) 82%, transparent);
  box-shadow: 0 8px 28px rgba(20, 22, 34, 0.04);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.chat-back,
.chat-top-action {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.chat-back:hover,
.chat-top-action:hover,
.chat-back:focus-visible,
.chat-top-action:focus-visible {
  border-color: var(--line);
  background: var(--bg);
  color: var(--ink);
  transform: translateY(-1px);
}
.chat-back svg { transform: rotate(180deg); }
.chat-peer {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1;
  color: inherit;
  text-decoration: none;
}
.chat-peer img {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 16px;
  object-fit: cover;
  background: var(--photo);
}
.chat-peer-copy { display: grid; min-width: 0; gap: 3px; }
.chat-topbar.is-compose { position: relative; }
.chat-topbar.is-compose .chat-peer {
  position: absolute;
  left: 64px;
  right: 64px;
  justify-content: center;
  pointer-events: none;
}
.chat-topbar.is-compose .chat-peer-copy { justify-items: center; }
.chat-topbar.is-compose .chat-peer-copy small {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.35;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.chat-peer-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.chat-peer-copy small { color: var(--muted); font-size: 11px; }
.chat-top-actions { display: flex; gap: 2px; }
.chat-top-action { border: 0; background: transparent; }
.chat-remove-action:hover,
.chat-remove-action:focus-visible {
  color: var(--coral);
}
.thread {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-content: initial;
  flex: 1 1 auto;
  gap: 7px;
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 0;
  margin: 0 auto;
  padding: 22px 18px 0;
  padding-left: max(18px, calc((100vw - 860px) / 2 + 18px));
  padding-right: max(18px, calc((100vw - 860px) / 2 + 18px));
  overflow: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  overflow-anchor: none;
  scrollbar-width: thin;
}
.thread > .hint {
  align-self: center;
  max-width: 330px;
  margin: auto 0 4px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-2);
  text-align: center;
  line-height: 1.45;
}
.bubble {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: fit-content;
  max-width: min(70%, 560px);
  margin: 0;
  padding: 10px 13px 7px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-2);
  box-shadow: 0 3px 14px rgba(38, 40, 62, 0.045);
  font-size: 14px;
  line-height: 1.42;
  transition: transform 0.16s ease;
}
.bubble:hover { transform: translateY(-1px); }
.bubble-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: flex-start;
  gap: 5px;
  width: fit-content;
  max-width: min(86%, 560px);
}
.bubble-wrap.mine { align-self: flex-end; align-items: flex-end; }
.bubble-wrap .bubble { max-width: 100%; }
.bubble.mine {
  align-self: auto;
  border-color: transparent;
  border-radius: 18px;
  background: var(--lime);
  color: var(--on-accent);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--lime) 22%, transparent);
}
.bubble.mine .time { color: color-mix(in srgb, var(--on-accent) 64%, transparent); }
.bubble .receipt { font-style: normal; letter-spacing: -0.15em; }
.bubble .receipt.on { color: var(--ink); }
.bubble.mine .receipt.on { color: var(--on-accent); }
.bubble-quote { margin-bottom: 7px; }
.bubble.has-photo { max-width: min(330px, 78%); padding: 7px 7px 6px; }
.bubble.has-photo .bubble-body { padding: 0 5px 2px; }
.bubble-body {
  min-width: 0;
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.bubble .time {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  min-height: 13px;
  margin: 8px 0 0;
  float: none;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}
.bubble.has-photo .time { margin: 8px 2px 0; }
.composer-dock {
  flex-shrink: 0;
  width: 100%;
  margin-top: 0;
  padding: 0 16px max(14px, env(safe-area-inset-bottom));
  background: transparent;
  pointer-events: none;
  z-index: 6;
}
html.keyboard .composer-dock { padding-bottom: 6px; }
.reply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: min(780px, 100%);
  margin: 0 auto 8px;
  padding: 8px 12px 8px 16px;
  border: 1px solid var(--accent-line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.16);
  color: var(--muted);
  font-size: 13px;
  pointer-events: auto;
  animation: composerReplyPop 0.18s ease;
}
@keyframes composerReplyPop {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.reply-bar span { display: grid; min-width: 0; gap: 2px; }
.reply-bar b { color: var(--lime); font-size: 12px; font-weight: 650; }
.reply-bar em {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-style: normal;
  line-height: 1.35;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.reply-cancel {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.reply-cancel:hover { background: var(--accent-soft); color: var(--ink); }

.composer {
  display: grid;
  grid-template-columns: 42px 42px minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: end;
  width: min(780px, 100%);
  margin-inline: auto;
  padding: 6px 8px;
  border-radius: 28px;
  border: 1px solid color-mix(in srgb, var(--line) 75%, var(--accent-line) 25%);
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow:
    0 12px 34px -4px rgba(0, 0, 0, 0.22),
    0 3px 10px -2px rgba(0, 0, 0, 0.08),
    0 0 0 1px color-mix(in srgb, var(--line) 40%, transparent);
  pointer-events: auto;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.composer:focus-within {
  border-color: var(--accent-line);
  box-shadow:
    0 16px 42px -4px rgba(0, 0, 0, 0.28),
    0 4px 14px -2px rgba(0, 0, 0, 0.12),
    0 0 0 3px var(--accent-soft);
}
.composer.is-sending {
  opacity: 0.78;
  pointer-events: none;
}
.composer.is-sending .composer-send {
  cursor: wait;
}
.composer-attach {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.composer-attach:hover {
  background: var(--accent-soft);
  color: var(--lime);
  transform: scale(1.06);
}
.composer-attach:active {
  transform: scale(0.94);
}
.composer textarea[name="body"] {
  height: 24px;
  min-height: 24px;
  max-height: 128px;
  min-width: 0;
  margin: 8px 0;
  padding: 0 8px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
  box-shadow: none;
}
.composer textarea[name="body"]:focus {
  border: 0;
  box-shadow: none;
}
.composer textarea[name="body"]::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
.composer-send {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--lime);
  color: var(--on-accent);
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--lime) 40%, transparent);
}
.composer-send:hover {
  background: var(--lime);
  color: var(--on-accent);
  filter: brightness(1.06);
}
.composer-send:disabled {
  opacity: 0.45;
  cursor: default;
}
.composer.is-labeled {
  grid-template-columns: 42px 42px minmax(0, 1fr) auto;
}
.composer.is-labeled .composer-send {
  width: auto;
  min-width: 42px;
  padding: 0 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
}
.composer.is-recording {
  grid-template-columns: auto minmax(0, 1fr) auto;
}
.composer.is-recording .composer-send {
  width: auto;
  padding: 0 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
}
.composer-text {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 8px;
}
.rec-time { color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
button.bubble-quote {
  display: block;
  width: 100%;
  border: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.bubble-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}
.bubble-action {
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
}
.bubble-action:first-child {
  border-color: color-mix(in srgb, var(--lime) 55%, var(--line));
  color: var(--lime);
}
.bubble-action.icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  color: var(--muted);
  border-radius: 50%;
}
.bubble-action.icon svg { display: block; width: 16px; height: 16px; }
.bubble-action:disabled { opacity: 0.5; cursor: default; }
.voice-note {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 168px;
}
.voice-note audio { display: none; }
.voice-play {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 14%, transparent);
  color: inherit;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}
.voice-bar {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: color-mix(in srgb, currentColor 22%, transparent);
  overflow: hidden;
}
.voice-bar i { display: block; height: 100%; background: currentColor; }
.voice-duration, .bubble-transcript { font-size: 12px; line-height: 1.4; }
.bubble-transcript { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.mine .voice-duration, .bubble.mine .bubble-transcript { color: var(--on-accent); }

@media (max-width: 600px) {
  .chat-list-intro { align-items: center; }
  .chat-count { min-width: 58px; min-height: 58px; border-radius: 19px; font-size: 23px; }
  .chat-search kbd { display: none; }
  .match { min-height: 74px; padding-inline: 8px; }
  .match-wrap .match { padding-right: 42px; }
  .match img, .match .avatar { width: 54px; height: 54px; border-radius: 16px; }
  .match { grid-template-columns: 54px minmax(0, 1fr); gap: 11px; }
  .match-remove { right: 4px; }
  .unread { right: 42px; }
  .chat-topbar {
    min-height: calc(66px + env(safe-area-inset-top));
    padding-top: max(8px, env(safe-area-inset-top));
    padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right));
    padding-bottom: 8px;
  }
  .chat-back, .chat-top-action { flex-basis: 38px; width: 38px; height: 38px; }
  .chat-peer img { width: 42px; height: 42px; flex-basis: 42px; border-radius: 14px; }
  .thread { padding: 18px 12px 0; }
  .bubble { max-width: 86%; }
  .bubble.has-photo { max-width: 88%; }
  .composer-dock { padding: 0 10px max(10px, env(safe-area-inset-bottom)); }
  .composer { grid-template-columns: 38px 38px minmax(0, 1fr) 38px; gap: 6px; padding: 5px 6px; border-radius: 26px; }
  .composer-attach, .composer-send { width: 38px; height: 38px; }
  .composer textarea[name="body"] { margin: 7px 0; padding: 0 6px; font-size: 16px; }
  .reply-bar { border-radius: 18px; padding: 6px 10px 6px 14px; margin-bottom: 6px; }
}

/* WIRING+ mark: a restrained liquid gradient with one slow specular sweep. */
.badge-gem-icon {
  width: 22px;
  height: 22px;
  overflow: hidden;
  isolation: isolate;
  background-size: 220% 220%;
  box-shadow: 0 2px 7px rgba(75, 55, 120, 0.14);
  animation: gemLiquid 9.5s ease-in-out infinite;
}
.badge-gem-icon::before {
  inset: -1px;
  filter: blur(4px);
  opacity: 0.28;
  animation: gemAuraSpread 9.5s ease-in-out infinite;
}
.badge-gem-icon::after {
  position: absolute;
  inset: -65% auto -65% -125%;
  z-index: 2;
  width: 92%;
  background: linear-gradient(105deg, transparent 8%, rgba(255, 255, 255, 0.04) 28%, rgba(255, 255, 255, 0.3) 45%, rgba(255, 255, 255, 0.55) 52%, rgba(255, 255, 255, 0.14) 62%, transparent 86%);
  filter: blur(0.35px);
  content: "";
  pointer-events: none;
  transform: rotate(18deg);
  animation: gemSheen 7.2s cubic-bezier(0.32, 0, 0.18, 1) infinite;
}
.badge-gem-icon svg {
  width: 13px;
  height: 13px;
  filter: drop-shadow(0 1px 1px rgba(30, 20, 55, 0.18));
  animation: gemIconGlow 9.5s ease-in-out infinite;
}
html[data-theme] .badge-gem-icon {
  box-shadow: 0 2px 7px rgba(35, 25, 60, 0.16);
}
@keyframes gemLiquid {
  0%, 100% {
    background-position: 0% 35%;
    filter: saturate(0.98) brightness(0.98);
  }
  50% {
    background-position: 100% 65%;
    filter: saturate(1.14) brightness(1.08);
  }
}
@keyframes gemSheen {
  0%, 22% { left: -125%; opacity: 0; }
  30% { opacity: 0.78; }
  56%, 100% { left: 145%; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .badge-gem-icon,
  .badge-gem-icon::before,
  .badge-gem-icon::after,
  .badge-gem-icon svg {
    animation: none !important;
  }
}

/* Server documents share the same header component and content edges. */
body.legal-page #server-header { --container-app: var(--container-page); }
body.admin-page #server-header { --container-app: var(--container-admin); }
body.support-page #server-header { --container-app: 540px; }
body.legal-page .legal, body.admin-page .legal {
  padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right));
}
