@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --blue:    #192FFF;
  --cyan:    #00F0FF;
  --bg:      #07070f;
  --bg2:     #0d0d1a;
  --bg3:     #111124;
  --surface: rgba(17, 17, 36, 0.9);
  --border:  rgba(25, 47, 255, 0.18);
  --glow-b:  rgba(25, 47, 255, 0.35);
  --glow-c:  rgba(0, 240, 255, 0.2);
  --primary: #192FFF;
  --online:  #22C55E;
  --offline: #EF4444;
  --warn:    #EAB308;
  --text:    #e8e8f4;
  --muted:   #8080a8;
  --radius:  5px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(ellipse 90% 70% at 15% 30%, rgba(25, 47, 255, 0.07) 0%, transparent 60%);
  color: var(--text);
  font-size: 14px;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: #fff; }

/* ── Auth pages ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse 120% 100% at 30% 60%, #091a3e 0%, #040d1e 50%, #020810 100%);
}

.auth-card {
  background: rgba(13, 13, 26, 0.85);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  backdrop-filter: blur(20px);
  box-shadow: 0 0 60px rgba(25, 47, 255, 0.12);
}

.auth-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: -0.01em;
  text-align: center;
  margin-bottom: 1.6rem;
}

.auth-card h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 0.35rem;
}

.auth-card > p {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
}

/* ── Forms ── */
.field { margin-bottom: 1rem; }

.field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.72rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.field input::placeholder,
.field textarea::placeholder { color: rgba(255, 255, 255, 0.2); }

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(25, 47, 255, 0.55);
  background: rgba(25, 47, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(25, 47, 255, 0.1);
}

.field select option { background: var(--bg3); }

.field textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn:hover { opacity: 0.88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--blue), #0f22cc);
  color: #fff;
  box-shadow: 0 0 20px var(--glow-b);
}

.btn-primary:hover { box-shadow: 0 0 32px var(--glow-b); }

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover { color: var(--text); border-color: rgba(25, 47, 255, 0.4); }

.btn-edit {
  background: rgba(25, 47, 255, 0.12);
  color: #99aaff;
  border: 1px solid rgba(25, 47, 255, 0.3);
}
.btn-edit:hover { background: rgba(25, 47, 255, 0.22); color: #c0caff; }

.btn-info {
  background: rgba(0, 240, 255, 0.08);
  color: #67e8f9;
  border: 1px solid rgba(0, 240, 255, 0.22);
}
.btn-info:hover { background: rgba(0, 240, 255, 0.16); }

.btn-warn {
  background: rgba(251, 146, 60, 0.1);
  color: #fdba74;
  border: 1px solid rgba(251, 146, 60, 0.28);
}
.btn-warn:hover { background: rgba(251, 146, 60, 0.2); }

.btn-full    { width: 100%; justify-content: center; }
.btn-sm      { padding: 0.42rem 0.9rem; font-size: 0.82rem; }

/* ── Layout ── */
.layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 220px;
  background: rgba(7, 7, 20, 0.97);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  backdrop-filter: blur(12px);
}

.sidebar-logo {
  padding: 20px 18px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--border);
}

.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 4px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  border-left: 2px solid transparent;
}

.sidebar-nav a:hover {
  background: rgba(25, 47, 255, 0.08);
  color: var(--text);
  border-left-color: rgba(25, 47, 255, 0.35);
}

.sidebar-nav a.active {
  background: rgba(25, 47, 255, 0.14);
  color: #fff;
  border-left-color: var(--cyan);
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #0f22cc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  font-family: 'Space Grotesk', sans-serif;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-nome {
  font-size: 0.82rem; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-role {
  font-size: 0.67rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin-top: 1px;
}

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  padding: 15px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: rgba(7, 7, 20, 0.6);
  backdrop-filter: blur(8px);
}

.topbar h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(8px);
}

.card-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 12px;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ── Server cards ── */
.srv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(8px);
}

.srv-card:hover {
  border-color: rgba(25, 47, 255, 0.5);
  box-shadow: 0 0 24px rgba(25, 47, 255, 0.1);
}

.srv-card.offline-card { border-color: rgba(239, 68, 68, 0.3); }

.srv-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.srv-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge.online  { background: rgba(34, 197, 94, 0.12); color: var(--online); border: 1px solid rgba(34,197,94,0.25); }
.badge.offline { background: rgba(239, 68, 68, 0.12); color: var(--offline); border: 1px solid rgba(239,68,68,0.25); }
.badge.warn    { background: rgba(234, 179, 8, 0.12);  color: var(--warn);    border: 1px solid rgba(234,179,8,0.25); }
.badge.blue    { background: rgba(25, 47, 255, 0.12);  color: #7b93ff;        border: 1px solid rgba(25,47,255,0.25); }

/* ── Progress bars ── */
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.bar-label { width: 60px; color: var(--muted); }
.bar-track { flex: 1; height: 5px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 3px; transition: width 0.3s; }
.bar-fill.ok   { background: linear-gradient(90deg, #16a34a, var(--online)); }
.bar-fill.warn { background: linear-gradient(90deg, #a16207, var(--warn)); }
.bar-fill.crit { background: linear-gradient(90deg, #b91c1c, var(--offline)); }
.bar-val { width: 56px; text-align: right; color: var(--muted); font-size: 11px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
}

td { padding: 11px 12px; border-bottom: 1px solid rgba(25, 47, 255, 0.08); }
tr:hover td { background: rgba(25, 47, 255, 0.04); }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }

.tab {
  padding: 10px 18px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s;
}

.tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.tab:hover  { color: var(--text); }

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 16, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 80px rgba(25, 47, 255, 0.15);
}

.modal h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: #fff;
}

.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ── User cell (tabela) ── */
.user-cell { display: flex; align-items: center; gap: 9px; }
.user-thumb {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(25,47,255,0.55), rgba(15,34,204,0.55));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; color: #fff; flex-shrink: 0;
  font-family: 'Space Grotesk', sans-serif;
  overflow: hidden; background-size: cover; background-position: center;
}

/* ── User foto no modal ── */
.usr-foto-section {
  display: flex; align-items: center; gap: 16px;
  padding-bottom: 16px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.usr-avatar {
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #0f22cc);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; font-weight: 700; color: #fff;
  flex-shrink: 0; font-family: 'Space Grotesk', sans-serif;
  overflow: hidden; background-size: cover; background-position: center;
}
.usr-foto-hint { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

/* ── Checkboxes servidores ── */
.srv-checkbox-list {
  max-height: 180px; overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
}
.srv-checkbox-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.srv-checkbox-item:last-child { border-bottom: none; }
.srv-checkbox-item:hover { background: rgba(25,47,255,0.08); }
.srv-checkbox-item input[type="checkbox"] {
  width: 15px; height: 15px; accent-color: var(--blue);
  cursor: pointer; flex-shrink: 0;
}
.srv-check-nome { flex: 1; font-size: 0.85rem; color: var(--text); font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ── Actions cell ── */
.actions-cell { white-space: nowrap; text-align: right; padding: 8px 12px; }
.actions-cell .btn + .btn { margin-left: 6px; }

/* ── Sidebar logo accent ── */
.sidebar-logo span { color: var(--cyan); }

/* ── Counters ── */
.counters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }

.counter-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(8px);
}

.counter-val {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.counter-lbl { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }

/* ── Filters ── */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }

.filter-btn {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}

.filter-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: 0 0 16px var(--glow-b); }
.filter-btn:hover  { color: var(--text); border-color: rgba(25,47,255,0.4); }

.search-input {
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 0.83rem;
  font-family: 'DM Sans', sans-serif;
  min-width: 220px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus { border-color: rgba(25,47,255,0.5); }

/* ── Toasts ── */
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }

.toast-item {
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 0.83rem;
  font-weight: 500;
  backdrop-filter: blur(12px);
  animation: toastIn 0.2s ease;
}

.toast-ok  { background: rgba(22, 101, 52, 0.9);  color: #bbf7d0; border: 1px solid rgba(34,197,94,0.3); }
.toast-err { background: rgba(127, 29, 29, 0.9); color: #fecaca; border: 1px solid rgba(239,68,68,0.3); }

@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Timeline ── */
.timeline { height: 18px; border-radius: 4px; overflow: hidden; display: flex; margin: 8px 0; gap: 1px; }
.tl-seg { height: 100%; }
.tl-seg.on  { background: var(--online); }
.tl-seg.off { background: rgba(239,68,68,0.5); }

/* ── Sensor cards ── */
.sensor-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }

.sensor-card {
  background: rgba(25, 47, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.sensor-chave { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.sensor-valor { font-family: 'Space Grotesk', sans-serif; font-size: 1.25rem; font-weight: 600; }
.sensor-unidade { font-size: 0.75rem; color: var(--muted); margin-left: 2px; }

/* ── Token box ── */
.token-box {
  background: rgba(0, 240, 255, 0.04);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: var(--radius);
  padding: 12px;
  font-family: monospace;
  font-size: 0.78rem;
  word-break: break-all;
  margin: 12px 0;
  color: var(--cyan);
}

/* ── Alerts ── */
.alert { padding: 11px 14px; border-radius: 8px; font-size: 0.83rem; margin-bottom: 16px; }
.alert-warn { background: rgba(234,179,8,.08);  border: 1px solid rgba(234,179,8,.3);  color: var(--warn); }
.alert-err  { background: rgba(239,68,68,.08);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.alert-ok   { background: rgba(34,197,94,.08);  border: 1px solid rgba(34,197,94,.3);  color: var(--online); }

/* ── Misc ── */
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.on  { background: var(--online);  box-shadow: 0 0 6px var(--online); }
.dot.off { background: var(--offline); }

.text-muted { color: var(--muted); }
.text-warn  { color: var(--warn); }
.text-ok    { color: var(--online); }
.text-err   { color: var(--offline); }

.mt-4  { margin-top: 4px; }  .mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; } .mb-8  { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }

.flex { display: flex; } .items-center { align-items: center; }
.gap-8 { gap: 8px; } .gap-16 { gap: 16px; }
.justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; }

.hidden { display: none !important; }

/* ── FAB (Floating Action Button) ── */
.fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--blue), #0f22cc);
  color: #fff;
  font-size: 1.7rem;
  font-weight: 300;
  font-family: 'DM Sans', sans-serif;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 4px 18px rgba(25, 47, 255, 0.55), 0 2px 6px rgba(0,0,0,0.35);
  transition: transform 0.18s, box-shadow 0.18s;
}
.fab:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 8px 30px rgba(25, 47, 255, 0.7), 0 4px 10px rgba(0,0,0,0.3);
}
.fab:active { transform: scale(0.94); }

/* ── Form hint ── */
.field-hint { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }

/* ── Upload arquivo do servidor ── */
.srv-arquivo-section {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  margin-bottom: 4px;
}
.srv-arquivo-icon {
  font-size: 1.5rem; color: var(--muted); flex-shrink: 0;
}
.srv-arquivo-info { flex: 1; min-width: 0; }
.srv-arquivo-nome {
  font-size: 0.82rem; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.srv-arquivo-hint { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
