/* ── RESET & BASE ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:        #0f1117;
  --bg2:       #181c26;
  --bg3:       #1f2435;
  --border:    rgba(255,255,255,.07);
  --primary:   #4f6ef7;
  --primary-dk:#3a56d4;
  --success:   #22c55e;
  --danger:    #ef4444;
  --warning:   #f59e0b;
  --text:      #e2e8f0;
  --muted:     #64748b;
  --sidebar-w: 230px;
  --topbar-h:  56px;
}
body { background: var(--bg); color: var(--text); font-family: system-ui,-apple-system,sans-serif; font-size: .925rem; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: #7c9aff; }

/* ── LAYOUT ───────────────────────────────────────────────────────────────── */
.painel-wrap { display: flex; min-height: 100vh; }

/* ── SIDEBAR ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100; transition: transform .25s;
}
.sidebar-logo {
  padding: 1.25rem 1.25rem 1rem;
  font-size: 1.1rem; font-weight: 700; color: var(--primary);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
}
.sidebar-nav { flex: 1; padding: .75rem .5rem; overflow-y: auto; }
.sidebar-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .85rem; border-radius: 8px; color: var(--muted);
  font-size: .88rem; font-weight: 500; transition: background .15s, color .15s;
  margin-bottom: 2px;
}
.sidebar-link:hover { background: var(--bg3); color: var(--text); }
.sidebar-link.active { background: rgba(79,110,247,.15); color: var(--primary); }
.sidebar-link .bi { font-size: 1rem; flex-shrink: 0; }
.sidebar-footer { padding: .75rem .5rem 1rem; border-top: 1px solid var(--border); }
.text-danger-light { color: #f87171 !important; }
.text-danger-light:hover { color: var(--danger) !important; background: rgba(239,68,68,.1) !important; }

/* ── MAIN ─────────────────────────────────────────────────────────────────── */
.painel-main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.painel-topbar {
  height: var(--topbar-h); background: var(--bg2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 1rem; font-weight: 600; flex: 1; }
.badge-server { font-size: .78rem; color: var(--muted); display: flex; align-items: center; }
.btn-sidebar-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.4rem; cursor: pointer; }
.painel-content { padding: 1.75rem; flex: 1; }

/* ── CARDS ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.25rem 1.5rem; margin-bottom: 1.25rem;
}
.card-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .4rem; }
.card-value { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.card-sub   { font-size: .8rem; color: var(--muted); margin-top: .25rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 1.1rem 1.25rem; }
.stat-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; margin-bottom: .75rem; }
.stat-icon.blue   { background: rgba(79,110,247,.15); color: var(--primary); }
.stat-icon.green  { background: rgba(34,197,94,.15);  color: var(--success); }
.stat-icon.yellow { background: rgba(245,158,11,.15); color: var(--warning); }
.stat-icon.red    { background: rgba(239,68,68,.15);  color: var(--danger);  }
.stat-icon.purple { background: rgba(168,85,247,.15); color: #a855f7;        }

/* ── TABLE ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th { padding: .6rem .9rem; text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); border-bottom: 1px solid var(--border); }
tbody td { padding: .65rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,.02); }

/* ── FORMS ────────────────────────────────────────────────────────────────── */
.form-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; align-items: flex-end; }
.form-group { display: flex; flex-direction: column; gap: .35rem; flex: 1; min-width: 160px; }
label { font-size: .8rem; color: var(--muted); }
input[type=text],input[type=email],input[type=password],input[type=number],select,textarea {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  padding: .5rem .75rem; color: var(--text); font-size: .875rem; width: 100%;
  transition: border-color .15s;
}
input:focus,select:focus,textarea:focus { outline: none; border-color: var(--primary); }
select option { background: var(--bg3); }

/* ── BUTTONS ──────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 1rem; border-radius: 8px; font-size: .875rem; font-weight: 500; cursor: pointer; border: none; transition: background .15s, opacity .15s; text-decoration: none; white-space: nowrap; }
.btn:hover { opacity: .88; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-success  { background: var(--success); color: #fff; }
.btn-ghost    { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-icon { width: 30px; height: 30px; padding: 0; justify-content: center; border-radius: 6px; }

/* ── ALERTS ───────────────────────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; display: flex; align-items: center; gap: .6rem; font-size: .875rem; }
.alert-success { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.25); color: #4ade80; }
.alert-danger  { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.25);  color: #f87171; }
.alert-info    { background: rgba(79,110,247,.12); border: 1px solid rgba(79,110,247,.25); color: #818cf8; }

/* ── BADGE ────────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 20px; font-size: .72rem; font-weight: 600; }
.badge-ok      { background: rgba(34,197,94,.15);  color: #4ade80; }
.badge-warn    { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge-danger  { background: rgba(239,68,68,.15);  color: #f87171; }
.badge-neutral { background: rgba(255,255,255,.08); color: var(--muted); }

/* ── PROGRESS ─────────────────────────────────────────────────────────────── */
.progress-bar-wrap { background: var(--bg3); border-radius: 99px; height: 6px; overflow: hidden; margin-top: .4rem; }
.progress-bar { height: 100%; border-radius: 99px; transition: width .3s; }
.progress-bar.blue   { background: var(--primary); }
.progress-bar.green  { background: var(--success); }
.progress-bar.yellow { background: var(--warning); }
.progress-bar.red    { background: var(--danger);  }

/* ── SECTION HEADER ───────────────────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: .75rem; }
.section-header h2 { font-size: 1rem; font-weight: 600; }

/* ── SERVICE STATUS ───────────────────────────────────────────────────────── */
.svc-row { display: flex; align-items: center; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.svc-row:last-child { border-bottom: none; }
.svc-name { font-weight: 500; }
.svc-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: .4rem; }
.svc-dot.ok   { background: var(--success); box-shadow: 0 0 6px var(--success); }
.svc-dot.fail { background: var(--danger);  box-shadow: 0 0 6px var(--danger);  }

/* ── LOGIN ────────────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 2.5rem 2rem; width: 100%; max-width: 380px; }
.login-logo { font-size: 1.4rem; font-weight: 800; color: var(--primary); text-align: center; margin-bottom: 1.75rem; }

/* ── TABS ─────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: .25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.tab-btn { padding: .55rem 1rem; border-radius: 8px 8px 0 0; background: none; border: none; color: var(--muted); font-size: .875rem; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; transition: color .15s; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── CODE/MONO ────────────────────────────────────────────────────────────── */
code { background: var(--bg3); padding: .1rem .35rem; border-radius: 4px; font-size: .82rem; font-family: 'Courier New', monospace; }
.log-box { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; font-family: monospace; font-size: .8rem; color: #94a3b8; max-height: 400px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; }

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .painel-main { margin-left: 0; }
  .btn-sidebar-toggle { display: flex; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
