/* Folchini NetAgent — identidade: preto/grafite, cinza e azul */
:root {
  --bg: #0C0F14;
  --panel: #151A23;
  --raised: #1B2230;
  --hover: #212A3A;
  --line: #283142;
  --line-soft: #1F2734;
  --text: #E7EBF1;
  --muted: #8D97A8;
  --faint: #5D687B;
  --blue: #2F7BFF;
  --blue-hi: #7FB0FF;
  --navy: #0B2A5B;
  --ok: #22C55E;
  --warn: #F5A524;
  --crit: #F04438;
  --r-s: 6px;
  --r-m: 10px;
  --f-head: "Bahnschrift", "DIN Alternate", "DIN 2014", "Roboto Condensed", "Arial Narrow", sans-serif;
  --f-body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  --f-data: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
a { color: var(--blue-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--f-head); font-weight: 600; letter-spacing: .01em; margin: 0; }
h1 { font-size: 22px; line-height: 1.2; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 .6em; }
code, .mono { font-family: var(--f-data); font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
::selection { background: var(--blue); color: #fff; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------------- layout ---------------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: #07090D; border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; border-bottom: 1px solid var(--line-soft); }
.brand img { width: 52px; height: 26px; }
.brand b { font-family: var(--f-head); font-size: 16px; display: block; line-height: 1.1; }
.brand span { color: var(--muted); font-size: 12px; }
.nav { overflow-y: auto; padding: 8px 8px 16px; flex: 1; }
.nav .grp { color: var(--faint); font-size: 12px; padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-s); color: var(--muted); font-size: 13.5px; }
.nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--raised); color: #fff; box-shadow: inset 3px 0 0 var(--blue); }
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav .badge { margin-left: auto; }
.side .me { border-top: 1px solid var(--line-soft); padding: 12px 14px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side .me b { color: var(--text); font-weight: 600; display: block; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line-soft); background: rgba(12,15,20,.92); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(6px); }
.top h1 { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .search { width: 280px; }
.btn.burger { display: none; }
.page { padding: 20px 24px 60px; max-width: 1500px; width: 100%; }
.sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------------- blocos ---------------- */
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-m); padding: 16px; }
.panel + .panel { margin-top: 16px; }
.grid > .panel + .panel, .split > .panel + .panel { margin-top: 0; }
.panel > header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel > header h2, .panel > header h3 { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid > *, .split > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.hidden { display: none !important; }
.empty { color: var(--muted); padding: 26px 10px; text-align: center; }
.empty b { color: var(--text); display: block; font-family: var(--f-head); font-size: 15px; margin-bottom: 4px; }

/* indicadores (faixa de leitura, não cartões repetidos) */
.meter { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--line-soft); border-radius: var(--r-m); background: var(--panel); overflow: hidden; }
.meter > a, .meter > div { padding: 14px 16px; border-right: 1px solid var(--line-soft); color: var(--text); }
.meter > :last-child { border-right: 0; }
.meter > a:hover { background: var(--raised); text-decoration: none; }
.meter.m4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.meter .v { font-family: var(--f-head); font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.meter .l { color: var(--muted); font-size: 12.5px; }
.meter .v.ok { color: var(--ok); } .meter .v.crit { color: var(--crit); } .meter .v.warn { color: var(--warn); } .meter .v.blue { color: var(--blue-hi); }

/* LED de status — como a luz de link da porta do switch */
.led { display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--faint); flex: none; vertical-align: middle; }
.led.online, .led.ok, .led.conforme, .led.concluido { background: var(--ok); box-shadow: 0 0 6px rgba(34,197,94,.7); }
.led.offline, .led.crit, .led.erro, .led.divergente { background: var(--crit); box-shadow: 0 0 6px rgba(240,68,56,.7); animation: blink 1.6s steps(2) infinite; }
.led.warn, .led.aguardando_aprovacao, .led.sem_dado { background: var(--warn); box-shadow: 0 0 6px rgba(245,165,36,.6); }
.led.executando, .led.na_fila { background: var(--blue); box-shadow: 0 0 6px rgba(47,123,255,.8); animation: blink .8s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.ports { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.port { font-family: var(--f-data); font-size: 11px; padding: 0 5px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); background: var(--bg); }
.port.hot { border-color: #6b2a24; color: #ffb3ab; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--raised); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.blue { color: var(--blue-hi); border-color: #234a8a; background: #0f1d36; }
.badge.ok { color: #86efac; border-color: #1d5133; background: #0d1f16; }
.badge.warn { color: #fcd34d; border-color: #5c4413; background: #21190a; }
.badge.crit { color: #fca5a5; border-color: #6b2a24; background: #230f0d; }
.count { background: var(--crit); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; font-weight: 700; }

/* ---------------- tabelas ---------------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r-m); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); background: #11161E; position: sticky; top: 0; white-space: nowrap; cursor: default; }
th.sort { cursor: pointer; }
th.sort:hover { color: var(--text); }
td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--hover); }
tbody tr.sel td { background: #13213A; }
td.data { font-family: var(--f-data); font-size: 12.5px; white-space: nowrap; }
td .t { font-weight: 600; }
td .s { color: var(--muted); font-size: 12px; }

/* ---------------- formulários ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--raised); color: var(--text); padding: 7px 13px; border-radius: var(--r-s); font: 600 13px var(--f-body); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #1f66e6; }
.btn.danger { color: #fca5a5; border-color: #6b2a24; background: #1c0f0e; }
.btn.danger:hover { background: #2b1412; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--raised); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
label.f > span { display: flex; justify-content: space-between; gap: 8px; }
input, select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-s); padding: 7px 10px; font: 13.5px var(--f-body); width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(47,123,255,.18); }
textarea { min-height: 70px; resize: vertical; }
textarea.data, input.data { font-family: var(--f-data); font-size: 12.5px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); flex: none; }
label.chk { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text); cursor: pointer; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form .full { grid-column: 1 / -1; }
.help { color: var(--faint); font-size: 12px; }
.search { position: relative; }
.search input { padding-left: 30px; }
.search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters > * { width: auto; min-width: 150px; }
.filters .search { min-width: 240px; flex: 1; }

/* ---------------- abas, modal, gaveta ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 9px 13px; font: 600 13px var(--f-body); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: #fff; border-bottom-color: var(--blue); }
.overlay { position: fixed; inset: 0; background: rgba(3,5,8,.7); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 30px 80px rgba(0,0,0,.55); }
.modal.wide { max-width: 980px; }
.modal > header { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.modal > header h2 { flex: 1; }
.modal > .body { padding: 18px; }
.modal > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-soft); }
.drawer-bd { position: fixed; inset: 0; background: rgba(3,5,8,.45); z-index: 39; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--panel); border-left: 1px solid var(--line); z-index: 40; display: flex; flex-direction: column; box-shadow: -30px 0 80px rgba(0,0,0,.5); animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer > header { padding: 16px 18px 0; }
.drawer > header .row { margin-bottom: 8px; }
.drawer > .body { padding: 0 18px 30px; overflow-y: auto; flex: 1; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
pre.json { background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--r-s); padding: 12px; font: 12px/1.45 var(--f-data); overflow: auto; max-height: 420px; color: #c9d4e5; white-space: pre-wrap; }
.log { background: #07090D; border: 1px solid var(--line-soft); border-radius: var(--r-s); padding: 10px 12px; font: 12px/1.6 var(--f-data); max-height: 220px; overflow: auto; color: #b8c4d8; }

/* progresso */
.bar { height: 6px; background: var(--raised); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy), var(--blue)); border-radius: 99px; transition: width .4s; }
.hbar { display: grid; grid-template-columns: 140px 1fr 40px; gap: 10px; align-items: center; font-size: 12.5px; margin: 6px 0; }
.hbar .track { height: 8px; background: var(--raised); border-radius: 2px; }
.hbar .track i { display: block; height: 100%; background: var(--blue); border-radius: 2px; }

/* lista de pendências/achados */
.issues { list-style: none; margin: 0; padding: 0; }
.issues li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.issues li:last-child { border-bottom: 0; }
.issues li .led { margin-top: 5px; }
.issues b { display: block; }

/* chat */
.chat { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 460px; }
.msgs { flex: 1; overflow-y: auto; padding: 4px 4px 12px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; line-height: 1.55; }
.msg.user { align-self: flex-end; background: var(--navy); border: 1px solid #1c4486; }
.msg.assistant { align-self: flex-start; background: var(--raised); border: 1px solid var(--line); }
.msg .tools { margin-top: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.composer { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.composer textarea { min-height: 46px; height: 46px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chips button { background: var(--raised); border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: 5px 12px; font: 12.5px var(--f-body); cursor: pointer; }
.chips button:hover { color: var(--text); border-color: var(--blue); }

/* toasts */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 90; }
.toast { background: var(--raised); border: 1px solid var(--line); border-left: 3px solid var(--blue); padding: 10px 14px; border-radius: var(--r-s); max-width: 380px; box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: 13px; }
.toast.err { border-left-color: var(--crit); }
.toast.ok { border-left-color: var(--ok); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 500px at 50% -10%, rgba(47,123,255,.16), transparent 60%), var(--bg); }
.login .box { width: 100%; max-width: 380px; }
.login .logo { width: 180px; display: block; margin: 0 auto 6px; }
.login .logo .inf { stroke-dasharray: 420; stroke-dashoffset: 420; animation: draw 1.6s ease-out .1s forwards; }
.login .logo .trace { opacity: 0; animation: fade .5s ease-out 1.4s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
.login h1 { text-align: center; font-size: 24px; }
.login .tag { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: 13px; }
.login form { display: grid; gap: 12px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px; padding: 20px; }
.login .err { color: #fca5a5; font-size: 13px; }

.snapshot { width: 100%; border-radius: var(--r-s); border: 1px solid var(--line); background: #000; min-height: 120px; }
.copy { display: flex; gap: 6px; align-items: stretch; }
.copy code { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-s); padding: 8px 10px; overflow-x: auto; white-space: nowrap; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix .grp td { background: #11161E; color: var(--muted); font-weight: 600; text-align: left; }

@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .meter:not(.m4) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .meter:not(.m4) > :nth-child(3) { border-right: 0; }
  .meter:not(.m4) > :nth-child(-n+3) { border-bottom: 1px solid var(--line-soft); }
}
@media (max-width: 820px) {
  .meter.m4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.6); }
  .btn.burger { display: inline-flex; }
  .top { padding: 10px 14px; }
  .top .search { display: none; }
  .page { padding: 14px 12px 60px; }
  .g2, .g3, .form { grid-template-columns: 1fr; }
  .meter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meter > * { border-bottom: 1px solid var(--line-soft); }
  .meter > :nth-child(odd) { border-right: 1px solid var(--line-soft) !important; }
  .meter > :nth-child(even) { border-right: 0 !important; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 6px; }
  .msg { max-width: 92%; }
  .hide-m { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .login .logo .inf { stroke-dashoffset: 0; } .login .logo .trace { opacity: 1; }
}
