@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Paleta Dark Neon - Estilo Meta Dashboard */
  --bg-app: #050505;
  --bg-panel: #0a0a0a; /* Quase preto */
  --bg-card-hover: #151515;
  
  --border-color: #1a1a1a;
  --border-light: #222;

  --text-primary: #ffffff;
  --text-secondary: #888888;
  --text-muted: #555555;

  /* Cores Neon */
  --color-ok: #00e050;      /* Verde neon */
  --color-warning: #ffee00; /* Amarelo puro */
  --color-critical: #ff003c;/* Vermelho neon */
  
  --font-main: 'Inter', sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 12px;
  overflow: hidden; /* Dashboard fixo */
}

/* Scrollbar fina e escura */
.custom-scrollbar::-webkit-scrollbar { width: 4px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

/* LAYOUT */
.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* HEADER */
.app-header {
  height: 50px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  display: flex;
  align-items: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.02em;
}

.brand-logo .v4 { color: #ff0000; margin-right: 4px; }
.brand-logo .company { color: #fff; }

.header-divider {
  width: 1px;
  height: 16px;
  background: #333;
}

.header-title {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
}

.header-update {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
}

.header-update span:first-child {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-right: 4px;
}

/* MAIN GRID */
.app-main {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr 1fr 1fr; /* Coluna Sidebar fixa + 3 flex */
  gap: 1px; /* Gap cria as linhas divisórias */
  background: var(--border-color); /* Cor das linhas da grid */
  overflow: hidden;
}

/* PAINÉIS */
.panel {
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-header {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.panel-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.panel-count {
  font-size: 18px;
  font-weight: 800;
}
.text-ok { color: var(--color-ok); }
.text-warning { color: var(--color-warning); }
.text-critical { color: var(--color-critical); }

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* SIDEBAR (Performance do Time) */
.panel-sidebar {
  background: #080808;
}

.panel-sub-header {
  display: flex;
  justify-content: space-between;
  padding: 10px 20px;
  font-size: 9px;
  font-weight: 700;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Managers Row Styles */
.manager-row {
  display: flex;
  flex-direction: column;
  padding: 12px 20px;
  border-bottom: 1px solid #111;
}

.manager-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.mgr-rank { color: var(--text-muted); font-size: 11px; width: 20px; }
.mgr-name { color: #fff; font-weight: 700; font-size: 13px; flex: 1; }
.mgr-score { font-weight: 700; font-size: 13px; text-align: right; }

.score-ok { color: var(--color-ok); }
.score-warning { color: var(--color-warning); }
.score-critical { color: var(--color-critical); }

/* Progress Bar Line */
.mgr-bar-bg {
  height: 2px;
  background: #222;
  width: 100%;
  position: relative;
}
.mgr-bar-fill {
  height: 100%;
  position: absolute;
  left: 0; top: 0;
}
.bg-ok { background: var(--color-ok); box-shadow: 0 0 5px rgba(0,224,80,0.3); }
.bg-warning { background: var(--color-warning); }
.bg-critical { background: var(--color-critical); box-shadow: 0 0 5px rgba(255,0,60,0.3); }

/* Sidebar Legend & QR */
.sidebar-footer {
  margin-top: auto;
  padding: 20px;
  border-top: 1px solid var(--border-color);
}

.legend-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.legend-item {
  color: var(--text-muted);
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot { width: 6px; height: 6px; border-radius: 50%; }
.dot-ok { background: var(--color-ok); }
.dot-warning { background: var(--color-warning); }
.dot-critical { background: var(--color-critical); }

.qr-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.qr-box {
  width: 80px;
  height: 80px;
  color: #ff3333; /* Cor avermelhada do QR na imagem */
  background: #fff;
  padding: 4px;
  border-radius: 4px;
}
.qr-text strong {
  display: block;
  color: #ff3333;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.qr-text span {
  color: #666;
  font-size: 9px;
}

/* ACCOUNT ROWS (Main Panels) */
.account-row {
  display: grid;
  grid-template-columns: 24px 1fr auto auto; /* Icon | Name | Manager | Date */
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  cursor: default;
  transition: background 0.2s;
}
.account-row:hover { background: var(--bg-card-hover); }

.acc-icon { display: flex; align-items: center; justify-content: center; }
.acc-icon svg { width: 16px; height: 16px; }

.icon-ok { color: var(--color-ok); }
.icon-warning { color: var(--color-warning); }
.icon-critical { color: var(--color-critical); }

.acc-name {
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acc-manager {
  color: var(--text-muted);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.acc-date {
  color: var(--text-secondary);
  font-size: 11px;
  text-align: right;
  min-width: 60px;
}

/* Footer Action Bar */
.panel-footer-action {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}
.action-alert {
  color: #ff003c;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* APP FOOTER */
.app-footer {
  height: 30px;
  background: #080808;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}
.footer-indicators {
  display: flex;
  gap: 20px;
}
.ind-item {
  color: #444;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.icon-ok { color: var(--color-ok); }
.icon-warn { color: var(--color-warning); }
.icon-crit { color: var(--color-critical); }
.icon-dead { color: #555; }

/* States */
.state-empty, .state-loading, .state-error {
  padding: 40px;
  text-align: center;
  color: #444;
  font-size: 11px;
}
.loading-spinner {
  width: 20px; height: 20px;
  border: 2px solid #333;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsividade Básica */
@media (max-width: 1200px) {
    .app-main { grid-template-columns: 200px 1fr 1fr 1fr; }
}