/* Кветариум — общий стиль */

:root {
  /* Фирменные цвета Kleek (kleek.ru) */
  --bg: #f4f4f4;
  --card: #ffffff;
  --ink: #191919;
  --muted: #6f6c8b;
  --line: #e7e5ef;
  --accent: #7f42e1;
  --accent-hover: #6d33cf;
  --accent-soft: #f5f0ff;
  --ok: #12805c;
  --ok-soft: #e2f5ec;
  --danger: #e14a4a;
  --danger-soft: #ffe9e9;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(25, 25, 25, 0.04), 0 4px 16px rgba(25, 25, 25, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  /* TT Norms — фирменный шрифт Kleek; если не установлен, системный */
  font: 16px/1.55 "TT Norms", "TT Norms Tochka Extended", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}

h1 { font-size: 26px; margin: 0 0 8px; line-height: 1.25; }
h2 { font-size: 19px; margin: 0 0 8px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- шапка админки ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.topnav { display: flex; gap: 14px; }
.topnav a { color: var(--muted); font-weight: 500; padding: 6px 2px; }
.topnav a:hover { color: var(--ink); text-decoration: none; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { color: var(--muted); font-size: 14px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline { display: inline; }

/* ---------- раскладка ---------- */

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}

.empty { text-align: center; padding: 40px 20px; }

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: #fafaff; text-decoration: none; box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; box-shadow: none; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f0f0f8; color: var(--ink); box-shadow: none; }
.btn-ghost.danger, .btn-danger { color: var(--danger); }
.btn-danger { border-color: #f0c8c8; }
.btn-danger:hover { background: var(--danger-soft); }

.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- формы ---------- */

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--ink);
  background: #fff;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-sm { max-width: 280px; }

.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14.5px; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  margin: 12px 0;
}
.alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid #f2cfcf; }
.alert-ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #bfe8d5; }
.alert-ok code {
  background: #fff; padding: 2px 8px; border-radius: 6px;
  font-size: 15px; font-weight: 700; user-select: all;
}

/* ---------- фирменный знак ---------- */

.brand-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.brand-mark { width: 36px; height: 36px; display: block; }
.brand-name { font-weight: 800; font-size: 21px; letter-spacing: -0.02em; color: var(--ink); }
.brand-float {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  opacity: 0.92;
}
.brand-float .brand-head { margin-bottom: 0; }

/* ---------- логин ---------- */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card { width: 100%; max-width: 380px; padding: 30px 28px; margin-top: 14px; }
.brand-lg { text-align: center; font-size: 24px; margin-bottom: 4px; }
.auth-card .btn-block { margin-top: 6px; }

/* ---------- таблица опросов ---------- */

.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th {
  text-align: left;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafaff; }
.row-title { font-weight: 600; color: var(--ink); }
.row-sub { font-size: 13.5px; margin-top: 2px; }
.table-card { padding: 6px 10px; overflow-x: auto; }

.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}
.chip-open { background: var(--ok-soft); color: var(--ok); }
.chip-closed { background: #f0f0f5; color: var(--muted); }

/* ---------- карточка опроса ---------- */

.link-row { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.link-input {
  flex: 1;
  min-width: 240px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--accent);
  background: var(--accent-soft);
}
.qlist { padding-left: 22px; margin: 0; }
.qlist li { margin-bottom: 12px; }
.qlist .opts { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.qlist .opts li { margin-bottom: 2px; }
.danger-zone { border-color: #f0dcdc; }

/* ---------- конструктор ---------- */

.q-card { border-left: 4px solid var(--accent); }
.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.q-num { font-weight: 700; font-size: 14px; }
.type-badge {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12.5px;
  font-weight: 600;
}
.q-tools { margin-left: auto; display: flex; gap: 6px; }

.options { margin-top: 4px; }
.option-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.option-row input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
}
.option-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.add-questions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.save-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  position: sticky;
  bottom: 12px;
}
.save-row .btn-primary { box-shadow: 0 6px 20px rgba(91, 91, 214, 0.35); }

/* ---------- квиз ---------- */

.quiz-body {
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg) 45%);
}

.quiz {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 76px 18px 40px;
}

.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: #e3e4f2;
  z-index: 20;
}
.progress .bar {
  height: 100%;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.quiz-card {
  width: 100%;
  max-width: 620px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 12px 44px rgba(127, 66, 225, 0.1);
  padding: 30px 30px 24px;
}
.quiz-title { text-align: center; font-weight: 700; font-size: 15px; color: var(--muted); margin: 0 0 4px; }
.quiz-desc { text-align: center; font-size: 14px; color: var(--muted); margin: 0 0 14px; }

.q-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.q-count { font-size: 13px; font-weight: 600; color: var(--muted); }
.req { font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 9px; border-radius: 999px; }
.req-no { color: var(--muted); background: #f0f0f5; }

.q-text { font-size: 22px; line-height: 1.3; margin: 0 0 18px; }

.choices { display: flex; flex-direction: column; gap: 10px; }
.hint { font-size: 13.5px; color: var(--muted); margin-bottom: 2px; }

.choice {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  position: relative;
}
.choice:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.choice:disabled { opacity: 0.45; cursor: not-allowed; }
.choice.picked {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.choice.picked::after {
  content: "✓";
  margin-left: auto;
  color: var(--accent);
  font-weight: 700;
  padding-left: 12px;
}

.scale { display: flex; gap: 10px; flex-wrap: wrap; }
.scale-btn {
  flex: 1;
  min-width: 52px;
  height: 60px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  font: inherit;
  font-size: 19px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.scale-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.scale-btn.picked { border-color: var(--accent); background: var(--accent); color: #fff; }

.text-answer textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  font: inherit;
  font-size: 16px;
  resize: vertical;
  min-height: 110px;
}
.text-answer textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.quiz-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}
.quiz-nav .btn { padding: 11px 22px; font-size: 15px; }

/* финальная проверка */
.review-title { margin-bottom: 14px; }
.review-list { margin: 0 0 6px; }
.review-list dt { font-weight: 600; margin-top: 12px; }
.review-list dd { margin: 3px 0 0; color: var(--accent); font-weight: 500; }
.review-list dd.skipped { color: var(--muted); font-weight: 400; }

/* переходы между вопросами */
.slide-fwd-enter-active, .slide-fwd-leave-active,
.slide-back-enter-active, .slide-back-leave-active {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
}
.slide-fwd-enter-from { transform: translateX(56px); opacity: 0; }
.slide-fwd-leave-to { transform: translateX(-56px); opacity: 0; }
.slide-back-enter-from { transform: translateX(-56px); opacity: 0; }
.slide-back-leave-to { transform: translateX(56px); opacity: 0; }

/* ---------- «спасибо» ---------- */

.done-card { text-align: center; padding: 44px 32px; max-width: 420px; }
.done-check {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 38px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pop {
  0% { transform: scale(0.2); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- команда ---------- */

.add-user-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.pass-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1; }
.input-group input, .pass-row input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
}
.input-group input:focus, .pass-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.pass-row input.mismatch { border-color: var(--danger); }
.hint.bad { color: var(--danger); }

@media (max-width: 700px) {
  .add-user-grid, .pass-row { grid-template-columns: 1fr; }
}

/* ---------- результаты ---------- */

.results-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.result-card h2 { margin-top: 6px; }
.result-title { display: flex; align-items: center; gap: 10px; }

.chart-box { position: relative; height: 260px; margin: 16px 0 8px; }
.chart-box-sm { height: 180px; }

.counts { width: 100%; border-collapse: collapse; font-size: 14.5px; margin-top: 8px; }
.counts td { padding: 8px 10px; border-bottom: 1px dashed var(--line); }
.counts tr:last-child td { border-bottom: none; }
.counts td:first-child { font-weight: 500; }
.counts .num { text-align: right; width: 60px; }
.counts td:last-child { width: 70px; }

.avg { display: flex; align-items: baseline; gap: 12px; margin: 10px 0 4px; }
.avg-num { font-size: 44px; font-weight: 800; color: var(--accent); line-height: 1; }

.text-answers { padding-left: 20px; margin: 10px 0 0; }
.text-answers li { margin-bottom: 10px; }

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

@media (max-width: 640px) {
  .container { padding: 20px 12px 50px; }
  .card { padding: 16px; }
  .quiz-card { padding: 22px 18px 18px; }
  .q-text { font-size: 20px; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .topnav { gap: 8px; }
  .who { display: none; }
  .save-row { flex-direction: column; align-items: stretch; text-align: center; }
  .quiz-nav .btn { flex: 1; }
}
