:root {
  --bg: #0b1118; --panel: #121b26; --panel-2: #172332; --line: #223244; --text: #e6edf5; --muted: #8aa0b6;
  --accent: #38bdf8; --good: #34d399; --ok: #a3e635; --warn: #fbbf24; --bad: #f87171; --na: #64748b;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.35);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f6fa; --panel: #ffffff; --panel-2: #f1f5f9; --line: #d9e2ec; --text: #0f1b2a; --muted: #5b6f84;
    --accent: #0284c7; --good: #059669; --ok: #65a30d; --warn: #b45309; --bad: #dc2626; --na: #94a3b8;
    --shadow: 0 1px 2px rgba(15,27,42,.08); color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.right { margin-left: auto; }
.hidden { display: none !important; }

/* barra superior */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px; padding: 0 14px;
  height: 54px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .2px; margin-right: 10px; color: var(--text); white-space: nowrap; }
.brand svg { width: 26px; height: 26px; }
.userbox { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

main { max-width: 1280px; margin: 0 auto; padding: 18px 14px 60px; }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 26px 0 10px; display: flex; align-items: center; gap: 8px; }
.pagehead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

/* componentes */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 14px 16px; }
.btn { background: var(--panel-2); border: 1px solid var(--line); padding: 8px 13px; border-radius: 9px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #04121c; border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: .85em; }
.btn:disabled { opacity: .55; cursor: wait; }
input, select, textarea { width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=checkbox] { width: auto; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: .85em; color: var(--muted); margin-bottom: 4px; }
label.check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.help { font-size: .8em; color: var(--muted); margin-top: 3px; }
.search { max-width: 280px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; }
.stat .n { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: .85em; }
.stat.good .n { color: var(--good); } .stat.bad .n { color: var(--bad); } .stat.warn .n { color: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: .85em; color: var(--muted); }
.chip b { color: var(--text); }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--na); flex: none; }
.dot.online { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }
.dot.offline { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 25%, transparent); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bad) 8%, transparent); } }
@media (prefers-reduced-motion: reduce) { .dot.offline { animation: none; } }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75em; font-weight: 600; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.badge.good { color: var(--good); } .badge.bad { color: var(--bad); } .badge.warn { color: var(--warn); }

/* offline */
.alert { border-left: 4px solid var(--bad); }
.offline-item { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.offline-item:first-child { border-top: 0; }
.offline-item .cause { grid-column: 2; color: var(--text); background: var(--panel-2); border-radius: 8px; padding: 8px 10px; font-size: .9em; }
.warn-item { padding: 8px 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.warn-item:first-child { border-top: 0; }

/* setoriais */
.sectors { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.sector.stale { opacity: .72; }
.sector-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sector-head .title { font-weight: 700; }
.sector-body { max-height: 300px; overflow: auto; }
.client { display: grid; grid-template-columns: auto 1fr 120px; align-items: center; gap: 4px 10px; padding: 7px 14px; border-top: 1px solid var(--line); }
.client:first-child { border-top: 0; }
.client .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client.off { background: color-mix(in srgb, var(--bad) 7%, transparent); }
.empty { padding: 18px; color: var(--muted); text-align: center; }

.sig { display: flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; min-width: 0; }
.sig .bar { flex: 1; height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; min-width: 34px; }
.sig .bar i { display: block; height: 100%; background: var(--na); }
.sig.good .bar i { background: var(--good); } .sig.ok .bar i { background: var(--ok); }
.sig.warn .bar i { background: var(--warn); } .sig.bad .bar i { background: var(--bad); }
.sig.good b { color: var(--good); } .sig.ok b { color: var(--ok); } .sig.warn b { color: var(--warn); } .sig.bad b { color: var(--bad); }
.sig b { font-weight: 600; white-space: nowrap; }

/* tabelas */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: .78em; text-transform: uppercase; letter-spacing: .5px; border-top: 0; white-space: nowrap; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--panel-2); }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { margin-left: 4px; }
th.sticky, td.sticky { position: sticky; right: 0; background: var(--panel); box-shadow: -6px 0 8px -6px rgba(0,0,0,.35); }
tr.click:hover td.sticky { background: var(--panel-2); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 14px; }

.grid-devices { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.devtile { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; color: var(--text); }
.devtile:hover { border-color: var(--accent); text-decoration: none; }
.devtile .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* detalhe */
.hero { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 16px; }
.hero .name { font-size: 1.35rem; font-weight: 700; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1px; background: var(--line); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.kv > div { background: var(--panel); padding: 10px 14px; }
.kv .k { color: var(--muted); font-size: .78em; text-transform: uppercase; letter-spacing: .4px; }
.kv .v { font-weight: 600; margin-top: 2px; word-break: break-word; }
.bigsig { padding: 16px; }
.bigsig .num { font-size: 2.4rem; font-weight: 800; line-height: 1; }
.hints { margin: 0; padding: 0; list-style: none; }
.hints li { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.hints li:first-child { border-top: 0; }
.hints .ico { flex: none; width: 1.2em; text-align: center; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.tl { padding: 0; margin: 0; list-style: none; }
.tl li { padding: 8px 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.tl li:first-child { border-top: 0; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .box { width: 100%; max-width: 380px; padding: 26px; }
.login h1 { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.err { color: var(--bad); font-size: .9em; min-height: 1.3em; margin: 4px 0 10px; }

/* modal + toast */
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); padding: 0; width: min(560px, 94vw); max-height: 92vh; }
dialog::backdrop { background: rgba(2,8,14,.62); }
dialog form, dialog .dlg { padding: 18px 20px; max-height: 90vh; overflow: auto; }
dialog h3 { margin: 0 0 14px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.checklist { display: grid; gap: 6px; margin-bottom: 12px; max-height: 160px; overflow: auto; background: var(--panel-2); padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); background: var(--panel-2);
  border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { border-color: var(--bad); color: var(--bad); }
.progress { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-top: 6px; min-width: 120px; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .3s; }

@media (max-width: 640px) {
  main { padding: 12px 10px 50px; }
  .client { grid-template-columns: auto 1fr 100px; }
  th, td { padding: 8px 10px; }
  .stat .n { font-size: 1.6rem; }
}

/* mapa */
.mapwrap { overflow: auto; padding: 14px; }
.mapwrap.focus { padding: 6px; }
.mp-svg { display: block; margin: 0 auto; max-width: none; }
.mapwrap.focus .mp-svg { width: 100%; max-width: 980px; height: auto; max-height: 82vh; }
.mp-edge { fill: none; stroke: var(--line); stroke-width: 2.2; opacity: .9; }
.mp-edge.off { stroke-dasharray: 6 5; opacity: .8; }
.mp-edge.up { stroke: var(--muted); stroke-width: 2; }
.mp-ring { fill: none; stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 6; opacity: .7; }
.mp-node rect.bg { fill: var(--panel-2); stroke: var(--line); stroke-width: 1.2; }
.mp-node.virt rect.bg { stroke-dasharray: 5 4; }
.mp-node:hover rect.bg { stroke: var(--accent); }
.mp-node text { fill: var(--text); font-size: 13px; }
.mp-node .t1 { font-weight: 700; } .mp-node .t2 { fill: var(--muted); font-size: 11.5px; } .mp-node .t3 { fill: var(--muted); font-size: 11.5px; }
.mp-node .bad { fill: var(--bad); font-weight: 700; }
.mp-cl circle { fill: var(--panel); stroke-width: 3; }
.mp-cl circle.off { stroke-dasharray: 4 3; }
.mp-cl:hover circle { fill: var(--panel-2); }
.mp-cl text { text-anchor: middle; fill: var(--text); }
.mp-cl .sg { font-size: 13px; font-weight: 700; } .mp-cl .nm { font-size: 12px; fill: var(--muted); }
.mp-ap circle { fill: var(--panel-2); stroke-width: 4; }
.mp-ap .n1 { font-size: 13px; }
.mp-ap text { text-anchor: middle; fill: var(--text); } .mp-ap .n1 { font-size: 14px; font-weight: 700; } .mp-ap .n2 { font-size: 12px; fill: var(--muted); }
.mp-legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 10px 2px; color: var(--muted); font-size: .85em; }
.mp-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.mp-legend i.dash { background: none; border: 2px dashed var(--bad); }

/* editar rádio */
dialog.wide { width: min(780px, 96vw); }
.rc-h { margin: 16px 0 8px; font-size: .92rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.rc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.rc-impact { margin: 6px 0 14px; padding-left: 18px; } .rc-impact li { margin: 4px 0; }
.rc-steps { list-style: none; margin: 4px 0 12px; padding: 0; } .rc-steps li { padding: 5px 0 5px 24px; position: relative; color: var(--muted); }
.rc-steps li::before { content: "✓"; position: absolute; left: 2px; color: var(--good); }
.rc-steps li.cur { color: var(--text); font-weight: 600; } .rc-steps li.cur::before { content: "…"; color: var(--accent); }
.rc-ok { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); padding: 10px 12px; border-radius: 10px; font-weight: 600; }
tr.hist td { opacity: .62; }

/* abas e gráficos */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 4px; overflow-x: auto; }
.tab { background: none; border: 0; color: var(--muted); padding: 10px 16px; cursor: pointer; font: inherit; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--text); border-bottom-color: var(--good); font-weight: 600; }
.rangebar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.rangebar .right { margin-left: auto; }
.chart { margin-bottom: 4px; }
.chart-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); align-items: center; }
.legend i, .tip i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.chart-empty { padding: 28px 0; text-align: center; }
.chart-wrap { position: relative; cursor: crosshair; user-select: none; touch-action: pan-y; }
.zoomsel { position: absolute; background: rgba(99, 120, 255, .18); border: 1px solid rgba(99, 120, 255, .7); pointer-events: none; z-index: 1; }
.chartsvg { width: 100%; height: auto; display: block; }
.chartsvg .grid { stroke: var(--line); stroke-width: 1; }
.chartsvg .ax { fill: var(--muted); font-size: 10px; }
.chartsvg .band { fill: var(--bad); opacity: .14; }
.chartsvg .mark { stroke: var(--warn); stroke-dasharray: 3 3; stroke-width: 1; }
.chartsvg .markdot { fill: var(--warn); }
.chartsvg .cursor { stroke: var(--muted); stroke-width: 1; }
.tip { position: absolute; top: 4px; pointer-events: none; background: var(--card, #1b2330); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; min-width: 130px; box-shadow: 0 4px 14px rgba(0,0,0,.35); z-index: 2; }

.rangebar input, .rangebar select { width: auto; }

.attn { display: block; color: inherit; text-decoration: none; }
.attn:hover { border-color: var(--muted); }
.pw { letter-spacing: .5px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pill.good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.pill.na { background: var(--panel-2); color: var(--muted); }
tr.click { cursor: pointer; }

/* PPPoE */
.ppcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 10px 0; }
.ppcards .big { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ppcards .warnbox { border-color: var(--warn); } .ppcards .badbox { border-color: var(--bad); }
.dropbars { display: flex; align-items: flex-end; gap: 2px; height: 36px; margin-top: 6px; }
.dropbars i { flex: 1; background: var(--line); border-radius: 2px 2px 0 0; min-width: 3px; }
.dropbars i.on { background: var(--bad); }
.subtabs { display: inline-flex; gap: 4px; }
.stab { background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); padding: 6px 12px; border-radius: 999px; cursor: pointer; font: inherit; }
.stab.active { color: var(--text); border-color: var(--good); font-weight: 600; }
.notice { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 14px; }
.notice.warn { border-color: var(--warn); }
.logbox { background: var(--panel-2); padding: 10px; border-radius: 8px; max-height: 180px; overflow: auto; white-space: pre-wrap; }
tr.clickable { cursor: pointer; } tr.clickable:hover { background: var(--panel-2); }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }

/* menu lateral + barra superior enxuta */
.icon-btn { background: none; border: 1px solid transparent; color: var(--text); font-size: 20px; line-height: 1; width: 40px; height: 40px; border-radius: 9px; cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--panel-2); }
.topbar .userbox { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar #branch-sel { max-width: 220px; min-width: 0; }
.brand { margin-right: 0; }
.layout { display: flex; align-items: flex-start; min-height: calc(100vh - 54px); }
.sidebar { position: sticky; top: 54px; flex: none; width: 236px; height: calc(100vh - 54px); overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 10px 8px 24px; }
.layout:not(.side-open) .sidebar { display: none; }
.layout main { flex: 1 1 auto; min-width: 0; width: 100%; }
.nav { display: block; }
.navgroup { margin-bottom: 10px; }
.navtitle { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); padding: 8px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 9px 10px; border-radius: 8px; font-weight: 500; min-height: 40px; }
.nav a .ic { width: 22px; text-align: center; flex: none; }
.nav a:hover { background: var(--panel-2); text-decoration: none; color: var(--text); }
.nav a.active { color: var(--text); background: var(--panel-2); box-shadow: inset 3px 0 0 var(--good); }
.scrim { display: none; }
.usermenu { position: relative; }
.userbtn { display: flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 3px 12px 3px 4px; cursor: pointer; font: inherit; min-height: 38px; }
.userbtn:hover { background: var(--panel-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--good); color: #06130d; display: grid; place-items: center; font-weight: 700; flex: none; }
.uname { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.4); padding: 6px; z-index: 40; }
.menu button { display: flex; width: 100%; align-items: center; gap: 8px; text-align: left; background: none; border: 0; color: var(--text); padding: 11px 10px; border-radius: 7px; cursor: pointer; font: inherit; }
.menu button:hover { background: var(--panel-2); }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
@media (max-width: 899px) {
  .topbar { padding: 0 8px; gap: 4px; }
  .uname, .brandname { display: none; }
  .userbtn { padding: 3px; border-radius: 50%; }
  .topbar #branch-sel { max-width: 44vw; }
  .sidebar { position: fixed; top: 54px; bottom: 0; left: 0; height: auto; width: min(290px, 84vw); z-index: 30; transform: translateX(-102%); transition: transform .22s ease; display: block !important; box-shadow: 6px 0 24px rgba(0,0,0,.35); }
  .layout.side-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 54px 0 0 0; background: rgba(0,0,0,.5); z-index: 25; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .layout.side-open .scrim { opacity: 1; pointer-events: auto; }
  .nav a { min-height: 46px; }
  .menu { position: fixed; right: 8px; top: 58px; }
  .pagehead { gap: 8px; }
  .tablewrap { -webkit-overflow-scrolling: touch; }
  .btn, select, input:not([type=checkbox]):not([type=radio]) { min-height: 40px; }
  dialog form, dialog .dlg { max-width: 94vw; }
}
@media (prefers-reduced-motion: reduce) { .sidebar, .scrim { transition: none; } }

/* busca global */
.gsearch { position: relative; flex: 1 1 260px; max-width: 460px; margin: 0 8px; min-width: 0; }
.gsearch input { width: 100%; }
.gsearch .menu { left: 0; right: 0; top: calc(100% + 4px); min-width: 0; max-height: 70vh; overflow: auto; }
.gs-item { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 7px; color: var(--text); }
.gs-item:hover, .gs-item:focus { background: var(--panel-2); text-decoration: none; }
.gs-toggle { display: none; }
@media (max-width: 899px) {
  .gs-toggle { display: inline-block; }
  .gsearch { display: none; }
  .topbar.gs-open .gsearch { display: block; position: absolute; left: 0; right: 0; top: 54px; max-width: none; margin: 0; padding: 8px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 35; }
  .topbar.gs-open .gsearch .menu { position: static; margin-top: 6px; box-shadow: none; }
}

.navbadge { margin-left: auto; background: var(--bad); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; position: relative; top: -34px; float: right; margin-right: 10px; pointer-events: none; }
.navbadge.unack { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .navbadge.unack { animation: none; } }

#offline-bar { position: sticky; top: 0; z-index: 60; background: var(--warn); color: #000; text-align: center; font-size: 13px; padding: 6px 10px; }
.chk { display: flex; gap: 8px; align-items: center; padding: 6px 0; font-size: 15px; }
.chk input { width: 20px; height: 20px; }
.qrgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-top: 12px; }
.qrcard { border: 1px dashed var(--line, #8886); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; background: #fff; color: #000; break-inside: avoid; }
@media print { .noprint, .topbar, .sidebar, #toast { display: none !important; } body { background: #fff; } .layout { display: block; } .qrgrid { grid-template-columns: repeat(4, 1fr); } }

/* TR-069: barras horizontais */
.hbar-row { display: grid; grid-template-columns: minmax(80px, 1.2fr) 2fr auto; gap: 8px; align-items: center; margin: 5px 0; font-size: .88em; }
.hbar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar { height: 8px; background: color-mix(in srgb, var(--muted) 20%, transparent); border-radius: 6px; overflow: hidden; display: block; }
.hbar i { display: block; height: 100%; border-radius: 6px; }
.hbar-n { color: var(--muted); font-variant-numeric: tabular-nums; }
.stab { text-decoration: none; }

/* seletor de mapa (Mapa / Claro / Satélite) e bonequinho do Street View */
.geo-switch { display: flex; background: #fff; border-radius: 8px; box-shadow: 0 1px 5px rgba(0,0,0,.4); overflow: hidden; }
.geo-switch button, .geo-peg { border: 0; background: #fff; color: #222; padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.geo-switch button + button { border-left: 1px solid #ddd; }
.geo-switch button.on, .geo-peg.on { background: #1a73e8; color: #fff; }
.geo-peg { display: block; margin-top: 8px; border-radius: 8px; box-shadow: 0 1px 5px rgba(0,0,0,.4); font-size: 18px; padding: 5px 10px; }
[hidden] { display: none !important; }

.offline-bar{position:fixed;left:0;right:0;bottom:0;z-index:50;background:var(--warn,#b45309);color:#fff;text-align:center;padding:6px 10px;font-size:.85rem}

/* Painel NOC: tela cheia para a TV, fonte grande, cor da borda mostra o estado geral */
.noc{position:fixed;inset:0;z-index:60;background:#0b1220;color:#e5e7eb;padding:2vh 2vw;overflow:auto;border:.6vh solid #16a34a}
.noc.warn{border-color:#d97706}.noc.crit{border-color:#dc2626;animation:nocpulse 2s ease-in-out infinite}
@keyframes nocpulse{50%{border-color:#7f1d1d}}
.noc-head{display:flex;align-items:center;gap:2vw;margin-bottom:2vh}
.noc-title{font-size:3vh;font-weight:700;letter-spacing:.05em}.noc-clock{margin-left:auto;font-size:3vh;font-variant-numeric:tabular-nums}.noc-lost{color:#f59e0b}
.noc-btn{background:#1f2937;color:#e5e7eb;border:0;border-radius:8px;padding:1vh 1.2vw;font-size:2.4vh;cursor:pointer;text-decoration:none}
.noc-stats{display:grid;grid-template-columns:repeat(5,1fr);gap:1.2vw;margin-bottom:2vh}
.noc-stat{background:#111827;border-radius:12px;padding:2vh 1vw;text-align:center}
.noc-stat .n{font-size:8vh;font-weight:800;line-height:1;white-space:nowrap}.noc-stat .l{font-size:2.2vh;color:#9ca3af;margin-top:.8vh}
.noc-stat.good .n{color:#22c55e}.noc-stat.bad .n{color:#ef4444}.noc-stat.warn .n{color:#f59e0b}
.noc-cols{display:grid;grid-template-columns:1fr 1fr;gap:1.5vw}
.noc-col h2{font-size:2.6vh;margin:1.5vh 0 1vh;color:#cbd5e1}
.noc-row{display:flex;gap:1vw;justify-content:space-between;background:#111827;border-left:.8vh solid #374151;border-radius:6px;padding:1.1vh 1vw;margin-bottom:.8vh;font-size:2.3vh}
.noc-row span{color:#9ca3af;text-align:right}.noc-row.bad{border-left-color:#ef4444}.noc-row.warn{border-left-color:#f59e0b}.noc-row.good{border-left-color:#22c55e}
.noc-empty{color:#6b7280;font-size:2.3vh;padding:1vh 0}
@media (max-width:800px){.noc-stats{grid-template-columns:repeat(2,1fr)}.noc-cols{grid-template-columns:1fr}.noc-stat .n{font-size:6vh}}

.noc-slide{margin-left:1vw;font-size:2.6vh;font-weight:500;color:#93c5fd}
.noc-dots{display:flex;gap:.7vw;margin-left:2vw}.noc-dot{width:1.6vh;height:1.6vh;border-radius:50%;border:0;background:#374151;cursor:pointer;padding:0}.noc-dot.on{background:#60a5fa}
.noc-banner{background:#7c2d12;color:#fff;border-radius:8px;padding:1.2vh 1.2vw;margin-bottom:1.5vh;font-size:2.6vh;font-weight:600}.noc-banner.crit{background:#7f1d1d}
select.noc-btn{appearance:none;-webkit-appearance:none}
.noc-title{white-space:nowrap}select.noc-btn{flex:none;width:auto}.noc-head{flex-wrap:wrap}
.noc-bars{display:flex;align-items:flex-end;gap:.4vw;height:22vh;background:#111827;border-radius:8px;padding:1vh 1vw}.noc-bar{flex:1;background:#3b82f6;border-radius:3px 3px 0 0;min-height:2px}

/* telas personalizadas: grade de 12 colunas */
.noc-grid{display:grid;grid-template-columns:repeat(12,1fr);grid-auto-rows:5.4vh;gap:1vh 1vw}
.noc-w{container-type:size;background:#111827;border-radius:12px;padding:1vh 1vw;overflow:hidden;position:relative;display:flex;flex-direction:column;min-width:0}
.noc-w.stat,.noc-w.clock,.noc-w.device{text-align:center;justify-content:center}
.noc-w .n{font-size:min(8vh,38cqmin);font-weight:800;line-height:1.05}.noc-w .l{font-size:min(2.2vh,6cqw);color:#9ca3af;margin-top:.6vh}
.noc-w .n.good{color:#22c55e}.noc-w .n.bad{color:#ef4444}.noc-w .n.warn{color:#f59e0b}
.noc-w h2{font-size:2.4vh;margin:0 0 .8vh;color:#cbd5e1}
.noc-w .noc-row{padding:.9vh .8vw;font-size:2.1vh;min-width:0}
.noc-w .noc-row b{flex:none;max-width:45%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.noc-w .noc-row span{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.noc-w .noc-bars{flex:1;height:auto;min-height:6vh}
.noc-nodata{color:#6b7280;font-size:2.2vh;text-align:center;margin:auto}.noc-nodata small{font-size:1.8vh}
.noc-text{font-size:3vh;margin:auto 0;white-space:pre-wrap}
.noc-btn.ok{background:#15803d}
.noc-edit{display:flex;flex-wrap:wrap;gap:.8vw;align-items:center;margin-bottom:1vh}.noc-edit input,.noc-edit select{background:#1f2937;color:#e5e7eb;border:1px solid #374151;border-radius:8px;padding:1vh .8vw;font-size:2vh}
.noc-grow{flex:1}.noc-hint{color:#9ca3af;font-size:1.9vh;margin-bottom:1vh}
.noc.editing .noc-grid{background-image:linear-gradient(#1f293799 1px,transparent 1px),linear-gradient(90deg,#1f293799 1px,transparent 1px);background-size:calc(100%/12) 6.4vh}
.noc.editing .noc-w{cursor:grab;touch-action:none;outline:2px dashed #3b82f6;user-select:none}.noc.editing .noc-w.drag{opacity:.75;cursor:grabbing;z-index:5}
.noc-wtools{position:absolute;top:.4vh;right:.4vw;display:flex;gap:.3vw;z-index:2}.noc-wtools button{background:#1f2937;color:#e5e7eb;border:0;border-radius:6px;font-size:1.8vh;padding:.3vh .6vw;cursor:pointer}
.noc-wres{position:absolute;right:0;bottom:0;width:2.6vh;height:2.6vh;cursor:nwse-resize;background:linear-gradient(135deg,transparent 50%,#3b82f6 50%);border-radius:0 0 12px 0}
.noc-edit input{flex:0 1 22vw}.noc-edit select{flex:0 0 auto}
.noc-edit select{width:auto;max-width:30vw}.noc-edit .noc-btn{font-size:1.9vh;padding:.8vh .9vw}.noc-edit input,.noc-edit select{font-size:1.9vh;padding:.8vh .7vw}
.noc.editing .noc-head{margin-bottom:1vh}

.noc-w .noc-map{flex:1;width:100%;min-height:0;background:#0b1220;border-radius:8px}.noc-pulse{animation:nocpulse 1.6s ease-in-out infinite}@keyframes nocpulse{0%,100%{r:1.8}50%{r:3.4}}
.noc-w .noc-link{display:flex;align-items:baseline;gap:1.5vw;flex-wrap:wrap}.noc-w .noc-link .l{font-size:min(2.2vh,5cqw)}.noc-w .noc-linkchart{flex:1;width:100%;min-height:6vh;background:#0b1220;border-radius:8px;margin-top:.6vh}

/* mapa de IPs do bloco */
.ipgrid { display: flex; flex-wrap: wrap; gap: 3px; margin: 10px 0; max-height: 46vh; overflow: auto; }
.ipc { display: inline-block; width: 16px; height: 16px; border-radius: 3px; border: 1px solid rgba(127, 127, 127, .35); vertical-align: -3px; }
a.ipc { cursor: pointer; }
.ipc-o { background: #22c55e; border-color: #16a34a; }
.ipc-x { background: #ef4444; border-color: #dc2626; }
.ipc-m { background: #94a3b8; border-color: #64748b; }
.ipc-u { background: #f59e0b; border-color: #d97706; }
.ipc-l { background: transparent; }
.ipc-n { background: repeating-linear-gradient(45deg, rgba(127, 127, 127, .25) 0 3px, transparent 3px 6px); }
.ipleg { display: flex; flex-wrap: wrap; gap: 6px 16px; }

/* diagnóstico completo do login: cabeçalho fixo, seções rolando por baixo */
dialog.dgx { width: min(1040px, 97vw); }
dialog.dgx .dlg.dg { padding: 0; max-height: 92vh; overflow: auto; }
.dg-head { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--accent, #4f6bed) 35%, var(--panel)); border-bottom: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.dg-title { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; font-weight: 700; font-size: 1.05rem; }
.dg-x { background: none; border: 0; color: inherit; font-size: 1.2rem; cursor: pointer; }
.dg-tabs { display: flex; gap: 6px; padding: 0 12px; align-items: flex-end; flex-wrap: wrap; }
.dg-tabs button { border: 0; padding: 7px 18px; border-radius: 8px 8px 0 0; background: color-mix(in srgb, var(--panel) 55%, transparent); color: inherit; font-weight: 600; cursor: pointer; }
.dg-tabs button.on { background: var(--panel); }
.dg-st { margin-left: auto; padding-bottom: 6px; }
.dg-info { background: var(--panel); display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 4px 18px; padding: 10px 16px; font-size: .9rem; }
.dg-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 16px 10px; background: color-mix(in srgb, var(--accent, #4f6bed) 28%, var(--panel)); }
.dg-body { padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.dg-body h4 { margin: 0 0 8px; }
.dg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.dg-kvs { display: grid; gap: 3px; font-size: .9rem; }
.dg-bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 6px; }
.dg-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; height: 100%; }
.dg-pair { flex: 1; display: flex; align-items: flex-end; gap: 1px; }
.dg-pair i { flex: 1; border-radius: 3px 3px 0 0; min-height: 2px; }
.dg-col span { font-size: .62rem; text-align: center; color: var(--muted, #94a3b8); margin-top: 3px; white-space: nowrap; overflow: hidden; }
.dg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 4px 0 8px; }

.qrbox svg { display: block; width: 100%; height: auto; }
