:root {
  color-scheme: dark;
  --bg: #09090f;
  --panel: #12121d;
  --border: #26263a;
  --text: #f1f0ff;
  --muted: #9695ad;
  --accent: #9b72ff;
  --green: #4ade80;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #1b1530, var(--bg) 48%);
  color: var(--text);
  font-family: system-ui, sans-serif;
}
.container {
  width: min(1100px, 100%);
  margin: auto;
  padding: 32px 22px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #a78bfa, #6d28d9);
  font-size: 23px;
  font-weight: 800;
}
h1 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.7px;
}
.subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.status {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #12121dcc;
  color: var(--muted);
  font-size: 13px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px #4ade8070;
}

.welcome {
  margin-bottom: 26px;
}
.welcome h2 {
  margin: 0 0 8px;
  font-size: clamp(25px, 5vw, 34px);
  letter-spacing: -1px;
}
.welcome p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}
.card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(145deg, #171725, #101019);
  box-shadow: 0 12px 35px #00000018;
}
.card-label {
  color: var(--muted);
  font-size: 13px;
}
.card-value {
  margin-top: 12px;
  font-size: 29px;
  font-weight: 700;
  letter-spacing: -0.7px;
}
.card-note {
  margin-top: 7px;
  color: var(--accent);
  font-size: 12px;
}

.section-title {
  margin: 36px 0 16px;
  font-size: 18px;
}
.bot-placeholder {
  padding: 28px 22px;
  border: 1px dashed #39334f;
  border-radius: 18px;
  background: #12121d80;
  text-align: center;
}
.bot-placeholder p {
  color: var(--muted);
  line-height: 1.6;
}
footer {
  margin-top: 40px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
@media (max-width: 520px) {
  .container {
    padding: 22px 16px;
  }
  header {
    margin-bottom: 28px;
  }
  .card {
    padding: 19px;
  }
}

  .bot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 16px;
    margin-bottom: 32px;
  }
  .bot-card {
    min-width: 0;
    padding: 20px;
    background: rgba(19, 20, 34, 0.9);
    border: 1px solid rgba(155, 114, 255, 0.18);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  }

  .bot-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
  }

  .bot-card h3 {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 1rem;
  }

  .bot-nickname {
    margin: 5px 0 0;
    color: #9898ad;
    font-size: 0.85rem;
    overflow-wrap: anywhere;
  }
    .bot-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    font-size: 0.78rem;
    color: #b8b8ca;
  }

  .bot-status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #777789;
  }

  .bot-status.is-connected::before {
    background: #43d9a3;
    box-shadow: 0 0 10px rgba(67, 217, 163, 0.35);
  }

  .bot-status.is-disconnected::before {
    background: #ff6b81;
  }
  .bot-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

  .bot-detail {
    padding: 12px;
    background: rgba(255, 255, 255, 0.025);
    border-radius: 10px;
  }

  .bot-detail-label {
    display: block;
    margin-bottom: 6px;
    color: #9898ad;
    font-size: 0.76rem;
  }

  .bot-detail-value {
    font-size: 0.92rem;
    font-weight: 600;
    overflow-wrap: anywhere;
  }

  .bot-placeholder {
    grid-column: 1 / -1;
  }

  .bot-error {
    color: #ff9aa9;
  }


@media (max-width: 520px) {
  .bot-grid {
    grid-template-columns: 1fr;
  }

  .bot-card {
    padding: 16px;
  }
}

/* Bot avatars */
.bot-avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(155, 114, 255, 0.65);
  background: #131422;
}


/* Main tab navigation */
.main-tabs {
  display: flex;
  gap: 10px;
  margin: 24px 0;
  padding: 6px;
  border: 1px solid rgba(155, 114, 255, 0.2);
  border-radius: 14px;
  background: #11121f;
}

.tab-button {
  flex: 1;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #aaa9bf;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.tab-button:hover {
  color: #ffffff;
  background: rgba(155, 114, 255, 0.1);
}

.tab-button.active {
  color: #ffffff;
  background: #7651cc;
  box-shadow: 0 4px 14px rgba(118, 81, 204, 0.25);
}

.tab-button:focus-visible {
  outline: 2px solid #b69aff;
  outline-offset: 3px;
}

.tab-panel[hidden] {
  display: none !important;
}

.bot-detail-value.is-farming {
  color: #43d9a3;
  font-weight: 600;
}

.bot-detail-value.is-idle {
  color: #b8b8ca;
}

/* Bot search and filter controls */
.bot-search,
.bot-filter {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 240px;
  min-width: 0;
  margin-bottom: 18px;
}

.bot-search label,
.bot-filter label {
  color: #b8b8ca;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.bot-search input,
.bot-filter select {
  box-sizing: border-box;
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  color: #f4f1ff;
  background: #131422;
  border: 1px solid rgba(155, 114, 255, 0.3);
  border-radius: 12px;
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease,
              background 0.2s ease;
}

.bot-search input::placeholder {
  color: #777789;
}

.bot-search input:hover,
.bot-filter select:hover {
  border-color: rgba(155, 114, 255, 0.6);
}

.bot-search input:focus,
.bot-filter select:focus {
  border-color: #9b72ff;
  box-shadow: 0 0 0 3px rgba(155, 114, 255, 0.16);
  background: #18182b;
}

.bot-filter select {
  cursor: pointer;
}

.bot-filter select option {
  color: #f4f1ff;
  background: #131422;
}

/* Master account highlight */
#master-bot-container {
  max-width: 620px;
  margin-bottom: 28px;
}

.master-bot-card {
  border: 1px solid rgba(155, 114, 255, 0.65);
  background: linear-gradient(
    135deg,
    rgba(42, 31, 72, 0.95),
    rgba(19, 20, 34, 0.98)
  );
  box-shadow: 0 8px 28px rgba(95, 60, 180, 0.16);
}

.master-bot-label {
  margin: 0 0 16px;
  color: #b99aff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.master-bot-farming {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid rgba(155, 114, 255, 0.2);
  font-size: 0.9rem;
  font-weight: 600;
}

.master-bot-farming.is-farming {
  color: #43d9a3;
}

.master-bot-farming.is-idle {
  color: #b8b8ca;
}
/* License and trade actions */
.license-actions { margin-bottom: 20px; }
.action-button, .license-dialog-actions button {
  padding: 10px 16px;
  border: 1px solid #7355aa;
  border-radius: 8px;
  background: #342653;
  color: #f4efff;
  font: inherit;
  cursor: pointer;
}
.action-button:hover, .license-dialog-actions button:hover { background: #453269; }
.action-button:disabled { opacity: .6; cursor: wait; }
#license-dialog {
  width: min(420px, calc(100% - 32px));
  padding: 24px;
  border: 1px solid #7355aa;
  border-radius: 14px;
  background: #191927;
  color: #f2f0fa;
}
#license-dialog::backdrop { background: rgba(5,5,12,.72); }
#license-form { display: flex; flex-direction: column; gap: 12px; }
#license-form h3 { margin: 0 0 8px; }
#license-form input, #license-form select {
  box-sizing: border-box;
  width: 100%;
  padding: 10px;
  border: 1px solid #414057;
  border-radius: 8px;
  background: #131322;
  color: #f2f0fa;
}
.license-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
#license-message, .trade-cards-message { color: #bdb5d8; font-size: .85rem; }
.trade-cards-button { margin-top: 16px; }

/* Activity tab */
#activity-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(155, 114, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}
.activity-item span {
  color: #f2f0fa;
  font-weight: 500;
}
.activity-item time {
  flex-shrink: 0;
  color: #aaa4c2;
  font-size: 0.85rem;
}
.activity-empty {
  padding: 18px;
  color: #aaa4c2;
  text-align: center;
}
@media (max-width: 560px) {
  .activity-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

[hidden] { display: none !important; }
#login-panel{min-height:100vh;display:flex;align-items:center;justify-content:center}
#login-panel .welcome{width:min(420px,100%);margin:0;padding:34px;border:1px solid var(--border);border-radius:22px;background:linear-gradient(145deg,#171725f5,#101019f5);box-shadow:0 24px 70px #00000055}
#login-panel h1{margin-bottom:10px;font-size:28px;letter-spacing:-.8px}
#login-panel .welcome p{margin-bottom:24px;color:var(--muted)}
#login-form{display:grid;gap:10px}
#login-form label{margin-top:8px;color:#d8d5ed;font-size:13px;font-weight:600}
#login-form input{width:100%;min-height:44px;padding:11px 13px;border:1px solid var(--border);border-radius:10px;background:#0b0b13;color:var(--text);font:inherit}
#login-form input:focus{border-color:var(--accent);outline:2px solid #9b72ff35}
#login-form button{min-height:44px;margin-top:14px;border:0;border-radius:10px;background:linear-gradient(135deg,#a78bfa,#7c3aed);color:white;font:inherit;font-weight:700;cursor:pointer}
#login-form #login-message{min-height:20px;margin:6px 0 0;color:#fca5a5;font-size:13px;overflow-wrap:anywhere}#logout-button{padding:10px 16px;border:1px solid #39334f;border-radius:10px;background:linear-gradient(135deg,#211a35,#171725);color:#e5ddff;font:inherit;font-size:13px;font-weight:600;cursor:pointer;transition:all .2s;box-shadow:0 4px 12px #0003}
#logout-button:hover{border-color:#9b72ff;background:#30234b;color:#fff;transform:translateY(-1px)}
#logout-button:active{transform:translateY(0)}

/* Clickable bot cards */
.bot-card-clickable {
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.bot-card-clickable:hover {
  transform: translateY(-3px);
  border-color: rgba(155, 114, 255, 0.65);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

.bot-card-clickable:focus-visible {
  outline: 2px solid #9b72ff;
  outline-offset: 3px;
}

/* Flexible trade action buttons */
.trade-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
  margin-top: 16px;
  margin-bottom: 12px;
}

.trade-actions .trade-cards-button {
  flex: 1 1 150px;
  min-width: 0;
  min-height: 44px;
  padding: 11px 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, #493477, #30234e);
  border: 1px solid #8062bd;
  box-shadow: 0 4px 12px #00000025;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.trade-actions .trade-cards-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #604493, #413064);
  transform: translateY(-2px);
  box-shadow: 0 7px 16px #00000040;
}

.trade-actions .trade-cards-button:active:not(:disabled) {
  transform: translateY(0);
}

.trade-actions .trade-cards-button:focus-visible {
  outline: 2px solid #c4b5fd;
  outline-offset: 3px;
}

.trade-cards-message {
  overflow-wrap: anywhere;
}

@media (max-width: 420px) {
  .trade-actions {
    gap: 8px;
  }

  .trade-actions .trade-cards-button {
    flex-basis: 130px;
    padding: 10px 8px;
    font-size: 14px;
  }
}
