/* Опрос РОФ — мобильный интерфейс */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #8b93a7;
  --line: #e3e8f2;
  --accent: #1f4bd8;
  --accent-soft: #eef2ff;
  --yes: #0f7b4f;
  --yes-soft: #e8f6ef;
  --no: #b4342a;
  --no-soft: #fdeeec;
  --shadow: 0 1px 2px rgba(17, 24, 39, .06), 0 8px 24px -12px rgba(17, 24, 39, .18);
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Атрибут hidden должен побеждать любые display: grid/flex в правилах ниже. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- шапка ---------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 720px; margin: 0 auto;
  padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.deadline {
  font-size: 12px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}

main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 20px 18px 40px; }

.screen { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- заголовок ---------- */

.hero { padding: 8px 0 18px; }
.hero h1 { margin: 0 0 6px; font-size: 26px; line-height: 1.2; letter-spacing: -.02em; }
.lede { margin: 0; color: var(--ink-2); font-size: 15px; }

/* ---------- поиск ---------- */

.search-wrap { position: relative; margin-bottom: 12px; }
#search {
  width: 100%;
  padding: 15px 44px 15px 16px;
  font-size: 17px;
  font-family: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
#search::-webkit-search-cancel-button { display: none; }
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(31, 75, 216, .12); }
.clear-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: #eef1f7; color: var(--ink-2); font-size: 20px; line-height: 1;
  cursor: pointer;
}

/* ---------- фильтры ролей ---------- */

.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  color: var(--ink-2); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 999px;
  cursor: pointer; transition: .15s;
}
.chip .count { color: var(--ink-3); font-weight: 500; margin-left: 4px; }
.chip[aria-selected="true"] {
  color: #fff; background: var(--accent); border-color: var(--accent);
}
.chip[aria-selected="true"] .count { color: rgba(255, 255, 255, .75); }

.hint { margin: 4px 2px 10px; font-size: 13px; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

/* ---------- список людей ---------- */

.people-list { display: flex; flex-direction: column; gap: 8px; }
.people-list > * { min-width: 0; }

.person {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-width: 0; padding: 13px 14px;
  text-align: left; font-family: inherit; font-size: 16px; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: 14px; cursor: pointer;
  transition: border-color .12s, transform .08s, box-shadow .12s;
}
.person:active { transform: scale(.985); }
.person:hover { border-color: #c8d2e8; }

.avatar {
  flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700; letter-spacing: -.02em;
  color: var(--accent); background: var(--accent-soft);
}
.person-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.person-name {
  display: block;
  font-weight: 600; letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
.person-meta {
  display: block;
  font-size: 12.5px; color: var(--ink-3);
  overflow-wrap: anywhere;
}
.role-tag { 
  flex: 0 0 auto;
  font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px;
  color: var(--ink-2); background: #f1f4fa;
}
.role-tag.r-РОФ { color: #1d4ed8; background: #e8efff; }
.role-tag.r-РМР { color: #7c3aed; background: #f1eaff; }
.role-tag.r-ФР-ОР { color: #b45309; background: #fef3c7; }

.empty { text-align: center; padding: 40px 10px; color: var(--ink-2); }

/* ---------- карточка ответа ---------- */

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 14px; padding: 6px 0;
  background: none; border: 0; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--accent);
}

.card {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.person-card { display: flex; align-items: center; gap: 14px; padding: 16px; }
.person-card .avatar { width: 52px; height: 52px; font-size: 17px; }
.person-card .person-name { font-size: 18px; }
.person-card .person-meta { font-size: 13px; white-space: normal; }

.question {
  margin: 22px 2px 14px;
  font-size: 17px; font-weight: 600; letter-spacing: -.01em;
}

.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 18px 16px;
  font-family: inherit; font-size: 17px; font-weight: 600; text-align: left;
  color: var(--ink); background: var(--card);
  border: 2px solid var(--line); border-radius: 14px;
  cursor: pointer; transition: .14s;
}
.option:active { transform: scale(.99); }
.option-check {
  flex: 0 0 auto; width: 26px; height: 26px;
  border: 2px solid #cfd6e6; border-radius: 50%;
  position: relative; transition: .14s;
}
.option-yes:hover, .option-yes.selected { border-color: var(--yes); background: var(--yes-soft); }
.option-yes.selected .option-check { border-color: var(--yes); background: var(--yes); }
.option-no:hover, .option-no.selected { border-color: var(--no); background: var(--no-soft); }
.option-no.selected .option-check { border-color: var(--no); background: var(--no); }
.option.selected .option-check::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 7px; height: 12px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.option[disabled] { opacity: .6; pointer-events: none; }

/* ---------- готово ---------- */

#step-done { text-align: center; padding-top: 30px; }
.done-mark {
  width: 64px; height: 64px; margin: 0 auto 16px;
  display: grid; place-items: center;
  font-size: 30px; color: #fff; background: var(--yes);
  border-radius: 50%; animation: pop .3s cubic-bezier(.2, .9, .3, 1.4);
}
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#step-done h2 { margin: 0 0 6px; font-size: 23px; letter-spacing: -.02em; }
.done-name { margin: 0 0 4px; font-weight: 600; }
.done-answer {
  display: inline-block; margin: 10px 0 6px;
  padding: 7px 14px; border-radius: 999px;
  font-weight: 700; font-size: 15px;
}
.done-answer.yes { color: var(--yes); background: var(--yes-soft); }
.done-answer.no { color: var(--no); background: var(--no-soft); }

.btn-secondary {
  margin-top: 24px; padding: 13px 22px;
  font-family: inherit; font-size: 15px; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  border: 0; border-radius: 12px; cursor: pointer;
}

/* ---------- подвал и тост ---------- */

.footer {
  max-width: 720px; margin: 0 auto; padding: 16px 18px 28px;
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 12.5px; color: var(--ink-3);
}
.footer a { color: var(--ink-3); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 11px 18px; border-radius: 12px;
  background: #111827; color: #fff; font-size: 14px;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .5); z-index: 100;
}

/* ---------- адаптив ---------- */

@media (min-width: 640px) {
  .hero h1 { font-size: 30px; }
  main { padding-top: 28px; }
  .people-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
