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

:root {
  /* ── Fonts: system stack (no web-font download) ── */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* ── 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: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); }
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: var(--font-mono);
  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: var(--font-mono);
  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: var(--font-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: var(--font-mono);
  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: var(--font-mono) !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;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}

/* ── Brand panel ── */
.login-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--sp-12);
  background: linear-gradient(155deg, #13132a 0%, #0d0d1a 55%, #0a0a12 100%);
  border-right: 1px solid var(--border);
  isolation: isolate;
}
.hero-grid {
  position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 70% at 30% 40%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 30% 40%, #000 30%, transparent 75%);
}
.hero-glow {
  position: absolute; z-index: -1; border-radius: 50%;
  filter: blur(70px); opacity: .5;
}
.hero-glow-a { width: 420px; height: 420px; background: #4f46e5; top: -120px; left: -80px; }
.hero-glow-b { width: 340px; height: 340px; background: #0ea5e9; bottom: -140px; right: -60px; opacity: .3; animation-delay: -7s; }

.hero-top { display: flex; align-items: center; gap: var(--sp-3); }
.hero-name { font-weight: var(--fw-bold); letter-spacing: .14em; font-size: var(--fs-sm); color: var(--text); }

.logo-mark {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, #6366f1, #0ea5e9);
  box-shadow: 0 8px 24px rgba(99, 102, 241, .35), inset 0 1px 0 rgba(255,255,255,.25);
  color: #fff;
}
.logo-mark svg { width: 22px; height: 22px; margin-left: -2px; }
.logo-mark-sm { width: 34px; height: 34px; border-radius: 10px; }
.logo-mark-sm svg { width: 17px; height: 17px; }

.hero-body { max-width: 460px; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 5px 12px;
  border: 1px solid rgba(16, 185, 129, .35);
  background: var(--success-soft);
  color: #6ee7b7;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  letter-spacing: .08em; text-transform: uppercase;
}
.dot-live {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, .6);
  animation: dot-live 2s infinite;
}
@keyframes dot-live {
  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); }
}
.hero-title {
  margin: var(--sp-5) 0 var(--sp-4);
  font-size: clamp(30px, 3.2vw, 42px);
  line-height: 1.12;
  font-weight: var(--fw-bold);
  letter-spacing: -.02em;
}
.hero-title span {
  background: linear-gradient(90deg, #a5b4fc, #7dd3fc);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.hero-lead { color: var(--text-muted); font-size: var(--fs-md); line-height: 1.6; margin: 0 0 var(--sp-8); }

.hero-features { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-4); }
.hero-features li { display: flex; align-items: center; gap: var(--sp-4); }
.hero-features b { display: block; font-size: var(--fs-base); font-weight: var(--fw-semibold); }
.hero-features small { display: block; color: var(--text-muted); font-size: var(--fs-sm); margin-top: 2px; }
.feat-ico {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: #a5b4fc;
}
.feat-ico svg { width: 19px; height: 19px; }
.hero-foot { color: var(--text-dim); font-size: var(--fs-sm); }
.hero-foot .mono { font-family: var(--font-mono); color: var(--text-muted); }

/* ── Form panel ── */
.login-panel {
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-8) var(--sp-6);
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, .08), transparent 60%), var(--bg);
}
.login-card {
  width: 100%; max-width: 380px;
  animation: login-in .45s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes login-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.login-card-brand {
  display: none;
  align-items: center; gap: var(--sp-3);
  margin-bottom: var(--sp-8);
  font-weight: var(--fw-bold); letter-spacing: .08em; font-size: var(--fs-sm);
}
.login-heading { margin: 0; font-size: var(--fs-2xl); font-weight: var(--fw-bold); letter-spacing: -.01em; }
.login-sub { color: var(--text-muted); margin: var(--sp-2) 0 var(--sp-6); font-size: var(--fs-base); }

.login-alert {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-5);
  border-radius: var(--r-md);
  border: 1px solid rgba(239, 68, 68, .35);
  background: var(--error-soft);
  color: #fca5a5;
  font-size: var(--fs-sm);
  animation: login-shake .4s ease;
}
.login-alert svg { width: 18px; height: 18px; flex: none; }
@keyframes login-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.login-form .field { margin-bottom: var(--sp-5); }
.login-form label {
  display: block;
  margin-bottom: var(--sp-2);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
  color: var(--text);
}
.input-wrap { position: relative; }
.input-wrap .input-ico {
  position: absolute; left: 14px; top: 50%;
  width: 18px; height: 18px;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  transition: color var(--t-fast);
}
.login-form input {
  width: 100%;
  height: 48px;
  padding: 0 44px 0 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font: inherit; font-size: var(--fs-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.login-form input::placeholder { color: var(--text-dim); }
.login-form input:hover { border-color: var(--border-strong); }
.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.input-wrap:focus-within .input-ico { color: #a5b4fc; }
.input-wrap.is-invalid input { border-color: var(--error); box-shadow: 0 0 0 4px var(--error-soft); }
.input-wrap.is-invalid .input-ico { color: var(--error); }
/* Chrome autofill on dark bg */
.login-form input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset;
  caret-color: var(--text);
}

.pw-toggle {
  position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: transparent; border: 0; border-radius: var(--r-sm);
  color: var(--text-dim); cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}
.pw-toggle:hover { color: var(--text); background: var(--surface-3); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pw-toggle svg { width: 18px; height: 18px; }

.caps-warn {
  margin-top: var(--sp-2);
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
  color: var(--warn);
}

.login-submit {
  position: relative;
  width: 100%; height: 48px;
  margin-top: var(--sp-2);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  border: 0; border-radius: var(--r-md);
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  font: inherit; font-size: var(--fs-md); font-weight: var(--fw-semibold);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(79, 70, 229, .3), inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform var(--t-fast), box-shadow var(--t-fast), filter var(--t-fast);
}
.login-submit:hover { filter: brightness(1.08); box-shadow: 0 10px 26px rgba(79, 70, 229, .42), inset 0 1px 0 rgba(255,255,255,.18); }
.login-submit:active { transform: translateY(1px); }
.login-submit:focus-visible { outline: 2px solid #a5b4fc; outline-offset: 3px; }
.login-submit .btn-arrow { width: 18px; height: 18px; transition: transform var(--t-base); }
.login-submit:hover .btn-arrow { transform: translateX(3px); }
.login-submit .btn-spin {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.login-submit.is-loading { cursor: progress; filter: none; }
.login-submit.is-loading .btn-arrow { display: none; }
.login-submit.is-loading .btn-spin { display: inline-block; }
.login-submit.is-loading .btn-label::after { content: '…'; }

.login-foot {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: var(--sp-6) 0 0;
  color: var(--text-dim); font-size: var(--fs-xs);
}
.login-foot svg { width: 13px; height: 13px; }

/* ── Responsive ── */
@media (max-width: 960px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-card-brand { display: flex; }
  .login-panel {
    align-items: flex-start;
    padding: 12vh var(--sp-4) var(--sp-8);
    background:
      radial-gradient(ellipse 90% 45% at 50% 0%, rgba(99, 102, 241, .16), transparent 70%),
      var(--bg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .dot-live, .login-card, .login-alert { animation: none; }
}

.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; }
}

/* ═════════════════════════════════════════════════════════════════════
   UI REFRESH — 2026-09-27
   Visual polish + mobile app-style layout + lighter rendering.
   Pure presentation: no ids / data-* / JS hooks changed.
   ═════════════════════════════════════════════════════════════════════ */

/* ── Base & surfaces ── */
body {
  background:
    radial-gradient(ellipse 70% 40% at 50% -10%, rgba(99, 102, 241, .10), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
.topbar {
  backdrop-filter: none;
  background: rgba(10, 10, 15, .97);
  padding-top: max(var(--sp-3), env(safe-area-inset-top));
}
.brand-mark {
  width: 30px; height: 30px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, #6366f1, #0ea5e9);
  box-shadow: 0 4px 14px rgba(99, 102, 241, .35), inset 0 1px 0 rgba(255,255,255,.25);
  color: #fff;
}
.brand-mark .icon { width: 16px; height: 16px; margin-left: -1px; }
.brand-title { letter-spacing: .02em; }
.topbar-left { gap: var(--sp-2); }

.card {
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.018), transparent 120px), var(--surface);
}
.card h2 .icon, .card-head h2 .icon { color: #a5b4fc; }
.list-item { border-radius: 10px; }

/* ── Buttons ── */
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(79, 70, 229, .25), inset 0 1px 0 rgba(255,255,255,.15);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-monitor { box-shadow: 0 8px 24px rgba(16, 185, 129, .25); }
.btn-monitor.is-stop { box-shadow: 0 8px 24px rgba(239, 68, 68, .25); }

/* ── Stats bar ── */
.stat-card {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent), var(--surface);
}
.stat-card::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: var(--stat-c, var(--accent));
  opacity: .7;
}
.stat-card:nth-child(1) { --stat-c: var(--info); }
.stat-card:nth-child(2) { --stat-c: var(--success); }
.stat-card:nth-child(3) { --stat-c: var(--error); }
.stat-card:nth-child(4) { --stat-c: var(--warn); }
.stat-card:nth-child(5) { --stat-c: var(--accent); }
.stat-card:hover { transform: none; }
.stat-value { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ── Main tabs: segmented control (desktop) ── */
.tabs-wrap > .tabs {
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: fit-content;
  max-width: 100%;
}
.tabs-wrap > .tabs .tab {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 8px 14px;
  border: 0;
  border-radius: 9px;
  color: var(--text-muted);
}
.tabs-wrap > .tabs .tab .icon { width: 16px; height: 16px; opacity: .8; }
.tabs-wrap > .tabs .tab:hover { color: var(--text); background: var(--surface-2); }
.tabs-wrap > .tabs .tab.active {
  color: var(--text);
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.tabs-wrap > .tabs .tab.active .icon { color: #a5b4fc; opacity: 1; }

/* ── Grids never overflow their column (long names / nowrap titles) ── */
.list-grid { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.list-grid > *, .assign-checkbox-grid > *, .stats-bar > * { min-width: 0; }
.list-item-head > * { min-width: 0; }
.list-item-head .badge { flex: none; }

/* ── Monitor: compact account tiles ── */
#connectedList {
  grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr));
  gap: var(--sp-2);
}
#connectedList .list-item { padding: 10px 12px; gap: 4px; }
#connectedList .list-item-title { font-size: var(--fs-sm); }
#connectedList .list-item-sub.mono { display: none; } /* phone is never sent by /status → always "—" */
#connectedList .list-item-sub { font-size: 11px; color: var(--text-dim); }
#connectedList .badge { font-size: 11px; padding: 1px 8px; }
#connectedList .badge-dot.is-pulse { animation: none; } /* 34 infinite animations → static dot */

/* ── Assignments ── */
.assign-bulkbar { align-items: center; border-radius: 12px; }
.assign-row { border-radius: 12px; }
.assign-check { border-radius: 9px; }

/* ── Logs ── */
.logs-sidebar { border-radius: 14px; }
.logs-toggle { box-shadow: 0 8px 24px rgba(79, 70, 229, .45); background: linear-gradient(135deg, #6366f1, #4f46e5); }

/* Global `label { margin-bottom }` was leaking into toggles / checkbox tiles */
.list-item label.toggle, .assign-check { margin-bottom: 0; }
.list-item-head { align-items: center; }

/* ── Mobile: app-style layout ── */
@media (max-width: 768px) {
  /* Bottom navigation bar (same .tab buttons, just repositioned) */
  .tabs-wrap > .tabs {
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 58;
    width: auto; max-width: none;
    margin: 0;
    display: grid; grid-template-columns: repeat(5, 1fr);
    gap: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(17, 17, 26, .98);
    border: 0; border-top: 1px solid var(--border);
    border-radius: 0;
    overflow: visible;
  }
  .tabs-wrap > .tabs .tab {
    flex-direction: column; gap: 3px;
    padding: 7px 2px 5px;
    font-size: 10.5px; font-weight: var(--fw-semibold);
    letter-spacing: .01em;
    min-width: 0;
  }
  .tabs-wrap > .tabs .tab .icon { width: 21px; height: 21px; }
  .tabs-wrap > .tabs .tab .tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .tabs-wrap > .tabs .tab:hover { background: none; }
  .tabs-wrap > .tabs .tab.active { background: var(--accent-soft); box-shadow: none; color: #c7d2fe; }
  .main-grid { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .logs-toggle { bottom: calc(76px + env(safe-area-inset-bottom)); right: var(--sp-3); width: 48px; height: 48px; }
  .logs-sidebar { bottom: calc(62px + env(safe-area-inset-bottom)); height: 58vh; z-index: 57; }

  /* Topbar */
  .brand-mark { width: 26px; height: 26px; border-radius: 8px; }
  .brand-mark .icon { width: 14px; height: 14px; }
  .topbar .badge-instant { display: none; }
  .brand-title { max-width: none; }

  /* Stats: compact 3 + 2 */
  .stats-bar { grid-template-columns: repeat(6, 1fr); gap: var(--sp-2); }
  .stat-card { grid-column: span 2; padding: 10px 12px; gap: 0; border-radius: 12px; }
  .stat-card:nth-child(n+4) { grid-column: span 3; }
  .stat-icon { display: none; }
  .stat-label { font-size: 10.5px; letter-spacing: .05em; }
  .stat-value { font-size: var(--fs-lg); margin-top: 1px; }

  /* Cards */
  .card { padding: var(--sp-4) var(--sp-3); border-radius: 12px; }
  .card-head { flex-direction: row; align-items: center; }
  .card-head-actions .btn { height: 36px; }
  #connectedList { grid-template-columns: 1fr 1fr; }
  #connectedList .list-item { padding: 9px 10px; }
  #connectedList .list-item-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  #connectedList .list-item-row { flex-wrap: nowrap; min-width: 0; max-width: 100%; }
  #connectedList .list-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #connectedList .list-item-sub { display: none; }
  .monitor-control { gap: var(--sp-3); }

  /* Assignments: buttons wrap instead of overflowing */
  .assign-bulkbar { display: grid; grid-template-columns: 1fr 1fr; }
  .assign-bulkbar-label { grid-column: 1 / -1; margin: 0; }
  .assign-bulkbar .btn,
  .assign-row-actions .btn {
    white-space: normal; height: auto; min-height: 40px;
    padding: 6px 8px; line-height: 1.25; text-align: center;
    min-width: 0;
  }
  .assign-row-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .assign-row-actions .btn { font-size: var(--fs-xs); }
  .assign-toolbar .search-input { min-width: 0; max-width: none; }
  .assign-checkbox-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .assign-check { min-height: 44px; }

  /* FAB stays above the open sheet so it can close it (was covered before) */
  .logs-toggle { z-index: 59; }
  .logs-sidebar.open + .logs-toggle {
    background: var(--surface-3);
    box-shadow: 0 0 0 1px var(--border-strong), 0 8px 24px rgba(0,0,0,.5);
  }
  /* Closed log sheet must hide fully behind the bottom nav */
  .logs-sidebar:not(.open) { transform: translateY(calc(100% + 90px)); }
  /* Short label for the 5th tab */
  .tabs-wrap > .tabs .tab-label[data-short] { font-size: 0; }
  .tabs-wrap > .tabs .tab-label[data-short]::after { content: attr(data-short); font-size: 10.5px; }
  /* Long group names: up to 2 lines instead of a hard cut */
  #groupsList .list-item-title {
    white-space: normal;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    line-height: 1.3;
  }
  #groupsList .list-item-head { align-items: flex-start; }

  /* Lighter: no blur layers on phones */
  .modal { backdrop-filter: none; background: rgba(0, 0, 0, .75); }
  .modal-card { padding-bottom: env(safe-area-inset-bottom); }
}
@media (max-width: 360px) {
  .tabs-wrap > .tabs .tab { font-size: 9.5px; }
  #connectedList { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
