/* ==============================================================================
   EMPC DESIGN SYSTEM - SGI (Sistema Gerenciador de Internet)
   Identidade Visual Corporativa Oficial: Obsidian Dark & Dourado (#C9972E)
   Compatível com o ecossistema EMPC.IA (ia.empcti.com.br)
   ============================================================================== */

:root {
  /* Cores Base do Ecossistema EMPC */
  --bg: #07080b;
  --bg-subtle: #0d0f15;
  --panel: #11141c;
  --panel-elevated: #161a25;
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-hover: rgba(255, 255, 255, 0.12);
  
  /* Tipografia */
  --ink: #f8fafc;
  --ink-secondary: #cbd5e1;
  --muted: #94a3b8;
  --muted-dark: #64748b;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  /* Dourado Oficial EMPC */
  --brand: #C9972E;
  --brand-hover: #d9aa42;
  --brand-light: rgba(201, 151, 46, 0.12);
  --brand-border: rgba(201, 151, 46, 0.35);
  --brand-glow: 0 0 25px rgba(201, 151, 46, 0.25);
  --brand-dark: #7b5508;

  /* Estados e Alertas */
  --warn: #f59e0b;
  --danger: #ef4444;
  --ok: #22c55e;
  
  /* Elementos Estruturais */
  --sidebar-bg: #090a0f;
  --sidebar-text: #f8fafc;
  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  --panel-shadow: 0 20px 45px -15px rgba(0, 0, 0, 0.85);
  --radius: 14px;
  --radius-sm: 8px;
}

/* Modos de Organização com base no Dourado EMPC */
body.theme-hotel {
  --brand: #C9972E;
  --brand-hover: #d9aa42;
  --brand-light: rgba(201, 151, 46, 0.14);
}

body.theme-condominium {
  --brand: #10b981;
  --brand-hover: #34d399;
  --brand-light: rgba(16, 185, 129, 0.14);
}

body.theme-company {
  --brand: #C9972E;
  --brand-hover: #d9aa42;
  --brand-light: rgba(201, 151, 46, 0.14);
}

* { 
  box-sizing: border-box; 
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

body { 
  margin: 0; 
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
  background-color: var(--bg); 
  color: var(--ink); 
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Títulos com fonte Outfit de alto impacto */
h1, h2, h3, h4, strong {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

button, input, select, textarea { 
  font-family: inherit; 
}

/* Botões do Design System EMPC */
button { 
  border: 0; 
  border-radius: var(--radius-sm); 
  background: var(--brand); 
  color: #07080b; 
  padding: 10px 18px; 
  font-weight: 700;
  font-size: 14px;
  cursor: pointer; 
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(201, 151, 46, 0.2);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

button:hover { 
  background: var(--brand-hover); 
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(201, 151, 46, 0.35);
}

button:active {
  transform: translateY(0);
}

button.secondary { 
  background: rgba(255, 255, 255, 0.05); 
  color: var(--ink); 
  border: 1px solid var(--panel-border);
  box-shadow: none;
}
button.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

button.danger { 
  background: rgba(239, 68, 68, 0.15); 
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  box-shadow: none;
}
button.danger:hover {
  background: #dc2626;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}

button:disabled { 
  opacity: .4; 
  cursor: not-allowed; 
  transform: none !important;
  box-shadow: none !important;
}

/* Campos de Formulário Modernos */
input, select, textarea { 
  width: 100%; 
  border: 1px solid rgba(255, 255, 255, 0.1); 
  border-radius: var(--radius-sm); 
  padding: 11px 14px; 
  background: rgba(13, 15, 21, 0.85); 
  color: #ffffff; 
  outline: none;
  font-size: 14px;
  transition: all 0.2s ease;
}

input::placeholder, textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  background: rgba(18, 21, 30, 0.95);
  box-shadow: 0 0 0 3px rgba(201, 151, 46, 0.2);
}

textarea { min-height: 110px; resize: vertical; }

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

[hidden] { display: none !important; }

/* ==============================================================================
   TELA DE LOGIN (LOGIN SCREEN) - ESTILO OFICIAL EMPC
   ============================================================================== */
.login-screen { 
  min-height: 100vh; 
  display: grid; 
  place-items: center; 
  padding: 24px; 
  background-color: #07080b;
  background-image: 
    radial-gradient(ellipse 75% 55% at 50% -10%, rgba(201, 151, 46, 0.14), transparent 70%),
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 36px 36px, 36px 36px;
  position: relative;
}

.login-box { 
  width: min(480px, 100%); 
  background: rgba(15, 17, 24, 0.88); 
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.09); 
  border-radius: 20px; 
  padding: 38px 34px; 
  display: grid; 
  gap: 20px; 
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85), 0 0 40px -10px rgba(201, 151, 46, 0.1);
  position: relative;
  z-index: 10;
}

.login-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 151, 46, 0.5), transparent);
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  padding: 4px 14px;
  border-radius: 9999px;
  border: 1px solid rgba(201, 151, 46, 0.35);
  background: rgba(201, 151, 46, 0.08);
  color: #C9972E;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.login-header {
  display: grid;
  gap: 12px;
}

.login-brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-logo-img {
  height: 44px;
  width: auto;
}

.login-subtitle {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0;
  line-height: 1.45;
}

.btn-login-submit {
  background: var(--brand);
  color: #07080b;
  font-size: 15px;
  font-weight: 800;
  padding: 13px 20px;
  border-radius: 10px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 18px rgba(201, 151, 46, 0.28);
}
.btn-login-submit:hover {
  background: var(--brand-hover);
  box-shadow: 0 8px 25px rgba(201, 151, 46, 0.45);
}

.login-box-footer {
  text-align: center;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.4);
}

/* ==============================================================================
   SHELL DA APLICAÇÃO (DASHBOARD & NAVEGAÇÃO)
   ============================================================================== */
.app-shell { 
  min-height: 100vh; 
  display: grid; 
  grid-template-columns: 270px 1fr; 
}

.sidebar { 
  background: var(--sidebar-bg); 
  color: var(--sidebar-text); 
  padding: 24px 18px; 
  display: flex; 
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--panel-border);
}

.sidebar-top {
  display: grid;
  gap: 28px;
}

.sidebar .brand { 
  display: grid; 
  gap: 6px; 
  padding: 0 6px;
}

.sidebar-logo {
  height: 38px;
  width: auto;
}

.sidebar-tenant-name {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav { 
  display: grid; 
  gap: 4px; 
}
.nav button { 
  width: 100%; 
  background: transparent; 
  text-align: left; 
  color: rgba(255, 255, 255, 0.7); 
  padding: 11px 14px; 
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: none;
  justify-content: flex-start;
  border: 1px solid transparent;
}
.nav button:hover { 
  background: rgba(255, 255, 255, 0.04); 
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.05);
  transform: translateX(2px);
}
.nav button.active { 
  background: linear-gradient(90deg, rgba(201, 151, 46, 0.16), rgba(201, 151, 46, 0.03)); 
  color: #d9aa42; 
  font-weight: 700;
  border-left: 3px solid var(--brand);
  border-color: transparent transparent transparent var(--brand);
}

.content { 
  padding: 32px 40px; 
  display: grid; 
  gap: 24px; 
  align-content: start; 
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.topbar { 
  display: flex; 
  justify-content: space-between; 
  gap: 12px; 
  align-items: center; 
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 18px;
}
.topbar h1 { 
  margin: 0; 
  font-size: 28px; 
  letter-spacing: -0.03em; 
  color: #ffffff;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: rgba(201, 151, 46, 0.09);
  border: 1px solid rgba(201, 151, 46, 0.3);
  color: #d9aa42;
  font-size: 13px;
  font-weight: 600;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

/* ==============================================================================
   PAINÉIS E CARDS
   ============================================================================== */
.grid { 
  display: grid; 
  grid-template-columns: repeat(12, 1fr); 
  gap: 18px; 
}

.panel { 
  background: var(--panel); 
  border: 1px solid var(--panel-border); 
  border-radius: var(--radius); 
  padding: 24px; 
  box-shadow: var(--panel-shadow);
  display: grid;
  gap: 16px;
}
.panel h2 { 
  margin: 0; 
  font-size: 20px; 
  letter-spacing: -0.02em;
}

.card { 
  background: rgba(255, 255, 255, 0.02); 
  border: 1px solid var(--panel-border); 
  border-radius: var(--radius-sm); 
  padding: 18px; 
  display: grid; 
  gap: 8px; 
  box-shadow: var(--card-shadow);
}
.card:hover {
  border-color: rgba(201, 151, 46, 0.35);
  background: rgba(255, 255, 255, 0.035);
}

.metric-card { 
  grid-column: span 4; 
  min-height: 115px; 
  align-content: center; 
  border-left: 4px solid var(--brand);
  background: linear-gradient(135deg, rgba(201, 151, 46, 0.07), rgba(255, 255, 255, 0.01));
}
.metric { 
  font-size: 34px; 
  font-weight: 800; 
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.03em;
}

.muted { color: var(--muted); font-size: 13.5px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section-title h2 { margin: 0; }

.progress { 
  width: 100%; 
  height: 10px; 
  border-radius: 999px; 
  overflow: hidden; 
  background: rgba(255, 255, 255, 0.06); 
}
.progress span { 
  display: block; 
  height: 100%; 
  background: linear-gradient(90deg, var(--brand), var(--brand-hover)); 
  border-radius: inherit; 
  min-width: 2px; 
  box-shadow: 0 0 10px rgba(201, 151, 46, 0.5);
}

.cookie-summary { 
  margin-top: 8px; 
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  padding: 14px; 
  border-radius: var(--radius-sm);
}

.form-grid { 
  display: grid; 
  grid-template-columns: repeat(3, minmax(0, 1fr)); 
  gap: 16px; 
}

/* ==============================================================================
   TABELAS
   ============================================================================== */
.table-wrap { 
  overflow: auto; 
  border: 1px solid var(--panel-border); 
  border-radius: var(--radius-sm); 
  box-shadow: var(--card-shadow);
  background: var(--panel);
}
table { 
  width: 100%; 
  border-collapse: collapse; 
  background: transparent; 
  min-width: 720px; 
}
th, td { 
  border-bottom: 1px solid var(--panel-border); 
  padding: 13px 18px; 
  text-align: left; 
  font-size: 13.5px; 
}
th { 
  color: var(--muted); 
  background: rgba(255, 255, 255, 0.02); 
  font-weight: 700; 
  font-size: 12px; 
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255, 255, 255, 0.03); }

/* Badges */
.badge { 
  display: inline-flex; 
  align-items: center;
  padding: 4px 10px; 
  border-radius: 999px; 
  font-size: 11.5px; 
  font-weight: 700; 
  background: rgba(255, 255, 255, 0.06); 
  color: var(--muted); 
}
.badge.ok { 
  background: rgba(34, 197, 94, 0.12); 
  color: #4ade80; 
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.badge.warn { 
  background: rgba(245, 158, 11, 0.12); 
  color: #fbbf24; 
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.badge.danger { 
  background: rgba(239, 68, 68, 0.12); 
  color: #f87171; 
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.alert { 
  border: 1px solid rgba(239, 68, 68, 0.35); 
  background: rgba(239, 68, 68, 0.1); 
  color: #fca5a5; 
  padding: 12px 16px; 
  border-radius: var(--radius-sm); 
  font-size: 13.5px; 
  font-weight: 600; 
}
.success { 
  border: 1px solid rgba(34, 197, 94, 0.35); 
  background: rgba(34, 197, 94, 0.1); 
  color: #86efac; 
  padding: 12px 16px; 
  border-radius: var(--radius-sm); 
  font-size: 13.5px; 
  font-weight: 600; 
}

/* Painel de Preferência de Cookies */
.cookie-preference-panel {
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.25);
  padding: 14px;
  border-radius: var(--radius-sm);
  display: grid;
  gap: 10px;
}
.cookie-pref-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  gap: 12px;
}
.cookie-pref-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--brand);
}

/* Portal do Cliente */
.portal-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  gap: 24px;
  width: 100%;
}
.portal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 18px;
}
.portal-welcome {
  text-align: center;
  background: linear-gradient(135deg, rgba(201, 151, 46, 0.2), rgba(15, 17, 24, 0.95));
  border: 1px solid rgba(201, 151, 46, 0.3);
  color: white;
  padding: 36px 24px;
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
  display: grid;
  gap: 12px;
}
.portal-welcome h2 { color: white; margin: 0; font-size: 28px; }
.portal-welcome p { color: rgba(255, 255, 255, 0.8); margin: 0; }

.speed-meter-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}
.speed-number {
  font-size: 52px;
  font-weight: 800;
  color: var(--brand);
  font-family: 'Outfit', sans-serif;
  line-height: 1;
}

/* Área de Marketing */
.marketing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.marketing-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}
.marketing-card:hover {
  transform: translateY(-3px);
  border-color: rgba(201, 151, 46, 0.4);
}
.marketing-img-placeholder {
  height: 130px;
  background: linear-gradient(135deg, rgba(201, 151, 46, 0.12), rgba(0, 0, 0, 0.4));
  display: grid;
  place-items: center;
  font-size: 36px;
  color: var(--brand);
}
.marketing-content {
  padding: 18px;
  display: grid;
  gap: 8px;
  flex-grow: 1;
}
.marketing-content h4 { margin: 0; font-size: 16px; font-weight: 700; color: #ffffff; }
.marketing-content p { margin: 0; font-size: 13px; color: var(--muted); }

/* Log do Pixel */
.pixel-activity-log {
  background: #08090d;
  color: #38bdf8;
  font-family: monospace;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Rodapé */
.footer-brand {
  margin-top: 24px;
  border-top: 1px solid var(--panel-border);
  padding-top: 16px;
  text-align: center;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 500;
}
.sidebar .footer-brand {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.3);
  margin-top: auto;
  padding-top: 16px;
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--panel-border); }
  .sidebar-top { gap: 14px; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 20px 16px; }
  .grid { grid-template-columns: 1fr; }
  .metric-card { grid-column: 1; }
  .section-title { align-items: flex-start; flex-direction: column; }
}

/* Modal Institucional, Privacidade e Guia de Uso */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: #0d0f17;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.9), 0 0 35px rgba(201, 151, 46, 0.15);
  border-radius: 18px;
  width: min(840px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  color: #ffffff;
}

.modal-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  box-shadow: none;
}
.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  transform: none;
}

.modal-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 24px 0;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.2);
}

.modal-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  padding: 10px 16px;
  font-size: 13.5px;
  box-shadow: none;
}
.modal-tab:hover {
  background: transparent;
  color: #ffffff;
  transform: none;
}
.modal-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 700;
  background: transparent;
  transform: none;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  color: var(--ink-secondary);
  font-size: 14px;
  line-height: 1.65;
}

.modal-body h4 {
  color: var(--brand);
  font-size: 16px;
  margin: 18px 0 8px;
}
.modal-body h4:first-child {
  margin-top: 0;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.3);
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

