/* =====================================================================
   FWNET Docs — identidade visual
   Cores oficiais (Manual de Identidade Visual FWNET):
     #00cd61 verde · #006380 azul-petróleo · #666666 cinza
   Fonte oficial: Geom Graphic. Se os arquivos da fonte forem colocados em
   /static/fonts (GeomGraphic-*.woff2) ela é usada; senão, Outfit (livre,
   geométrica e muito próxima) é o substituto.
   ===================================================================== */

@font-face { font-family: "Geom Graphic"; font-weight: 300; src: local("Geom Graphic Light"), local("GeomGraphic-Light"), url("/static/fonts/GeomGraphic-Light.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Geom Graphic"; font-weight: 400; src: local("Geom Graphic"), local("GeomGraphic-Regular"), url("/static/fonts/GeomGraphic-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Geom Graphic"; font-weight: 600; src: local("Geom Graphic SemiBold"), local("GeomGraphic-SemiBold"), url("/static/fonts/GeomGraphic-SemiBold.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Geom Graphic"; font-weight: 700; src: local("Geom Graphic Bold"), local("GeomGraphic-Bold"), url("/static/fonts/GeomGraphic-Bold.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Outfit"; font-weight: 100 900; src: url("/static/fonts/outfit-latin-wght.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; src: url("/static/fonts/jetbrains-mono-400.woff2") format("woff2"); font-display: swap; }

:root {
  --green: #00cd61;
  --green-600: #00a84f;
  --green-700: #008a41;
  --petrol: #006380;
  --petrol-700: #004e66;
  --petrol-800: #003a4c;
  --petrol-900: #002a37;
  --gray: #666666;
  --brand-grad: linear-gradient(120deg, #3a3f4d 0%, #2f6b7a 45%, #4fb46a 80%, #6cc95f 100%);

  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --surface-3: #eef2f4;
  --border: #e1e7eb;
  --border-strong: #cdd6dc;
  --text: #1c2830;
  --text-2: #4d5b64;
  --text-3: #7b8891;
  --link: var(--petrol);
  --primary: var(--petrol);
  --primary-hover: var(--petrol-700);
  --primary-text: #ffffff;
  --accent: var(--green);
  --accent-soft: #e3f9ec;
  --accent-text: #007a3a;
  --petrol-soft: #e1f0f4;
  --danger: #d13b3b;
  --danger-soft: #fdecec;
  --warn: #b86e00;
  --warn-soft: #fff4e0;
  --info: #1f6fd1;
  --info-soft: #e8f1fd;
  --shadow-sm: 0 1px 2px rgba(16, 40, 52, .06);
  --shadow: 0 1px 2px rgba(16, 40, 52, .05), 0 4px 16px rgba(16, 40, 52, .06);
  --shadow-lg: 0 12px 40px rgba(10, 30, 40, .18);
  --radius: 12px;
  --radius-sm: 8px;

  --side-bg: linear-gradient(180deg, #00303d 0%, #003847 60%, #003342 100%);
  --side-text: #b9ccd3;
  --side-text-strong: #ffffff;
  --side-hover: rgba(255, 255, 255, .06);
  --side-active: rgba(0, 205, 97, .12);

  --font: "Geom Graphic", "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c171c; --surface: #122128; --surface-2: #152730; --surface-3: #1a2f39;
    --border: #213843; --border-strong: #2d4855; --text: #e3edf1; --text-2: #a9bcc4; --text-3: #7d929b;
    --link: #3fc0e0; --primary: #0a7ea1; --primary-hover: #0b8fb6; --accent-soft: rgba(0, 205, 97, .12);
    --accent-text: #3ee08a; --petrol-soft: rgba(0, 150, 190, .14); --danger-soft: rgba(209, 59, 59, .16);
    --warn: #f0a33a; --warn-soft: rgba(240, 163, 58, .14); --info: #6aa8f5; --info-soft: rgba(106, 168, 245, .14);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .2);
    --side-bg: linear-gradient(180deg, #071d25 0%, #08222b 100%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c171c; --surface: #122128; --surface-2: #152730; --surface-3: #1a2f39;
  --border: #213843; --border-strong: #2d4855; --text: #e3edf1; --text-2: #a9bcc4; --text-3: #7d929b;
  --link: #3fc0e0; --primary: #0a7ea1; --primary-hover: #0b8fb6; --accent-soft: rgba(0, 205, 97, .12);
  --accent-text: #3ee08a; --petrol-soft: rgba(0, 150, 190, .14); --danger-soft: rgba(209, 59, 59, .16);
  --warn: #f0a33a; --warn-soft: rgba(240, 163, 58, .14); --info: #6aa8f5; --info-soft: rgba(106, 168, 245, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .2);
  --side-bg: linear-gradient(180deg, #071d25 0%, #08222b 100%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
code, .mono { font-family: var(--mono); font-size: .92em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.ic.sm { width: 15px; height: 15px; vertical-align: -2px; }
.ic.lg { width: 22px; height: 22px; }
.muted { color: var(--text-3); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side {
  background: var(--side-bg); color: var(--side-text); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; overflow: hidden; z-index: 20;
}
.side::after { /* faixa com o degradê do símbolo */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--brand-grad);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 18px; color: #fff; text-decoration: none !important; }
.brand img { width: 36px; height: 36px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0,0,0,.3)); }
.wordmark { font-size: 25px; line-height: 1; letter-spacing: .02em; color: #fff; }
.wordmark b { font-weight: 800; }
.wordmark span { font-weight: 300; }
.brand small { display: block; font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--green); margin-top: 5px; font-weight: 500; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 24px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-section { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: #6f8f9a; padding: 18px 10px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--side-text);
  text-decoration: none; font-weight: 450; position: relative; margin: 1px 0;
}
.nav a:hover { background: var(--side-hover); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; font-weight: 550; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--green); }
.nav a.active .ic { color: var(--green); }
.nav .count { margin-left: auto; font-size: 11.5px; color: #7fa1ac; font-variant-numeric: tabular-nums; }
.nav a.active .count { color: #b5e9cc; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; display: flex; align-items: center; gap: 14px; padding: 0 28px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 15;
}
.topbar .menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13.5px; min-width: 0; white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--text-2); }
.crumbs .sep { opacity: .5; }
.crumbs strong { color: var(--text); font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
.searchbox {
  margin-left: auto; display: flex; align-items: center; gap: 10px; width: min(380px, 40vw); height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text-3); cursor: text;
}
.searchbox:hover { border-color: var(--border-strong); }
.searchbox kbd { margin-left: auto; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-3); }
.userchip { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 4px; border-radius: 99px; border: 1px solid transparent; cursor: pointer; background: none; }
.userchip:hover { background: var(--surface-2); border-color: var(--border); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; color: #fff; background: linear-gradient(135deg, var(--petrol), var(--green-600)); }
.userchip .who { text-align: left; line-height: 1.2; }
.userchip .who small { display: block; color: var(--text-3); font-size: 11.5px; }

.content { padding: 28px 32px 60px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---------------------------------------------------------------- componentes */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer;
  font-weight: 500; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.accent { background: var(--green); border-color: var(--green); color: #00301a; }
.btn.accent:hover { background: #00b857; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn.icon { width: 36px; padding: 0; justify-content: center; }
.btn.icon.sm { width: 30px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-h h3 { font-size: 15px; }
.card-h .ic { color: var(--petrol); }
[data-theme="dark"] .card-h .ic { color: var(--link); }
.card-b { padding: 16px 18px; }
.card-b.flush { padding: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; }

.page-h { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-h h1 { font-size: 26px; line-height: 1.2; }
.page-h .sub { color: var(--text-3); margin-top: 3px; font-size: 14px; }
.page-h .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.tile {
  width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; flex: none;
  color: var(--tc, var(--petrol)); background: color-mix(in srgb, var(--tc, var(--petrol)) 13%, transparent);
}
.tile .ic { width: 24px; height: 24px; }
.tile.sm { width: 32px; height: 32px; border-radius: 9px; }
.tile.sm .ic { width: 17px; height: 17px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 500; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.nodot::before { display: none; }
.pill.s-prod { background: var(--accent-soft); color: var(--accent-text); }
.pill.s-homol { background: var(--info-soft); color: var(--info); }
.pill.s-manut { background: var(--warn-soft); color: var(--warn); }
.pill.s-off { background: var(--surface-3); color: var(--text-3); }
.pill.s-decom { background: var(--danger-soft); color: var(--danger); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12.5px; background: var(--petrol-soft); color: var(--petrol); margin: 2px 4px 2px 0; }
[data-theme="dark"] .tag { color: var(--link); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------------------------------------------------------------- tabela */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.input, .select, textarea.input {
  height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface);
  min-width: 0; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; padding: 9px 12px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--petrol); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }
.input.search { padding-left: 36px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237b8891' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 12px center; }
.select { padding-right: 30px; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237b8891' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; }
/* A lista aberta herda o fundo do select; com fundos translúcidos (seletores do topo no tema
   escuro) o Chromium no Windows a desenha sobre branco e o texto claro some. Cores sólidas: */
.select option, .select optgroup { background-color: var(--surface); color: var(--text); }

.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
table.t th {
  text-align: left; font-weight: 550; color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0;
}
table.t th.sortable { cursor: pointer; user-select: none; }
table.t th.sortable:hover { color: var(--text); }
table.t th .arrow { opacity: .8; }
table.t td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td { background: var(--surface-2); }
table.t td.name a { font-weight: 550; color: var(--text); }
table.t tr.group td { background: var(--surface-3); font-weight: 600; font-size: 13px; color: var(--text-2); padding: 7px 14px; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.card > .table-wrap:first-child table.t th:first-child { border-top-left-radius: var(--radius); }
.card > .table-wrap:first-child table.t th:last-child { border-top-right-radius: var(--radius); }

.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .tile { margin: 0 auto 14px; width: 60px; height: 60px; border-radius: 16px; }
.empty h3 { color: var(--text); margin-bottom: 6px; font-size: 17px; }
.empty p { margin: 0 0 18px; }

/* ---------------------------------------------------------------- dashboard */
.hero {
  position: relative; overflow: hidden; border-radius: 16px; padding: 26px 28px; margin-bottom: 22px; color: #fff;
  background: linear-gradient(115deg, #00303d 0%, #004e63 55%, #00735a 100%);
}
.hero::after { /* onda inspirada no manual */
  content: ""; position: absolute; right: -80px; bottom: -120px; width: 520px; height: 260px; border-radius: 50%;
  border: 38px solid rgba(0, 205, 97, .16); transform: rotate(-12deg);
}
.hero h1 { font-size: 26px; font-weight: 600; }
.hero p { margin: 6px 0 0; color: #bfe0e8; max-width: 640px; }
.hero .actions { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); color: #fff; }
.hero .btn:hover { background: rgba(255,255,255,.18); }
.hero .btn.accent { background: var(--green); border-color: var(--green); color: #00301a; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat {
  display: flex; align-items: center; gap: 13px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); text-decoration: none !important; transition: border-color .12s, transform .12s, box-shadow .12s;
}
.stat:hover { border-color: var(--tc); box-shadow: var(--shadow); transform: translateY(-1px); }
.stat .n { font-size: 24px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--text-3); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .meta { margin-left: auto; color: var(--text-3); font-size: 12.5px; text-align: right; white-space: nowrap; }
.list a.title { color: var(--text); font-weight: 550; }
.alert-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.alert-row:last-child { border-bottom: 0; }
.alert-row .ic { margin-top: 2px; }

/* ---------------------------------------------------------------- detalhe */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.kv > div { padding: 9px 0; border-bottom: 1px dashed var(--border); min-width: 0; }
.kv > div.wide { grid-column: 1 / -1; }
.kv dt { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.kv dd { margin: 0; word-break: break-word; white-space: pre-line; }
.kv dd:empty::after { content: "—"; color: var(--text-3); }
.copyable { display: inline-flex; align-items: center; gap: 6px; }
.copy-btn { border: 0; background: none; padding: 2px; border-radius: 5px; cursor: pointer; color: var(--text-3); opacity: 0; transition: opacity .1s; }
.copyable:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--petrol); background: var(--surface-3); }
.secret { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); }
.secret .btn { font-family: var(--font); }
.ref { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 6px; border-radius: 7px; background: var(--surface-3); color: var(--text); font-weight: 500; margin: 2px 4px 2px 0; }
.ref:hover { background: var(--petrol-soft); text-decoration: none; }
.ref .ic { width: 14px; height: 14px; color: var(--tc); }
.ref.gone { opacity: .6; text-decoration: line-through; }
.side-card .list li { padding: 9px 16px; }
.meta-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.meta-grid span:nth-child(odd) { color: var(--text-3); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--petrol), var(--green)); }
.bar.warn > i { background: linear-gradient(90deg, #d48a00, #e8a93a); }
.bar.danger > i { background: linear-gradient(90deg, #b02a2a, #e05353); }
.alloc { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; align-items: center; font-size: 13px; margin: 8px 0; }
.ipinfo { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ipinfo div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; }
.ipinfo small { display: block; color: var(--text-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.ipinfo b { font-family: var(--mono); font-weight: 500; font-size: 14px; }
.chip-ip { font-family: var(--mono); font-size: 12.5px; padding: 3px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); border: 0; cursor: pointer; margin: 3px 4px 3px 0; }
.chip-ip:hover { outline: 1px solid var(--green); }

.graph { height: 380px; border-radius: 0 0 var(--radius) var(--radius); background:
  radial-gradient(circle, color-mix(in srgb, var(--text-3) 22%, transparent) 1px, transparent 1px) 0 0 / 22px 22px, var(--surface-2); }
.graph.tall { height: 560px; }

.md { line-height: 1.65; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { margin: 1.4em 0 .5em; }
.md h1 { font-size: 22px; } .md h2 { font-size: 19px; padding-bottom: 6px; border-bottom: 1px solid var(--border); } .md h3 { font-size: 16px; }
.md code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }
.md pre { background: #0f1f26; color: #d9e8ee; padding: 14px 16px; border-radius: 10px; overflow-x: auto; }
.md pre code { background: none; padding: 0; color: inherit; }
.md table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 14px; }
.md th, .md td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.md th { background: var(--surface-2); }
.md blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--green); background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.md img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }
.md .wikilink.missing { color: var(--danger); border-bottom: 1px dashed; }

.attach { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.att { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); position: relative; }
.att .thumb { height: 92px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.att .thumb img { width: 100%; height: 100%; object-fit: cover; }
.att .info { padding: 7px 9px; font-size: 12.5px; }
.att .info a { color: var(--text); font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .acts { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.att:hover .acts { opacity: 1; }
.att .acts button { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 3px; cursor: pointer; color: var(--text-2); display: grid; }
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: 10px; padding: 14px; text-align: center; color: var(--text-3); cursor: pointer; font-size: 13px; margin-top: 10px; }
.dropzone.over, .dropzone:hover { border-color: var(--green); color: var(--accent-text); background: var(--accent-soft); }
.gallery img { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); display: block; margin: 0 auto 12px; }
.drawing { margin: 0 0 16px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.drawing > a { display: block; padding: 12px; text-align: center; cursor: zoom-in; }
.drawing img { border: 0; border-radius: 4px; margin: 0 auto; max-height: 75vh; object-fit: contain; }
.drawing figcaption { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 12px; font-size: 13px; border-top: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.pastezone { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1.5px dashed var(--border-strong); border-radius: 12px; color: var(--text-2); background: var(--surface-2); outline: none; transition: border-color .12s, background .12s; }
.pastezone > .ic { color: var(--petrol); flex: none; }
.pastezone > div { flex: 1; min-width: 0; }
.pastezone:hover, .pastezone:focus, .pastezone.over { border-color: var(--green); background: var(--accent-soft); }
.pastezone.busy { opacity: .6; pointer-events: none; }

.diff { font-size: 13px; margin: 6px 0 0; padding: 0; list-style: none; }
.diff li { padding: 3px 0; }
.diff del { color: var(--danger); background: var(--danger-soft); text-decoration: line-through; padding: 0 4px; border-radius: 4px; }
.diff ins { color: var(--accent-text); background: var(--accent-soft); text-decoration: none; padding: 0 4px; border-radius: 4px; }
.timeline li { align-items: flex-start; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); margin-top: 6px; flex: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------------------------------------------------------------- formulário */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > label { font-size: 13px; font-weight: 550; color: var(--text-2); }
.field > label .req { color: var(--danger); margin-left: 2px; }
.field .help { font-size: 12px; color: var(--text-3); }
.field .err { font-size: 12.5px; color: var(--danger); display: none; }
.field.invalid .err { display: block; }
.field.invalid .input, .field.invalid .select, .field.invalid .refpick { border-color: var(--danger); }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--border-strong); border-radius: 99px; cursor: pointer; font-size: 13px; user-select: none; }
.checks input { display: none; }
.checks label:has(input:checked) { background: var(--petrol-soft); border-color: var(--petrol); color: var(--petrol); font-weight: 550; }
[data-theme="dark"] .checks label:has(input:checked) { color: var(--link); border-color: var(--link); }
.refpick { position: relative; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 6px; min-height: 38px; align-items: center; }
.refpick:focus-within { border-color: var(--petrol); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }
.refpick input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 120px; height: 28px; padding: 0 4px; }
.refpick .ref { margin: 0; }
.refpick .ref button { border: 0; background: none; cursor: pointer; color: var(--text-3); padding: 0 0 0 2px; display: grid; }
.refpick .ref button:hover { color: var(--danger); }
.refmenu { position: absolute; left: -1px; right: -1px; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 290px; overflow-y: auto; z-index: 30; padding: 4px; }
.refmenu div { padding: 7px 10px; border-radius: 7px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.refmenu div.on, .refmenu div:hover { background: var(--petrol-soft); }
.refmenu small { margin-left: auto; color: var(--text-3); font-family: var(--mono); }
.refmenu .none { color: var(--text-3); cursor: default; }
.secret-input { display: flex; gap: 6px; }
.secret-input .input { flex: 1; font-family: var(--mono); }
.form-actions { position: sticky; bottom: 0; display: flex; gap: 10px; justify-content: flex-end; padding: 14px 0; margin-top: 8px; background: linear-gradient(transparent, var(--bg) 30%); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; }
.tabs button { border: 0; background: none; padding: 10px 12px; cursor: pointer; color: var(--text-3); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--green); }
.mdtools { display: flex; gap: 2px; margin-left: auto; align-items: center; }
.md-editor { width: 100%; min-height: 320px; border: 0; padding: 16px 18px; background: transparent; resize: vertical; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; outline: none; }
.md-preview { padding: 16px 18px; min-height: 320px; }

/* ---------------------------------------------------------------- modal, toast, palette */
.overlay { position: fixed; inset: 0; background: rgba(5, 20, 26, .5); backdrop-filter: blur(2px); display: grid; place-items: start center; padding: 9vh 16px 16px; z-index: 100; animation: fade .12s ease-out; }
.modal { width: min(520px, 100%); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden; animation: pop .15s ease-out; max-height: 84vh; display: flex; flex-direction: column; }
.modal.wide { width: min(760px, 100%); }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal-h h3 { font-size: 17px; }
.modal-b { padding: 18px 20px; overflow-y: auto; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 10px; background: #102a33; color: #fff; box-shadow: var(--shadow-lg); animation: pop .15s ease-out; max-width: 420px; font-size: 14px; }
.toast .ic { color: var(--green); }
.toast.error .ic { color: #ff7b7b; }
.palette { width: min(640px, 100%); }
.palette input { width: 100%; border: 0; padding: 18px 20px; font-size: 17px; background: transparent; outline: none; border-bottom: 1px solid var(--border); }
.palette .results { max-height: 420px; overflow-y: auto; padding: 6px; }
.palette .res { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer; color: var(--text); text-decoration: none !important; }
.palette .res.on { background: var(--petrol-soft); }
.palette .res .t { font-weight: 550; }
.palette .res small { color: var(--text-3); display: block; font-size: 12.5px; }
.palette .res .k { margin-left: auto; color: var(--text-3); font-size: 12px; }
.palette .hint { padding: 9px 16px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12px; display: flex; gap: 14px; background: var(--surface-2); }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.login-art { position: relative; overflow: hidden; background: linear-gradient(150deg, #00303d 0%, #004d62 50%, #006380 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: flex-end; }
.login-art svg { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 55%; }
.login-art .claim { position: relative; z-index: 1; }
.login-art .claim .wordmark { font-size: 44px; }
.login-art p { color: #bfe0e8; font-size: 17px; max-width: 440px; }
.login-form { display: grid; place-items: center; padding: 40px 24px; }
.login-form form { width: min(360px, 100%); }
.login-form img { width: 230px; margin-bottom: 30px; }
.login-form h2 { font-size: 22px; margin-bottom: 4px; }
.login-form .field { margin-top: 14px; }
.login-form .btn { width: 100%; justify-content: center; height: 42px; margin-top: 22px; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 9px 12px; border-radius: 8px; font-size: 13.5px; margin-top: 14px; }

/* ---------------------------------------------------------------- mapa */
.map-wrap { display: grid; grid-template-columns: 1fr; gap: 12px; }
.map-canvas { height: calc(100vh - 240px); min-height: 420px; border-radius: var(--radius); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend label { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--border-strong); cursor: pointer; font-size: 13px; background: var(--surface); user-select: none; }
.legend label .sw { width: 9px; height: 9px; border-radius: 50%; background: var(--tc); }
.legend input { display: none; }
.legend label:not(:has(input:checked)) { opacity: .45; }
.nodeinfo { position: absolute; right: 14px; top: 14px; width: 260px; z-index: 5; }

.admin-lists { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.admin-lists .list li { cursor: pointer; padding: 9px 16px; }
.admin-lists .list li.on { background: var(--petrol-soft); font-weight: 550; }

/* ---------------------------------------------------------------- multi-tenant */
.tenant-switch { display: flex; align-items: center; gap: 6px; margin-left: auto; color: var(--text-3); }
.tenant-switch .select { height: 36px; min-width: 190px; max-width: 260px; font-weight: 550; color: var(--text); border-color: var(--petrol); background-color: var(--petrol-soft); }
.tenant-switch + .searchbox { margin-left: 0; }
.tenant-pill { background: var(--petrol-soft); color: var(--petrol); font-weight: 550; }
.tenant-pill .ic { width: 13px; height: 13px; }
[data-theme="dark"] .tenant-pill { color: var(--link); }
.page-h .sub .tenant-pill { margin-left: 4px; vertical-align: 1px; }
.tenant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.tenant-card { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; text-align: left; transition: border-color .12s, background .12s; }
.tenant-card:hover { border-color: var(--petrol); background: var(--petrol-soft); }
.tenant-card b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-card small { color: var(--text-3); font-size: 12.5px; }
.perm-matrix td:not(:first-child), .perm-matrix th:not(:first-child) { text-align: center; }
.perm-matrix td:first-child { font-weight: 550; }

/* ---------------------------------------------------------------- responsivo */
@media (max-width: 1100px) {
  .detail, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 262px; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: var(--shadow-lg); }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 48px; }
  .searchbox { width: auto; flex: 1; }
  .searchbox span, .searchbox kbd, .userchip .who { display: none; }
  .tenant-switch .select { min-width: 0; max-width: 150px; }
  .tenant-switch > .ic { display: none; }
  .form-grid, .kv { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .admin-lists { grid-template-columns: 1fr; }
  .crumbs { display: none; }
}

/* ---------------------------------------------------------------- unidades (filiais) */
.unit-sep { color: var(--text-3); font-weight: 600; }
.tenant-switch .unit-select { min-width: 160px; border-color: var(--green-600); background-color: var(--accent-soft); }
.tenant-tree .tenant-row td { background: var(--surface-2); }
.tenant-tree .unit-row td.name { padding-left: 34px; }
.tenant-tree .tree-line { color: var(--text-3); font-family: var(--mono); margin-right: 2px; }
.tenant-tree .unit-row .ic { color: var(--green-600); }
@media (max-width: 860px) { .tenant-switch .unit-select { min-width: 0; max-width: 130px; } }

/* ---------------------------------------------------------------- autenticação AD */
.ldap-steps { margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; }
.ldap-steps:empty { display: none; }
.ldap-steps li { align-items: flex-start; }
.pill.src-ad { background: var(--info-soft); color: var(--info); }
.login-hint { margin-top: 12px; padding: 9px 12px; border-radius: 8px; background: var(--petrol-soft); color: var(--text-2); font-size: 13px; display: flex; gap: 8px; align-items: center; }

/* Mapa de interfaces do switch (formulário) */
/* sem rolagem própria: senão o menu de busca de dispositivos fica cortado dentro da tabela */
.portmap .table-wrap { overflow: visible; }
.portmap .t td { padding: 6px 8px; vertical-align: middle; }
.portmap .refmenu { max-height: 240px; }
@media (max-width: 720px) {
  .portmap thead { display: none; }
  .portmap .t, .portmap tbody { display: block; }
  .portmap tr[data-pm-row] { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .portmap tr[data-pm-row] td { display: block; padding: 0; border: 0; }
  .portmap tr[data-pm-row] .input { width: 100%; }
  .portmap tr[data-pm-row] td:nth-child(2), .portmap tr[data-pm-row] td:nth-child(3) { grid-column: 1 / -1; }
  .portmap tr[data-pm-row] td:nth-child(4) { grid-row: 1; grid-column: 2; }
}
.portmap .t .input { height: 34px; }
.portmap .refpick { min-height: 34px; }
.portmap-tools { margin-top: 10px; gap: 8px; flex-wrap: wrap; }
.portmap-tools .input { flex: 1; min-width: 220px; max-width: 360px; height: 32px; }
