:root {
  --bg: #0b1220; --surface: rgba(18, 27, 46, .84); --surface2: rgba(30, 41, 64, .9); --border: rgba(255,255,255,.09);
  --text: #e6edf7; --muted: #94a3b8; --accent: #3b82f6; --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: transparent; color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--border); background: var(--surface2); border-radius: 8px; padding: 7px 12px; }
button:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
a.botao { display: inline-block; border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; color: var(--text); background: var(--surface2); }
a.botao.pri, button.pri { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.perigo { color: var(--bad); }
button.mini { padding: 3px 8px; font-size: 12px; }
input, select { background: rgba(255,255,255,.05); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; outline: none; }
input:focus, select:focus { border-color: var(--accent); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 20% 10%, #1d3a6e 0%, transparent 60%), radial-gradient(900px 500px at 90% 90%, #0f4c5c 0%, transparent 55%), var(--bg); }
.login form { width: 100%; max-width: 360px; background: rgba(18,27,46,.75); backdrop-filter: blur(14px); border: 1px solid var(--border); border-radius: 16px; padding: 28px; display: grid; gap: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.login img { width: 90px; margin: 0 auto 4px; display: block; }
.login h1 { margin: 0 0 6px; text-align: center; font-size: 20px; }
.login .erro { color: var(--bad); min-height: 20px; font-size: 13px; text-align: center; }

/* layout com menu lateral (igual aos demais WMSCloud) */
.casca { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px;
  background: rgba(14, 17, 25, .55); backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%); border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; font-size: 14.5px; }
.brand img { width: 40px; height: 36px; object-fit: contain; flex: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.brand .bt { display: flex; flex-direction: column; line-height: 1.2; }
.brand .bt small { font-weight: 500; font-size: 11px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.05); color: var(--text); }
.nav a.active { background: rgba(255,255,255,.09); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav svg { width: 17px; height: 17px; flex: none; }
.nav .badge { margin-left: auto; font-size: 11px; background: var(--warn); color: #111; border-radius: 99px; padding: 0 7px; font-weight: 700; }
.side .foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--muted); }
.side .foot .quem { color: var(--text); font-weight: 600; font-size: 13px; }
.side .foot .row2 { display: flex; gap: 6px; margin-top: 8px; }
.side .foot .row2 button { flex: 1; display: flex; justify-content: center; padding: 6px; }
.side .foot svg { width: 16px; height: 16px; }
.principal { min-width: 0; }
.principal main { max-width: 1400px; padding: 22px 28px 50px; margin: 0; }
.principal .aviso { margin: 18px 28px 0; }
h2.titulo { margin: 0 0 14px; font-size: 20px; }
.nav a.mob-only { display: none; }
@media (max-width: 820px) {
  .casca { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 12px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a { padding: 7px 10px; }
  .nav a.mob-only { display: flex; }
  .side .foot { display: none; }
  .brand { padding-bottom: 8px; }
  .principal main { padding: 16px 16px 40px; }
  .principal .aviso { margin: 12px 16px 0; }
}

header { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
header img { width: 40px; height: 32px; object-fit: contain; }
header h1 { font-size: 17px; margin: 0; }
header .ver { color: var(--muted); font-size: 12px; }
header .dir { margin-left: auto; display: flex; gap: 8px; align-items: center; color: var(--muted); }
.aviso { margin: 12px 20px 0; padding: 10px 14px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.aviso button { margin-left: auto; }
.cartoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.cartao { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.cartao b { display: block; font-size: 24px; }
.cartao span { color: var(--muted); font-size: 12px; }
.barra { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.barra .esp { flex: 1; }
.caixa { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
tr.clica { cursor: pointer; }
tr.clica:hover td { background: rgba(255,255,255,.03); }
.mut { color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Code", Menlo, monospace; font-size: 13px; }
.bola { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: var(--muted); }
.bola.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; border: 1px solid var(--border); }
.tag.direto { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.tag.relay { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.tag.tentando { color: var(--muted); }
.tag.pede { color: var(--warn); }
.tag.azul { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }

/* janela */
.fundo { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; z-index: 20; }
.janela { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 760px; max-height: 90vh; overflow: auto; padding: 20px; }
.janela h2 { margin: 0 0 14px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.janela .fechar { margin-left: auto; }
.grade { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; align-items: center; margin-bottom: 16px; }
.grade > .mut { font-size: 13px; }
.cmd { background: #070c16; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; position: relative; }
.cmd button { position: absolute; top: 6px; right: 6px; }
.secao { margin: 18px 0 8px; font-weight: 600; }
#toasts { position: fixed; bottom: 16px; right: 16px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--surface2); border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 8px; max-width: 360px; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.toast.erro { border-left-color: var(--bad); }
@media (max-width: 640px) {
  .grade { grid-template-columns: 1fr; }
}

/* mapa */
.mapa { padding: 6px; background: radial-gradient(800px 420px at 50% 50%, #13213b 0%, var(--surface) 70%); }
.mapa svg { width: 100%; height: auto; display: block; min-height: 420px; }
.mapa .lig { fill: none; stroke-width: 2.5; transition: opacity .2s; }
.mapa .lig.direto { stroke: var(--ok); stroke-dasharray: 10 6; animation: fluxo 1.2s linear infinite; filter: drop-shadow(0 0 3px rgba(34,197,94,.6)); }
.mapa .lig.relay { stroke: var(--warn); stroke-dasharray: 4 6; opacity: .85; animation: fluxo 2.4s linear infinite; }
.mapa .lig:hover { stroke-width: 5; }
.mapa .raio { stroke: rgba(148,163,184,.12); stroke-width: 1; }
.mapa .raio.on { stroke: rgba(59,130,246,.28); }
.mapa .apagada { opacity: .12; }
.mapa .no { cursor: pointer; transition: opacity .2s; }
.mapa .no circle { fill: var(--surface2); stroke: var(--cor); stroke-width: 3; }
.mapa .no.on circle { filter: drop-shadow(0 0 6px var(--cor)); }
.mapa .no.off circle { stroke: #475569; fill: #0f172a; }
.mapa .no.off .nm { fill: var(--muted); }
.mapa .no:hover circle { stroke-width: 5; }
.mapa text { fill: var(--text); font-size: 13px; pointer-events: none; }
.mapa text.ic { text-anchor: middle; font-size: 15px; }
.mapa text.nm { font-weight: 600; }
.mapa text.sub { fill: var(--muted); font-size: 11px; }
.mapa .central .cc { fill: #1e3a8a; stroke: #60a5fa; stroke-width: 3; }
.mapa .central text.ic { font-size: 20px; }
@keyframes fluxo { to { stroke-dashoffset: -32; } }
.legenda { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; margin-left: 6px; }
.legenda i { display: inline-block; width: 22px; height: 0; border-top: 3px dashed; margin-left: 8px; }
.legenda .l-dir { border-color: var(--ok); }
.legenda .l-rel { border-color: var(--warn); border-top-style: dotted; }
.legenda .l-cen { border-color: rgba(59,130,246,.5); border-top-width: 1px; border-top-style: solid; }
@media (prefers-reduced-motion: reduce) { .mapa .lig { animation: none; } }

/* fundo do painel: o papel de parede do login, desfocado */
.fundo-app { position: fixed; inset: -60px; z-index: -2; background: center / cover no-repeat; filter: blur(22px) saturate(115%); opacity: 0; transition: opacity .8s ease; }
.fundo-app.on { opacity: 1; }
.fundo-veu { position: fixed; inset: 0; z-index: -1; background: rgba(9, 12, 20, .58); }
header { backdrop-filter: blur(12px); }
