/* Interface operacional UFEM. Carregada por ultimo para neutralizar estilos legados. */
:root {
  --ui-bg: #f3f0e9;
  --ui-bg-soft: #e9f0ed;
  --ui-paper: #fffefb;
  --ui-paper-2: #f8f7f2;
  --ui-ink: #14272c;
  --ui-ink-2: #465b60;
  --ui-muted: #75878a;
  --ui-line: #d9dfdb;
  --ui-line-strong: #bdcbc7;
  --ui-navy: #0d2f35;
  --ui-navy-2: #164750;
  --ui-teal: #087f78;
  --ui-teal-soft: #d9eeea;
  --ui-amber: #d9822b;
  --ui-red: #bd3f42;
  --ui-green: #1f7a55;
  --ui-shadow: 0 12px 34px rgba(21, 48, 52, 0.08);
  --ui-shadow-sm: 0 3px 12px rgba(21, 48, 52, 0.07);
}

body,
body.theme-cyberpunk,
body.theme-emerald {
  --bg: var(--ui-bg);
  --bg-gradient: linear-gradient(135deg, var(--ui-bg) 0%, var(--ui-bg-soft) 100%);
  --panel: var(--ui-paper);
  --panel-2: var(--ui-paper-2);
  --panel-hover: #f0f5f2;
  --panel-active: var(--ui-teal-soft);
  --sunken: #eef2ef;
  --line: var(--ui-line);
  --line-strong: var(--ui-line-strong);
  --line-hover: var(--ui-teal);
  --line-active: var(--ui-teal);
  --txt: var(--ui-ink);
  --txt-dim: var(--ui-ink-2);
  --muted: var(--ui-muted);
  --accent: var(--ui-teal);
  --accent-glow: rgba(8, 127, 120, 0.16);
  --purple: #5269a5;
  --purple-glow: rgba(82, 105, 165, 0.14);
  --pink: #a94f72;
  --accent2: var(--ui-amber);
  --danger: var(--ui-red);
  --success: var(--ui-green);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --blur: none;
}

body.theme-stark {
  --ui-bg: #0e191c;
  --ui-bg-soft: #142326;
  --ui-paper: #16262a;
  --ui-paper-2: #1b2d31;
  --ui-ink: #edf5f3;
  --ui-ink-2: #c5d5d1;
  --ui-muted: #93aaa5;
  --ui-line: #30464a;
  --ui-line-strong: #426067;
  --ui-navy: #071114;
  --ui-navy-2: #102d33;
  --ui-teal: #5fc9bd;
  --ui-teal-soft: #203f40;
  --ui-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
  --ui-shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.2);
}

html { background: var(--ui-bg); }
body {
  color: var(--ui-ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(8, 127, 120, 0.08), transparent 30rem),
    linear-gradient(135deg, var(--ui-bg) 0%, var(--ui-bg-soft) 100%) fixed;
  font-family: "Outfit", Tahoma, sans-serif;
  letter-spacing: 0;
}

body::before,
.ag-canvas,
.ag-orb,
.snow,
.mascot,
.cyber-terminal-dock { display: none !important; }

.faixa-modo,
.faixa-modo.simulado,
.faixa-modo.desconhecido,
.faixa-modo.super-ativa-faixa {
  position: relative;
  z-index: 60;
  min-height: 30px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #dceae5;
  color: #1c5a4a;
  border: 0;
  border-bottom: 1px solid #c5d7d1;
  box-shadow: none;
  font: 600 11px/1.35 "Outfit", Tahoma, sans-serif;
  letter-spacing: 0.02em;
  text-transform: none;
  animation: none;
}
.faixa-modo.real { background: #f8dddd; color: #8f292d; border-color: #eabdbf; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--ui-navy) 96%, transparent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 28px rgba(8, 31, 35, 0.16);
  backdrop-filter: blur(14px);
}

header {
  min-height: 72px;
  max-width: 1500px;
  margin: auto;
  padding: 12px clamp(14px, 2.4vw, 30px);
  gap: 18px;
}
.brand { gap: 12px; }
.brand .drone { display: none; }
.logo {
  min-width: 52px;
  color: #fff;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-shadow: none;
}
.brand h1 { color: #fff; font-size: 17px; font-weight: 700; }
.brand h1 .sub { color: #a9c4c5; font-size: 11px; font-weight: 500; }
.chips { margin-top: 5px; gap: 5px; }
.chip {
  min-height: 21px;
  padding: 2px 7px;
  color: #d8e8e6;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  font-size: 10px;
}
.header-tools { gap: 8px; }
.search-box { width: min(32vw, 390px); }
.search-box input {
  min-height: 40px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}
.search-box input::placeholder { color: #aac0c1; }
.search-box input:focus { border-color: #65c8bc; box-shadow: 0 0 0 3px rgba(95, 201, 189, 0.16); }
.header-tools .ghost {
  min-height: 40px;
  color: #e6f0ef;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
}
.header-tools .ghost:hover { color: #fff; background: rgba(255, 255, 255, 0.13); }

.tabs {
  max-width: 1500px;
  margin: auto;
  padding: 0 clamp(14px, 2.4vw, 30px) 10px;
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  background: transparent;
  border: 0;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 11px;
  color: #b8cccd;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: none;
  font-size: 11.5px;
  font-weight: 600;
}
.tab-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.tab-btn.active {
  color: #0b3738;
  background: #d9f0eb;
  border-color: #d9f0eb;
  box-shadow: none;
}
.badge { background: var(--ui-amber); color: #fff; }
.menu-toggle { color: #fff; background: var(--ui-navy); border-color: rgba(255,255,255,.12); }

main {
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: clamp(16px, 2.5vw, 30px);
}
.tab { animation: uiReveal 220ms ease-out both; }
@keyframes uiReveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.painel,
.card,
.stat,
.chart-card,
.gauges-card,
.super-col,
.bi-card,
.jv-alertas {
  color: var(--ui-ink);
  background: var(--ui-paper);
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  box-shadow: var(--ui-shadow-sm);
  backdrop-filter: none;
}
.painel::before, .painel::after,
.card::before, .card::after,
.stat::before, .stat::after,
.chart-card::before, .chart-card::after,
.gauges-card::before, .gauges-card::after { display: none; }
.painel:hover, .card:hover, .stat:hover { border-color: var(--ui-line-strong); box-shadow: var(--ui-shadow); transform: none; }

h1, h2, h3, h4 { color: var(--ui-ink); letter-spacing: -0.02em; }
.hint, .muted, .stat-sub, .bi-kpi-sub { color: var(--ui-muted); }
.stat-top, .bi-kpi-lbl { color: var(--ui-ink-2); letter-spacing: 0.04em; }
.stat-num, .bi-kpi-num { color: var(--ui-ink); }
.stat.hot { border-color: #e7c5a2; background: #fffaf3; }
.stat.vendas, .bi-kpi.acento { border-color: #a8d3c8; }

button {
  border-radius: 9px;
  font-family: inherit;
  font-weight: 650;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}
button:hover:not(:disabled) { transform: translateY(-1px); }
.primary, .approve {
  color: #fff;
  background: var(--ui-teal);
  border-color: var(--ui-teal);
  box-shadow: 0 5px 14px rgba(8, 127, 120, 0.17);
}
.primary:hover:not(:disabled), .approve:hover:not(:disabled) { background: #066b66; }
.ghost { color: var(--ui-ink-2); background: var(--ui-paper); border-color: var(--ui-line-strong); }
.ghost:hover:not(:disabled) { color: var(--ui-ink); background: var(--ui-paper-2); }
.danger { color: var(--ui-red); background: #fff7f6; border-color: #e5b7b8; }

input, select, textarea, .super-textarea {
  color: var(--ui-ink);
  background: var(--ui-paper);
  border: 1px solid var(--ui-line-strong);
  border-radius: 9px;
  box-shadow: inset 0 1px 1px rgba(19, 44, 48, 0.03);
}
input:focus, select:focus, textarea:focus, .super-textarea:focus {
  border-color: var(--ui-teal);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(8, 127, 120, 0.13);
}

.tag, .pill, .on-badge, .chip-f, .chip-filtro {
  color: var(--ui-ink-2);
  background: var(--ui-paper-2);
  border-color: var(--ui-line);
}
.chip-f.sel, .chip-filtro.ativo { color: #fff; background: var(--ui-teal); border-color: var(--ui-teal); }

table { color: var(--ui-ink); background: var(--ui-paper); }
thead th { color: var(--ui-ink-2); background: var(--ui-paper-2); border-color: var(--ui-line); }
tbody td { border-color: var(--ui-line); }
tbody tr:hover { background: #f2f6f3; }

.super-layout { grid-template-columns: minmax(220px, .75fr) minmax(300px, 1.15fr) minmax(340px, 1.3fr); gap: 14px; }
.super-col { background: var(--ui-paper); border-color: var(--ui-line); box-shadow: var(--ui-shadow-sm); }
.super-col-head { color: var(--ui-ink); background: var(--ui-paper-2); border-color: var(--ui-line); }
.super-item { border-color: var(--ui-line); }
.super-item:hover { background: var(--ui-paper-2); }
.super-item.ativo { background: var(--ui-teal-soft); border-left-color: var(--ui-teal); }
.super-item.alerta { background: #fff8ee; border-left-color: var(--ui-amber); }
.super-nome, .super-msg-txt { color: var(--ui-ink); }
.super-time, .super-msg-at { color: var(--ui-muted); }
.super-hist-msgs { background: #f3f5f2; }
.super-msg-cliente { background: #fff; border-color: var(--ui-line); }
.super-msg-atendente { background: #dff0ec; border-color: #bfded7; }
.super-msg-bot { background: #eceafa; border-color: #d8d2ef; }
.super-msg-quem { color: var(--ui-teal); }
.super-textarea { min-height: 230px; font-family: inherit; }

.jv-alertas { background: #fffaf0; border-color: #ead8b9; box-shadow: none; }
.jv-alert { color: #72501e; background: transparent; border-color: #eddfc7; }
.toast { color: #fff; background: var(--ui-navy); border: 0; box-shadow: var(--ui-shadow); }
.modal-dialog, .jv-modal-box { color: var(--ui-ink); background: var(--ui-paper); border-color: var(--ui-line); box-shadow: 0 24px 70px rgba(9, 35, 39, 0.2); }

.bi-line { stroke: var(--ui-teal); }
.bi-line-2 { stroke: #5269a5; }
.bi-bar { fill: var(--ui-teal); }
.bi-bar-2 { fill: var(--ui-amber); }
.gauge-bg { stroke: #dfe5e1; }

@media (max-width: 1024px) {
  .super-layout { grid-template-columns: 1fr; }
  .super-lista, .super-hist-msgs { max-height: 360px; }
}

@media (max-width: 720px) {
  .faixa-modo { min-height: 28px; padding: 5px 10px; font-size: 10px; }
  header { min-height: 62px; padding: 10px 12px; }
  .logo { min-width: auto; font-size: 18px; }
  .brand h1 { font-size: 14px; }
  .brand h1 .sub, .chips, .header-tools .theme-btn { display: none; }
  .header-tools { margin-left: auto; }
  .header-tools .search-box { display: none; }
  .header-tools .ghost { min-height: 36px; padding: 7px 10px; font-size: 0; }
  .header-tools .ghost::first-letter { font-size: 16px; }
  .menu-toggle { display: flex; min-height: 43px; padding: 9px 13px; background: var(--ui-navy); }
  .tabs {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 75;
    width: min(86vw, 330px);
    height: 100dvh;
    padding: max(58px, env(safe-area-inset-top)) 12px 24px;
    display: none;
    flex-direction: column;
    gap: 3px;
    overflow-y: auto;
    background: var(--ui-navy);
    box-shadow: -18px 0 50px rgba(5, 24, 27, 0.26);
  }
  .tabs.open { display: flex; }
  .tab-btn { width: 100%; min-height: 44px; justify-content: flex-start; padding: 10px 13px; color: #c8d9d9; font-size: 13px; }
  .tab-btn.active { color: #0b3738; background: #d9f0eb; }
  .menu-backdrop { background: rgba(8, 28, 31, 0.48); backdrop-filter: blur(2px); }
  main { padding: 14px 10px 24px; }
  .painel, .card, .stat, .chart-card, .gauges-card, .bi-card { border-radius: 11px; }
  .actions, .super-btns { display: grid; grid-template-columns: 1fr; }
  .actions button, .super-btns button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Direcao final: fundo preto com informacao codificada por cor. */
:root, body, body.theme-cyberpunk, body.theme-stark, body.theme-emerald {
  --ui-bg:#000; --ui-bg-soft:#050708; --ui-paper:#0b0f11; --ui-paper-2:#111719;
  --ui-ink:#f2f7f6; --ui-ink-2:#c3d0ce; --ui-muted:#82928f;
  --ui-line:#232c2e; --ui-line-strong:#354346; --ui-navy:#05090a; --ui-navy-2:#0d2428;
  --ui-teal:#35d3c5; --ui-teal-soft:#102b2a; --ui-amber:#ffb84a;
  --ui-red:#ff6670; --ui-green:#46d590; --ui-shadow:0 18px 46px rgba(0,0,0,.42);
  --ui-shadow-sm:0 5px 18px rgba(0,0,0,.34); --bg:#000; --bg-gradient:#000;
  --panel:var(--ui-paper); --panel-2:var(--ui-paper-2); --panel-hover:#151d1f;
  --panel-active:var(--ui-teal-soft); --sunken:#050809; --line:var(--ui-line);
  --line-strong:var(--ui-line-strong); --txt:var(--ui-ink); --txt-dim:var(--ui-ink-2);
  --muted:var(--ui-muted); --accent:var(--ui-teal); --purple:#8da2ff; --pink:#ff78ad;
  --accent2:var(--ui-amber); --danger:var(--ui-red); --success:var(--ui-green);
}
html,body{background:#000;color:var(--ui-ink)}
body{background:radial-gradient(circle at 12% -10%,rgba(53,211,197,.1),transparent 28rem),radial-gradient(circle at 92% 20%,rgba(141,162,255,.07),transparent 25rem),#000 fixed}
.topbar{background:rgba(3,7,8,.96)}
.faixa-modo,.faixa-modo.simulado,.faixa-modo.desconhecido,.faixa-modo.super-ativa-faixa{color:#76e4bc;background:#071510;border-color:#173d2e}
.faixa-modo.real{color:#ff8d93;background:#1a0809;border-color:#4b1b1e}
.painel,.card,.stat,.chart-card,.gauges-card,.super-col,.bi-card,.jv-alertas{color:var(--ui-ink);background:linear-gradient(145deg,#0d1214,#090c0e);border-color:var(--ui-line)}
h1,h2,h3,h4,.stat-num,.bi-kpi-num,.super-nome,.super-msg-txt{color:var(--ui-ink)}
.hint,.muted,.stat-sub,.bi-kpi-sub,.super-time,.super-msg-at{color:var(--ui-muted)}
.stat-top,.bi-kpi-lbl{color:var(--ui-ink-2)}
.home-grid .stat:nth-child(4n+1){border-top:2px solid var(--ui-teal)}.home-grid .stat:nth-child(4n+1) .stat-num{color:var(--ui-teal)}
.home-grid .stat:nth-child(4n+2){border-top:2px solid var(--ui-amber)}.home-grid .stat:nth-child(4n+2) .stat-num{color:var(--ui-amber)}
.home-grid .stat:nth-child(4n+3){border-top:2px solid #8da2ff}.home-grid .stat:nth-child(4n+3) .stat-num{color:#8da2ff}
.home-grid .stat:nth-child(4n+4){border-top:2px solid #ff78ad}.home-grid .stat:nth-child(4n+4) .stat-num{color:#ff78ad}
.stat.hot{color:var(--ui-ink);background:#171107;border-color:#5b431b}.stat.vendas,.bi-kpi.acento{border-color:#1e654e}
input,select,textarea,.super-textarea,.search-box input{color:var(--ui-ink);background:#050809;border-color:var(--ui-line-strong)}
input::placeholder,textarea::placeholder,.search-box input::placeholder{color:#697a77}
.ghost{color:var(--ui-ink-2);background:#0b1012;border-color:var(--ui-line-strong)}.ghost:hover:not(:disabled){color:#fff;background:#151d1f}
.danger{color:var(--ui-red);background:#17090a;border-color:#552326}.tag,.pill,.on-badge,.chip-f,.chip-filtro{color:var(--ui-ink-2);background:#121719;border-color:var(--ui-line)}
table{color:var(--ui-ink);background:#0b0f11}thead th{color:#aebdbb;background:#121719;border-color:var(--ui-line)}tbody td{border-color:var(--ui-line)}tbody tr:hover{background:#11191a}
.super-col,.super-col-head{color:var(--ui-ink);background:#0b0f11;border-color:var(--ui-line)}.super-col-head{background:#121719}.super-item{border-color:var(--ui-line)}.super-item:hover{background:#12191b}.super-item.ativo{background:#102b2a;border-left-color:var(--ui-teal)}.super-item.alerta{background:#1b1308;border-left-color:var(--ui-amber)}
.super-hist-msgs{background:#050809}.super-msg-cliente{color:var(--ui-ink);background:#141a1c;border-color:#2b3638}.super-msg-atendente{color:var(--ui-ink);background:#0f302d;border-color:#1e5953}.super-msg-bot{color:var(--ui-ink);background:#1d2038;border-color:#343a67}.super-msg-quem{color:var(--ui-teal)}
.jv-alertas{color:#ffd795;background:#171106;border-color:#493616}.jv-alert{color:#ffd795;background:transparent;border-color:#493616}.modal-dialog,.jv-modal-box{color:var(--ui-ink);background:#0b0f11;border-color:var(--ui-line)}.gauge-bg{stroke:#253033}
@media(max-width:720px){.menu-toggle,.tabs{background:#05090a}}

@media (max-width: 559px) {
  html, body, #app, .topbar, main, .tab { width: 100%; max-width: 100%; overflow-x: hidden; }
  .menu-toggle { width: 100%; justify-content: space-between; }
  .home-grid, .telemetry-dashboard, .bi-grid, .bi-kpis, .grid2, .grid-auto, .grid-auto-lg {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .jv-alert, .jv-at, .stat, .painel, .card { min-width: 0; overflow-wrap: anywhere; }
  .jv-alert { white-space: normal; }
  .stat-num, .bi-kpi-num { white-space: normal; }
}
