/* ---------- Тулбар: поиск + Все/Онлайн ---------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  margin: 0 -4px;
  background: var(--color-bg);
}
.search {
  flex: 1;
  min-width: 220px;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--color-control);
  color: var(--color-muted);
  cursor: text;
  transition: box-shadow .15s;
}
.search:focus-within { box-shadow: 0 0 0 2px rgb(246 42 42 / .5); }
.search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}
.search input::placeholder { color: var(--color-muted); }

.chips {
  position: relative;
  display: flex;
  height: 44px;
  border-radius: 8px;
  background: var(--color-control);
  user-select: none;
}
.chips-indicator {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 8px;
  background: var(--color-accent);
  pointer-events: none;
}
.chip {
  position: relative;
  padding: 0 18px;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
}
.chip span {
  position: relative;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--color-muted);
  transition: color .18s;
}
.chip:hover span { color: rgb(255 255 255 / .7); }
.chip[aria-pressed="true"] span { color: var(--color-on-accent, #fff); }
.chip:focus-visible { box-shadow: inset 0 0 0 2px rgb(246 42 42 / .5); }

/* ---------- Таблица ---------- */
.table { --cols: minmax(200px, 1.6fr) minmax(180px, 1.3fr) minmax(120px, .8fr) minmax(110px, .7fr); }
.table-head,
.row {
  display: grid;
  grid-template-columns: var(--cols);
  align-items: center;
  gap: 12px;
  padding: 0 16px;
}
.table-head { padding-top: 4px; padding-bottom: 8px; }
.sort {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-muted);
  cursor: pointer;
  outline: none;
  user-select: none;
  transition: color .15s;
  justify-self: start;
}
.sort svg { width: 14px; height: 14px; opacity: .4; transition: opacity .15s, transform .2s; }
.sort:hover { color: var(--color-text); }
.sort:hover svg { opacity: .8; }
.sort.asc, .sort.desc { color: var(--color-text); }
.sort.asc svg, .sort.desc svg { opacity: 1; }

.table-body { display: flex; flex-direction: column; gap: 8px; }
.row {
  min-height: 56px;
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: inset 0 0 0 1px var(--color-border);
  font-size: 14px;
  animation: row-in .2s cubic-bezier(0, 0, .2, 1) backwards;
  animation-delay: var(--delay, 0s);
}
@keyframes row-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.cell { min-width: 0; padding: 12px 0; }

.member { display: flex; align-items: center; gap: 12px; min-width: 0; }
.member-avatar { position: relative; width: 36px; height: 36px; flex-shrink: 0; }
.member-avatar .pic {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-control);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: rgb(255 255 255 / .7);
  object-fit: cover;
}
.member-avatar .dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-muted);
  box-shadow: 0 0 0 2px var(--color-bg);
}
.member-avatar .dot.online { background: var(--color-success); }
.member-text { min-width: 0; line-height: 1.25; }
.member-nick { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-handle { display: block; font-size: 12px; font-weight: 600; color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cell-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-static { font-weight: 600; font-variant-numeric: tabular-nums; color: rgb(255 255 255 / .8); }
.cell-static .hash { color: var(--color-muted); margin-right: 1px; }
.cell-points { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--color-stat-accent); }

.table-empty {
  padding: 40px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-muted);
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: inset 0 0 0 1px var(--color-border);
}

/* Узкий экран: строки становятся карточками */
@media (max-width: 767px) {
  .table-head { display: none; }
  .row { grid-template-columns: 1fr auto; gap: 0 12px; padding: 4px 14px; }
  .row .cell:nth-child(1) { grid-column: 1 / -1; padding-bottom: 4px; }
  .row .cell { padding: 6px 0; }
  .row .cell-name { grid-column: 1; }
  .row .cell-static { grid-column: 1; padding-top: 0; font-size: 12px; }
  .row .cell-points { grid-column: 2; grid-row: 2 / 4; align-self: center; font-size: 16px; }
}

/* ---------- Кнопки ---------- */
.btn {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .15s, color .15s, box-shadow .15s, transform .15s, opacity .15s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.btn:focus-visible { box-shadow: inset 0 0 0 2px rgb(246 42 42 / .5); }
.btn-soft { background: rgb(255 255 255 / .05); color: var(--color-text); }
.btn-soft:hover { background: rgb(255 255 255 / .1); }
.btn-soft.added { background: rgb(246 42 42 / .12); color: #ff6b6b; }
.btn-soft.added:hover { background: rgb(246 42 42 / .18); }
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #ff3b3b; }
.btn-ghost { background: transparent; color: var(--color-muted); box-shadow: inset 0 0 0 1px var(--color-border); }
.btn-ghost:hover:not(:disabled) { color: var(--color-text); background: var(--color-hover); }
.btn-lg { height: 44px; font-size: 14px; }

/* ---------- Поля форм ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-muted); }
.field-label i { font-style: normal; font-weight: 600; letter-spacing: 0; text-transform: none; opacity: .7; margin-left: 4px; }
.input {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--color-control);
  color: var(--color-muted);
  cursor: text;
  transition: box-shadow .15s;
}
.input:focus-within { box-shadow: 0 0 0 2px rgb(246 42 42 / .5); }
.input[hidden] { display: none; }
.input input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  -moz-appearance: textfield;
}
.input input::placeholder { color: var(--color-muted); }
.input input::-webkit-outer-spin-button,
.input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.form-error { padding: 10px 14px; border-radius: 8px; background: rgb(248 113 113 / .1); color: var(--color-error); font-size: 13px; font-weight: 600; }
.form-error[hidden] { display: none; }

/* Уведомление */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--color-control);
  box-shadow: 0 0 0 1px var(--color-border), 0 10px 30px rgb(0 0 0 / .5);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity .2s, transform .2s cubic-bezier(0, 0, .2, 1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
