/* ─────────────────────────────────────────────────────────────────────
   TELEGRAM BOT ANI — dark theme, vanilla CSS
   Design tokens → components → layout → tab-specific → responsive
   ───────────────────────────────────────────────────────────────────── */

:root {
  /* ── Colors ── */
  --bg: #0a0a0f;
  --surface: #14141f;
  --surface-2: #1c1c2b;
  --surface-3: #23233a;
  --surface-4: #2d2d44;
  --border: #2a2a3d;
  --border-strong: #3a3a55;
  --text: #e8e8f0;
  --text-muted: #8a8aa3;
  --text-dim: #5e5e7d;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: rgba(99, 102, 241, .15);
  --success: #10b981;
  --success-hover: #059669;
  --success-soft: rgba(16, 185, 129, .15);
  --warn: #f59e0b;
  --warn-hover: #d97706;
  --warn-soft: rgba(245, 158, 11, .15);
  --error: #ef4444;
  --error-hover: #dc2626;
  --error-soft: rgba(239, 68, 68, .15);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, .15);

  /* ── Spacing scale (px) ── */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-12: 48px;

  /* ── Radius ── */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-pill: 999px;

  /* ── Font size ── */
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 20px;
  --fs-2xl: 24px;

  /* ── Font weight ── */
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* ── Shadow ── */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .5);
  --shadow-glow: 0 0 0 3px rgba(99, 102, 241, .15);

  /* ── Transition ── */
  --t-fast: 120ms ease;
  --t-base: 180ms ease;

  /* ── Z-index ── */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 300;
  --z-toast: 400;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

input, textarea, select, button { font-family: inherit; font-size: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ─────────────────────────────────────────────────────────────────────
   BUTTONS (uniform)
   ───────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 38px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform 60ms;
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn-md { /* default */ }
.btn-lg { height: 46px; padding: 0 var(--sp-5); font-size: var(--fs-md); }

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

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

.btn-warn { background: var(--warn); border-color: var(--warn); color: #1a1a1a; }
.btn-warn:hover { background: var(--warn-hover); border-color: var(--warn-hover); }

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

.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-icon.btn-lg { width: 46px; }

.btn-block { width: 100%; }

.btn-loading {
  pointer-events: none;
  position: relative;
  color: transparent !important;
}
.btn-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  color: #fff;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-close {
  width: 32px; height: 32px; padding: 0;
  background: transparent; border: none; color: var(--text-muted);
  border-radius: var(--r-sm); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.btn-close:hover { background: var(--surface-3); color: var(--text); }

/* ─────────────────────────────────────────────────────────────────────
   INPUTS (uniform)
   ───────────────────────────────────────────────────────────────────── */
input[type=text],
input[type=password],
input[type=number],
input[type=tel],
textarea, select {
  width: 100%;
  height: 40px;
  padding: 0 var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: var(--fs-sm);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }

textarea {
  min-height: 80px;
  padding: var(--sp-3);
  height: auto;
  resize: vertical;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-sm);
  line-height: 1.5;
}

label {
  display: block;
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}
label input, label textarea, label select {
  margin-top: var(--sp-2);
  color: var(--text);
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text);
  margin: 0;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.inline-check input { width: auto; height: auto; }

.field-hint {
  display: block;
  margin-top: var(--sp-1);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-weight: var(--fw-normal);
}
.field-error {
  display: block;
  margin-top: var(--sp-1);
  font-size: var(--fs-xs);
  color: var(--error);
}

/* ─────────────────────────────────────────────────────────────────────
   BADGES & PILLS
   ───────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  letter-spacing: .02em;
  line-height: 1.4;
}
.badge-instant { background: var(--success-soft); color: var(--success); border: 1px solid rgba(16,185,129,.3); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warn    { background: var(--warn-soft); color: var(--warn); }
.badge-error   { background: var(--error-soft); color: var(--error); }
.badge-info    { background: var(--info-soft); color: var(--info); }
.badge-muted   { background: var(--surface-3); color: var(--text-muted); }

.badge-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; background: currentColor;
}
.badge-dot.is-pulse {
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse-dot 1.4s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,.55); }
  70%  { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* ─────────────────────────────────────────────────────────────────────
   TOGGLE SWITCH
   ───────────────────────────────────────────────────────────────────── */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  user-select: none;
  font-size: var(--fs-sm);
  color: var(--text);
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track {
  width: 44px; height: 24px;
  background: var(--border);
  border-radius: var(--r-pill);
  position: relative;
  transition: background var(--t-base);
  flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--t-base);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-track { background: var(--success); }
.toggle input:checked + .toggle-track::after { transform: translateX(20px); }
.toggle input:focus-visible + .toggle-track { box-shadow: var(--shadow-glow); }

/* ─────────────────────────────────────────────────────────────────────
   ICONS
   ───────────────────────────────────────────────────────────────────── */
.icon {
  width: 16px; height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 24px; height: 24px; }
.icon-2xl { width: 48px; height: 48px; stroke-width: 1.5; }

/* ─────────────────────────────────────────────────────────────────────
   TOPBAR
   ───────────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-5);
  background: rgba(10, 10, 15, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  gap: var(--sp-3);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: var(--sp-3); }
.brand-title {
  font-family: 'DM Sans';
  font-weight: var(--fw-bold);
  font-size: var(--fs-md);
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.wib-clock { color: var(--text-muted); font-size: var(--fs-sm); }
.live-dot {
  width: 8px; height: 8px; background: var(--success); border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16,185,129,.6);
  animation: live-pulse 1.4s ease-in-out infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,.6); }
  70%  { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
.live-text {
  font-size: var(--fs-xs);
  color: var(--success);
  font-weight: var(--fw-semibold);
  letter-spacing: .08em;
}

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  min-width: 200px;
  padding: var(--sp-1);
  box-shadow: var(--shadow-md);
  z-index: var(--z-dropdown);
}
.dropdown-menu button {
  display: flex; align-items: center; gap: var(--sp-2);
  width: 100%; text-align: left;
  background: none; border: none;
  color: var(--text);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: var(--fs-sm);
  transition: background var(--t-fast);
}
.dropdown-menu button:hover { background: var(--surface-3); }

/* ─────────────────────────────────────────────────────────────────────
   STATS BAR
   ───────────────────────────────────────────────────────────────────── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5) 0;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  transition: transform var(--t-fast), border-color var(--t-fast);
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  border-radius: var(--r-md);
  color: var(--accent);
  flex-shrink: 0;
}
.stat-icon.is-success { color: var(--success); background: var(--success-soft); }
.stat-icon.is-error   { color: var(--error); background: var(--error-soft); }
.stat-icon.is-warn    { color: var(--warn); background: var(--warn-soft); }
.stat-icon.is-info    { color: var(--info); background: var(--info-soft); }
.stat-body { min-width: 0; }
.stat-label {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: var(--fw-medium);
}
.stat-value {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  margin-top: 2px;
  line-height: 1.1;
}
.text-success { color: var(--success); }
.text-error   { color: var(--error); }
.text-warn    { color: var(--warn); }
.text-muted   { color: var(--text-muted); }

/* ─────────────────────────────────────────────────────────────────────
   MAIN GRID
   ───────────────────────────────────────────────────────────────────── */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5) var(--sp-8);
  align-items: start;
}
.tabs-wrap { min-width: 0; }

/* ─────────────────────────────────────────────────────────────────────
   TABS
   ───────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab, .sub-tab {
  background: none; border: none;
  color: var(--text-muted);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  font-weight: var(--fw-medium);
  font-size: var(--fs-sm);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  scroll-snap-align: start;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab:hover, .sub-tab:hover { color: var(--text); }
.tab.active, .sub-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel, .sub-panel { display: none; }
.tab-panel.active, .sub-panel.active { display: block; }

/* ─────────────────────────────────────────────────────────────────────
   CARDS
   ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  transition: border-color var(--t-fast);
}
.card:hover { border-color: var(--border-strong); }
.card h2 {
  margin: 0 0 var(--sp-4);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.card-head h2 { margin: 0; display: inline-flex; align-items: center; gap: var(--sp-2); }
.card-head-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.count-pill {
  background: var(--surface-3);
  color: var(--text-muted);
  border-radius: var(--r-pill);
  padding: 2px 10px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}

.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-3);
}

.list-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  display: flex; flex-direction: column;
  gap: var(--sp-2);
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.list-item:hover { border-color: var(--border-strong); }
.list-item-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-2);
}
.list-item-title {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-md);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-item-sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-item-row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.list-item-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

/* Avatar circle (initial) */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  flex-shrink: 0;
}
.avatar-sm { width: 26px; height: 26px; font-size: var(--fs-xs); }

/* ─────────────────────────────────────────────────────────────────────
   EMPTY STATE
   ───────────────────────────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--sp-12) var(--sp-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
}
.empty-state .icon-2xl { color: var(--text-dim); margin-bottom: var(--sp-2); }
.empty-state h3 {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text);
}
.empty-state p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  max-width: 380px;
}

/* ─────────────────────────────────────────────────────────────────────
   SKELETON LOADERS
   ───────────────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--r-sm);
}
.skeleton-text { height: 14px; margin: 6px 0; }
.skeleton-card { height: 130px; border-radius: var(--r-md); }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─────────────────────────────────────────────────────────────────────
   MONITOR TAB
   ───────────────────────────────────────────────────────────────────── */
.monitor-control {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  flex-wrap: wrap;
}
.btn-monitor {
  min-width: 280px;
  height: 64px;
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: .08em;
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  border-radius: var(--r-lg);
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-3);
  border-width: 1px;
  border-style: solid;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.btn-monitor:hover { background: var(--success-hover); border-color: var(--success-hover); }
.btn-monitor.is-stop { background: var(--error); border-color: var(--error); }
.btn-monitor.is-stop:hover { background: var(--error-hover); border-color: var(--error-hover); }
.btn-monitor .icon { width: 22px; height: 22px; }

.monitor-info {
  display: flex; flex-direction: column;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.monitor-info strong { color: var(--text); font-weight: var(--fw-semibold); }

/* ─────────────────────────────────────────────────────────────────────
   ASSIGNMENTS TAB
   ───────────────────────────────────────────────────────────────────── */
.assign-toolbar {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.assign-toolbar .search-input {
  flex: 1;
  min-width: 200px;
  max-width: 340px;
}
.assign-bulkbar {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding: var(--sp-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-4);
  position: sticky;
  top: 70px;
  z-index: 10;
}
.assign-bulkbar-label {
  display: inline-flex; align-items: center;
  color: var(--text-muted); font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  text-transform: uppercase; letter-spacing: .05em;
  margin-right: var(--sp-2);
}

.assign-groups {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.assign-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  transition: border-color var(--t-fast);
}
.assign-row:hover { border-color: var(--border-strong); }
.assign-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
.assign-row-info { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; flex-wrap: wrap; }
.assign-row-name { font-weight: var(--fw-semibold); font-size: var(--fs-md); }
.assign-row-id { font-size: var(--fs-xs); color: var(--text-muted); }
.assign-row-counter {
  background: var(--surface-3);
  color: var(--text);
  border-radius: var(--r-pill);
  padding: 2px 10px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}
.assign-row-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.assign-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-2);
}
.assign-check {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  min-height: 40px;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.assign-check:hover { background: var(--surface-3); border-color: var(--border-strong); }
.assign-check.is-on { background: var(--accent-soft); border-color: var(--accent); }
.assign-check input { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; accent-color: var(--accent); }
.assign-check-name { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; background: var(--text-dim);
}
.status-dot.is-on { background: var(--success); }

/* ─────────────────────────────────────────────────────────────────────
   DATA TABLE (still used in responses matrix)
   ───────────────────────────────────────────────────────────────────── */
.assign-table-wrap { overflow: auto; max-height: 60vh; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.data-table th, .data-table td {
  border: 1px solid var(--border);
  padding: var(--sp-2);
  text-align: center;
}
.data-table th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
  position: sticky; top: 0; z-index: 1;
  font-size: var(--fs-xs);
}
.data-table td:first-child, .data-table th:first-child {
  text-align: left;
  background: var(--surface-2);
  position: sticky; left: 0; z-index: 2;
  font-weight: var(--fw-medium);
}
.data-table td:first-child { color: var(--text); }
.data-table textarea {
  font-size: var(--fs-xs);
  min-height: 60px;
  padding: var(--sp-2);
  border-radius: var(--r-sm);
}
.data-table textarea.is-dirty { border-color: var(--warn); box-shadow: 0 0 0 2px rgba(245,158,11,.2); }

/* ─────────────────────────────────────────────────────────────────────
   LOGS SIDEBAR
   ───────────────────────────────────────────────────────────────────── */
.logs-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex; flex-direction: column;
  height: calc(100vh - 220px);
  position: sticky; top: 90px;
  overflow: hidden;
}
.logs-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.logs-head h3 {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  display: inline-flex; align-items: center; gap: var(--sp-2);
}
.logs-list {
  flex: 1; overflow-y: auto;
  padding: var(--sp-2);
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
}
.log-entry {
  padding: var(--sp-2);
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-1);
  display: flex;
  gap: var(--sp-2);
  align-items: flex-start;
}
.log-entry:hover { background: var(--surface-2); }
.log-ts { color: var(--text-muted); white-space: nowrap; flex: 0 0 auto; font-size: 11px; }
.log-lv {
  padding: 0 6px;
  border-radius: 3px;
  font-weight: var(--fw-semibold);
  font-size: 10px;
  letter-spacing: .03em;
  flex: 0 0 auto;
}
.log-lv-INFO    { background: var(--info-soft); color: var(--info); }
.log-lv-SUCCESS { background: var(--success-soft); color: var(--success); }
.log-lv-WARN    { background: var(--warn-soft); color: var(--warn); }
.log-lv-ERROR   { background: var(--error-soft); color: var(--error); }
.log-msg { flex: 1; word-break: break-word; line-height: 1.4; }
.log-meta { color: var(--text-muted); font-size: 11px; }

.logs-toggle {
  display: none;
  position: fixed; bottom: var(--sp-4); right: var(--sp-4);
  z-index: 50;
  width: 52px; height: 52px;
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  align-items: center; justify-content: center;
}

/* ─────────────────────────────────────────────────────────────────────
   MODALS
   ───────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: var(--z-modal);
  padding: var(--sp-4);
  animation: fade-in var(--t-base);
}
.modal[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-md);
  animation: modal-in var(--t-base);
}
.modal-confirm { max-width: 420px; }
.modal-wide { max-width: 1100px; }
@keyframes modal-in {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-card > header {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.modal-card > header h3 {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
}
.modal-body {
  padding: var(--sp-5);
  overflow: auto;
}
.modal-body p { margin: 0 0 var(--sp-3); color: var(--text-muted); font-size: var(--fs-sm); }
.modal-card > footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
  display: flex; gap: var(--sp-2); justify-content: flex-end;
  flex-wrap: wrap;
}

/* OTP input (5-digit big) */
.otp-input {
  font-family: 'JetBrains Mono', monospace !important;
  font-size: var(--fs-xl) !important;
  text-align: center;
  letter-spacing: .3em;
  height: 56px !important;
}

/* ─────────────────────────────────────────────────────────────────────
   TOAST (top-right)
   ───────────────────────────────────────────────────────────────────── */
.toast-wrap {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: var(--z-toast);
  display: flex; flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  min-width: 260px;
  max-width: 400px;
  box-shadow: var(--shadow-md);
  animation: toast-in var(--t-base);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  pointer-events: auto;
}
.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--error); }
.toast-warn    { border-left-color: var(--warn); }
.toast-info    { border-left-color: var(--accent); }
.toast-success .icon { color: var(--success); }
.toast-error .icon   { color: var(--error); }
.toast-warn .icon    { color: var(--warn); }
.toast-info .icon    { color: var(--accent); }
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ─────────────────────────────────────────────────────────────────────
   LOGIN PAGE
   ───────────────────────────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at top, rgba(99, 102, 241, .12), transparent 60%),
    var(--bg);
}
.login-wrap { width: 100%; max-width: 420px; padding: var(--sp-5); }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-8);
  box-shadow: var(--shadow-md);
}
.login-brand { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-1); }
.login-brand .brand-title { font-size: var(--fs-xl); max-width: none; }
.login-sub {
  color: var(--text-muted);
  margin: var(--sp-1) 0 var(--sp-5);
  font-size: var(--fs-sm);
}
.login-form label {
  color: var(--text);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-4);
}
.login-form .btn { width: 100%; }
.login-hint {
  margin-top: var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-align: center;
}
.login-hint code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: var(--r-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
}

.alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-sm);
  display: flex; align-items: center; gap: var(--sp-2);
}
.alert-error {
  background: var(--error-soft);
  border: 1px solid rgba(239, 68, 68, .3);
  color: var(--error);
}

/* ─────────────────────────────────────────────────────────────────────
   HELP ICON
   ───────────────────────────────────────────────────────────────────── */
.help-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  margin-left: var(--sp-1);
  background: var(--surface-3);
  color: var(--text-muted);
  border-radius: 50%;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  border: 1px solid var(--border);
  cursor: help;
  vertical-align: middle;
  transition: background var(--t-fast), color var(--t-fast);
}
.help-link:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.caret { display: inline-block; margin-left: var(--sp-1); font-size: 10px; opacity: .7; }

/* ─────────────────────────────────────────────────────────────────────
   BULK PASTE (responses modal)
   ───────────────────────────────────────────────────────────────────── */
.bulk-preview {
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-xs);
}
.bulk-preview-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) 0;
  border-bottom: 1px dashed var(--border);
}
.bulk-preview-row:last-child { border-bottom: none; }
.bulk-preview-row .mono { color: var(--text); }
.bulk-mismatch { color: var(--warn); font-size: var(--fs-xs); margin-top: var(--sp-2); }

/* ─────────────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-bar {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
  .logs-sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    height: 60vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    transform: translateY(100%);
    transition: transform var(--t-base);
    z-index: 55;
    border-top: 1px solid var(--border);
  }
  .logs-sidebar.open { transform: translateY(0); }
  .logs-toggle { display: inline-flex; }
  .main-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .topbar {
    flex-wrap: wrap;
    padding: var(--sp-2) var(--sp-3);
    gap: var(--sp-2);
  }
  .topbar-center { order: 3; flex-basis: 100%; text-align: center; }
  .stats-bar {
    grid-template-columns: 1fr 1fr;
    padding: var(--sp-3) var(--sp-3) 0;
    gap: var(--sp-2);
  }
  .stat-card { padding: var(--sp-3); }
  .stat-value { font-size: var(--fs-xl); }
  .stat-icon { width: 32px; height: 32px; }
  .main-grid { padding: var(--sp-3); }
  .brand-title { font-size: var(--fs-base); max-width: 140px; }
  .wib-clock { font-size: var(--fs-xs); }
  .card { padding: var(--sp-4); }
  .card-head { flex-direction: column; align-items: flex-start; }
  .btn-monitor { width: 100%; min-width: 0; }
  .list-grid { grid-template-columns: 1fr; }
  .list-item-actions .btn span:not(.icon) { display: none; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-card {
    max-height: 95vh;
    max-width: 100%;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    animation: modal-in-mobile var(--t-base);
  }
  @keyframes modal-in-mobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .assign-row-head { flex-direction: column; align-items: stretch; }
  .assign-row-actions .btn { flex: 1; min-width: 0; }
  .assign-bulkbar { position: static; }
  .assign-bulkbar .btn { flex: 1; min-width: 120px; }
  .toast-wrap { top: var(--sp-2); right: var(--sp-2); left: var(--sp-2); }
  .toast { min-width: 0; max-width: none; }
}
@media (max-width: 414px) {
  .stats-bar { grid-template-columns: 1fr 1fr; }
  .topbar-right { gap: var(--sp-2); }
  .topbar-right .live-text { display: none; }
}
