:root {
  --bg: #f4f5fa;
  --panel: rgba(255, 255, 255, 0.96);
  --panel2: rgba(255, 255, 255, 0.78);
  --text: #1f2937;
  --muted: rgba(31, 41, 55, 0.6);
  --brand: #7c3aed;
  --brand2: #0891b2;
  --danger: #e11d48;
  --ok: #059669;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.14);
  --radius-xl: 28px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --space-xs: 10px;
  --space-sm: 14px;
  --space-md: 18px;
  --space-lg: 22px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow-x: clip;
  background: radial-gradient(1200px 700px at 15% 10%, rgba(167, 139, 250, 0.10), transparent 55%),
    radial-gradient(900px 600px at 90% 10%, rgba(34, 211, 238, 0.08), transparent 50%),
    radial-gradient(700px 500px at 60% 90%, rgba(251, 113, 133, 0.07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.35;
}

a { color: inherit; }

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.brand { display: flex; gap: 14px; align-items: center; }
.logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.25), transparent 55%),
    linear-gradient(135deg, rgba(167, 139, 250, 0.9), rgba(34, 211, 238, 0.9));
  box-shadow: var(--shadow);
}
.brand-title { font-weight: 750; letter-spacing: 0.3px; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.top-actions { display: flex; gap: 12px; }

.tabs {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 1200;
  width: min(640px, calc(100% - 24px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(15, 23, 42, 0.10);
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.18);
}

.tab {
  border: none;
  background: rgba(15, 23, 42, 0.02);
  color: var(--text);
  padding: 10px 6px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-weight: 750;
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 58px;
  user-select: none;
  overflow: visible;
}
.tab.active {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.18), rgba(34, 211, 238, 0.14));
}
.tab-ico { font-size: 18px; line-height: 1; opacity: 0.95; }
.tab-lbl { font-size: 10.5px; color: var(--muted); }
.tab.active .tab-lbl { color: rgba(17, 24, 39, 0.92); }
.tab-lbl {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.15;
  max-width: 100%;
  text-align: center;
  word-break: break-word;
  overflow-wrap: anywhere;
}
@media (max-width: 420px) {
  .tabs { gap: 6px; padding: 8px; }
  .tab { padding: 9px 4px; }
  .tab-lbl { font-size: 10px; }
}

.main {
  flex: 1;
  padding: 18px 16px calc(128px + env(safe-area-inset-bottom));
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding-bottom: calc(176px + env(safe-area-inset-bottom));
}

/* Веб-версия (десктоп): используем доступную ширину экрана */
@media (min-width: 1000px) {
  .main { max-width: 1080px; }
}

.view { display: block; }
.hidden { display: none; }

.muted { color: var(--muted); line-height: 1.35; }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

@media (min-width: 880px) {
  .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.card {
  background: var(--panel);
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-title { font-weight: 750; margin-bottom: 12px; }

.home-segment {
  display: flex;
  gap: 10px;
  padding: 6px;
  border-radius: var(--radius-xl);
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.seg {
  flex: 1 1 0;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--muted);
  padding: 12px 14px;
  font-weight: 750;
  cursor: pointer;
}

.seg.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.18), rgba(34, 211, 238, 0.14));
  border-color: rgba(167, 139, 250, 0.65);
}

.messages-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.events-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 4px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.10);
}

.events-switch {
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: rgba(17, 24, 39, 0.72);
  font-weight: 750;
  padding: 11px 12px;
}

.events-switch.active {
  background: #ff5a2c;
  color: #fff;
}

.events-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.event-tile {
  border: 0;
  border-radius: 18px;
  color: #fff;
  padding: 16px 14px;
  min-height: 164px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: flex-start;
  box-shadow: 0 12px 34px rgba(0,0,0,0.24);
}

.event-tile-art {
  width: 86px;
  height: 86px;
  border-radius: 16px;
  background: rgba(255,255,255,0.16);
  display: grid;
  place-items: center;
  font-size: 34px;
}

.event-tile-title {
  font-weight: 800;
  font-size: 18px;
  line-height: 1.1;
}

.event-tile-meta,
.event-tile-small {
  font-size: 12px;
  opacity: 0.88;
  line-height: 1.3;
}

.theme-orange { background: #ff5a2c; }
.theme-dark { background: #0a0a0a; }
.theme-blue { background: #16a7df; }

@media (min-width: 920px) {
  .messages-shell {
    grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
    align-items: start;
  }
}

@media (max-width: 560px) {
  .events-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .event-tile {
    min-height: 146px;
    padding: 14px 12px;
  }
  .event-tile-art {
    width: 72px;
    height: 72px;
  }
  .event-tile-title {
    font-size: 16px;
  }
}

.messages-list-card,
.messages-thread-card {
  min-height: 420px;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.matches-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.matches-strip .match-card {
  flex: 0 0 auto;
}

.chat-item {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
}

.chat-item.active {
  border-color: rgba(167, 139, 250, 0.7);
  background: rgba(167, 139, 250, 0.08);
}

.chat-avatar-wrap {
  position: relative;
  flex: 0 0 auto;
}

.chat-avatar-wrap.unread::after {
  content: '';
  position: absolute;
  right: -2px;
  top: -2px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.95);
}

.chat-avatar,
.chat-thread-avatar {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.chat-main {
  min-width: 0;
  flex: 1;
}

.chat-topline,
.chat-thread-head {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
}

.chat-name,
.chat-thread-name {
  font-weight: 800;
}

.chat-time,
.chat-thread-meta {
  color: var(--muted);
  font-size: 12px;
}

.chat-preview {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.messages-thread-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-thread-user {
  display: flex;
  gap: 12px;
  align-items: center;
}

.chat-thread-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 280px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.chat-bubble {
  max-width: min(80%, 460px);
  padding: 12px 14px;
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.10);
}

.chat-bubble.them {
  background: rgba(15, 23, 42, 0.06);
  align-self: flex-start;
}

.chat-bubble.me {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.24), rgba(34, 211, 238, 0.18));
  align-self: flex-end;
}

.chat-bubble-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-bubble-time {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.chat-composer {
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-composer .input {
  max-width: none;
  flex: 1;
}

.chat-screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: calc(100dvh - 235px);
  min-height: 460px;
  padding: 18px 16px calc(128px + env(safe-area-inset-bottom));
}

.chat-screen-head {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.chat-screen-head .chat-back {
  flex: 0 0 auto;
  padding: 10px 12px;
}

.chat-screen-head .chat-thread-user {
  min-width: 0;
  flex: 1;
}

.chat-screen .chat-thread-body {
  flex: 1;
  max-height: none;
  min-height: 0;
}

@media (max-width: 560px) {
  .chat-screen { padding: 14px 12px calc(132px + env(safe-area-inset-bottom)); }
}

.profile-editor {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-editor .card-title {
  margin-bottom: 0;
}

.row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  margin: 12px 0;
  flex-wrap: wrap;
}
.row > * { min-width: 0; }
.row-inline { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.right { justify-content: flex-end; }

.btn {
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 700;
  touch-action: manipulation;
}
.btn:hover { background: rgba(15, 23, 42, 0.10); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(251, 113, 133, 0.6); color: #be123c; }

.input, .select {
  width: 100%;
  max-width: 260px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: rgba(15, 23, 42, 0.05);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius-md);
}
.input { min-width: min(260px, 100%); }

.label { color: var(--muted); font-size: 12px; margin-right: 10px; }

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-field .label {
  margin-right: 0;
}

.profile-editor .input,
.profile-editor textarea {
  max-width: none;
  width: 100%;
}

.profile-editor textarea {
  min-height: 160px;
  resize: vertical;
}

.questionnaire-card {
  gap: 18px;
}

.questionnaire-grid {
  display: grid;
  gap: 14px;
}

.question-block {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.question-title {
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
}

.questionnaire-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  justify-items: center;
}

.questionnaire-options .questionnaire-chip { max-width: 460px; }

.questionnaire-chip {
  width: 100%;
  min-height: 78px;
  border-radius: 18px;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  white-space: normal;
  line-height: 1.25;
}

.questionnaire-chip small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}

.qn-question-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.circle-layout {
  gap: 18px;
}

.circle-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.circle-panel .input,
.circle-panel .select,
.circle-panel textarea {
  max-width: none;
  width: 100%;
}

.circle-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.circle-chip {
  min-height: 48px;
  white-space: normal;
  text-align: left;
}

.circle-custom-row {
  align-items: stretch;
}

.circle-custom-row .input {
  flex: 1 1 0;
  min-width: 0;
}

.circle-friends,
.circle-group-list {
  display: grid;
  gap: 10px;
}

.circle-friend,
.circle-rec-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.circle-friend.selected {
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
}

.circle-tag-wrap {
  gap: 8px;
}

.status-pill.good {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.3);
  color: #047857;
}

.status-pill.warn {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.28);
  color: #b45309;
}

.status-pill.bad {
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.28);
  color: #be123c;
}

.status-pill.muted {
  background: rgba(15, 23, 42, 0.06);
  border-color: rgba(15, 23, 42, 0.12);
  color: var(--muted);
}

.profile-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.profile-actions .btn {
  flex: 1 1 0;
  min-width: 0;
}

.profile-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-steps .btn {
  width: 100%;
}

.match-strip {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.match-card {
  width: 98px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.match-photo-wrap {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  padding: 4px;
  background: transparent;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.match-card.new .match-photo-wrap {
  border-color: rgba(34, 197, 94, 0.9);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.match-card.seen .match-photo-wrap {
  border-color: rgba(15, 23, 42, 0.10);
  box-shadow: none;
}

.match-card:hover .match-photo-wrap {
  transform: translateY(-1px);
}

.match-photo {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
}

.match-name {
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  line-height: 1.1;
}

.match-meta {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  line-height: 1.1;
}

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

/* Анкета (дерево решений) занимает всю ширину карточки фильтров */
.tree-filter-group {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip-x {
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 12px;
  color: inherit;
  padding: 0 2px;
  margin-left: 6px;
  opacity: 0.7;
}
.chip-x:hover { opacity: 1; }

.accordion-head,
.tree-filter-cat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.accordion-head { margin-top: 12px; }

.accordion-title,
.tree-filter-cat-head > span:first-child {
  flex: 1;
  min-width: 0;
}

.chevron {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  transition: transform 0.2s ease;
}

[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.accordion-body { margin-top: 12px; }

.tree-filter {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.tree-filter-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 12px 2px;
}

.tree-filter-body[hidden],
.accordion-body[hidden] { display: none; }

.tree-filter-q .muted { margin-bottom: 6px; font-size: 13px; text-align: center; }
.tree-filter-q .chip-row { justify-content: center; }

.filter-select,
.range {
  width: 100%;
  max-width: none;
}

.filter-select {
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.filter-select option {
  color: #0b1220;
  background: #e5e7eb;
}

.range {
  accent-color: var(--brand2);
}

.range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.14);
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand2);
  border: 2px solid rgba(255, 255, 255, 0.85);
  margin-top: -7px;
}

.range::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.14);
}

.range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand2);
  border: 2px solid rgba(255, 255, 255, 0.85);
}

.plan-creator {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.plan-creator-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
}

.plan-creator .profile-field {
  gap: 6px;
}

.plan-company {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}

.plan-company input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand2);
}

.wishlist-places {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.item-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.muted-pill {
  color: var(--muted);
}

@media (max-width: 560px) {
  .match-card {
    width: 82px;
  }

  .match-photo-wrap {
    width: 76px;
    height: 76px;
  }

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

  .plan-creator-grid {
    grid-template-columns: 1fr;
  }

  .questionnaire-options {
    grid-template-columns: 1fr;
  }

  .circle-chip-grid {
    grid-template-columns: 1fr;
  }
}

.photo-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.photo-hero-main {
  appearance: none;
  padding: 0;
  cursor: pointer;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 520px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background:
    radial-gradient(circle at 20% 20%, rgba(167, 139, 250, 0.18), transparent 45%),
    radial-gradient(circle at 80% 20%, rgba(34, 211, 238, 0.16), transparent 42%),
    rgba(15, 23, 42, 0.05);
  display: grid;
  place-items: center;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.photo-hero-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-hero-main:hover {
  transform: translateY(-1px);
  border-color: rgba(167, 139, 250, 0.35);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.10);
}

.photo-hero-main.empty {
  min-height: 360px;
}

.photo-empty {
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.2px;
}

.photo-hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.photo-hero-actions .btn {
  flex: 1 1 0;
  min-width: 0;
}

.photo-strip {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.photo-thumb {
  width: 72px;
  height: 72px;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(15, 23, 42, 0.05);
  cursor: pointer;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

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

.kpi {
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.kpi .n { font-size: 24px; font-weight: 800; }
.kpi .l { color: var(--muted); margin-top: 4px; font-size: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(15, 23, 42, 0.06);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  font-weight: 650;
  color: var(--text);
}
.chip.active {
  border-color: rgba(34, 211, 238, 0.65);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
  background: rgba(34, 211, 238, 0.10);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  min-height: 28px;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.25);
  color: #6d28d9;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list { display: grid; gap: 10px; }
.item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(15, 23, 42, 0.04);
}

#map {
  height: min(52vh, 440px);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.10);
}

#eventsMap {
  height: min(58vh, 520px);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.10);
}
.item-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.item-head > * { min-width: 0; }
.item-title { font-weight: 800; }
.item-meta { color: var(--muted); font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.item-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.dialog {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: var(--radius-lg);
  padding: 0;
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  box-shadow: var(--shadow);
  max-width: min(940px, calc(100vw - 20px));
  max-height: min(92dvh, 900px);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
}

.dialog-card { padding: 18px; overflow: auto; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 12px; }
.dialog-title { font-weight: 850; font-size: 16px; }

@media (max-width: 560px) {
  .dialog {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: 100dvh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .dialog-card { height: 100%; overflow: auto; padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  .dialog-head {
    position: sticky;
    top: 0;
    padding: 10px 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    z-index: 2;
  }

  .profile-editor {
    gap: 20px;
  }

  .profile-actions {
    position: sticky;
    bottom: calc(12px + env(safe-area-inset-bottom));
    margin-top: 8px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: var(--radius-lg);
  }

  .profile-actions .btn {
    flex-basis: 100%;
  }

  .photo-hero-actions .btn {
    flex-basis: 100%;
  }

  .photo-hero-main.empty {
    min-height: 320px;
  }

  .photo-thumb {
    width: 64px;
    height: 64px;
  }
}

.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 999px;
  transition: 0.2s;
}
.slider:before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider {
  background: rgba(52, 211, 153, 0.25);
  border-color: rgba(52, 211, 153, 0.35);
}
.switch input:checked + .slider:before { transform: translateX(20px); }

.toast {
  position: fixed;
  right: 12px;
  bottom: 64px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  max-width: 360px;
  box-shadow: 0 14px 44px rgba(15, 23, 42, 0.18);
}

@media (min-width: 980px) {
  .tabs { left: 50%; right: auto; transform: translateX(-50%); width: min(640px, calc(100% - 24px)); }
}

.tinder-wrap {
  position: relative;
  height: min(64vh, 520px);
}
@media (max-height: 740px) {
  .tinder-wrap { height: min(58vh, 460px); }
}

.tinder-card {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background:
    radial-gradient(900px 520px at 25% 15%, rgba(167, 139, 250, 0.22), transparent 55%),
    radial-gradient(700px 520px at 80% 20%, rgba(34, 211, 238, 0.18), transparent 55%),
    rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.16);
  touch-action: pan-y;
  user-select: none;
  will-change: transform;
}

.tinder-card * { text-shadow: none; }

.tinder-card .pad { padding: 20px; display: grid; gap: 14px; height: 100%; overflow: auto; }
.tinder-card .pad { grid-auto-rows: min-content; }
.tinder-title { line-height: 1.1; }
.tinder-sub { line-height: 1.3; }
.tinder-about { margin-top: 2px; }
.tinder-badges { margin-top: 2px; }
.tinder-badges { row-gap: 12px; }
.tinder-badges .pill { max-width: 100%; }
.tinder-badges { justify-content: flex-start; }
.tinder-badges .pill { margin: 0; }
.tinder-card .pad > .muted { padding-bottom: 12px; }

/* Ensure pills never visually overlap: keep them as stable chips with consistent height. */
.pill { line-height: 1; }

@media (max-width: 420px) {
  .pill { font-size: 11px; padding: 6px 9px; min-height: 26px; }
  .tinder-title { font-size: 20px; }
}
.tinder-title { font-weight: 900; font-size: 22px; letter-spacing: 0.2px; }
.tinder-sub { color: var(--muted); }
.tinder-badges { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; align-content: flex-start; }
.tinder-badges + .tinder-badges { margin-top: 6px; }
.tinder-badges { isolation: isolate; }
.tinder-about { color: rgba(17, 24, 39, 0.88); line-height: 1.35; }
.tinder-actions { display: flex; gap: 12px; justify-content: center; margin-top: 12px; }
.tbtn {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}
.tbtn.like { border-color: rgba(52, 211, 153, 0.45); background: rgba(52, 211, 153, 0.08); }
.tbtn.nope { border-color: rgba(251, 113, 133, 0.50); background: rgba(251, 113, 133, 0.06); }

.tinder-stamp {
  position: absolute;
  top: 18px;
  left: 18px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-weight: 950;
  letter-spacing: 0.6px;
  border: 2px solid rgba(15, 23, 42, 0.35);
  background: rgba(255, 255, 255, 0.85);
  transform: rotate(-10deg);
  opacity: 0;
  pointer-events: none;
}
.tinder-stamp.like { border-color: rgba(52, 211, 153, 0.75); color: #065f46; }
.tinder-stamp.nope { border-color: rgba(251, 113, 133, 0.8); color: #9f1239; transform: rotate(10deg); left: auto; right: 18px; }

/* ==== Анкета совместимости (свайп-карточки) ==== */
.questionnaire-dialog {
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.qn-progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}
.qn-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #60a5fa);
  transition: width 260ms ease;
}
.qn-counter { font-size: 12px; text-align: right; }
.qn-stage { position: relative; min-height: 260px; overflow: visible; touch-action: pan-y; }
.qn-card {
  background: rgba(15, 23, 42, 0.045);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 20px;
  padding: 14px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 240ms ease, opacity 220ms ease;
  will-change: transform;
  user-select: none;
  touch-action: pan-y;
}
.qn-card.slide-left { transform: translateX(-40%); opacity: 0; }
.qn-card.slide-right { transform: translateX(40%); opacity: 0; }
.qn-q {
  font-size: 16px;
  font-weight: 650;
  line-height: 1.32;
  flex: 0 0 auto;
  text-align: center;
}
.qn-opts {
  display: flex;
  flex-direction: row;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  padding: 2px 2px 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}
.qn-opts::-webkit-scrollbar { display: none; }
.qn-opts-wrap { display: flex; flex-direction: column; gap: 10px; }
.qn-opts-nav {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  background: rgba(250, 250, 252, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.1);
}
.qn-opts-nav .btn { flex: 1 1 0; min-width: 0; }
.qn-num { display: flex; flex-direction: column; gap: 12px; padding: 2px 0 6px; }
.qn-num-input { font-size: 17px; font-weight: 650; text-align: left; }
.qn-num .btn { align-self: flex-start; min-width: 160px; }
.qn-search { display: flex; flex-direction: column; gap: 10px; padding: 2px 0 6px; }
.qn-search-input { font-size: 15px; }
.qn-search-results { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.qn-search-item {
  text-align: left;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(15, 23, 42, 0.03);
  color: var(--text, #e5e7eb);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.qn-search-item:hover { background: rgba(15, 23, 42, 0.07); }
.qn-search-item.chosen {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.55);
}
.qn-multi-done { align-self: flex-start; min-width: 160px; }
.qn-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  margin-top: 14px;
  padding: 2px 10px 0;
}
.qn-cta .btn { min-width: min(220px, 80%); }
.qn-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  flex: 0 0 auto;
  width: min(230px, 72vw);
  scroll-snap-align: start;
  padding: 12px 13px;
  border-radius: 15px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(15, 23, 42, 0.03);
  color: var(--text, #e5e7eb);
  font: inherit;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 120ms ease;
}
.qn-opt:active { transform: scale(0.97); }
.qn-opt:hover { background: rgba(15, 23, 42, 0.07); }
.qn-opt.selected {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.55);
}
.qn-opt-letter {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.08);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #9ca3af;
}
.qn-opt.selected .qn-opt-letter { background: rgba(52, 211, 153, 0.22); color: #059669; }
.qn-opt-text { display: flex; flex-direction: column; gap: 2px; }
.qn-opt-label { font-weight: 550; line-height: 1.3; }
.qn-opt-hint { font-size: 12px; color: #8b93a7; }
.qn-actions { justify-content: space-between; align-items: center; }
.qn-hint { font-size: 12px; }

.account-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);
  font-size: 13px;
  line-height: 1.35;
}
.account-badge-info { overflow-wrap: anywhere; }
.account-badge .btn { padding: 8px 12px; font-size: 13px; flex: 0 0 auto; }

/* ==== Прогресс по категориям в профиле ==== */
.cat-progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.cat-progress-item {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.03);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: border-color 150ms ease, transform 150ms ease;
}
.cat-progress-item:hover {
  border-color: rgba(99, 102, 241, 0.55);
  transform: translateY(-1px);
}
.cat-progress-item:active { transform: translateY(0); }
.cat-progress-name { font-size: 13px; font-weight: 600; }
.cat-progress-bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  margin-top: 8px;
  overflow: hidden;
}
.cat-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #60a5fa);
}
.cat-progress-count { font-size: 11px; color: #8b93a7; margin-top: 6px; }
.cat-progress-done .cat-progress-fill { background: #34d399; }

/* ==== Вердикт совместимости ==== */
.verdict { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; }
.verdict.good { color: #059669; }
.verdict.warn { color: #d97706; }
.verdict.bad { color: #e11d48; }
.compat-diff { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }

/* ==== Места для записи (бронирование) ==== */
.venues-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.venue-card {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.03);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.venue-emoji { font-size: 26px; }
.venue-title { font-weight: 650; line-height: 1.3; }
.venue-addr { font-size: 12px; }
.venue-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.venue-price { font-weight: 600; color: #047857; font-size: 14px; }
.bk-form { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.bk-row { display: flex; flex-direction: column; gap: 4px; }
.bk-offers { margin-top: 4px; }
.bk-offer {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
}
.bk-offer.disabled { opacity: 0.45; pointer-events: none; }
.bk-offer-name { flex: 1; font-weight: 550; }
.bk-offer-price { font-weight: 700; }
.bk-success { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.bk-error { margin-top: 12px; color: #e11d48; font-size: 13px; }
