/* ==========================================================================
   Nimble · side panel, discover, admin dashboard, modal internals
   ========================================================================== */

/* ============================== side panel =============================== */
.side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .022));
  border: 1px solid var(--border);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
[data-theme='light'] .side { background: linear-gradient(180deg, #fff, rgba(255, 255, 255, .78)); }
.side__head { padding: 18px 18px 14px; text-align: center; border-bottom: 1px solid var(--border); position: relative; }
.side__close { position: absolute; top: 12px; right: 12px; }
.side__avatar { margin: 4px auto 12px; }
.side__title { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 18px; font-weight: 750; letter-spacing: -.3px; }
.side__title .ico { width: 17px; height: 17px; color: var(--accent-3); }
.side__sub { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.side__sub--online { color: var(--ok); }
.side__tabs { display: flex; gap: 4px; padding: 10px 12px 0; }
.side__tab {
  flex: 1;
  padding: 9px 8px;
  border-radius: 11px;
  font-size: 13.2px;
  font-weight: 650;
  color: var(--text-2);
  transition: background .18s, color .18s;
}
.side__tab:hover { background: var(--surface-2); color: var(--text); }
.side__tab.is-active { background: var(--surface-3); color: var(--text); }
.side__body { flex: 1; min-height: 0; padding: 12px; overflow-y: auto; }
.side__actions { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.side__actions .btn { flex: 1; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 4px; font-size: 13.4px; border-bottom: 1px dashed var(--border); }
.kv:last-child { border-bottom: 0; }
.kv__k { color: var(--text-3); }
.kv__v { font-weight: 600; text-align: right; }

.member {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  transition: background .18s;
}
.member:hover { background: var(--surface-2); }
.member__avatar { position: relative; }
.member__avatar .dot { position: absolute; right: -2px; bottom: -1px; border-color: var(--bg-2); }
.member__body { flex: 1; min-width: 0; }
.member__name { font-size: 14px; font-weight: 620; }
.member__status { font-size: 12.2px; color: var(--text-3); }
.member__actions { display: flex; gap: 2px; opacity: 0; transition: opacity .18s; }
.member:hover .member__actions { opacity: 1; }

.rolechip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11.4px;
  font-weight: 700;
  letter-spacing: .2px;
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.rolechip .ico { width: 12px; height: 12px; }
.rolechip--owner { color: #ffd88a; background: rgba(247, 185, 85, .16); border-color: rgba(247, 185, 85, .3); }
.rolechip--admin { color: #cbb8ff; background: rgba(176, 108, 255, .18); border-color: rgba(176, 108, 255, .32); }
.rolechip--channel { color: #9ee8ff; background: rgba(53, 214, 245, .16); border-color: rgba(53, 214, 245, .3); }
.rolechip--group { color: #b7ffd8; background: rgba(53, 211, 154, .16); border-color: rgba(53, 211, 154, .3); }
.rolechip--banned { color: #ffb3c0; background: rgba(251, 113, 133, .16); border-color: rgba(251, 113, 133, .3); }

/* ============================== discover ================================ */
.discover { display: flex; flex-direction: column; gap: 18px; }
.discover__head { display: flex; flex-direction: column; gap: 6px; }
.discover__head h3 { font-size: 17px; font-weight: 740; letter-spacing: -.2px; }
.discover__head p { font-size: 13.4px; color: var(--text-2); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 14px; }
.channel-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform .22s, box-shadow .25s, border-color .2s;
  overflow: hidden;
  animation: popIn .3s ease both;
}
.channel-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.channel-card__glow {
  position: absolute;
  inset: -40% -20% auto auto;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--grad);
  filter: blur(48px);
  opacity: .22;
  pointer-events: none;
}
.channel-card__top { display: flex; align-items: center; gap: 12px; }
.channel-card__name { font-size: 15.4px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.channel-card__name .ico { width: 16px; height: 16px; color: var(--accent-3); }
.channel-card__meta { font-size: 12.4px; color: var(--text-3); }
.channel-card__desc { font-size: 13.4px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px; }
.channel-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }

/* =============================== admin ================================== */
.admin { display: flex; gap: 18px; min-height: 100%; overflow: hidden; }
.admin__nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 210px;
  flex: none;
  padding-right: 16px;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.admin__tab {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 620;
  color: var(--text-2);
  text-align: left;
  transition: background .18s, color .18s, transform .18s;
  flex-shrink: 0;
}
.admin__tab:hover { background: var(--surface-2); color: var(--text); transform: translateX(2px); }
.admin__tab.is-active { background: var(--grad); color: #fff; box-shadow: var(--accent-glow); }
.admin__main { flex: 1; min-width: 0; overflow: hidden auto; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; width: 100%; overflow: hidden; }
.stat-card {
  position: relative;
  padding: 15px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: popIn .3s ease both;
}
.stat-card__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #fff;
  background: var(--grad);
  box-shadow: var(--accent-glow);
  margin-bottom: 11px;
}
.stat-card__value { font-size: 25px; font-weight: 800; letter-spacing: -.8px; line-height: 1; }
.stat-card__label { font-size: 12.4px; color: var(--text-3); margin-top: 5px; font-weight: 600; }
.stat-card--ok .stat-card__icon { background: linear-gradient(135deg, #35d39a, #12b6dd); }
.stat-card--warn .stat-card__icon { background: linear-gradient(135deg, #f7b955, #f97316); }
.stat-card--danger .stat-card__icon { background: linear-gradient(135deg, #fb7185, #b06cff); }

.chart { padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.chart__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.chart__title { font-size: 14.6px; font-weight: 700; }
.chart__total { font-size: 12.6px; color: var(--text-3); }
.chart__bars { display: flex; align-items: flex-end; gap: 6px; height: 132px; }
.chart__bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart__bar {
  width: 100%;
  min-height: 4px;
  border-radius: 7px 7px 4px 4px;
  background: var(--grad);
  opacity: .85;
  transition: opacity .2s, transform .2s;
  transform-origin: bottom;
  animation: growUp .5s cubic-bezier(.2, .9, .25, 1) both;
}
.chart__bar:hover { opacity: 1; transform: scaleY(1.03); }
.chart__labels { display: flex; gap: 6px; margin-top: 7px; }
.chart__label { flex: 1; text-align: center; font-size: 10.4px; color: var(--text-3); }
@keyframes growUp { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.table-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.table-toolbar .search { flex: 1; margin: 0; }

.data-table { display: flex; flex-direction: column; gap: 6px; width: 100%; overflow-x: auto; overflow: hidden; }
.data-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background .18s, border-color .18s;
  animation: popIn .22s ease both;
  min-width: 100%;
}
.data-row:hover { background: var(--surface-2); border-color: var(--border-strong); }
.data-row--banned { opacity: .62; }
.data-cell { min-width: 0; }
.data-cell--grow { flex: 1; min-width: 0; }
.data-cell--w110 { width: 110px; flex: none; }
.data-cell--w80 { width: 80px; flex: none; text-align: right; }
.user-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.user-cell__name { font-size: 14.2px; font-weight: 640; display: flex; align-items: center; gap: 5px; min-width: 0; }
.user-cell__name .ico { width: 14px; height: 14px; color: var(--accent-3); flex-shrink: 0; }
.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-cell__name { font-size: 14.2px; font-weight: 640; display: flex; align-items: center; gap: 5px; }
.user-cell__name .ico { width: 14px; height: 14px; color: var(--accent-3); }
.user-cell__meta { font-size: 12.2px; color: var(--text-3); }
.data-actions { display: flex; gap: 4px; flex: none; }
.num { font-variant-numeric: tabular-nums; font-weight: 650; }

.announce { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.announce textarea {
  width: 100%;
  min-height: 120px;
  padding: 13px 15px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  outline: none;
  resize: vertical;
  font-size: 14.6px;
  line-height: 1.5;
  transition: border-color .2s, box-shadow .2s;
}
.announce textarea:focus { border-color: rgba(124, 140, 255, .5); box-shadow: 0 0 0 4px rgba(124, 140, 255, .12); }
.announce__preview {
  padding: 13px 15px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
}
.announce__preview b { font-size: 12.4px; color: var(--text-3); display: block; margin-bottom: 7px; text-transform: uppercase; letter-spacing: .1em; }

/* ============================ modal content ============================= */
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-bottom: 18px; }
.type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 16px 10px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13.2px;
  font-weight: 650;
  color: var(--text-2);
  transition: all .2s;
}
.type-card:hover { transform: translateY(-2px); color: var(--text); border-color: var(--border-strong); }
.type-card.is-active { color: var(--text); border-color: rgba(124, 140, 255, .55); background: var(--grad-soft); box-shadow: 0 0 0 3px rgba(124, 140, 255, .12); }
.type-card__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; color: #fff; background: var(--grad); box-shadow: var(--accent-glow); }

.picker__tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; min-height: 30px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px 5px 10px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 620;
  background: var(--grad-soft);
  border: 1px solid rgba(124, 140, 255, .35);
  animation: popIn .18s ease both;
}
.tag__x { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--text-2); transition: background .16s, color .16s; }
.tag__x:hover { background: rgba(251, 113, 133, .2); color: #ffb3c0; }

.picker__list { max-height: 320px; overflow-y: auto; margin: 0 -6px; }
.picker__item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background .16s;
}
.picker__item:hover { background: var(--surface-2); }
.picker__item.is-selected { background: var(--grad-soft); }
.picker__check {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  flex: none;
  border-radius: 8px;
  border: 1.5px solid var(--border-strong);
  color: transparent;
  transition: all .18s;
}
.picker__check .ico { width: 14px; height: 14px; stroke-width: 2.6; }
.picker__item.is-selected .picker__check { background: var(--grad); border-color: transparent; color: #fff; }

.hint-box {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.2px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
}
.hint-box .ico { color: var(--accent); flex: none; }
.field__box--area { height: auto; padding: 10px 13px; align-items: flex-start; }
.field__box--area textarea { min-height: 74px; max-height: 200px; resize: vertical; line-height: 1.45; }
.toggle-chip.is-active { color: #fff; background: var(--grad); border-color: transparent; box-shadow: var(--accent-glow); }
.side__desc { font-size: 13.2px; color: var(--text-2); margin-bottom: 12px; }
.side__role { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.danger-zone { border-color: rgba(251, 113, 133, .28) !important; background: rgba(251, 113, 133, .07) !important; }
.danger-zone .ico { color: var(--danger) !important; }

.profile-head { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.avatar-edit { position: relative; }
.avatar-edit__btn {
  position: absolute;
  right: -6px;
  bottom: -6px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  background: var(--grad);
  box-shadow: var(--accent-glow);
  transition: transform .18s;
}
.avatar-edit__btn:hover { transform: scale(1.1) rotate(-6deg); }
.avatar-edit__btn--left { left: -6px; right: auto; }

.palette { display: flex; flex-wrap: wrap; gap: 8px; }
.palette__swatch {
  width: 32px;
  height: 32px;
  border-radius: 11px;
  box-shadow: var(--shadow-in);
  transition: transform .18s, box-shadow .2s;
  position: relative;
}
.palette__swatch:hover { transform: translateY(-2px) scale(1.06); }
.palette__swatch.is-active { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--accent); }

.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; max-height: 190px; overflow-y: auto; }
.emoji-grid button {
  height: 40px;
  border-radius: 11px;
  font-size: 21px;
  display: grid;
  place-items: center;
  transition: background .16s, transform .16s;
}
.emoji-grid button:hover { background: var(--surface-3); transform: scale(1.1); }
.emoji-grid button.is-active { background: var(--grad-soft); box-shadow: inset 0 0 0 1px rgba(124, 140, 255, .5); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }

.msg-search-result { display: flex; flex-direction: column; gap: 6px; }
.msg-search-hit {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: left;
  transition: background .18s, transform .18s;
}
.msg-search-hit:hover { background: var(--surface-2); transform: translateX(3px); }
.msg-search-hit__top { display: flex; justify-content: space-between; gap: 10px; font-size: 12.4px; color: var(--text-3); margin-bottom: 4px; }
.msg-search-hit__text { font-size: 13.8px; }
.msg-search-hit mark { background: rgba(124, 140, 255, .28); color: var(--text); border-radius: 4px; padding: 0 2px; }

/* ============================== ГДЗ / решебник ============================== */
.gdz { display: flex; flex-direction: column; gap: 14px; }

.gdz__subjects { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gdz__subject {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  transition: border-color .2s, background .2s, transform .18s, box-shadow .2s;
}
.gdz__subject:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.gdz__subject.is-active { border-color: rgba(124, 140, 255, .55); background: var(--surface-2); box-shadow: 0 0 0 4px rgba(124, 140, 255, .12); }
.gdz__subject-emoji { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); font-size: 18px; transition: background .2s; }
.gdz__subject.is-active .gdz__subject-emoji { background: var(--grad); }
.gdz__subject-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.gdz__subject-text b { font-size: 14.2px; font-weight: 700; }
.gdz__subject-text small { font-size: 11.4px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.gdz__form { display: flex; gap: 9px; }
.gdz__input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.gdz__input-wrap:focus-within { border-color: rgba(124, 140, 255, .5); box-shadow: 0 0 0 4px rgba(124, 140, 255, .12); background: var(--surface-2); }
.gdz__input-ico { color: var(--text-3); flex: none; }
.gdz__input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 14.6px; }
.gdz__input::placeholder { color: var(--text-3); }
.gdz__form .btn { height: 46px; }

.gdz__hint { font-size: 12.6px; color: var(--text-3); margin-top: -6px; }
.gdz__hint--error { color: #ff9fb0; }

.gdz__examples { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gdz__examples-label { font-size: 12.4px; color: var(--text-3); }
.gdz__chips { display: flex; gap: 7px; flex-wrap: wrap; }
.gdz__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all .18s;
}
.gdz__chip:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); transform: translateY(-1px); }

.gdz__result:empty { display: none; }
.gdz-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
  animation: popIn .3s cubic-bezier(.2, .9, .25, 1) both;
}
.gdz-card__cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 84px;
  border-radius: 12px;
  background: var(--grad);
  color: #fff;
  box-shadow: var(--accent-glow);
}
.gdz-card__cover-tag { font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.gdz-card__cover-emoji { font-size: 20px; }
.gdz-card__body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gdz-card__meta { font-size: 12.2px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.gdz-card__authors { font-size: 12.8px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gdz-card__task { font-size: 17px; font-weight: 750; }
.gdz-card__url { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12.2px; color: var(--accent); min-width: 0; }
.gdz-card__url span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gdz-card__url .ico { flex: none; }
.gdz-card__actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }

.gdz__recent { display: flex; flex-direction: column; gap: 8px; }
.gdz__section-label { font-size: 11.4px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }

/* feature toggles */
.fx-no-calls #btnChatCall { display: none !important; }
.fx-no-media #btnAttach, .fx-no-media #btnMic, .fx-no-media #fileInput { display: none !important; }
.fx-no-emoji #btnEmoji { display: none !important; }
.fx-no-avatars .avatar__emoji { display: none !important; }
.fx-no-avatars .palette__swatch { display: none !important; }

@media (max-width: 820px) {
  .admin { flex-direction: column; }
  .admin__nav { flex-direction: row; width: auto; padding: 0 0 12px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .admin__tab { white-space: nowrap; }
  .type-grid { grid-template-columns: 1fr; }
}

/* ============================== servers («Сервера») ====================== */
.srv-list { display: flex; flex-direction: column; gap: 10px; }
.srv-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 15px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.srv-card__ico {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--accent-3);
  border: 1px solid var(--border);
}
.srv-card__ico .ico { width: 20px; height: 20px; }
.srv-card__body { flex: 1; min-width: 0; }
.srv-card__name { display: flex; align-items: center; gap: 8px; font-size: 14.8px; font-weight: 680; }
.srv-card__meta { margin-top: 3px; font-size: 12.6px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-ping {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 13.4px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.srv-ping__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); flex: none; }
.srv-ping__ms { min-width: 64px; text-align: right; }
.srv-ping.is-ok { color: var(--ok); border-color: rgba(53, 211, 154, .35); }
.srv-ping.is-ok .srv-ping__dot { background: var(--ok); box-shadow: 0 0 10px rgba(53, 211, 154, .8); }
.srv-ping.is-mid { color: var(--warn); border-color: rgba(247, 185, 85, .35); }
.srv-ping.is-mid .srv-ping__dot { background: var(--warn); box-shadow: 0 0 10px rgba(247, 185, 85, .8); }
.srv-ping.is-bad { color: var(--danger); border-color: rgba(251, 113, 133, .4); }
.srv-ping.is-bad .srv-ping__dot { background: var(--danger); box-shadow: 0 0 10px rgba(251, 113, 133, .8); }
.srv-note { display: flex; align-items: center; gap: 7px; margin-top: 0; font-size: 12.3px; color: var(--text-3); }
.srv-note .ico { width: 14px; height: 14px; flex: none; }
.srv-wrap { display: flex; flex-direction: column; gap: 10px; padding: 20px 24px; }
.srv-card__meta + .srv-card__meta { margin-top: 0; }
.srv-down {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 13.4px;
  font-weight: 700;
  color: #ff0000;
  background: rgba(255, 0, 0, .1);
  border: 1px solid rgba(255, 0, 0, .45);
  text-shadow: 0 0 12px rgba(255, 0, 0, .55);
}
.srv-down::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: #ff0000;
  box-shadow: 0 0 10px rgba(255, 0, 0, .9);
}

/* телефоны (Android): карточка в две строки — текст сверху, пинг/статус снизу */
@media (max-width: 560px) {
  .srv-wrap { padding: 14px 14px 16px; }
  .srv-card { flex-wrap: wrap; row-gap: 9px; padding: 12px 13px; }
  .srv-card__body { flex: 1 1 calc(100% - 53px); }
  .srv-card__name { font-size: 15px; }
  .srv-ping, .srv-down { margin-left: 53px; }
  .srv-ping__ms { min-width: 0; }
}

/* --------------------------- service mode (admin) ------------------------- */
.service-switch {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.service-switch__title { margin-bottom: 3px; font-size: 14.4px; font-weight: 700; }
.service-status {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.2px;
  color: #a7f0d2;
  border: 1px solid rgba(53, 211, 154, .28);
  background: rgba(53, 211, 154, .1);
}
.service-status.is-on {
  color: #ffdda1;
  border-color: rgba(247, 185, 85, .34);
  background: rgba(247, 185, 85, .12);
}
.service-field__label {
  margin: 4px 2px -6px;
  font-size: 12.4px;
  font-weight: 600;
  color: var(--text-2);
}

/* ------------------------- chat wallpapers ------------------------- */
.wp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.wp-swatch {
  position: relative;
  height: 80px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-3);
  box-shadow: var(--shadow-in);
  border: 1px solid var(--line);
  transition: transform .16s, box-shadow .18s;
}
.wp-swatch:hover { transform: translateY(-2px); }
.wp-swatch.is-active { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--accent); }
.wp-swatch__label {
  position: absolute;
  left: 9px;
  bottom: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .75);
}
.wp-upload {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
#messages.has-wallpaper { background-repeat: no-repeat; background-attachment: local; }

/* --------------------------- stickers ----------------------------------- */
.sticker-pop { width: 336px; padding: 12px; }
.stk-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 9px; }
.stk-head__hint { font-size: 10.5px; color: var(--text-3); }
.stk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-height: 300px; overflow-y: auto; }
.stk-item {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 12px;
  background: var(--bg-3);
  cursor: pointer;
  transition: transform .14s, box-shadow .16s;
}
.stk-item:hover { transform: translateY(-2px) scale(1.03); box-shadow: var(--shadow-in); }
.stk-add {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px dashed var(--line);
  color: var(--text-3);
  display: grid;
  place-items: center;
  transition: color .16s, border-color .16s;
}
.stk-add:hover { color: var(--accent); border-color: var(--accent); }
.stk-empty { margin-top: 10px; font-size: 12px; line-height: 1.45; color: var(--text-3); }

/* --------------------------- stickers / circles in messages ------------- */
.msg__sticker { width: 150px; height: 150px; object-fit: contain; display: block; }
.msg--sticker .msg__bubble {
  background: transparent;
  border: 0;
  padding: 0;
  box-shadow: none;
  backdrop-filter: none;
}
.msg__circle-wrap { position: relative; width: 204px; height: 204px; }
.msg__circle {
  width: 204px;
  height: 204px;
  border-radius: 50%;
  object-fit: cover;
  background: #000;
  display: block;
  cursor: pointer;
}
.msg__circle-dur {
  position: absolute;
  right: 10px;
  bottom: 12px;
  font-size: 11px;
  color: #fff;
  background: rgba(0, 0, 0, .55);
  padding: 2px 7px;
  border-radius: 9px;
  pointer-events: none;
}
.msg--circle .msg__bubble { padding: 5px; }
.msg__video-wrap { max-width: 380px; }
.msg__video { width: 100%; border-radius: 14px; display: block; background: #000; }

/* ------------------------- circle recorder ------------------------------ */
.circle-rec {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(4, 6, 14, .72);
  backdrop-filter: blur(10px);
}
.circle-rec__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border-radius: 26px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9);
}
.circle-rec__video {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  object-fit: cover;
  background: #000;
  transform: scaleX(-1);
}
.circle-rec__bar { display: flex; align-items: baseline; gap: 12px; }
.circle-rec__time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; }
.circle-rec__hint { font-size: 11.5px; color: var(--text-3); }
.circle-rec__actions { display: flex; gap: 12px; }
.circle-rec__btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  transition: transform .16s;
}
.circle-rec__btn:hover { transform: scale(1.07); }
.circle-rec__btn--send { background: var(--ok, #35d39a); }
.circle-rec__btn--cancel { background: var(--danger, #ff4d6d); }

/* ---------------------------- media hub -------------------------------- */
.media-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.media-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 12px;
  background: var(--bg-3); color: var(--text-2);
  font-weight: 600; font-size: 13px; transition: background .16s, color .16s;
}
.media-tab.is-active { background: var(--grad); color: #fff; box-shadow: var(--accent-glow); }
.media-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.media-content { display: flex; flex-direction: column; gap: 8px; }
.media-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-3); font-weight: 700; margin-top: 10px;
}
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.media-card {
  display: flex; flex-direction: column;
  border-radius: 16px; background: var(--bg-3);
  border: 1px solid var(--line); overflow: hidden;
}
.media-card__art {
  height: 132px; width: 100%; object-fit: cover;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #171d38, #0b0f22);
  color: var(--accent);
}
.media-card__art .ico { width: 38px; height: 38px; }
.media-card__body { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
.media-card__title { font-size: 14px; }
.media-card__desc { font-size: 12px; color: var(--text-2); line-height: 1.4; max-height: 3.6em; overflow: hidden; }
.media-card__meta { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.media-card__audio, .media-card__video { width: 100%; border-radius: 10px; margin-top: 4px; }
.media-card__del { align-self: flex-start; }
.media-card__note { font-size: 11.5px; color: var(--danger); }
.media-empty {
  display: flex; flex-direction: column; gap: 4px; padding: 22px; text-align: center;
  border-radius: 14px; border: 1px dashed var(--line); color: var(--text-3); font-size: 12.5px;
}
.media-empty b { color: var(--text-1); font-size: 13.5px; }
.media-loading { padding: 24px; text-align: center; color: var(--text-3); font-size: 13px; }
.media-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.media-file__name { font-size: 12px; color: var(--text-3); }

/* moderation */
.mod-row {
  display: flex; gap: 12px; padding: 12px; border-radius: 14px;
  background: var(--bg-3); border: 1px solid var(--line);
  margin-bottom: 10px; align-items: flex-start;
}
.mod-row__thumb {
  width: 64px; height: 64px; border-radius: 10px; object-fit: cover;
  background: var(--bg-2); flex: none; display: grid; place-items: center;
  font-weight: 800; color: var(--accent);
}
.mod-row__body { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.mod-row__body .dim { font-size: 11px; color: var(--text-3); }
.mod-row__desc { font-size: 12px; color: var(--text-2); line-height: 1.4; }
.mod-row__actions { display: flex; flex-direction: column; gap: 6px; }

/* games */
.game-wrap { position: relative; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.game-canvas { width: min(100%, 420px); aspect-ratio: 1; border-radius: 16px; background: #0b1020; touch-action: none; }
.game-overlay {
  position: absolute; inset: 0 0 34px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; border-radius: 16px;
  background: rgba(6, 8, 18, .78); backdrop-filter: blur(4px);
  cursor: pointer; text-align: center;
}
.game-overlay.is-hidden { display: none; }
.game-overlay b { font-size: 19px; }
.game-overlay span { font-size: 12.5px; color: var(--text-2); }
.game-hud { display: flex; justify-content: space-between; gap: 12px; width: 100%; font-size: 13px; color: var(--text-2); align-items: center; }
.game-score { font-variant-numeric: tabular-nums; color: var(--text-1); font-weight: 700; }
.game-status { font-weight: 600; }
.mines-board { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; width: min(100%, 420px); }
.mine {
  aspect-ratio: 1; border-radius: 7px; background: var(--bg-3);
  border: 1px solid var(--line); display: grid; place-items: center;
  font-weight: 800; font-size: 14px; color: var(--text-1); transition: background .12s;
}
.mine:hover { background: var(--bg-2); }
.mine.is-open { background: var(--bg-2); cursor: default; }
.mine.is-open[data-near="1"] { color: #7c8cff; }
.mine.is-open[data-near="2"] { color: #35d39a; }
.mine.is-open[data-near="3"] { color: #ffb347; }
.mine.is-open[data-near="4"] { color: #ff7a59; }
.mine.is-mine { background: rgba(251, 113, 133, .2); }

/* --------------------------- group call panel --------------------------- */
.call-card__stack { display: flex; align-items: center; }
.call-card__stack .avatar { margin-left: -10px; box-shadow: 0 0 0 3px var(--bg-2); }
.call-card__stack .avatar:first-child { margin-left: 0; }
.call-card--group .call-card__head { gap: 14px; }
