/* Компоненты дизайн-системы (frontend-spec §4): прототипные + новые этого цикла. */

/* --- Чипы --- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--mut); background: var(--card); white-space: nowrap;
}
.chip.on { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.chip.rose { border-color: transparent; background: var(--rose-soft); color: var(--rose); font-weight: 500; }
.chip.teal { border-color: transparent; background: var(--teal-soft); color: var(--teal); font-weight: 500; }
button.chip { min-height: 44px; } /* тач-таргет для кликабельных чипов */

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }

/* --- Сегмент-переключатель --- */
.seg { display: flex; gap: 22px; padding: 6px 20px 0; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.seg button { padding: 8px 2px 10px; font-size: 15px; color: var(--mut); border-bottom: 2px solid transparent; min-height: 44px; }
.seg button.on-rose { color: var(--rose); font-weight: 600; border-bottom-color: var(--rose); }
.seg button.on-teal { color: var(--teal); font-weight: 600; border-bottom-color: var(--teal); }

/* --- Прогресс-тики (сжимаются на узких экранах, а не выдавливают текст) --- */
.ticks { display: flex; gap: 4px; min-width: 0; flex-shrink: 1; }
.ticks i {
  flex: 1 1 auto; width: 14px; min-width: 4px; max-width: 14px;
  height: 3px; border-radius: 2px; background: var(--line); font-style: normal;
}
.ticks i.rose { background: var(--rose); }
.ticks i.teal { background: var(--teal); }
.ticks i.ink { background: var(--ink); }

/* --- Кнопки --- */
.btn {
  height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  gap: 8px; font-weight: 600; font-size: 14.5px; width: 100%;
}
.btn.dark { background: var(--ink); color: var(--bg); }
.btn.line { border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 500; }
.btn.rose { background: var(--rose-btn); color: var(--on-accent); }
.btn.teal { background: var(--teal-btn); color: var(--on-accent); }
.btn.danger { background: var(--danger-btn); color: var(--on-accent); }
.btn:disabled { opacity: .38; }
.btn.slim { width: auto; padding: 0 22px; }

/* --- Таббар --- */
.tabbar {
  display: flex; border-top: 1px solid var(--line); background: var(--card);
  padding: 8px 4px calc(10px + env(safe-area-inset-bottom)); flex-shrink: 0;
}
.tb {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; color: var(--dim); position: relative; padding-top: 8px; min-height: 48px;
}
.tb.on { color: var(--ink); font-weight: 600; }
.tb.on::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--ink);
}

/* --- Оверлеи и шиты --- */
.ovl { position: absolute; inset: 0; background: var(--bg); z-index: 20; display: flex; flex-direction: column; }
.scrim {
  position: absolute; inset: 0; background: rgba(10, 11, 13, .5); z-index: 30;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--card); border-radius: 20px 20px 0 0; width: 100%; max-width: 430px;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; /* низкие окна */
}

/* --- Меню и списки --- */
.mrow {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--line2); width: 100%; min-height: 50px;
}
.mrow:last-child { border-bottom: none; }
.mrow .mv { margin-left: auto; font-size: 13px; color: var(--mut); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.mlabel {
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--mut); font-weight: 600; margin: 16px 20px 6px;
}
.lrow {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-bottom: 1px solid var(--line2); width: 100%; min-height: 64px;
}
.pava { border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; overflow: hidden; }
.pava img { width: 100%; height: 100%; object-fit: cover; }
.ava {
  width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--bg);
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600;
  overflow: hidden; flex-shrink: 0;
}
.ava img { width: 100%; height: 100%; object-fit: cover; }
button.ava { min-width: 44px; min-height: 44px; width: 44px; height: 44px; }

/* --- Тоаст --- */
.toast {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 110px;
  background: var(--ink); color: var(--bg); border-radius: 999px; padding: 9px 18px;
  font-size: 13.5px; z-index: 60; opacity: 0; transition: opacity .25s;
  pointer-events: none; max-width: 90%; text-align: center; white-space: normal;
}
.toast.on { opacity: 1; }

/* --- Поля ввода (.field) --- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.field input[type="text"], .field input[type="number"], .field textarea, .field select {
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink);
  font-family: inherit; font-size: 15px; padding: 12px 14px; min-height: 48px; width: 100%;
  appearance: none; -webkit-appearance: none;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--ink); outline: none; }
.field.err input, .field.err textarea, .field.err select { border-color: var(--danger); }
.fhint { font-size: 12px; color: var(--mut); line-height: 1.4; }
.fhint.err { color: var(--danger); }
.fcount { font-size: 12px; color: var(--mut); text-align: right; }
.fcount.ok { color: var(--ok); }
.selrow { display: flex; gap: 8px; }
.selrow select { flex: 1; }

/* --- Карточка-радио (.opt-card) --- */
.opt-card {
  border: 1.5px solid var(--line); border-radius: 16px; background: var(--card);
  padding: 15px 16px; width: 100%; display: flex; flex-direction: column; gap: 3px; min-height: 56px;
}
.opt-card.on { border-color: var(--ink); border-width: 2px; padding: 14.5px 15.5px; }
.opt-card b { font-size: 15px; }
.opt-card span { font-size: 12.5px; color: var(--mut); }

/* --- Фото-тайл аплоадера (.photo-tile) --- */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.photo-tile {
  aspect-ratio: 3 / 4; border-radius: 14px; border: 1.5px dashed var(--line);
  background: var(--card); position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: var(--dim); width: 100%;
}
.photo-tile.filled { border-style: solid; }
.photo-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-tile .pt-badge {
  position: absolute; left: 6px; bottom: 6px; right: 6px; z-index: 2;
  font-size: 10.5px; font-weight: 600; text-align: center; border-radius: 8px; padding: 4px 6px;
  background: rgba(10, 11, 13, .62); color: #fff;
}
.photo-tile .pt-badge.warn { background: rgba(10, 11, 13, .62); color: #FFD9A0; }
.photo-tile .pt-load {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 11, 13, .4); color: #fff; font-size: 12px; font-weight: 600;
}

/* --- Тумблер (.switch): визуал 46×27, кликабельная зона 54×45 через ::before --- */
.switch {
  width: 46px; height: 27px; border-radius: 999px; background: var(--line);
  padding: 3px; display: flex; justify-content: flex-start; flex-shrink: 0;
  transition: background .15s; border: none; cursor: pointer; position: relative;
}
.switch::before { content: ''; position: absolute; inset: -9px -4px; border-radius: 999px; }
.switch::after { content: ''; width: 21px; height: 21px; border-radius: 50%; background: var(--card); display: block; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch[aria-checked="true"] { background: var(--ink); }
.switch[aria-checked="true"]::after { transform: translateX(19px); }
.switch:disabled { opacity: .4; }

/* --- Скелетоны --- */
.skel { background: linear-gradient(120deg, var(--ph1), var(--ph2)); border-radius: 10px; animation: shimmer 1.4s ease infinite; }

/* --- Пустое состояние / блок ошибки ---
   Центрирование через margin:auto на крайних детях, а не justify-content:center:
   при контенте выше окна контейнер скроллится и верх НЕ обрезается. */
.empty, .error-block {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 10px; text-align: center; padding: 20px 30px; color: var(--ink);
  overflow-y: auto; min-height: 0;
}
.empty > :first-child, .error-block > :first-child { margin-top: auto; }
.empty > :last-child, .error-block > :last-child { margin-bottom: auto; }
.empty svg, .error-block svg { flex-shrink: 0; }
.empty svg, .error-block svg { color: var(--dim); }
.empty b, .error-block b { font-size: 17px; font-weight: 600; }
.empty p, .error-block p { font-size: 13.5px; color: var(--mut); margin: 0; line-height: 1.5; }

/* --- Баннер --- */
.banner {
  margin: 10px 18px 0; padding: 11px 14px; border-radius: 12px;
  background: var(--rose-soft); color: var(--rose); font-size: 13px; line-height: 1.4;
  display: flex; gap: 10px; align-items: center; flex-shrink: 0;
}

/* --- Бейдж «проверен» --- */
.badge-verified { display: inline-flex; align-items: center; color: var(--teal); vertical-align: -3px; }

/* --- Кнопки решения --- */
.decide-row { display: flex; align-items: center; justify-content: center; gap: 26px; padding: 14px 20px 12px; flex-shrink: 0; }
.dbtn {
  border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.dbtn.skip { width: 54px; height: 54px; border: 1px solid var(--line); background: var(--card); color: var(--mut); }
.dbtn.like { width: 66px; height: 66px; background: var(--rose-btn); color: var(--on-accent); }
.dbtn.like.teal { background: var(--teal-btn); }
.dbtn:disabled { opacity: .45; }

/* --- Точки фотогалереи --- */
.dots { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; gap: 4px; z-index: 2; }
.dots i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .35); }
.dots i.on { background: rgba(255, 255, 255, .95); }
