:root {
  --bg: #05070a;
  --bg-accent: #0b0f1a;
  --card-bg: rgba(20, 26, 42, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-primary: #3b82f6;
  --accent-secondary: #10b981;
  --accent-danger: #ef4444;
  --accent-warning: #f59e0b;
  --glass-bg: rgba(15, 23, 42, 0.8);
  --shadow-premium: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
  --radius-lg: 16px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  background: var(--bg);
  background-image: 
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
  color: var(--text-primary);
  margin: 0;
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden; /* Evita scroll lateral no body */
}

header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  background: rgba(5, 7, 10, 0.7);
  border-bottom: 1px solid var(--card-border);
  padding: 0.75rem 0;
}

.wrap {
  max-width: 100%;
  padding: 0 1rem;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h2 {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.main-tabs {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
}

.nav-btn {
  padding: 6px 16px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
}

.nav-btn.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-btn {
  text-align: left;
  padding: 10px 14px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  width: 100%;
}

.side-btn.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent-primary);
  font-weight: 700;
}

.side-btn:hover { background: rgba(255, 255, 255, 0.03); }

.pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 99px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.ok { background: var(--accent-secondary); box-shadow: 0 0 8px var(--accent-secondary); }
.dot.bad { background: var(--accent-danger); box-shadow: 0 0 8px var(--accent-danger); }

main {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 1.5rem;
  padding: 1.5rem 1rem;
  max-width: 1600px;
  margin: 0 auto;
}

@media (max-width: 1200px) {
  main { grid-template-columns: 1fr; }
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-premium);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;
}

.card h3 {
  padding: 1rem 1.25rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
}

.content {
  padding: 1.25rem;
}

.row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.field {
  flex: 1;
  min-width: 150px;
}

label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

input, select {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

input:focus { border-color: var(--accent-primary); }

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  gap: 0.4rem;
  transition: all 0.2s;
}

.btn-primary { background: var(--accent-primary); color: white; }
.btn-primary:hover { background: #2563eb; transform: translateY(-1px); }
.btn-secondary { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); border: 1px solid var(--card-border); }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.2); }

.tele-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.2);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 800px;
}

th { background: rgba(255, 255, 255, 0.03); padding: 0.75rem; text-align: left; color: var(--text-secondary); border-bottom: 1px solid var(--card-border); }
td { padding: 0.75rem; border-bottom: 1px solid var(--card-border); }

#map {
  height: 480px;
  border-radius: var(--radius-md);
  background: #000;
}

.preview-box {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.kpi-card {
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  text-align: center;
}

.kpi-value { display: block; font-size: 1.1rem; font-weight: 700; }
.kpi-label { font-size: 0.65rem; color: var(--text-secondary); }

.badge { padding: 0.25rem 0.6rem; border-radius: 99px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; display: inline-block; }
.badge-online { background: rgba(16, 185, 129, 0.12); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); box-shadow: 0 0 8px rgba(16, 185, 129, 0.2); }
.badge-offline { background: rgba(239, 68, 68, 0.12); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); box-shadow: 0 0 8px rgba(239, 68, 68, 0.2); }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.small { font-size: 0.7rem; color: var(--text-secondary); }

.actions { display: flex; gap: 4px; justify-content: flex-end; }
.btn-small { padding: 4px 8px; font-size: 0.7rem; }

pre { margin: 0; white-space: pre-wrap; word-break: break-all; }
