:root {
  --bg:#f9fafb;--surface:#ffffff;--text:#1f2937;--muted:#6b7280;
  --primary:#7c3aed;--primary-600:#6d28d9;--ring:#ede9fe;--border:#e5e7eb;
  --radius:14px;--shadow:0 10px 26px rgba(17,24,39,.06);
}

/* ===== Reset e Base ===== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, Segoe UI, Roboto, Arial;
  color: var(--text);
  background: linear-gradient(#f9fafb, #f3f4f6);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== Layout global ===== */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: #fff; border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand i { font-size: 1.2rem; color: var(--primary); }
.header-actions { display: flex; gap: 8px; align-items: center; }

.site-footer {
  margin-top: auto; border-top: 1px solid var(--border); background: #fff;
}
.site-footer .container {
  padding: 14px 16px; color: var(--muted);
  font-size: .9rem; text-align: center;
}

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ========== LOGIN ========== */
.login-container {
  display: flex; align-items: center; justify-content: center;
  flex: 1; padding: 24px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow); padding: 28px;
}
.login-card h1 { margin: 0 0 6px 0; font-size: 1.5rem; }
.subtitle { margin: 0 0 18px 0; color: var(--muted); font-size: .95rem; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-group label { font-weight: 600; font-size: .9rem; }
.form-group input {
  padding: 12px; border: 1px solid var(--border);
  border-radius: 12px; background: #fff; color: var(--text);
}
.btn-login {
  width: 100%; background: var(--primary); color: #fff; border: none;
  border-radius: 12px; padding: 12px 16px;
  font-weight: 600; cursor: pointer; box-shadow: var(--shadow);
}
.btn-login:hover { background: var(--primary-600); }
.login-message { margin-top: 10px; font-size: .95rem; }

/* ===== Painel Master ===== */
.dash-wrap { display: flex; flex-direction: column; gap: 14px; padding: 16px 0; }
.dash-topbar {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 10px;
}
.dash-title { margin: 0; font-size: 1.2rem; color: var(--text); }
.dash-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.ui-input, .ui-select, .ui-btn {
  border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px;
  background: #fff; color: var(--text);
}
.ui-input { min-width: 220px; }
.ui-select { min-width: 200px; }
.ui-btn { cursor: pointer; box-shadow: var(--shadow); }
.ui-btn:hover { border-color: var(--primary); }
.ui-btn.ghost { background: #fff; border-color: #eee; box-shadow: none; }

.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; overflow: auto;
}
.ui-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
}
.ui-table th, .ui-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  text-align: left; white-space: nowrap;
}
.ui-table thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
.ui-table tbody tr:hover { background: #f9fafb; }

.td-strong { font-weight: 600; }
.td-actions { display: flex; gap: 8px; align-items: center; }
.badge { padding: .25rem .5rem; border-radius: 999px;
  border: 1px solid var(--border); font-size: .85rem;
}
.badge-online { background: #eafff1; border-color: #b5f0cf; }
.badge-offline { background: #fff0f0; border-color: #ffd1d1; }
.badge-connecting, .badge-qr { background: #fff9e6; border-color: #ffe8a6; }

.pager {
  display: flex; align-items: center;
  justify-content: space-between; margin-top: 10px;
}
.muted { color: var(--muted); text-align: center; }

.flash {
  align-self: flex-start; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; box-shadow: var(--shadow);
}
.flash[data-type="success"] { border-color: #b5f0cf; background: #eafff1; }
.flash[data-type="error"] { border-color: #ffd1d1; background: #fff0f0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ===== BLOCO NOVO — Status dos Bots ===== */
#statusMessage {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 10px;
}
.bots-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bot-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  transition: background 0.2s;
}
.bot-item:hover {
  background: #f9fafb;
}
.bot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}
.bot-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 4px;
}
.status {
  text-transform: capitalize;
  font-weight: 600;
}
.status.online { color: #22c55e; }
.status.stopped { color: #ef4444; }
.status.launching { color: #f59e0b; }

/* ===== Mobile Cards ===== */
@media (max-width: 720px) {
  .dash-actions { width: 100%; }
  .ui-input { flex: 1; min-width: 160px; }
  .ui-table thead { display: none; }
  .ui-table tbody tr {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 6px; padding: 10px 8px;
  }
  .ui-table tbody td {
    white-space: normal; border-bottom: none; padding: 4px 6px;
  }
  .ui-table tbody tr:hover { background: transparent; }
  .ui-table tbody td:nth-child(1)::before { content: "Servidor"; display: block; color: var(--muted); font-size: .8rem; }
  .ui-table tbody td:nth-child(2)::before { content: "Massagista"; display: block; color: var(--muted); font-size: .8rem; }
  .ui-table tbody td:nth-child(3)::before { content: "Status"; display: block; color: var(--muted); font-size: .8rem; }
  .ui-table tbody td:nth-child(4)::before { content: "Sessão"; display: block; color: var(--muted); font-size: .8rem; }
  .td-actions { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
}
