/* ---- Токены: фестивальная полиграфия, плоская печать ---- */
:root {
  --paper: #f2f1ea;
  --white: #ffffff;
  --ink: #16211a;
  --muted: #5d6a60;
  --hair: #d3d5ca;
  --green: #21a038;
  --green-dark: #157a2b;
  --yellow: #ffd23f;
  --red: #cf3f3f;
  --display: 'Unbounded', 'Golos Text', system-ui, sans-serif;
  --body: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 56px;
}

/* ---- Шапка участника ---- */
.masthead {
  max-width: 480px;
  margin: 0 auto;
  padding: 26px 16px 6px;
}

.masthead h1 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(21px, 6.5vw, 27px);
  line-height: 1.22;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.masthead h1 .hl {
  background: var(--green);
  color: var(--paper);
  padding: 1px 10px 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.masthead .lede {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 40ch;
}

/* ---- Рубрики ---- */
.rubric {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 12px;
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
}

.rubric::before {
  content: '';
  width: 9px;
  height: 9px;
  background: var(--green);
  flex: 0 0 9px;
}

.rubric::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--ink);
}

/* ---- Плитки спикеров ---- */
.tiles {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 16px 8px;
  margin: 0 -16px;
  scroll-padding: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tiles::-webkit-scrollbar { display: none; }

.tile {
  flex: 0 0 138px;
  background: var(--white);
  border: 2px solid var(--ink);
  padding: 12px;
  text-align: left;
  transition: transform 0.12s, box-shadow 0.12s;
}

.tile .initials {
  width: 40px;
  height: 40px;
  margin-bottom: 10px;
  background: var(--green);
  color: #fff;
  font: 700 15px/1 var(--mono);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile .name {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
}

.tile .role {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tile.selected {
  background: var(--ink);
  color: var(--paper);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--green);
}

.tile.selected .role { color: #a7b3a9; }

/* ---- Панель формы ---- */
.panel {
  background: var(--white);
  border: 2px solid var(--ink);
  padding: 16px;
}

.field { margin-bottom: 16px; }
.field:last-of-type { margin-bottom: 18px; }

label {
  display: block;
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

input[type='text'], textarea {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--white);
  padding: 12px 12px;
  font-size: 16px;
  appearance: none;
}

input[type='text']:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 3px 3px 0 var(--green);
}

textarea { min-height: 110px; resize: vertical; }

.counter {
  text-align: right;
  font: 500 11px/1 var(--mono);
  color: var(--muted);
  margin-top: 6px;
}

.counter.limit { color: var(--red); }

/* ---- Кнопки ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--white);
  padding: 12px 16px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-height: 46px;
}

.btn[disabled] { opacity: 0.5; cursor: default; }

.btn-cta {
  width: 100%;
  background: var(--green);
  color: #fff;
  box-shadow: 4px 4px 0 var(--ink);
}

.btn-cta:not([disabled]):active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}

.btn-small {
  padding: 8px 12px;
  min-height: 38px;
  font-size: 12px;
}

.btn-approve { background: var(--green); color: #fff; box-shadow: 2px 2px 0 var(--ink); }
.btn-approve:active { transform: translate(2px, 2px); box-shadow: none; }

.btn-reject { border-color: var(--red); color: var(--red); }
.btn-reject:active { background: var(--red); color: #fff; }

.btn-plain {
  border: none;
  background: none;
  padding: 8px 10px;
  min-height: 38px;
  font: 600 12px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-plain:hover { color: var(--red); }

/* ---- Талоны вопросов ---- */
.q-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.q-card {
  background: var(--white);
  border: 2px solid var(--ink);
}

.q-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 2px dashed var(--ink);
  font: 500 11px/1.4 var(--mono);
  color: var(--muted);
}

.q-head .seq {
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}

.q-head .who {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.q-head .when { margin-left: auto; white-space: nowrap; }

.q-body {
  margin: 0;
  padding: 12px;
  font-size: 15.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.q-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 12px 12px;
}

.q-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-top: 1px solid var(--hair);
}

.q-actions .btn-plain { margin-left: auto; }

/* ярлык спикера — [В СКОБКАХ], как в программке */
.sp-tag {
  font: 600 11px/1.4 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--green-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sp-tag::before { content: '[ '; }
.sp-tag::after { content: ' ]'; }

/* штамп статуса */
.stamp {
  font: 700 10.5px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 2px solid currentColor;
  padding: 4px 7px;
  transform: rotate(-2deg);
  white-space: nowrap;
}

.stamp-pending { color: var(--ink); background: var(--yellow); border-color: var(--ink); }
.stamp-approved { color: var(--green-dark); }
.stamp-rejected { color: var(--red); }

.empty {
  border: 2px dashed #a9b0a2;
  padding: 26px 16px;
  text-align: center;
  font: 500 12.5px/1.6 var(--mono);
  color: var(--muted);
}

/* ---- Тост ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 16px);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 4px 4px 0 var(--green);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  max-width: calc(100vw - 32px);
  text-align: center;
  z-index: 50;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { box-shadow: 4px 4px 0 var(--red); }

/* ---- Модератор ---- */
.topbar {
  background: var(--ink);
  color: var(--paper);
  border-bottom: 2px solid var(--ink);
  padding: 14px 16px;
}

.topbar-inner {
  max-width: 688px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logout {
  background: none;
  border: 2px solid #3c4a40;
  color: #9fb3a4;
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 12px;
  min-height: 36px;
}

.logout:hover { border-color: var(--paper); color: var(--paper); }

.topbar h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wrap-mod {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 56px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 2px solid var(--ink);
  background: var(--white);
  margin-bottom: 16px;
}

.tab {
  border: none;
  background: none;
  padding: 12px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 46px;
}

.tab + .tab { border-left: 2px solid var(--ink); }

.tab.active {
  background: var(--ink);
  color: var(--paper);
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 16px 14px;
  margin: 0 -16px;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar { display: none; }

.filter {
  flex: 0 0 auto;
  border: 2px solid var(--ink);
  background: var(--white);
  padding: 8px 12px;
  font: 600 12px/1.4 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-height: 40px;
}

.filter .count { margin-left: 6px; font-weight: 700; color: var(--green-dark); }

.filter.active {
  background: var(--ink);
  color: var(--paper);
}

.filter.active .count { color: #5fd97c; }

/* ---- Спикеры в панели модератора ---- */
.sp-card {
  background: var(--white);
  border: 2px solid var(--ink);
  padding: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.sp-card.inactive { opacity: 0.55; }

.sp-card .initials {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  background: var(--green);
  color: #fff;
  font: 700 15px/1 var(--mono);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sp-info { flex: 1; min-width: 0; }
.sp-info .name { font-weight: 700; font-size: 15px; }

.sp-info .role {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

/* переключатель «в программе» */
.switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex: 0 0 44px;
  margin-right: 6px;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.switch .track {
  position: absolute;
  inset: 0;
  border: 2px solid var(--ink);
  background: var(--white);
  transition: background 0.12s;
}

.switch .track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: var(--ink);
  transition: left 0.12s, background 0.12s;
}

.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { left: 21px; background: #fff; }
.switch input:focus-visible + .track { outline: 3px solid var(--green); outline-offset: 2px; }

.sp-edit-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-edit-form .row { display: flex; gap: 8px; }

.add-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 560px) {
  .add-form { flex-direction: row; }
  .add-form input { flex: 1; }
  .add-form .btn { flex: 0 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}
