/* ================================================================
   SGW V448 - IDENTIDADE VISUAL GLOBAL
   Paleta SGW: Navy + Azul vivo + Branco
   Semântica preservada: verde=sucesso/online, vermelho=erro/offline,
   amarelo=aviso.
   ================================================================ */

:root{
  --sgw448-navy-1000:#050d1c;
  --sgw448-navy-950:#07152f;
  --sgw448-navy-900:#0a1f46;
  --sgw448-navy-850:#0c2a5c;
  --sgw448-blue-800:#0b4db8;
  --sgw448-blue-700:#0b5ed7;
  --sgw448-blue-600:#1677ff;
  --sgw448-blue-500:#2f8cff;
  --sgw448-blue-400:#60a5fa;
  --sgw448-blue-200:#bfdbfe;
  --sgw448-blue-100:#dbeafe;
  --sgw448-blue-50:#eff6ff;

  --sgw448-canvas:#f5f9ff;
  --sgw448-surface:#ffffff;
  --sgw448-surface-soft:#f8fbff;
  --sgw448-text:#0f172a;
  --sgw448-muted:#64748b;
  --sgw448-line:#d8e6f6;

  --sgw448-success:#16a34a;
  --sgw448-success-soft:#dcfce7;
  --sgw448-danger:#dc2626;
  --sgw448-danger-soft:#fee2e2;
  --sgw448-warning:#d97706;
  --sgw448-warning-soft:#fef3c7;

  --sgw448-radius:14px;
  --sgw448-shadow:0 12px 32px rgba(7,31,70,.08);
  --sgw448-shadow-blue:0 12px 28px rgba(22,119,255,.18);
}

/* ----------------------- BASE / FUNDO ----------------------- */
html{
  accent-color:var(--sgw448-blue-600);
}

body{
  background:
    radial-gradient(circle at 100% 0, rgba(47,140,255,.09), transparent 29%),
    linear-gradient(180deg,#f9fcff 0%,var(--sgw448-canvas) 100%) !important;
  color:var(--sgw448-text) !important;
}

body .content-area,
body main.container{
  color:var(--sgw448-text);
}

body .muted,
body .mini,
body small{
  color:var(--sgw448-muted);
}

body h1,
body h2,
body h3,
body h4,
body h5,
body h6{
  color:var(--sgw448-navy-950);
}

body a{
  color:var(--sgw448-blue-700);
}

/* ----------------------- SIDEBAR ---------------------------- */
#sgw-sidebar-v39{
  background:
    radial-gradient(circle at 20% 0, rgba(47,140,255,.28), transparent 28%),
    linear-gradient(180deg,var(--sgw448-navy-950) 0%,var(--sgw448-navy-900) 52%,#0a3478 130%) !important;
  border-right:1px solid rgba(96,165,250,.25) !important;
  box-shadow:10px 0 32px rgba(5,13,28,.16) !important;
}

#sgw-sidebar-v39 .sgw53-brand{
  background:linear-gradient(135deg,rgba(22,119,255,.17),rgba(255,255,255,.03)) !important;
  border-bottom:1px solid rgba(147,197,253,.18) !important;
}

#sgw-sidebar-v39 .sgw53-logo{
  background:linear-gradient(135deg,#fff 0%,#dbeafe 48%,#60a5fa 100%) !important;
  color:var(--sgw448-navy-950) !important;
  box-shadow:0 7px 22px rgba(47,140,255,.30) !important;
}

#sgw-sidebar-v39 .sgw53-title{
  color:#fff !important;
  text-shadow:0 0 18px rgba(96,165,250,.25);
}

#sgw-sidebar-v39 .sgw53-sub{
  color:#93c5fd !important;
}

#sgw-sidebar-v39 .sgw53-item,
#sgw-sidebar-v39 .sgw53-parent{
  color:#dcecff !important;
}

#sgw-sidebar-v39 .sgw53-item:hover,
#sgw-sidebar-v39 .sgw53-parent:hover{
  background:rgba(47,140,255,.13) !important;
  color:#fff !important;
}

#sgw-sidebar-v39 .sgw53-item.active,
#sgw-sidebar-v39 .sgw53-parent.active{
  background:linear-gradient(90deg,rgba(22,119,255,.30),rgba(47,140,255,.08)) !important;
  color:#fff !important;
  box-shadow:inset 3px 0 0 var(--sgw448-blue-400) !important;
}

#sgw-sidebar-v39 .sgw53-submenu{
  background:rgba(4,16,38,.28) !important;
  border-color:rgba(96,165,250,.12) !important;
}

#sgw-sidebar-v39 .sgw53-badge,
#sgw-sidebar-v39 .pill{
  background:var(--sgw448-blue-600) !important;
  color:#fff !important;
}

/* ----------------------- CARDS / PAINÉIS -------------------- */
body .card,
body .panel,
body .table-card,
body .server-card,
body .provider-card,
body .integration-card,
body .stat-card,
body .metric-card,
body .summary-card,
body .info-card,
body .settings-card,
body .v166-card,
body .f151-card,
body .f164-card{
  background:linear-gradient(180deg,#fff 0%,#fbfdff 100%) !important;
  border-color:var(--sgw448-line) !important;
  box-shadow:var(--sgw448-shadow) !important;
}

body .card.link:hover,
body a.card:hover,
body .integration-card:hover{
  border-color:#93c5fd !important;
  box-shadow:var(--sgw448-shadow-blue) !important;
}

/* Heróis, kickers, títulos de módulos */
body .hero,
body .page-hero,
body .v154-hero,
body .v245-hero,
body .v395-hero{
  border-color:var(--sgw448-line) !important;
}

body .kicker,
body [class*="-kicker"]{
  color:var(--sgw448-blue-700) !important;
}

/* ----------------------- BOTÕES ----------------------------- */
body .btn.primary,
body button.primary,
body .btn-primary,
body [class*="-btn"].primary,
body [class*="-btn"]:not(.ghost):not(.danger):not(.delete):not(.reject):not(.ok):not(.success):not(.warning)[data-primary="1"]{
  background:linear-gradient(135deg,var(--sgw448-blue-700),var(--sgw448-blue-600) 55%,var(--sgw448-blue-500)) !important;
  border-color:transparent !important;
  color:#fff !important;
  box-shadow:0 8px 20px rgba(22,119,255,.24) !important;
}

body .btn.primary:hover,
body button.primary:hover,
body .btn-primary:hover{
  filter:brightness(1.06);
  box-shadow:0 11px 25px rgba(22,119,255,.31) !important;
}

body .btn.ghost,
body .btn-secondary,
body [class*="-btn"].ghost{
  background:#fff !important;
  color:var(--sgw448-blue-700) !important;
  border-color:#b8d6fb !important;
}

body .btn.ghost:hover,
body .btn-secondary:hover{
  background:var(--sgw448-blue-50) !important;
  border-color:var(--sgw448-blue-400) !important;
}

/* Botões genéricos que não têm intenção semântica */
body button:not(.danger):not(.delete):not(.reject):not(.ok):not(.success):not(.warning):not(.leaflet-control-zoom-in):not(.leaflet-control-zoom-out),
body .btn:not(.danger):not(.delete):not(.reject):not(.ok):not(.success):not(.warning){
  border-radius:10px;
}

/* ----------------------- FORMULÁRIOS ------------------------ */
body input:not([type="checkbox"]):not([type="radio"]),
body select,
body textarea{
  background:#fff !important;
  color:var(--sgw448-text) !important;
  border-color:#cddded !important;
}

body input:focus,
body select:focus,
body textarea:focus{
  border-color:var(--sgw448-blue-500) !important;
  box-shadow:0 0 0 3px rgba(22,119,255,.12) !important;
  outline:none !important;
}

body label{
  color:#334155;
}

/* ----------------------- TABELAS ---------------------------- */
body table{
  color:var(--sgw448-text);
}

body table thead th,
body .table-card thead th,
body [class*="table"] thead th{
  background:linear-gradient(180deg,#eef6ff,#e5f1ff) !important;
  color:var(--sgw448-navy-900) !important;
  border-color:#cfdef0 !important;
}

body table tbody td{
  border-color:#e3edf7 !important;
}

body table tbody tr:hover td{
  background:#f7fbff;
}

/* ----------------------- MODAIS ----------------------------- */
body .modal-box,
body .modal-card,
body .modal-floating-v16,
body .f151-modal-card,
body dialog{
  background:#fff;
  color:var(--sgw448-text);
  border-color:var(--sgw448-line) !important;
  box-shadow:0 26px 70px rgba(5,20,46,.22) !important;
}

body .modal-head,
body [class*="modal-head"]{
  border-color:var(--sgw448-line) !important;
}

/* ----------------------- BADGES / CHIPS --------------------- */
body .badge:not(.ativo):not(.online):not(.success):not(.ok):not(.bloqueado):not(.offline):not(.danger):not(.erro):not(.warning),
body .pill:not(.ativo):not(.online):not(.success):not(.ok):not(.bloqueado):not(.offline):not(.danger):not(.erro):not(.warning),
body .chip:not(.ativo):not(.online):not(.success):not(.ok):not(.bloqueado):not(.offline):not(.danger):not(.erro):not(.warning){
  background:var(--sgw448-blue-50) !important;
  color:var(--sgw448-blue-800) !important;
  border-color:var(--sgw448-blue-200) !important;
}

/* ----------------------- SEMÂNTICA PRESERVADA --------------- */
body .success,
body .ok,
body .online,
body .ativo,
body .badge.ativo,
body .badge.online,
body .badge.success{
  --sgw-semantic:var(--sgw448-success);
}

body .danger,
body .error,
body .erro,
body .offline,
body .bloqueado,
body .delete,
body .reject,
body .badge.bloqueado,
body .badge.offline,
body .badge.erro{
  --sgw-semantic:var(--sgw448-danger);
}

body .warning,
body .aviso,
body .pendente{
  --sgw-semantic:var(--sgw448-warning);
}

/* Apenas badges/chips semânticos; não muda containers grandes */
body .badge.ativo,
body .badge.online,
body .badge.success,
body .pill.online,
body .pill.success{
  background:var(--sgw448-success-soft) !important;
  color:#166534 !important;
  border-color:#86efac !important;
}

body .badge.bloqueado,
body .badge.offline,
body .badge.erro,
body .pill.offline,
body .pill.danger{
  background:var(--sgw448-danger-soft) !important;
  color:#991b1b !important;
  border-color:#fecaca !important;
}

body .badge.warning,
body .badge.pendente,
body .pill.warning{
  background:var(--sgw448-warning-soft) !important;
  color:#92400e !important;
  border-color:#fde68a !important;
}

/* ----------------------- DASHBOARD SGW ---------------------- */
body .sgw-dashboard,
body [class*="dashboard"]{
  --sgw-primary:var(--sgw448-blue-600);
}

body .kpi:not(.green):not(.danger):not(.red){
  border-color:#d6e6f8 !important;
}

body .kpi.sgw-selected,
body .sgw-selected{
  outline-color:rgba(22,119,255,.45) !important;
}

/* ----------------------- SCROLLBAR -------------------------- */
body{
  scrollbar-color:#7eb8fb #eaf3fe;
}

body ::-webkit-scrollbar-thumb{
  background:linear-gradient(var(--sgw448-blue-500),var(--sgw448-blue-700));
  border-radius:999px;
}

body ::-webkit-scrollbar-track{
  background:#edf5ff;
}

/* ================================================================
   TEMA ESCURO V166 - MESMA IDENTIDADE SGW EM NAVY
   ================================================================ */
html[data-sgw-theme="escuro"],
body.sgw-v166-dark{
  --sgw448-canvas:#050d1c;
  --sgw448-surface:#0b1b34;
  --sgw448-surface-soft:#0c2242;
  --sgw448-text:#edf6ff;
  --sgw448-muted:#9db4cf;
  --sgw448-line:#183c68;
}

body.sgw-v166-dark{
  background:
    radial-gradient(circle at 100% 0,rgba(22,119,255,.18),transparent 28%),
    linear-gradient(180deg,#061126 0%,#050d1c 100%) !important;
  color:var(--sgw448-text) !important;
}

body.sgw-v166-dark .content-area,
body.sgw-v166-dark main.container,
body.sgw-v166-dark .container{
  color:var(--sgw448-text) !important;
}

body.sgw-v166-dark h1,
body.sgw-v166-dark h2,
body.sgw-v166-dark h3,
body.sgw-v166-dark h4,
body.sgw-v166-dark h5,
body.sgw-v166-dark h6{
  color:#f4f9ff !important;
}

body.sgw-v166-dark .muted,
body.sgw-v166-dark .mini,
body.sgw-v166-dark small,
body.sgw-v166-dark label{
  color:#9db4cf;
}

body.sgw-v166-dark .card,
body.sgw-v166-dark .panel,
body.sgw-v166-dark .table-card,
body.sgw-v166-dark .server-card,
body.sgw-v166-dark .provider-card,
body.sgw-v166-dark .integration-card,
body.sgw-v166-dark .stat-card,
body.sgw-v166-dark .metric-card,
body.sgw-v166-dark .summary-card,
body.sgw-v166-dark .info-card,
body.sgw-v166-dark .settings-card,
body.sgw-v166-dark .v166-card,
body.sgw-v166-dark .f151-card,
body.sgw-v166-dark .f164-card{
  background:linear-gradient(180deg,#0d2242,#0a1b35) !important;
  color:var(--sgw448-text) !important;
  border-color:#1a4778 !important;
  box-shadow:0 14px 36px rgba(0,0,0,.24) !important;
}

body.sgw-v166-dark input:not([type="checkbox"]):not([type="radio"]),
body.sgw-v166-dark select,
body.sgw-v166-dark textarea{
  background:#07182f !important;
  color:#edf6ff !important;
  border-color:#24507d !important;
}

body.sgw-v166-dark table{
  color:#eaf4ff !important;
}

body.sgw-v166-dark table thead th,
body.sgw-v166-dark .table-card thead th,
body.sgw-v166-dark [class*="table"] thead th{
  background:linear-gradient(180deg,#102d55,#0d274a) !important;
  color:#eaf4ff !important;
  border-color:#214b77 !important;
}

body.sgw-v166-dark table tbody td{
  border-color:#173c65 !important;
}

body.sgw-v166-dark table tbody tr:hover td{
  background:#0e294c;
}

body.sgw-v166-dark .modal-box,
body.sgw-v166-dark .modal-card,
body.sgw-v166-dark .modal-floating-v16,
body.sgw-v166-dark .f151-modal-card,
body.sgw-v166-dark dialog{
  background:#0b1b34 !important;
  color:#edf6ff !important;
  border-color:#24507d !important;
}

body.sgw-v166-dark .btn.ghost,
body.sgw-v166-dark .btn-secondary,
body.sgw-v166-dark [class*="-btn"].ghost{
  background:#0b203d !important;
  color:#a9d1ff !important;
  border-color:#2c5f94 !important;
}

body.sgw-v166-dark .badge:not(.ativo):not(.online):not(.success):not(.ok):not(.bloqueado):not(.offline):not(.danger):not(.erro):not(.warning),
body.sgw-v166-dark .pill:not(.ativo):not(.online):not(.success):not(.ok):not(.bloqueado):not(.offline):not(.danger):not(.erro):not(.warning){
  background:#0f2d54 !important;
  color:#b9dbff !important;
  border-color:#285b91 !important;
}

/* Não mexer no conteúdo cartográfico */
body.sgw-v435-map-page .leaflet-container{
  color:#222 !important;
}
