:root {
  --bg-main: #020617;
  --bg-card: rgba(15, 23, 42, 0.9);
  --bg-card-soft: rgba(15, 23, 42, 0.8);
  --border-subtle: rgba(148, 163, 184, 0.3);
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.15);
  --accent-strong: #4f46e5;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --danger: #f97373;
  --success: #4ade80;
  --warning: #facc15;
  --shadow-soft: 0 22px 40px rgba(15, 23, 42, 0.8);
  --radius-lg: 18px;
  --radius-full: 999px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  color: var(--text-main);
}

.bg-gradient {
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(56, 189, 248, 0.12) 0, transparent 55%),
    radial-gradient(circle at 90% 0%, rgba(99, 102, 241, 0.18) 0, transparent 55%),
    linear-gradient(135deg, #020617 0%, #020617 40%, #020617 100%);
}

/* -------- Login -------- */

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

.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle);
}

.login-card {
  max-width: 440px;
  width: 100%;
  padding: 28px 28px 22px;
}

.login-header {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
}

.logo-circle {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle at 30% 0%, #a855f7, #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: white;
  font-size: 18px;
  box-shadow: 0 18px 35px rgba(79, 70, 229, 0.6);
}

.logo-circle.small {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

.login-header h1 {
  margin: 0 0 4px;
  font-size: 22px;
}

.login-header p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.login-form .form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--text-muted);
}

.form-group input,
textarea {
  width: 100%;
  padding: 10px 11px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.85);
  color: var(--text-main);
  outline: none;
  font-size: 14px;
}

.form-group input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.btn-primary,
.btn-secondary {
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  box-shadow: 0 18px 30px rgba(79, 70, 229, 0.6);
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-secondary {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.login-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #c7d2fe;
  border: 1px solid rgba(129, 140, 248, 0.4);
}

.pill-outline {
  background: transparent;
  color: var(--text-muted);
  border-color: rgba(148, 163, 184, 0.5);
}

.error-text {
  margin-top: 8px;
  font-size: 13px;
  color: var(--danger);
}

/* -------- Layout painel -------- */

.layout {
  display: flex;
  min-height: 100vh;
  padding: 18px;
  gap: 18px;
}

.sidebar {
  width: 260px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-header {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 18px;
}

.sidebar-header p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.bot-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

.bot-item {
  padding: 8px 9px;
  border-radius: 10px;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.86);
}

.bot-item:hover {
  border-color: rgba(129, 140, 248, 0.7);
  background: rgba(15, 23, 42, 0.96);
}

.bot-item.active {
  border-color: var(--accent);
  background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.18), rgba(15, 23, 42, 0.98));
}

.bot-item-title {
  font-size: 13px;
}

.bot-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

.bot-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-right: 5px;
}

.bot-status-dot.online {
  background: var(--success);
}

.bot-status-dot.paused {
  background: var(--warning);
}

.sidebar-logout {
  margin-top: auto;
  width: 100%;
}

/* -------- Main -------- */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar h1 {
  margin: 0 0 4px;
  font-size: 20px;
}

.topbar p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.topbar-user {
  font-size: 13px;
  color: var(--text-muted);
}

.content-card {
  padding: 16px 18px 18px;
}

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

.bot-last-update {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.bot-actions {
  display: flex;
  gap: 8px;
}

.bot-actions .btn-secondary {
  padding-inline: 14px;
  font-size: 12px;
}

.actions-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.save-status-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* -------- Responsivo -------- */

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
  }

  .sidebar-section {
    flex: 1;
  }

  .bot-list {
    max-height: 200px;
  }
}


/* -------- Admin de usuários -------- */

.user-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr);
  gap: 18px;
  margin-top: 12px;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.user-table th,
.user-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.user-table th {
  font-weight: 500;
  color: var(--text-muted);
}

.user-table td.actions {
  text-align: right;
}

.empty-text {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.user-form h3,
.user-list h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.pill-muted {
  background: transparent;
  color: var(--text-muted);
  border-color: rgba(148, 163, 184, 0.5);
}

@media (max-width: 960px) {
  .user-admin-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
