/* =============================================================
 * CARD
 * ============================================================= */

 .card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.card-head h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 2px;
}
.card-head p { margin: 0; }
.card-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--bg-elev-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

/* =============================================================
 * FORM
 * ============================================================= */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.form-field > label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-wrap: wrap;
}
.form-field > label .icon { color: var(--muted); }
.form-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* =============================================================
 * CHECKBOX
 * ============================================================= */

.checks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  font-size: 13px;
  transition: border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.check:hover { border-color: var(--border-2); }
.check input { display: none; }
.check-mark {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-2);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: transparent;
  transition: all 0.15s;
}
.check input:checked + .check-mark {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.check-label { color: var(--text-2); }
.check input:checked ~ .check-label { color: var(--text); }
.check.small { padding: 6px 8px; font-size: 12px; }

/* =============================================================
 * ROWS (mod roles, immune, panels)
 * ============================================================= */

.rows-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.rows-empty {
  padding: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  background: var(--bg-elev-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 0;
}
.row-id {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  color: var(--text-2);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--primary-a);
  color: var(--primary);
  white-space: nowrap;
}
.tag-muted {
  background: var(--bg-elev-3);
  color: var(--muted);
}
.tag-on  { background: rgba(87, 242, 135, 0.15); color: #57F287; }
.tag-off { background: rgba(237, 66, 69, 0.15);  color: #ED4245; }
.tag-premium {
  background: linear-gradient(135deg, #5865F2, #8a95ff);
  color: #fff;
}

.add-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.perms {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 0;
}

/* =============================================================
 * LOADER / SKELETON
 * ============================================================= */

.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 14px;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

.skeleton-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-elev-2), var(--bg-elev-3), var(--bg-elev-2));
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: 6px;
}
.skeleton-circle { width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; }
.skeleton-lines  { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skeleton-line   { height: 10px; border-radius: 5px; }
.w-30 { width: 30%; }
.w-60 { width: 60%; }

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* =============================================================
 * TOAST
 * ============================================================= */

.toast-host {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
  max-width: calc(100vw - 40px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  max-width: 380px;
  box-shadow: var(--shadow);
  pointer-events: auto;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.25s var(--ease), opacity 0.25s;
}
.toast.in { transform: translateX(0); opacity: 1; }
.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }

.toast-icon {
  display: flex;
  align-items: center;
  color: var(--text-2);
  flex-shrink: 0;
}
.toast-success .toast-icon { color: var(--success); }
.toast-error   .toast-icon { color: var(--danger); }

.toast-msg { flex: 1; min-width: 0; word-break: break-word; }

.toast-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  border-radius: 4px;
  flex-shrink: 0;
}
.toast-close:hover { color: var(--text); background: var(--bg-elev-3); }

/* =============================================================
 * MODAL
 * ============================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.2s;
}
.modal-overlay.in { opacity: 1; }

.modal {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  transform: scale(0.96);
  transition: transform 0.2s var(--ease);
}
.modal-overlay.in .modal { transform: scale(1); }

.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px;
}
.modal-text {
  color: var(--text-2);
  font-size: 14px;
  margin: 0 0 20px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* =============================================================
 * COMMANDS LIST
 * ============================================================= */

.cmd-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cmd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  flex-wrap: wrap;
}
.cmd-row:hover {
  background: var(--bg-elev-2);
  border-color: var(--border);
}
.cmd-row + .cmd-row { border-top: 1px solid var(--border); border-radius: 0; }
.cmd-row:first-child { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.cmd-row:last-child  { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

.cmd-row-off { opacity: 0.55; }

.cmd-main { flex: 1; min-width: 0; }

.cmd-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.cmd-name {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--primary);
  padding: 1px 6px;
  background: var(--primary-a);
  border-radius: 4px;
}

.cmd-args {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--text-2);
  padding: 1px 6px;
  background: var(--bg-elev-3);
  border-radius: 4px;
}
.cmd-args-empty { font-size: 12px; color: var(--muted); }

.cmd-desc { font-size: 13px; color: var(--muted); margin-left: 2px; }

.cmd-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cmd-status {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
}
.cmd-status-on     { background: var(--success-a); color: var(--success); }
.cmd-status-off    { background: var(--danger-a);  color: var(--danger); }
.cmd-status-locked { background: var(--bg-elev-3); color: var(--muted); }

/* =============================================================
 * SWITCH
 * ============================================================= */

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.switch input { display: none; }
.switch-slider {
  position: relative;
  width: 34px;
  height: 20px;
  background: var(--bg-elev-3);
  border: 1px solid var(--border-2);
  border-radius: 100px;
  transition: background 0.2s, border-color 0.2s;
}
.switch-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-2);
  border-radius: 50%;
  transition: transform 0.2s var(--ease), background 0.2s;
}
.switch input:checked + .switch-slider {
  background: var(--primary);
  border-color: var(--primary);
}
.switch input:checked + .switch-slider::after {
  transform: translateX(14px);
  background: #fff;
}
.switch-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 20px;
  color: var(--muted);
  opacity: 0.5;
}

/* =============================================================
 * CHIPS (roles / users / channels)
 * ============================================================= */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 7px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  position: relative;
  color: var(--text-2);
  line-height: 1.4;
  white-space: nowrap;
  max-width: 100%;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover {
  background: var(--bg-elev-3);
  border-color: var(--border-2);
}
.chip:active { transform: scale(0.97); }

.chip-role { padding-left: 4px; }
.chip-role-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.chip-role-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
}
.chip-role-emoji { font-size: 14px; line-height: 1; }
.chip-role-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip-role-missing .chip-role-name {
  color: var(--muted);
  font-style: italic;
}

.chip-user { padding-left: 2px; }
.chip-user-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-elev-3);
}
.chip-user-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.chip-user-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip-user-bot {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
}
.chip-user-missing .chip-user-name {
  color: var(--muted);
  font-style: italic;
}

.chip-id {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  padding: 3px 8px;
}
.chip-id-text { color: var(--text-2); }
.chip-id:hover .chip-id-text { color: var(--text); }

.chip-channel { padding-left: 6px; padding-right: 10px; }
.chip-channel svg { color: var(--muted); flex-shrink: 0; }
.chip-channel-name {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-2);
}
.chip-channel:hover .chip-channel-name { color: var(--text); }
.chip-channel-missing .chip-channel-name {
  color: var(--muted);
  font-style: italic;
}

/* ── Tooltip (left) ── */

.chip-tooltip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  background: #000;
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-family: ui-monospace, monospace;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  z-index: 100;
}
.chip-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 14px;
  border: 5px solid transparent;
  border-top-color: #000;
}
.chip:hover .chip-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* =============================================================
 * FIELD WITH INLINE CHIP
 * ============================================================= */

.field-with-chip {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: visible;
  transition: border-color 0.15s, box-shadow 0.15s;
  flex-wrap: wrap;
}
.field-with-chip:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-a);
}
.field-with-chip > input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 12px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-family: ui-monospace, monospace;
  font-size: 13px;
  min-width: 0;
}
.field-with-chip > input:focus {
  outline: none;
  box-shadow: none;
}
.field-chip-slot {
  display: flex;
  align-items: center;
  padding: 3px 6px 3px 0;
  min-width: 0;
}
.field-chip-slot:empty { display: none; }
.field-chip-slot .chip { margin: 0; }

/* =============================================================
 * ROW MAIN
 * ============================================================= */

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* =============================================================
 * EMOJI FIELD
 * ============================================================= */

.discord-emoji {
  display: inline-block;
  vertical-align: -0.15em;
  object-fit: contain;
}

.emoji-preview {
  min-width: 24px;
  min-height: 24px;
  line-height: 1;
  font-size: 20px;
}

.emoji-preview-img {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  object-fit: contain;
}
.emoji-preview-text { font-size: 20px; line-height: 1; }

.emoji-input-wrap {
  position: relative;
  display: block;
}
.emoji-input-wrap > input {
  width: 100%;
  box-sizing: border-box;
}
.emoji-input-wrap > input.emoji-input-hidden-text {
  color: transparent !important;
  caret-color: var(--text, #fff);
}
.emoji-overlay {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  min-width: 22px;
  height: 22px;
}
.emoji-overlay-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: middle;
}
.emoji-overlay-text { font-size: 18px; line-height: 1; }

/* =============================================================
 * TOGGLE (from commands)
 * ============================================================= */

.toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  transition: background 0.2s;
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider { background: #57F287; }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

.cmd-name  { font-family: var(--mono, monospace); font-size: 14px; }
.cmd-label { margin-left: 8px; }

/* =============================================================
 * USER CHIP LINK / NAV / BREADCRUMBS
 * ============================================================= */

.user-chip-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.user-chip-link:hover  { background: rgba(255, 255, 255, 0.06); }
.user-chip-link.active { background: rgba(88, 101, 242, 0.15); }

.nav-item-link {
  text-decoration: none;
  color: inherit;
}
.nav-item-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: linear-gradient(135deg, #5865F2, #8a95ff);
  color: #fff;
}

.crumb-current { color: var(--muted, #aaa); font-size: 13px; }

/* =============================================================
 * PROFILE
 * ============================================================= */

.profile-card { padding: 24px; }
.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.profile-name { margin: 0; font-size: 22px; }
.profile-id   { margin: 4px 0 0; }
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: var(--bg-elev-2, #1e1f22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-num   { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--muted, #aaa); }

.guild-mini-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 10px;
  flex-shrink: 0;
}
.guild-mini-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #5865F2;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.row-link {
  text-decoration: none;
  color: inherit;
}
.row-link:hover { background: rgba(255, 255, 255, 0.03); }

/* =============================================================
 * PREMIUM
 * ============================================================= */

.premium-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: radial-gradient(1200px 300px at 0% 0%, rgba(88, 101, 242, 0.25), transparent 60%);
  flex-wrap: wrap;
}
.premium-hero-text h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  flex-wrap: wrap;
}
.premium-hero-badge .tag-premium {
  font-size: 14px;
  padding: 6px 12px;
}

.premium-plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.premium-plan {
  position: relative;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.premium-plan h3 { margin: 0; font-size: 18px; }
.premium-plan-best {
  border-color: rgba(88, 101, 242, 0.5);
  box-shadow: 0 0 0 1px rgba(88, 101, 242, 0.4) inset;
}
.premium-plan-badge {
  position: absolute;
  top: -10px;
  right: 12px;
  background: linear-gradient(135deg, #57F287, #3ba55c);
  color: #0a0a0a;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
}
.premium-plan-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.premium-price-num    { font-size: 28px; font-weight: 700; }
.premium-price-period { font-size: 13px; color: var(--muted, #aaa); }

.premium-plan-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.premium-plan-features li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
}
.premium-plan-features li svg {
  color: #57F287;
  flex-shrink: 0;
  margin-top: 2px;
}
.premium-plan-cta { margin-top: auto; }

/* =============================================================
 * GUILD MINI ICON (sidebar)
 * ============================================================= */

.guild-mini-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg-elev-2, #1e1f22);
  flex-shrink: 0;
  display: block;
}

/* =============================================================
 * ADMIN TABLES
 * ============================================================= */

.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th,
.admin-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}
.admin-table th {
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  color: var(--muted, #aaa);
  white-space: nowrap;
}
.admin-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.admin-table-compact th,
.admin-table-compact td {
  padding: 6px 8px;
  white-space: nowrap;
}
.admin-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.admin-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #5865F2;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.admin-cell-null { color: var(--muted, #888); font-style: italic; }

.admin-db-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: start;
}
.admin-db-tables .rows-list {
  max-height: 70vh;
  overflow-y: auto;
}
.admin-db-table-btn { width: 100%; text-align: left; }
.admin-db-table-btn.active { background: rgba(88, 101, 242, 0.15); }
.admin-db-preview { min-width: 0; }

/* =============================================================
 * TICKETS PANELS
 * ============================================================= */

#ticketsPanelsList .card {
  padding: 16px;
}
#ticketsPanelsList textarea {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  padding: 8px 10px;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
}
#ticketsPanelsList textarea:focus {
  border-color: var(--primary);
  outline: none;
}

/* =============================================================
 * АДАПТИВ
 * ============================================================= */

/* ── 1600+ ── */
@media (min-width: 1600px) {
  .card { padding: 22px 24px; }
  .form-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .premium-plans { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

/* ── 1200–1599 ── */
@media (min-width: 1200px) and (max-width: 1599px) {
  .admin-db-layout { grid-template-columns: 300px 1fr; }
}

/* ── 1024–1199 ── */
@media (min-width: 1024px) and (max-width: 1199px) {
  .admin-db-layout { grid-template-columns: 260px 1fr; }
}

/* ── 900–1023 ── */
@media (min-width: 900px) and (max-width: 1023px) {
  .admin-db-layout { grid-template-columns: 240px 1fr; }
  .form-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
}

/* ── 768–899 (планшет) ── */
@media (max-width: 899px) {
  .card { padding: 16px 16px; }
  .card-head { margin-bottom: 14px; }

  .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
  }

  .checks-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .add-row {
    grid-template-columns: 1fr 1fr auto;
  }

  .admin-db-layout { grid-template-columns: 1fr; }

  .premium-hero { padding: 18px; }
  .premium-plans { grid-template-columns: 1fr; }

  .profile-stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 10px; }
  .stat-num { font-size: 18px; }
  .stat-label { font-size: 11px; }
}

/* ── 600–767 ── */
@media (max-width: 767px) {
  .add-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .add-row > .btn { width: 100%; }

  .cmd-row {
    padding: 10px;
    gap: 8px;
  }
  .cmd-side { width: 100%; justify-content: flex-end; }

  .row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .row-tags { width: 100%; }

  .field-with-chip {
    flex-wrap: nowrap;
  }
  .field-chip-slot {
    max-width: 55%;
    overflow: hidden;
  }

  .modal { padding: 18px; max-width: 100%; }
  .modal-actions { justify-content: stretch; }
  .modal-actions .btn { flex: 1; }

  .toast-host {
    left: 12px;
    right: 12px;
    bottom: 12px;
    align-items: stretch;
  }
  .toast { max-width: 100%; }

  .premium-hero {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .profile-head { gap: 12px; }
  .profile-avatar { width: 60px; height: 60px; }
  .profile-name { font-size: 18px; }

  .profile-stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .stat { padding: 8px; }
  .stat-num { font-size: 16px; }
  .stat-label { font-size: 10px; }
}

/* ── 480–599 ── */
@media (max-width: 599px) {
  .card { padding: 14px 14px; border-radius: 12px; }
  .card-head { gap: 10px; }
  .card-head h2 { font-size: 14px; }
  .card-icon { width: 30px; height: 30px; border-radius: 8px; }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .checks-grid {
    grid-template-columns: 1fr;
  }

  .row-main { gap: 6px; }

  .chip-role-name,
  .chip-user-name,
  .chip-channel-name {
    max-width: 130px;
  }

  .chip-tooltip { display: none; }

  .premium-plan { padding: 18px; }
  .premium-price-num { font-size: 24px; }

  .profile-stats {
    grid-template-columns: 1fr;
  }
  .stat-num { font-size: 20px; }

  .admin-table th,
  .admin-table td {
    padding: 8px;
    font-size: 12px;
  }
}

/* ── ≤ 479 ── */
@media (max-width: 479px) {
  .card { padding: 12px; }
  .card-head { margin-bottom: 12px; }
  .card-head h2 { font-size: 13.5px; }

  .field-with-chip {
    flex-wrap: wrap;
  }
  .field-chip-slot {
    max-width: 100%;
    width: 100%;
    padding: 0 0 6px 0;
    justify-content: flex-start;
  }

  .row {
    padding: 8px;
    gap: 6px;
  }
  .row-main { width: 100%; }

  .row > .btn-icon {
    margin-left: auto;
  }

  .chip-role-name,
  .chip-user-name,
  .chip-channel-name {
    max-width: 110px;
  }

  .cmd-status { font-size: 10px; padding: 2px 6px; }
  .cmd-name { font-size: 12.5px; }
  .cmd-desc { font-size: 12px; }

  .tag { font-size: 10px; padding: 1px 6px; }

  .modal { padding: 16px; }
  .modal-title { font-size: 15px; }
  .modal-text { font-size: 13px; margin-bottom: 14px; }

  .premium-plan { padding: 16px; }
  .premium-plan h3 { font-size: 16px; }
  .premium-plan-features li { font-size: 12px; }
}

/* ── ≤ 360 ── */
@media (max-width: 360px) {
  .card { padding: 10px; }
  .form-grid { gap: 10px; }
  .check { padding: 6px 8px; font-size: 12px; }
  .chip { font-size: 12px; padding: 2px 8px 2px 6px; }
  .chip-role-name,
  .chip-user-name,
  .chip-channel-name {
    max-width: 90px;
  }
  .toast { font-size: 12.5px; padding: 9px 11px; }
  .stat-num { font-size: 18px; }
}

/* ── ТВ / огромные экраны (2000+) ── */
@media (min-width: 2000px) {
  .card { padding: 28px 32px; border-radius: 16px; }
  .card-head h2 { font-size: 18px; }
  .card-icon { width: 40px; height: 40px; border-radius: 10px; }
  .form-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
  .checks-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .chip { font-size: 15px; padding: 4px 12px; }
  .premium-plan { padding: 32px; }
  .premium-price-num { font-size: 34px; }
  .modal { max-width: 500px; }
}

/* ── Тач-устройства (hover: none) ── */
@media (hover: none) and (pointer: coarse) {
  .chip:hover { background: var(--bg-elev-2); border-color: var(--border); }
  .chip:active { background: var(--bg-elev-3); border-color: var(--border-2); }
  .cmd-row:hover { background: transparent; border-color: transparent; }
  .cmd-row:active { background: var(--bg-elev-2); }
  .check:hover { border-color: var(--border); }
  .check:active { border-color: var(--border-2); }
  .admin-table tbody tr:hover { background: transparent; }
  .admin-table tbody tr:active { background: rgba(255, 255, 255, 0.02); }
  .row-link:hover { background: transparent; }
  .row-link:active { background: rgba(255, 255, 255, 0.03); }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Landscape phones (max-height 500) ── */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  .modal { max-height: 95vh; max-height: 95dvh; }
  .toast-host { bottom: 8px; }
  .card { padding: 12px; }
  .form-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

/* =============================================================
 * BOT PREVIEW (GENERAL TAB)
 * ============================================================= */

 .bot-preview-card {
  padding: 0;
  overflow: hidden;
  background: #111114;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius, 10px);
  margin-bottom: 14px;
}

.bot-preview-banner {
  width: 100%;
  height: 140px;
  background-color: #5865F2;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.bot-preview-banner-empty {
  background: linear-gradient(135deg, #5865F2 0%, #8a95ff 60%, #b0b8ff 100%);
}

.bot-preview-body {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 0 20px 18px;
  margin-top: -44px;
  position: relative;
  z-index: 1;
}

.bot-preview-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.bot-preview-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid #111114;
  background: #1e1f22;
  display: block;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.bot-preview-status {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #23a55a;
  border: 3px solid #111114;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.bot-preview-info {
  flex: 1;
  min-width: 0;
  padding-bottom: 4px;
}

.bot-preview-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text, #ececf1);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  line-height: 1.2;
  margin-bottom: 4px;
}

.bot-preview-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #5865F2;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  vertical-align: middle;
}

.bot-preview-tag {
  font-size: 12px;
  color: var(--muted, #7e7e8c);
  font-family: ui-monospace, monospace;
}

@media (max-width: 599px) {
  .bot-preview-banner { height: 100px; }
  .bot-preview-body { padding: 0 14px 14px; margin-top: -36px; gap: 12px; }
  .bot-preview-avatar { width: 72px; height: 72px; border-width: 4px; }
  .bot-preview-status { width: 16px; height: 16px; }
  .bot-preview-name { font-size: 18px; }
}

@media (max-width: 360px) {
  .bot-preview-banner { height: 80px; }
  .bot-preview-body { padding: 0 10px 10px; margin-top: -30px; gap: 10px; }
  .bot-preview-avatar { width: 60px; height: 60px; border-width: 3px; }
  .bot-preview-name { font-size: 16px; }
}

@media (hover: none) and (pointer: coarse) {
  .bot-preview-avatar { box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bot-preview-avatar { transition: none; }
}

/* =============================================================
 * BOT PREVIEW (GENERAL TAB)
 * ============================================================= */

 .bot-preview-card {
  padding: 0;
  overflow: hidden;
  background: #111114;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius, 10px);
  margin-bottom: 14px;
}

.bot-preview-banner {
  width: 100%;
  height: 140px;
  background-color: #5865F2;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.bot-preview-banner-empty {
  background: linear-gradient(135deg, #5865F2 0%, #8a95ff 60%, #b0b8ff 100%);
}

.bot-preview-body {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 0 20px 18px;
  margin-top: -44px;
  position: relative;
  z-index: 1;
}

.bot-preview-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.bot-preview-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid #111114;
  background: #1e1f22;
  display: block;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.bot-preview-status {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #23a55a;
  border: 3px solid #111114;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.bot-preview-info {
  flex: 1;
  min-width: 0;
  padding-bottom: 4px;
}

.bot-preview-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text, #ececf1);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  line-height: 1.2;
  margin-bottom: 4px;
}

.bot-preview-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #5865F2;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  vertical-align: middle;
}

.bot-preview-tag {
  font-size: 12px;
  color: var(--muted, #7e7e8c);
  font-family: ui-monospace, monospace;
}

@media (max-width: 599px) {
  .bot-preview-banner { height: 100px; }
  .bot-preview-body { padding: 0 14px 14px; margin-top: -36px; gap: 12px; }
  .bot-preview-avatar { width: 72px; height: 72px; border-width: 4px; }
  .bot-preview-status { width: 16px; height: 16px; }
  .bot-preview-name { font-size: 18px; }
}

@media (max-width: 360px) {
  .bot-preview-banner { height: 80px; }
  .bot-preview-body { padding: 0 10px 10px; margin-top: -30px; gap: 10px; }
  .bot-preview-avatar { width: 60px; height: 60px; border-width: 3px; }
  .bot-preview-name { font-size: 16px; }
}