* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Roboto", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
}

:root {
  --accent-1: #9ecbf2;
  --accent-2: #73aedd;
  --accent-3: #5b8ed0;
  --accent-4: #3f6dc0;
  --accent-solid: linear-gradient(160deg, #9ecbf2 0%, #73aedd 30%, #5b8ed0 65%, #3f6dc0 100%);
  --bg-0: #0a0e13;
  --bg-1: #0d1017;
  --bg-2: #10141c;
  --card-1: #171d29;
  --card-2: #131720;
  --border-soft: rgba(255, 255, 255, 0.08);
  --text-main: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.55);
  --text-faint: rgba(255, 255, 255, 0.35);
  --green: #22c55e;
  --green-soft: #4ade80;
  --red: #ef4444;
  --red-soft: #f87171;
  --sidebar-w: 220px;
}

html, body {
  height: 100%;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #182236 0%, #0d1017 55%, #070911 100%);
  color: var(--text-main);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ───────────── App shell ───────────── */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #10141c 0%, #0b0e14 100%);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 26px;
}

.sidebar-brand .avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--accent-solid);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(63, 109, 192, 0.45);
  flex-shrink: 0;
}

.sidebar-brand .brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.sidebar-brand .brand-sub {
  font-size: 10.5px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(160deg, rgba(158, 203, 242, 0.18), rgba(63, 109, 192, 0.22));
  color: #ffffff;
  box-shadow: none;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--card-2);
  border: none;
  font-size: 12px;
}

.sidebar-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: #2a2f38;
  flex-shrink: 0;
}

.logout-btn {
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  border: none;
  background: rgba(239, 68, 68, 0.12);
  color: var(--red-soft);
  font-size: 12.5px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 30px 36px 60px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 26px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
}

.page-subtitle {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  border: none;
  background: var(--accent-solid);
  color: #0a0e13;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(63, 109, 192, 0.35);
  transition: transform 0.15s ease;
}

.pill-btn:active { transform: scale(0.97); }

.pill-btn.ghost {
  background: var(--card-2);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
  box-shadow: none;
}

/* ───────────── Cards / generic ───────────── */

.card {
  background: linear-gradient(160deg, #1a2130, #10141c);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 22px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.badge.running { background: rgba(34, 197, 94, 0.14); color: var(--green-soft); }
.badge.stopped { background: rgba(255, 255, 255, 0.08); color: var(--text-dim); }
.badge.error { background: rgba(239, 68, 68, 0.14); color: var(--red-soft); }

/* ───────────── Toasts ───────────── */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 320px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  border-radius: 14px;
  background: linear-gradient(160deg, #1a2130, #10141c);
  border: 1px solid var(--border-soft);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45);
  transform: translateX(24px);
  opacity: 0;
  animation: toastIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.toast.leaving { animation: toastOut 0.25s ease forwards; }

@keyframes toastIn { to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { to { transform: translateX(24px); opacity: 0; } }

.toast-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.toast-icon svg { width: 13px; height: 13px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.toast.success .toast-icon { background: linear-gradient(150deg, #86efac, #22c55e 60%, #15803d); }
.toast.error .toast-icon { background: linear-gradient(150deg, #fca5a5, #ef4444 60%, #b91c1c); }
.toast.info .toast-icon { background: var(--accent-solid); }

.toast-text { font-size: 12.5px; line-height: 1.4; flex: 1; }

/* ───────────── Login page ───────────── */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(160deg, #1a2130, #10141c);
  border: 1px solid var(--border-soft);
  border-radius: 26px;
  padding: 34px 30px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
}

.login-avatar {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--accent-solid);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  box-shadow: 0 12px 28px rgba(63, 109, 192, 0.4);
}

.login-title {
  text-align: center;
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-subtitle {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 26px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  margin-bottom: 7px;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 13px;
  border: 1px solid var(--border-soft);
  background: var(--card-2);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.field input:focus {
  border-color: var(--accent-2);
  background: #151b26;
}

.login-error {
  display: none;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red-soft);
  font-size: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 14px;
}

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

.login-submit {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: var(--accent-solid);
  color: #0a0e13;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 12px 26px rgba(63, 109, 192, 0.4);
  margin-top: 4px;
}

.login-submit:active { transform: scale(0.98); }

.login-hint {
  text-align: center;
  margin-top: 18px;
  font-size: 11px;
  color: var(--text-faint);
}

/* ───────────── Upload page ───────────── */

.dropzone {
  border: 1.5px dashed rgba(158, 203, 242, 0.35);
  border-radius: 20px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  background: rgba(158, 203, 242, 0.03);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-2);
  background: rgba(158, 203, 242, 0.07);
}

.dropzone .dz-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: var(--accent-solid);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 26px rgba(63, 109, 192, 0.35);
}

.dropzone .dz-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.dropzone .dz-sub { font-size: 12px; color: var(--text-dim); }

.file-list {
  margin-top: 16px;
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-dim);
  background: var(--card-2);
  border-radius: 8px;
  padding: 6px 10px;
}

.upload-form .field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ───────────── Bots page ───────────── */

.bot-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: linear-gradient(160deg, #1a2130, #10141c);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 20px;
}

.bot-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bot-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent-solid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #0a0e13;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(63, 109, 192, 0.35);
}

.bot-logo img { width: 100%; height: 100%; object-fit: cover; }

.bot-name-wrap { flex: 1; min-width: 0; }
.bot-name { font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-desc { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bot-meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 10.5px;
  color: var(--text-faint);
}

.bot-meta-row span {
  background: var(--card-2);
  padding: 4px 8px;
  border-radius: 8px;
}

.bot-installing-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-1);
  background: rgba(158, 203, 242, 0.1);
  padding: 7px 10px;
  border-radius: 10px;
}

.bot-installing-hint svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  animation: installPulse 1.4s ease-in-out infinite;
}

@keyframes installPulse {
  0%, 100% { opacity: 0.5; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

.bot-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.bot-action-btn {
  padding: 9px 8px;
  border-radius: 11px;
  border: none;
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.bot-action-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.bot-action-btn.start { color: var(--green-soft); background: rgba(34, 197, 94, 0.14); }
.bot-action-btn.start:hover:not(:disabled) { background: rgba(34, 197, 94, 0.24); }

.bot-action-btn.stop { color: var(--red-soft); background: rgba(239, 68, 68, 0.14); }
.bot-action-btn.stop:hover:not(:disabled) { background: rgba(239, 68, 68, 0.24); }

.bot-action-btn.restart { color: var(--accent-1); background: rgba(158, 203, 242, 0.14); }
.bot-action-btn.restart:hover:not(:disabled) { background: rgba(158, 203, 242, 0.24); }

.bot-action-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.bot-secondary-row {
  display: flex;
  gap: 6px;
}

.bot-secondary-row button {
  flex: 1;
  padding: 6px 4px;
  border-radius: 9px;
  border: none;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.bot-secondary-row button svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.bot-secondary-row button[data-action="logo"] { color: var(--accent-1); background: rgba(158, 203, 242, 0.1); }
.bot-secondary-row button[data-action="logo"]:hover { background: rgba(158, 203, 242, 0.2); }

.bot-secondary-row button[data-action="logs"] { color: #a78bfa; background: rgba(167, 139, 250, 0.12); }
.bot-secondary-row button[data-action="logs"]:hover { background: rgba(167, 139, 250, 0.22); }

.bot-secondary-row button[data-action="delete"] { color: var(--red-soft); background: rgba(239, 68, 68, 0.1); }
.bot-secondary-row button[data-action="delete"]:hover { background: rgba(239, 68, 68, 0.2); }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-state .dz-icon { margin: 0 auto 16px; }

/* Logs console */

.console {
  background: #0a0d13;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 14px 16px;
  font-family: "Roboto Mono", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.7;
  height: 320px;
  overflow-y: auto;
}

.console-line { white-space: pre-wrap; word-break: break-word; }
.console-line .ts { color: var(--text-faint); margin-right: 8px; }
.console-line.stderr { color: var(--red-soft); }
.console-line.stdout { color: #cfe6ff; }
.console-line.meta { color: var(--accent-1); font-weight: 600; }

.select-input {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: var(--card-2);
  color: var(--text-main);
  font-size: 12.5px;
}

/* ───────────── Status page ───────────── */

.status-feed { display: flex; flex-direction: column; gap: 10px; }

.status-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--card-2);
  border: 1px solid var(--border-soft);
}

.status-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.status-icon svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.status-row.success .status-icon { background: linear-gradient(150deg, #86efac, #22c55e 60%, #15803d); }
.status-row.error .status-icon { background: linear-gradient(150deg, #fca5a5, #ef4444 60%, #b91c1c); }
.status-row.info .status-icon { background: var(--accent-solid); }

.status-body { flex: 1; min-width: 0; }
.status-title { font-size: 12.5px; font-weight: 700; }
.status-msg { font-size: 12px; color: var(--text-dim); margin-top: 2px; word-break: break-word; }
.status-time { font-size: 10.5px; color: var(--text-faint); margin-top: 4px; }

.stat-strip {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}

.stat-box {
  flex: 1;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--card-2);
  border: 1px solid var(--border-soft);
}

.stat-box .num { font-size: 22px; font-weight: 700; }
.stat-box .lbl { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.stat-box.online .num { color: var(--green-soft); }
.stat-box.offline .num { color: var(--red-soft); }

/* Responsive */

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; padding: 14px 16px; }
  .sidebar-brand { padding: 0; margin-right: 14px; }
  .nav-group { flex-direction: row; margin-top: 0; overflow-x: auto; }
  .sidebar-footer { display: none; }
  .main { padding: 22px 18px 50px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .upload-form .field-row { grid-template-columns: 1fr; }
}
