/* ================================================
   MC-Bot Panel — Redesigned Dark Minimalist Theme
   Accent: #5865f2 | Active Green: #3ba55d
   ================================================ */

/* ---- Custom Properties ---- */
:root {
  --bg:        #1b1d23;
  --surface:   #1f212a;
  --surface-2: #25272f;
  --border:    #2a2c33;
  --border-2:  #3a3c45;
  --text:      #e6e6e6;
  --text-2:    #aaa;
  --text-3:    #777;
  --accent:    #5865f2;
  --accent-h:  #4752c4;
  --green:     #3ba55d;
  --yellow:    #faa61a;
  --red:       #ed4245;
  --modal-w:   460px;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(88,101,242,0.08);
  --transition: 0.15s ease;
  --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(88,101,242,0.35); color: #fff; }

/* ---- Scrollbars (global dark + purple) ---- */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(88, 101, 242, 0.35) rgba(20, 21, 26, 0.6);
}
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: rgba(20, 21, 26, 0.6); border-radius: 3px; }
*::-webkit-scrollbar-thumb { background: rgba(88, 101, 242, 0.35); border-radius: 3px; transition: background 0.2s; }
*::-webkit-scrollbar-thumb:hover { background: rgba(88, 101, 242, 0.65); }

/* Modal-specific scrollbar */
.modal { scrollbar-width: thin; scrollbar-color: rgba(88, 101, 242, 0.4) transparent; }
.modal::-webkit-scrollbar-thumb { background: rgba(88, 101, 242, 0.45); }

/* ---- Layout ---- */
.app { display: flex; height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: 300px;
  background: rgba(16, 17, 23, 0.85);
  border-right: 1px solid rgba(88, 101, 242, 0.12);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sidebar-header h1 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.sidebar-title { display: flex; align-items: center; gap: 8px; }
.app-logo { width: 26px; height: 26px; display: block; border-radius: 6px; }

/* ---- Bot List ---- */
.bot-list {
  flex: 1;
  overflow-y: auto;
  margin: 0 -16px;
  padding: 0 16px;
}

.bot-item {
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(29, 31, 39, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease;
  backdrop-filter: blur(6px);
}
.bot-item:hover {
  background: rgba(88, 101, 242, 0.08);
  border-color: rgba(88, 101, 242, 0.2);
  transform: translateX(3px);
  box-shadow: 0 2px 16px rgba(88, 101, 242, 0.1);
}
.bot-item.active {
  background: rgba(88, 101, 242, 0.12);
  border-color: rgba(88, 101, 242, 0.35);
  box-shadow: 0 0 12px rgba(88, 101, 242, 0.08);
}
.bot-item-name {
  font-size: 13px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}
.bot-item-username {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bot-item-arrow { color: #444; font-size: 16px; flex-shrink: 0; }
.bot-item-delete {
  background: transparent;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.bot-item:hover .bot-item-delete { opacity: 1; }
.bot-item-delete:hover { color: #fff; background: var(--red); }

/* Status dot */
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot.online      { background: var(--green); box-shadow: 0 0 6px rgba(59,165,93,0.6); }
.dot.offline     { background: #4a4d55; }
.dot.connecting,
.dot.reconnecting { background: var(--yellow); animation: pulse-dot 1.4s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ---- Folder Groups ---- */
.folder-group { margin-bottom: 6px; }
.folder-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  user-select: none;
}
.folder-group-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-action-btn {
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.15s;
  flex-shrink: 0;
}
.folder-action-btn:hover {
  background: rgba(88,101,242,0.15);
  border-color: rgba(88,101,242,0.35);
  color: rgba(255,255,255,0.9);
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 4px 12px rgba(88,101,242,0.2);
}
.folder-action-btn:active { transform: translateY(0) scale(0.95); }
/* A faint default tint (not just on hover) so the 5 buttons read as
   distinct actions at a glance instead of 5 identical grey squares you
   have to hover one at a time to tell apart. */
.folder-action-btn.start-btn    { color: #6fcf97; }
.folder-action-btn.stop-btn     { color: #eb5757; }
.folder-action-btn.restart-btn  { color: #f2b866; }
.folder-action-btn.preset-btn   { color: #a3b3ff; }
.folder-action-btn.watchdog-btn { color: #c99aff; }
.folder-action-btn.start-btn:hover  { background: rgba(63,185,80,0.15); border-color: rgba(63,185,80,0.4); box-shadow: 0 4px 12px rgba(63,185,80,0.2); }
.folder-action-btn.stop-btn:hover   { background: rgba(235,87,87,0.15); border-color: rgba(235,87,87,0.4); box-shadow: 0 4px 12px rgba(235,87,87,0.2); }
.folder-action-btn.restart-btn:hover{ background: rgba(255,177,66,0.15); border-color: rgba(255,177,66,0.4); box-shadow: 0 4px 12px rgba(255,177,66,0.2); }
.folder-action-btn.preset-btn:hover { background: rgba(130,162,255,0.15); border-color: rgba(130,162,255,0.4); box-shadow: 0 4px 12px rgba(130,162,255,0.2); }
.folder-action-btn.watchdog-btn:hover{ background: rgba(185,130,255,0.15); border-color: rgba(185,130,255,0.4); box-shadow: 0 4px 12px rgba(185,130,255,0.2); }
.folder-group-header:hover .folder-action-btn { opacity: 1; }
.folder-action-btn img.btn-icon {
  width: 13px;
  height: 13px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.folder-action-btn .icon-mask { width: 13px; height: 13px; }
.folder-group-list { display: flex; flex-direction: column; }

/* ---- Folder Row ---- */
.folder-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 13px;
}
.folder-label { color: #999; }
.folder-row input {
  padding: 5px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: #16171c;
  color: #eee;
  font-size: 13px;
  flex: 1;
  max-width: 220px;
  transition: border-color var(--transition);
}
.folder-row input:focus { outline: none; border-color: var(--accent); }

/* ---- Sidebar Footer ---- */
.all-bots-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.all-bots-row .btn {
  flex: 1;
  min-width: 0;
  padding: 9px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(29, 31, 39, 0.7);
  backdrop-filter: blur(8px);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease;
}
.all-bots-row .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.all-bots-row .btn.small { padding: 9px 8px; }

.restart-all-btn {
  margin-bottom: 10px;
  width: 100%;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(29, 31, 39, 0.7);
  backdrop-filter: blur(8px);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease;
}
.restart-all-btn:hover {
  background: rgba(88, 101, 242, 0.12);
  border-color: rgba(88, 101, 242, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(88, 101, 242, 0.15);
}

.all-bots-icon-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  padding: 10px;
  background: rgba(29, 31, 39, 0.5);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
}
.all-bots-icon-row button.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 0 0 auto;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.75);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease;
}
.all-bots-icon-row button.icon-btn:hover {
  background: rgba(88, 101, 242, 0.15);
  border-color: rgba(88, 101, 242, 0.3);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.2);
}
.all-bots-icon-row button.icon-btn .icon-label {
  font-size: 11px;
  white-space: nowrap;
}
.all-bots-icon-row button.icon-btn img.btn-icon {
  width: 15px;
  height: 15px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.all-bots-icon-row button.icon-btn.toggle-on,
.btn.toggle-on {
  background: rgba(88, 101, 242, 0.18);
  border-color: rgba(88, 101, 242, 0.45);
  color: #a0aaff;
  box-shadow: 0 0 0 1px rgba(88, 101, 242, 0.25) inset;
}
.all-bots-icon-row button.icon-btn.toggle-on:hover {
  background: rgba(88, 101, 242, 0.28);
}
.btn.toggle-off {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.75);
}

.server-info {
  font-size: 11px;
  color: #666;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: auto;
  line-height: 1.6;
}

/* ---- Main Area ---- */
.main {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  min-width: 0;
  background: radial-gradient(ellipse 80% 60% at 60% 40%, rgba(88, 101, 242, 0.05) 0%, transparent 70%);
  position: relative;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 120px;
  text-align: center;
  animation: fadeInUp 0.5s ease forwards;
}
.empty-state-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(88, 101, 242, 0.08);
  border: 1px solid rgba(88, 101, 242, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.empty-state-icon svg { color: rgba(88, 101, 242, 0.5); }
.empty-state-text {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.3);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.empty-state-sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.18);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Bot View Header ---- */
/* ---- Bot Hero Panel ---- */
.bot-view {
  padding: 24px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: radial-gradient(ellipse 100% 60% at 50% 0%, rgba(88, 101, 242, 0.04) 0%, transparent 70%);
  min-height: 100%;
}
.bot-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-radius: 18px;
  background: rgba(29, 31, 39, 0.8);
  border: 1px solid rgba(88, 101, 242, 0.15);
  backdrop-filter: blur(12px);
  flex-wrap: wrap;
  animation: slideUp 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
.bot-hero-left { display: flex; align-items: center; gap: 14px; }
.mobile-back-btn { display: none; flex-shrink: 0; }
.bot-hero-info { display: flex; flex-direction: column; gap: 6px; }
.bot-hero-info h2 { margin: 0; font-size: 20px; font-weight: 700; color: #fff; }
.bot-hero-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.hero-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.18s cubic-bezier(0.34,1.56,0.64,1);
  letter-spacing: 0.01em;
}
.hero-btn:hover { transform: translateY(-2px); }
.hero-btn:active { transform: translateY(0) scale(0.97); }
.hero-btn svg { transition: transform 0.18s ease; }
.hero-btn:hover svg { transform: scale(1.1); }

.hero-btn-start {
  background: linear-gradient(135deg, rgba(59,165,93,0.25) 0%, rgba(59,165,93,0.15) 100%);
  border-color: rgba(59,165,93,0.35);
  color: var(--green);
}
.hero-btn-start:hover { background: linear-gradient(135deg, rgba(59,165,93,0.35) 0%, rgba(59,165,93,0.2) 100%); box-shadow: 0 6px 20px rgba(59,165,93,0.25); }

.hero-btn-stop {
  background: linear-gradient(135deg, rgba(239,68,68,0.2) 0%, rgba(239,68,68,0.1) 100%);
  border-color: rgba(239,68,68,0.3);
  color: #f87171;
}
.hero-btn-stop:hover { background: linear-gradient(135deg, rgba(239,68,68,0.3) 0%, rgba(239,68,68,0.15) 100%); box-shadow: 0 6px 20px rgba(239,68,68,0.2); }

.hero-btn-restart {
  background: linear-gradient(135deg, rgba(88,101,242,0.2) 0%, rgba(88,101,242,0.1) 100%);
  border-color: rgba(88,101,242,0.3);
  color: #a0aaff;
}
.hero-btn-restart:hover { background: linear-gradient(135deg, rgba(88,101,242,0.3) 0%, rgba(88,101,242,0.15) 100%); box-shadow: 0 6px 20px rgba(88,101,242,0.2); }

.hero-btn-delete {
  background: linear-gradient(135deg, rgba(239,68,68,0.15) 0%, rgba(239,68,68,0.05) 100%);
  border-color: rgba(239,68,68,0.2);
  color: #888;
}
.hero-btn-delete:hover { background: linear-gradient(135deg, rgba(239,68,68,0.25) 0%, rgba(239,68,68,0.1) 100%); color: #f87171; box-shadow: 0 6px 20px rgba(239,68,68,0.15); }

/* ---- Stats Bar ---- */
.stats-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.stat-card {
  flex: 1;
  min-width: 140px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(29, 31, 39, 0.7);
  border: 1px solid rgba(88, 101, 242, 0.1);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
}
.stat-card:hover { border-color: rgba(88,101,242,0.2); box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
.stat-card-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-health .stat-card-icon { background: rgba(239,68,68,0.15); color: #f87171; }
.stat-food .stat-card-icon { background: rgba(250,166,26,0.15); color: var(--yellow); }
.stat-position .stat-card-icon { background: rgba(88,101,242,0.15); color: var(--accent); }
.stat-card-data { flex: 1; min-width: 0; }
.stat-card-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: #666; font-weight: 600; margin-bottom: 2px; }
.stat-card-value { font-size: 18px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.stat-card-max { font-size: 12px; font-weight: 400; color: #555; }
.stat-card-bar { width: 100%; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.06); margin-top: 6px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 2px; transition: width 0.6s cubic-bezier(0.34,1.56,0.64,1); }
.stat-bar-hp { background: linear-gradient(90deg, #f87171, #ef4444); }
.stat-bar-food { background: linear-gradient(90deg, #fbbf24, #f59e0b); }

/* ---- Toggles Grid ---- */
.toggles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.toggle-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(29, 31, 39, 0.65);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.18s cubic-bezier(0.34,1.56,0.64,1);
  overflow: hidden;
}
.toggle-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: inherit;
}
.toggle-card:hover { border-color: rgba(88,101,242,0.25); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.25); }
.toggle-card:active { transform: translateY(0) scale(0.98); }
.toggle-card.on {
  border-color: rgba(88,101,242,0.3);
  background: rgba(88,101,242,0.08);
}
.toggle-card.on::before { opacity: 1; }
.toggle-card-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: center;
  color: #888;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease;
}
.toggle-card.on .toggle-card-icon { background: rgba(88,101,242,0.2); color: var(--accent); }
.toggle-card-body { flex: 1; min-width: 0; }
.toggle-card-name { font-size: 13px; font-weight: 600; color: #ddd; margin-bottom: 2px; }
.toggle-card-status { font-size: 11px; color: #555; }
.toggle-card.on .toggle-card-status { color: var(--accent); opacity: 0.7; }
.toggle-card-indicator {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.toggle-card.on .toggle-card-indicator { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 8px rgba(88,101,242,0.6); }
.toggle-card-watchdog .running-dot { position: absolute; top: 10px; right: 10px; }

/* AI-drawn PNG icons used as a CSS mask instead of a plain <img> — a plain
   image bakes in one fixed color, which would kill the existing gray→accent
   (toggle-card.on) and gray→per-mode-hover-color (mode-tile) transitions
   that already work by setting `color` on the icon container. Masking reads
   only the PNG's alpha silhouette and paints it with currentColor, so all
   of that existing state-based coloring keeps working untouched. */
.icon-mask {
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}
.toggle-card-icon .icon-mask { width: 18px; height: 18px; }
.mode-tile-icon .icon-mask { width: 20px; height: 20px; }

/* ---- Preset Actions ---- */
.preset-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.preset-actions-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #555; font-weight: 600; white-space: nowrap; }
.preset-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(29, 31, 39, 0.6);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #bbb;
  transition: all 0.18s cubic-bezier(0.34,1.56,0.64,1);
}
.preset-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.preset-btn:active { transform: translateY(0) scale(0.97); }
.preset-btn svg { transition: transform 0.2s ease; }
.preset-btn:hover svg { transform: rotate(-10deg) scale(1.1); }
.preset-btn-fish { border-color: rgba(47,158,143,0.3); color: #5dd9c8; }
.preset-btn-fish:hover { background: rgba(47,158,143,0.12); box-shadow: 0 6px 20px rgba(47,158,143,0.2); }
.preset-btn-exp { border-color: rgba(250,166,26,0.3); color: #fbbf24; }
.preset-btn-exp:hover { background: rgba(250,166,26,0.1); box-shadow: 0 6px 20px rgba(250,166,26,0.15); }
.preset-btn-loot { border-color: rgba(239,68,68,0.25); color: #f87171; }
.preset-btn-loot:hover { background: rgba(239,68,68,0.1); box-shadow: 0 6px 20px rgba(239,68,68,0.15); }

/* ---- Config Row ---- */
.config-row { display: flex; gap: 12px; flex-wrap: wrap; }
.config-card {
  flex: 1;
  min-width: 200px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(29, 31, 39, 0.6);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s ease;
}
.config-card:hover { border-color: rgba(88,101,242,0.15); }
.config-card-header { display: flex; align-items: center; gap: 7px; }
.config-card-icon { color: #555; display: flex; }
.config-card-title { font-size: 12px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.05em; cursor: help; }
/* ---- Custom select (replaces native <select> — the OS/browser dropdown
   popup can't be restyled with CSS alone, so this rebuilds it as a plain
   div-based list matching the rest of the site). The original <select>
   stays in the DOM (moved inside .custom-select, visually hidden) as the
   actual source of truth — app.js keeps reading/writing .value and
   listening for 'change' on it exactly as before, untouched. ---- */
.custom-select { position: relative; }
.custom-select-native {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; pointer-events: none;
}
.custom-select-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 7px 10px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.04);
  color: #eee; font-size: 13px; font-family: inherit; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.custom-select-trigger:hover { border-color: rgba(88,101,242,0.3); }
.custom-select.open .custom-select-trigger { border-color: rgba(88,101,242,0.5); background: rgba(88,101,242,0.06); }
.custom-select-trigger .chev { color: #666; flex-shrink: 0; transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1); }
.custom-select.open .custom-select-trigger .chev { transform: rotate(180deg); color: var(--accent); }
.custom-select-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50;
  background: linear-gradient(160deg, #23252e, #1a1c23);
  border: 1px solid rgba(88, 101, 242, 0.35);
  border-radius: var(--radius); padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(88,101,242,0.06);
  opacity: 0; pointer-events: none; transform: translateY(6px) scale(0.96);
  transform-origin: top center;
  transition: opacity 0.14s cubic-bezier(0.16, 1, 0.3, 1), transform 0.14s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 220px; overflow-y: auto;
}
.custom-select.open .custom-select-list { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.custom-select-option {
  padding: 7px 10px; border-radius: 6px; font-size: 13px; color: #ccc;
  cursor: pointer; transition: background 0.12s ease, color 0.12s ease;
}
.custom-select-option:hover { background: rgba(88,101,242,0.14); color: #fff; }
.custom-select-option.selected { background: rgba(88,101,242,0.22); color: #fff; font-weight: 600; }

.config-card input, .config-card select {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: #eee;
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.config-card input:focus, .config-card select:focus { outline: none; border-color: rgba(88,101,242,0.4); background: rgba(88,101,242,0.05); }
.config-card-hint { font-size: 10px; color: #444; }
/* Exactly 2 rows in every config-card that uses this class: all the fields
   (and the 24/7 toggle, for the schedule card) together on one line via
   .fields-row, then the action button alone on its own line via
   .action-row — camera/home/schedule all end up the same shape instead of
   wrapping to different heights. Buttons stay auto-width (not stretched
   full-width — tried that before, looked worse), just right-aligned. */
.camera-inputs { display: flex; flex-direction: column; gap: 8px; }
.camera-inputs .fields-row { display: flex; gap: 8px; }
.camera-inputs .fields-row > label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 11px; color: #555; white-space: nowrap; }
.camera-inputs .fields-row > label > input { flex: 1; min-width: 0; width: 0; padding: 7px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.04); color: #eee; font-size: 13px; font-family: inherit; }
.camera-inputs .fields-row > label > input:focus { outline: none; border-color: rgba(88,101,242,0.4); }
.camera-inputs .fields-row > button { flex: 0 0 auto; }
/* The schedule row's two time inputs sit inside labels of very different
   text length ("работает с" vs "по") — since each input's width came from
   "whatever's left in its own label" via flex:1, the longer label left less
   room and its input ended up much narrower than the other. Fixed width
   keeps both identical no matter how long the label text is. */
#scheduleWorkStart, #scheduleWorkEnd { flex: 0 0 58px; width: 58px; }
.camera-inputs .action-row { display: flex; justify-content: flex-end; }

/* ---- Mode Section ---- */
.mode-section { margin-bottom: 0; }
.mode-section-title {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mode-status-text { font-size: 11px; text-transform: none; letter-spacing: 0; color: #666; font-family: inherit; }
.mode-status-text.joining   { color: var(--yellow); }
.mode-status-text.attempted { color: var(--green); }
.mode-status-text.failed    { color: var(--red); }
.mode-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.mode-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 96px;
  height: 80px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(29,31,39,0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  color: rgba(255,255,255,0.75);
  font-size: 11px;
  font-family: inherit;
  text-align: center;
  padding: 8px 6px;
  transition:
    background 0.18s,
    border-color 0.18s,
    transform 0.18s cubic-bezier(0.34,1.56,0.64,1),
    box-shadow 0.18s,
    color 0.18s;
}
.mode-tile:hover {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}
.mode-tile:active { transform: translateY(0) scale(0.97); }
.mode-tile.active {
  border-color: rgba(88,101,242,0.7);
  background: rgba(88,101,242,0.12);
  color: rgba(255,255,255,0.95);
  box-shadow: 0 0 0 2px rgba(88,101,242,0.25), 0 6px 20px rgba(0,0,0,0.3);
}
.mode-tile.active .mode-tile-icon { color: #a5b4fc; }
.mode-tile-icon { font-size: 22px; line-height: 1; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.6); transition: color 0.18s; }
.mode-tile-label { font-weight: 600; }
.mode-survival1:hover { background: rgba(124,79,196,0.2); border-color: rgba(124,79,196,0.4); color: rgba(196,165,255,0.95); box-shadow: 0 10px 28px rgba(124,79,196,0.25); }
.mode-survival1:hover .mode-tile-icon { color: #c4a5ff; }
.mode-survival2:hover { background: rgba(88,142,196,0.2); border-color: rgba(88,142,196,0.4); color: rgba(165,196,255,0.95); box-shadow: 0 10px 28px rgba(88,142,196,0.25); }
.mode-survival2:hover .mode-tile-icon { color: #a5c4ff; }
.mode-skyblock:hover { background: rgba(47,158,143,0.2); border-color: rgba(47,158,143,0.4); color: rgba(130,200,190,0.95); box-shadow: 0 10px 28px rgba(47,158,143,0.25); }
.mode-skyblock:hover .mode-tile-icon { color: #82c8be; }
.mode-anarchy:hover { background: rgba(217,114,46,0.2); border-color: rgba(217,114,46,0.4); color: rgba(255,180,120,0.95); box-shadow: 0 10px 28px rgba(217,114,46,0.25); }
.mode-anarchy:hover .mode-tile-icon { color: #ffb478; }
.mode-hub:hover { background: rgba(74,85,104,0.2); border-color: rgba(74,85,104,0.4); color: rgba(160,170,190,0.95); box-shadow: 0 10px 28px rgba(74,85,104,0.25); }
.mode-hub:hover .mode-tile-icon { color: #a0aabe; }

/* ---- Proxy Section ---- */
.proxy-section { margin-bottom: 0; }
.proxy-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  flex-wrap: wrap;
}
.proxy-label { color: #999; }
.proxy-status { color: #ccc; font-family: Consolas, monospace; font-size: 12px; }
.proxy-status.active { color: var(--green); }
.proxy-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.vps-ip-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  color: #999;
  flex-wrap: wrap;
}
.vps-ip-line #vpsIpValue { color: #ccc; font-family: Consolas, monospace; }
.proxy-fields input {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: #eee;
  font-size: 13px;
  width: 130px;
  font-family: inherit;
  transition: border-color 0.15s ease;
}
.proxy-fields input:focus { outline: none; border-color: rgba(88,101,242,0.4); }
.modal-proxy-row { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-proxy-row input { flex: 1; min-width: 0; padding: 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.04); color: #eee; font-size: 13px; font-family: inherit; }
.modal-proxy-row input:focus { outline: none; border-color: rgba(88,101,242,0.4); }

/* ---- Hotbar ---- */
.hotbar {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
  margin-bottom: 0;
  max-width: 480px;
}
.hotbar-slot {
  aspect-ratio: 1;
  background: var(--surface-2);
  border: 2px solid var(--border-2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 9px;
  text-align: center;
  padding: 2px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition), transform 0.08s ease, box-shadow var(--transition);
}
.hotbar-slot:hover { transform: translateY(-4px); border-color: rgba(88,101,242,0.4); box-shadow: 0 6px 16px rgba(0,0,0,0.3); }
.hotbar-slot:active { transform: translateY(0); }
.hotbar-slot.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(88,101,242,0.25); }
.hotbar-slot.chosen { border-color: var(--yellow); box-shadow: 0 0 0 2px rgba(250,166,26,0.25); }
.hotbar-slot.busy { cursor: wait; opacity: 0.5; pointer-events: none; }
.hotbar-slot .count {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 11px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 1px 3px #000;
}

/* ---- Inventory ---- */
.hotbar-section { display: flex; flex-direction: column; gap: 8px; }
.hotbar-label { display: flex; align-items: center; gap: 7px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #555; font-weight: 600; }
.inventory-section { display: flex; flex-direction: column; gap: 8px; }
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
  max-width: 480px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(29, 31, 39, 0.7);
  border: 1px solid rgba(88,101,242,0.1);
}
.hotbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(29,31,39,0.8);
  border: 1px solid rgba(88,101,242,0.15);
  font-size: 13px;
}
.hotbar-actions-label { color: #ccc; flex: 1; }

/* ---- Chat Box ---- */
.chat-box {
  margin-bottom: 0;
}
.chat-box:focus-within { border-color: rgba(88,101,242,0.4); }
.chat-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.chat-box-title { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }

/* ---- System / Watchdog / Broadcast modal grid ---- */
.system-modal   { width: min(440px, 94vw); }
.add-bot-modal  { width: min(500px, 94vw); }
/* The one modal in the page carries BOTH classes (it's the AI-assistant
   modal, which also embeds the watchdog settings grid) — assistant-modal's
   narrower width used to win the cascade and squeezed the whole thing
   (wd-grid's 16 fields, the ИИ-присмотр toggle button) into 580px instead
   of the 780px the watchdog grid actually needs. Only watchdog-modal sets
   width now. */
.watchdog-modal { width: min(780px, 96vw); }
.broadcast-modal { width: min(640px, 96vw); max-height: 88vh; overflow-y: auto; }

.system-body { display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.sys-row { display: flex; flex-direction: column; gap: 4px; }
.sys-row-label { display: flex; justify-content: space-between; color: #ccc; }
.sys-row-label .val { color: #fff; font-weight: 600; }

.wd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin-top: 4px;
}
.wd-grid-1col { grid-template-columns: 1fr; }
.wd-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 0;
  font-size: 12px;
  color: #aaa;
}
.wd-grid input[type=number],
.wd-grid input[type=text],
.wd-grid input[type=password] {
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: #16171c;
  color: #eee;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color var(--transition);
}
.wd-grid input:focus { outline: none; border-color: var(--accent); }

/* Every setting in the watchdog/assistant modal now lives inside a titled
   box (wd-group) — general options, wait-before-fixing timers, retry
   behavior, and the two coordinate triplets — instead of one big loose
   wd-grid where unrelated fields (or, worse, two different coordinate
   points) sat right next to each other with no group context. */
.wd-group {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}
.wd-group-title {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  cursor: help;
}
.wd-group .wd-grid { margin-top: 0; }
.wd-coord-row { display: flex; gap: 8px; }
.wd-coord-row label {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #aaa;
}
.wd-coord-row input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: #16171c;
  color: #eee;
  font-size: 13px;
  transition: border-color var(--transition);
}
.wd-coord-row input:focus { outline: none; border-color: var(--accent); }

.wd-telegram-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.wd-section-title {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 16px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.wd-folder-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.wd-folder-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.wd-folder-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wd-folder-row select {
  padding: 4px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: #16171c;
  color: #eee;
  font-size: 12px;
  transition: border-color var(--transition);
}
.wd-history {
  max-height: 200px;
  overflow-y: auto;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.wd-history-item { padding: 7px 10px; border-radius: var(--radius); background: #16171c; }
.wd-history-item .wd-ts { color: #555; margin-right: 6px; }
.wd-history-item.fix_attempt { border-left: 3px solid var(--yellow); }
.wd-history-item.alert_sent   { border-left: 3px solid var(--red); }
.wd-history-item.resolved     { border-left: 3px solid var(--green); }
.wd-empty { color: #555; font-size: 12px; }

/* ---- Broadcast Campaigns ---- */
.broadcast-campaigns { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.broadcast-campaign {
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 14px;
  background: #1b1c22;
  transition: border-color var(--transition);
}
.broadcast-campaign:hover { border-color: rgba(88,101,242,0.4); }
.broadcast-campaign-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.broadcast-campaign-title {
  font-weight: 600;
  font-size: 13px;
  color: #ddd;
  display: flex;
  align-items: center;
  gap: 6px;
}
.broadcast-campaign-title .running-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 1.4s ease-in-out infinite;
}
.running-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 1.4s ease-in-out infinite;
}
.broadcast-bot-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.broadcast-bot-list .btn { padding: 5px 10px; font-size: 12px; }
.broadcast-textarea {
  width: 100%;
  min-height: 64px;
  margin-top: 4px;
  padding: 8px;
  box-sizing: border-box;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: #16171c;
  color: #eee;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  transition: border-color var(--transition);
}
.broadcast-textarea:focus { outline: none; border-color: var(--accent); }
.broadcast-per-bot { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.broadcast-per-bot-row { display: flex; align-items: center; gap: 8px; }
.broadcast-per-bot-row span { flex: 0 0 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: #ccc; }
.broadcast-per-bot-row input {
  flex: 1;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: #16171c;
  color: #eee;
  font-size: 13px;
  transition: border-color var(--transition);
}
.broadcast-per-bot-row input:focus { outline: none; border-color: var(--accent); }
.broadcast-campaign .modal-actions { margin-top: 8px; }
.broadcast-log { max-height: 120px; overflow-y: auto; margin-top: 6px; font-size: 12px; color: #888; }
.asst-telegram-hint { font-size: 12px; color: #888; margin-top: 4px; line-height: 1.5; }

/* ---- System Bars ---- */
.sys-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.sys-bar-fill { height: 100%; background: var(--green); transition: width 0.4s ease; border-radius: 3px; }
.sys-bar-fill.warn { background: var(--yellow); }
.sys-bar-fill.crit { background: var(--red); }
.sys-meta { font-size: 12px; color: #777; line-height: 1.6; }

/* ---- Chat Box ---- */
.chat-box {
  display: flex;
  flex-direction: column;
  height: 55vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}
.chat-box:focus-within { border-color: rgba(88,101,242,0.4); }
.chat-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.chat-box-title { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.06em; }
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  font-size: 13px;
  font-family: Consolas, 'Courier New', monospace;
  background: #13141a;
  line-height: 1.6;
}
.chat-disabled-notice {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #444;
  font-size: 13px;
  background: #13141a;
}
.chat-line { margin-bottom: 3px; white-space: pre-wrap; word-break: break-word; }
.chat-line.system { color: #666; font-style: italic; }
.chat-line .ts { color: #3a3c45; margin-right: 6px; }

.chat-form { display: flex; border-top: 1px solid var(--border); }
.chat-form input {
  flex: 1;
  border: none;
  background: var(--surface);
  color: #eee;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  transition: background var(--transition);
}
.chat-form input:focus { outline: none; background: var(--surface-2); }
.chat-form .btn { border-radius: 0; }

/* ---- Buttons ---- */
.btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition), transform 0.08s ease, box-shadow var(--transition), opacity var(--transition);
  position: relative;
  overflow: hidden;
}
.btn:hover { background: var(--accent-h); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(88,101,242,0.35); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #c53033; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(237,66,69,0.35); }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border-2);
  color: #aaa;
}
.btn.ghost:hover { background: var(--surface-2); color: var(--text); border-color: #555; transform: translateY(-1px); }
.btn.ghost.active,
.btn.ghost.btn-toggle-active { background: rgba(88,101,242,0.15); border-color: rgba(88,101,242,0.4); color: #a0aaff; }
.btn.ghost.active:hover,
.btn.ghost.btn-toggle-active:hover { background: rgba(88,101,242,0.25); }

/* Icon buttons in sidebar */
/* Fallback sizing for .btn-icon <img> icons used outside the scoped
   .all-bots-icon-row / .folder-action-btn contexts (e.g. plain text+icon
   buttons like wdEnabledToggle, toggle-card icons). */
img.btn-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  vertical-align: middle;
  pointer-events: none;
}
.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: #888;
  border-radius: var(--radius);
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform 0.08s ease, box-shadow var(--transition);
  flex: 0 0 auto;
}
.icon-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(88,101,242,0.2);
}
.icon-btn:active { transform: translateY(0); }
.icon-btn.running {
  border-color: var(--green);
  color: var(--green);
  animation: running-pulse 2s ease-in-out infinite;
}
@keyframes running-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59,165,93,0.3); }
  50% { box-shadow: 0 0 0 4px rgba(59,165,93,0.1); }
}

/* ---- Spinner (for loading states) ---- */
.btn .spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Modal Overlay ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---- Modal ---- */
.modal {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius-lg);
  width: min(var(--modal-w), 94vw);
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
  animation: slideUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(88,101,242,0.12);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal h3 {
  margin: 0 0 4px 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal h3 svg { color: var(--accent); }
.modal label {
  font-size: 12px;
  color: #999;
  margin-top: 6px;
  display: block;
}
.modal input[type=text],
.modal input[type=password],
.modal select {
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: #16171c;
  color: #eee;
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  transition: border-color var(--transition);
}
.modal input:focus,
.modal select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,101,242,0.12);
}
.permissions-modal { width: min(480px, 96vw); }
.permissions-users-list { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.permissions-user-block {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.permissions-user-name { font-size: 13px; font-weight: 600; color: #ddd; }
.permissions-save-btn { align-self: flex-end; }
.checkbox-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-row input[type=checkbox] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.error-text { color: var(--red); font-size: 12px; min-height: 16px; }

/* ---- Modal Header ---- */
.modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.modal-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(88,101,242,0.12);
  border: 1px solid rgba(88,101,242,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}
.modal-header-text h3 {
  margin: 0 0 2px 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.modal-header-text p {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
}
.modal-body { display: flex; flex-direction: column; gap: 10px; }
.modal-section { display: flex; flex-direction: column; gap: 8px; }
.modal-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.modal-field { display: flex; flex-direction: column; gap: 4px; }
.modal-field label {
  font-size: 12px;
  color: #999;
  margin: 0;
}
.modal-field input,
.modal-field select {
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: #16171c;
  color: #eee;
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--transition);
}
.modal-field input:focus,
.modal-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,101,242,0.12);
}
.field-hint { color: #555; font-weight: 400; }
.modal-proxy-presets { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Custom Tooltip ---- */
.custom-tooltip {
  position: fixed;
  z-index: 2000;
  max-width: 260px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, #23252e, #1a1c23);
  color: #f0f0f5;
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid rgba(88, 101, 242, 0.4);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(88,101,242,0.06), 0 0 16px rgba(88,101,242,0.1);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) scale(0.94);
  transition: opacity 0.14s cubic-bezier(0.16, 1, 0.3, 1), transform 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}
.custom-tooltip.measuring { opacity: 0 !important; transform: none !important; transition: none !important; }
.custom-tooltip.visible { opacity: 1; transform: translateY(0) scale(1); }
.custom-tooltip::before {
  content: '';
  position: absolute;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: #1e2029;
  border: 1px solid rgba(88,101,242,0.4);
  transform: rotate(45deg);
}
.custom-tooltip.pos-top::before { bottom: -5px; border-top: none; border-left: none; }
.custom-tooltip.pos-bottom::before { top: -5px; border-bottom: none; border-right: none; }

/* ---- Mobile ---- */
@media (max-width: 860px) {
  .app { flex-direction: column; height: auto; min-height: 100vh; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); box-sizing: border-box; }
  .bot-list { max-height: 40vh; }
  .main { overflow-y: visible; padding: 14px; }
  .mobile-back-btn { display: inline-flex; }

  body.bot-selected .sidebar { display: none; }
  body:not(.bot-selected) .main { display: none; }

  .mode-tile { width: 30vw; max-width: 110px; }
  .chat-box { height: 45vh; }
  .wd-grid { grid-template-columns: 1fr 1fr; }
  .broadcast-modal, .assistant-modal { max-height: 95vh; }

  .btn { padding: 10px 14px; }
  .btn.small { padding: 8px 12px; font-size: 13px; }

  .toggles-grid { grid-template-columns: 1fr 1fr; }
  .bot-hero { flex-direction: column; align-items: flex-start; }
  .bot-hero-actions { width: 100%; }
  .hero-btn { flex: 1; justify-content: center; }
  .config-row { flex-direction: column; }
  .stats-bar { flex-direction: column; }

  .all-bots-row { flex-direction: column; }

  .sidebar { padding: 12px; }
  .sidebar-header { margin-bottom: 8px; }
  .all-bots-icon-row { gap: 4px; }
  .icon-btn { width: 32px; height: 32px; font-size: 11px; }
}

@media (max-width: 480px) {
  .wd-grid { grid-template-columns: 1fr; }
  .modal { padding: 16px; }
}

/* ================================================
   LOGIN SCREEN
   ================================================ */

.login-screen {
  position: fixed;
  inset: 0;
  background: #0d0e12;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  overflow: hidden;
}

#loginParticles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.login-bg-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s ease;
  z-index: 0;
  pointer-events: none;
}

.login-bg-image.loaded { opacity: 0.28; }

.login-bg-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(13, 14, 18, 0.75) 0%,
    rgba(13, 14, 18, 0.85) 50%,
    rgba(13, 14, 18, 0.72) 100%
  );
  z-index: 1;
  pointer-events: none;
}

.login-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(88, 101, 242, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 101, 242, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: gridScroll 20s linear infinite;
}

@keyframes gridScroll {
  0% { background-position: 0 0; }
  100% { background-position: 48px 48px; }
}

.login-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, #5865f2 0%, transparent 70%);
  animation: glowPulse 4s ease-in-out infinite alternate;
}

@keyframes glowPulse {
  0% { opacity: 0.08; transform: translate(-50%, -50%) scale(0.95); }
  100% { opacity: 0.15; transform: translate(-50%, -50%) scale(1.05); }
}

.login-card {
  position: relative;
  background: rgba(29, 31, 39, 0.92);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(88, 101, 242, 0.3);
  border-radius: 20px;
  padding: 48px 44px 44px;
  width: 400px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 32px 96px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(88, 101, 242, 0.12), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 0.05s;
  z-index: 10;
}

.login-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 36px;
}

.login-logo-wrap {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.35) 0%, rgba(71, 82, 196, 0.35) 100%);
  border: 1px solid rgba(88, 101, 242, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 12px 40px rgba(88, 101, 242, 0.35), 0 0 0 6px rgba(88, 101, 242, 0.08);
  animation: float 3s ease-in-out infinite;
  overflow: hidden;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.login-logo-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  pointer-events: none;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-3);
  margin: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.login-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.login-field input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}

.login-field input::placeholder {
  color: var(--text-3);
}

.login-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.15);
}

.login-field input.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(237, 66, 69, 0.12);
}

/* Chrome/Edge force a light background on autofilled fields (saved login/
   password) that plain CSS can't override directly — this is the standard
   workaround: paint the field's own background in via an absurdly long
   inset box-shadow transition instead of the background property. */
.login-field input:-webkit-autofill,
.login-field input:-webkit-autofill:hover,
.login-field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  box-shadow: 0 0 0 1000px var(--bg) inset;
  transition: background-color 5000s ease-in-out 0s;
  caret-color: var(--text);
}

.login-error {
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(237, 66, 69, 0.1);
  border: 1px solid rgba(237, 66, 69, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #f07178;
  animation: shake 0.4s ease;
}

.login-error.visible {
  display: flex;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.login-error svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.login-btn {
  width: 100%;
  padding: 13px;
  margin-top: 6px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(88, 101, 242, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.2px;
}

.login-btn:hover:not(:disabled) {
  background: var(--accent-h);
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(88, 101, 242, 0.5);
}

.login-btn:active:not(:disabled) {
  transform: translateY(0);
}

.login-skip-btn {
  width: 100%;
  padding: 11px;
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.login-skip-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.04);
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-btn .btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.login-btn-text { display: inline; }
.login-btn-loading .login-btn-text { display: none; }
.login-btn-loading .login-btn-spinner-wrap { display: inline-flex; align-items: center; gap: 8px; }
.login-btn-spinner-wrap { display: none; }

.login-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.3px;
}
