/* PED Hub - design system.
   Tokens centralizados em :root (tema escuro, padrao) e :root[data-theme="light"]. Nenhum componente usa cor fixa:
   tudo passa por token. Estado nunca e so cor: todo status tem texto e icone (ver badge/metric em lib.js). */

:root {
  color-scheme: dark;
  /* superficies */
  --bg: #0F172A;            /* fundo da aplicacao */
  --surface: #172235;       /* cartoes, tabelas, painel lateral */
  --surface-2: #1E293B;     /* elevacao: cabecalho de tabela, hover, campos */
  --line: #2C3B54;
  --line-strong: #3A4C6B;
  /* texto */
  --fg: #E6EBF3;
  --muted: #9AA8BF;
  /* marca e estados (cores de preenchimento) */
  --primary: #2563EB;       /* acao de alteracao (salvar, criar) */
  --primary-hover: #1D4FD0;
  --on-primary: #FFFFFF;
  --ok: #22C55E;
  --warn: #F59E0B;
  --crit: #EF4444;
  --info: #38BDF8;
  /* estados como texto/icone sobre superficie (contraste AA) */
  --link: #6BA6FF;
  --ok-fg: #34D27B;
  --warn-fg: #F5B13A;
  --crit-fg: #FF7B7B;
  --info-fg: #52C4F5;
  --neutral-fg: #9AA8BF;
  --focus: #7DB3FF;
  --shadow: 0 8px 28px rgba(2, 8, 23, .55);
  --overlay: rgba(2, 8, 23, .62);
  /* forma e espaco */
  --radius: 10px;
  --radius-sm: 7px;
  --gap: 16px;
  --sidebar-w: 248px;
  --rail-w: 64px;
  --topbar-h: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --line: #D8DFEA;
  --line-strong: #B9C4D6;
  --fg: #0F172A;
  --muted: #4B5A72;
  --primary: #2563EB;
  --primary-hover: #1D4FD0;
  --ok: #16A34A;
  --warn: #D97706;
  --crit: #DC2626;
  --info: #0284C7;
  --link: #1D4ED8;
  --ok-fg: #15803D;
  --warn-fg: #B45309;
  --crit-fg: #B91C1C;
  --info-fg: #0369A1;
  --neutral-fg: #4B5A72;
  --focus: #1D4ED8;
  --shadow: 0 8px 24px rgba(15, 23, 42, .16);
  --overlay: rgba(15, 23, 42, .45);
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar-h) + 12px); }
body { margin: 0; font: 14.5px/1.5 var(--font); background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 15px; margin: 0 0 8px; }
a { color: var(--link); }
code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
.bad { color: var(--crit-fg); }
.empty { color: var(--muted); padding: 8px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { flex: none; vertical-align: -3px; }

/* foco visivel em todo elemento interativo */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--primary); color: var(--on-primary); padding: 8px 14px; border-radius: var(--radius-sm); text-decoration: none; }
.skip:focus { top: 8px; }

/* ----------------------------------------------------------------------------------- login */
#login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
#login form { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
#login .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
#login .logo b { font-size: 22px; letter-spacing: -.01em; }
#login p.sub { margin: 0 0 18px; }
#login label + label { margin-top: 12px; }
#loginmsg { min-height: 22px; margin: 10px 0; font-size: 13px; color: var(--crit-fg); }
.mark { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; letter-spacing: .02em; }

/* ------------------------------------------------------------------------------------ casca */
#app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); grid-template-rows: var(--topbar-h) 1fr; grid-template-areas: "side top" "side main"; min-height: 100vh; transition: grid-template-columns .18s ease; }
#app.rail { grid-template-columns: var(--rail-w) minmax(0, 1fr); }

#side { grid-area: side; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden; z-index: 30; }
#side .brand { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 16px; color: var(--fg); text-decoration: none; flex: none; }
#side .scroll { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
#side .grouplabel { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 10px 10px 6px; font-weight: 650; }
#side a.item, #side button.item { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--fg); font-size: 14px; }
#side a.item:hover, #side button.item:hover { background: var(--surface-2); }
#side a.item:focus-visible, #side button.item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
#side a.item[aria-current="page"] { background: color-mix(in srgb, var(--primary) 22%, transparent); color: var(--fg); box-shadow: inset 3px 0 0 var(--primary); font-weight: 600; }
#side .mod > a.item { font-weight: 600; }
#side .mod > a.item .icon { color: var(--muted); }
#side .mod.on > a.item .icon, #side a.item[aria-current="page"] .icon { color: var(--link); }
#side .subnav { margin: 2px 0 8px 17px; padding-left: 8px; border-left: 1px solid var(--line); }
#side .subnav a.item { padding: 6px 10px; font-size: 13.5px; color: var(--muted); }
#side .subnav a.item:hover { color: var(--fg); }
#side .subnav a.item[aria-current="page"] { color: var(--fg); }
#side .subnav button.item { padding: 6px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; }
#side .subnav .nest { margin-left: 6px; padding-left: 6px; border-left: 1px solid var(--line); }
#side .caret { margin-left: auto; transition: transform .15s; }
#side button[aria-expanded="true"] .caret { transform: rotate(90deg); }
#side .foot { border-top: 1px solid var(--line); padding: 8px 10px; flex: none; }
#app.rail #side .brand .name, #app.rail #side .item .lbl, #app.rail #side .subnav, #app.rail #side .grouplabel, #app.rail #side .foot .lbl { display: none; }
#app.rail #side a.item, #app.rail #side button.item { justify-content: center; padding: 10px 0; }
#app.rail #side .brand { justify-content: center; padding: 0; }

#top { grid-area: top; display: flex; align-items: center; gap: 10px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
#top .ctx { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; min-width: 0; }
#top .ctx .icon { color: var(--link); }
#top .ctx small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
#top .spacer { flex: 1; min-width: 0; }
.iconbtn { all: unset; box-sizing: border-box; position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm); cursor: pointer; color: var(--fg); flex: none; }
.iconbtn:hover { background: var(--surface-2); }
.iconbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.iconbtn .count { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--crit); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.search { position: relative; flex: 0 1 420px; min-width: 0; }
.search .icon { position: absolute; left: 11px; top: 11px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; padding-left: 34px; padding-right: 44px; height: 38px; }
.search kbd { position: absolute; right: 9px; top: 9px; font: 11px var(--mono); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 6px; pointer-events: none; }
.results { position: absolute; left: 0; right: 0; top: 44px; z-index: 40; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 6px; box-shadow: var(--shadow); max-height: 70vh; overflow: auto; min-width: 320px; }
.results a { display: block; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--fg); text-decoration: none; }
.results a:hover, .results a[aria-selected="true"] { background: var(--surface-2); }
.results .tag { margin-left: 8px; font-size: 11px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 7px; }
.results .pad { padding: 10px; }
.menu { position: absolute; right: 0; top: 44px; z-index: 40; min-width: 240px; max-width: 92vw; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 6px; box-shadow: var(--shadow); }
.menu .head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu a, .menu button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--fg); font-size: 14px; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu a:focus-visible, .menu button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.menu.wide { width: 380px; }
.menu .note { display: flex; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--fg); text-decoration: none; font-size: 13.5px; }
.menu .note:hover { background: var(--surface-2); }
.pop { position: relative; }

main { grid-area: main; padding: 18px 24px 56px; min-width: 0; outline: none; }
.crumbs { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; font-size: 13px; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin: 0 8px; opacity: .6; }
.crumbs a { color: var(--link); text-decoration: none; } .crumbs a:hover { text-decoration: underline; }
.crumbs [aria-current] { color: var(--fg); }

/* cabecalho de pagina padrao: titulo, descricao, acoes */
header.page { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px 16px; margin-bottom: 18px; }
header.page .ph-text { min-width: 0; flex: 1 1 320px; }
header.page .desc, header.page > .muted { color: var(--muted); font-size: 13.5px; margin: 4px 0 0; max-width: 760px; }
header.page > .muted { flex-basis: 100%; order: 3; margin-top: 0; }
header.page .ph-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: var(--gap); min-width: 0; }
section.flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: var(--gap); }
.grid.charts { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid > section { margin: 0; }

@media (max-width: 900px) {
  #app, #app.rail { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
  #side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .18s ease; box-shadow: var(--shadow); }
  #app.drawer-open #side { transform: none; }
  #app.rail #side .brand .name, #app.rail #side .item .lbl, #app.rail #side .subnav, #app.rail #side .grouplabel { display: revert; }
  #app.rail #side a.item, #app.rail #side button.item { justify-content: flex-start; padding: 8px 10px; }
  #scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 25; }
  main { padding: 14px 14px 48px; }
  #top { padding: 0 10px; gap: 4px; }
  #top .ctx small { display: none; }
  .search kbd { display: none; }
  .search { flex: 1 1 120px; }
  .menu.wide { width: 330px; }
}
@media (max-width: 560px) { #top .ctx span.nm { display: none; } .results { min-width: 0; } }

/* ----------------------------------------------------------------------------- controles */
button, .btn { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 5px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--fg); cursor: pointer; text-decoration: none; white-space: nowrap; }
button:hover:not(:disabled), a.btnlink:hover { border-color: var(--link); }
button:disabled { opacity: .55; cursor: default; }
/* semantica: padrao = consultar/navegar; primary = alterar/salvar; exec = executar; danger = destrutivo */
button.primary, a.btnlink.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
button.primary:hover:not(:disabled), a.btnlink.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
button.exec, a.btnlink.exec { border-color: var(--info-fg); color: var(--info-fg); background: transparent; }
button.danger { border-color: var(--crit-fg); color: var(--crit-fg); background: transparent; }
button.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--crit) 14%, transparent); border-color: var(--crit-fg); }
button.danger.solid { background: var(--crit); border-color: var(--crit); color: #fff; font-weight: 600; }
button.ghost { background: transparent; border-color: transparent; color: var(--link); }
a.btnlink { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--fg); text-decoration: none; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.inline { flex-direction: row; align-items: center; gap: 6px; font-size: 14px; color: var(--fg); }
input, select, textarea { font: inherit; min-height: 36px; padding: 6px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--fg); }
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 16px; height: 16px; accent-color: var(--primary); }
input::placeholder { color: var(--muted); opacity: .8; }
input:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--crit-fg); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--neutral-fg); background: color-mix(in srgb, currentColor 13%, transparent); border: 1px solid color-mix(in srgb, currentColor 40%, transparent); }
.badge.on, .badge.ok { color: var(--ok-fg); } .badge.warn { color: var(--warn-fg); } .badge.info { color: var(--info-fg); }
.badge.bad, .badge.blk, .badge.down, .badge.crit { color: var(--crit-fg); } .badge.off, .badge.neutral { color: var(--neutral-fg); }
.badge .icon { vertical-align: 0; }

/* ----------------------------------------------------------------------------------- tabelas */
.tbl { margin: 0; }
.tbl-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.tbl-bar .grow { flex: 1 1 220px; max-width: 340px; position: relative; }
.tbl-bar .grow .icon { position: absolute; left: 10px; top: 10px; color: var(--muted); pointer-events: none; }
.tbl-bar .grow input { width: 100%; padding-left: 32px; }
.tbl-bar select { max-width: 200px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 650; white-space: nowrap; background: var(--surface-2); text-transform: none; position: sticky; top: 0; }
th button.sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; color: inherit; font: inherit; border-radius: 4px; }
th button.sort:hover { color: var(--fg); } th button.sort:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
th button.sort .icon { opacity: .35; } th[aria-sort="ascending"] .icon, th[aria-sort="descending"] .icon { opacity: 1; color: var(--link); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
tbody tr.clickable { cursor: pointer; }
td .actions { flex-wrap: nowrap; }
.tbl-bar .colwrap { margin-left: auto; position: relative; }
.colpop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 190px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.colpop label { display: flex; flex-direction: row; align-items: center; gap: 6px; padding: 3px 0; color: var(--fg); cursor: pointer; }
.tbl-batch { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 8px; border: 1px solid var(--primary); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--primary) 10%, transparent); }
.tbl-batch.quiet { border-color: var(--line); background: none; }
.tablewrap th.selcell, .tablewrap td.selcell { width: 34px; padding-right: 0; } .tablewrap th.menucell, .tablewrap td.menucell { width: 44px; text-align: right; position: sticky; right: 0; background: var(--surface); }
.rowmenu-btn { min-height: 30px; min-width: 34px; padding: 0 8px; font-size: 18px; line-height: 1; }
.rowmenu { position: absolute; right: 8px; top: calc(100% - 4px); z-index: 25; min-width: 190px; padding: 4px; text-align: left; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.rowmenu button { display: block; width: 100%; text-align: left; border: 0; background: none; min-height: 34px; padding: 4px 10px; } .rowmenu button:hover { background: var(--surface); } .rowmenu button.danger { color: var(--crit-fg); }
.filterbox { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 10px; margin: 0 0 10px; } .filterbox > summary { cursor: pointer; color: var(--muted); min-height: 30px; display: flex; align-items: center; gap: 8px; }
.tbl-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.tbl-foot .pager { display: flex; gap: 6px; align-items: center; }
.tbl-foot button { min-height: 30px; padding: 2px 8px; }

/* ----------------------------------------------------------------------------- estados de tela */
.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 34px 16px; color: var(--muted); }
.state .glyph { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, currentColor 12%, transparent); }
.state b { color: var(--fg); font-size: 15px; }
.state p { margin: 0; max-width: 460px; font-size: 13.5px; }
.state.compact { padding: 18px 12px; }
.state.error { color: var(--crit-fg); } .state.forbidden { color: var(--warn-fg); } .state.empty { color: var(--muted); }
.state.loading { color: var(--muted); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--link); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ----------------------------------------------------------------------------- dashboards */
.metric { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--fg); position: relative; overflow: hidden; }
.metric::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--neutral-fg); }
.metric.ok::before { background: var(--ok); } .metric.warn::before { background: var(--warn); } .metric.crit::before { background: var(--crit); } .metric.info::before { background: var(--info); }
a.metric:hover { border-color: var(--link); }
.metric .lbl { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.metric .val { font-size: 26px; font-weight: 650; letter-spacing: -.01em; line-height: 1.2; }
.metric .hint { font-size: 12.5px; color: var(--muted); }
.metric .st { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.metric.ok .st { color: var(--ok-fg); } .metric.warn .st { color: var(--warn-fg); } .metric.crit .st { color: var(--crit-fg); } .metric.info .st { color: var(--info-fg); } .metric.neutral .st { color: var(--neutral-fg); }
.metrics { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: var(--gap); }
a.metric b { font-size: 24px; } a.metric span { font-size: 13px; color: var(--muted); }
.dgrid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.dgrid > .dpanel { margin: 0; grid-column: span 12; display: flex; flex-direction: column; gap: 14px; border-radius: 14px; padding: 16px 20px; }
@media (min-width: 900px) { .dpanel.s3 { grid-column: span 3 !important; } .dpanel.s4 { grid-column: span 4 !important; } .dpanel.s6 { grid-column: span 6 !important; } .dpanel.s8 { grid-column: span 8 !important; } }
@media (min-width: 640px) and (max-width: 899px) { .dpanel.s3, .dpanel.s4 { grid-column: span 6; } }
.dhead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dhead h2 { margin: 0; font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--fg); }
.dhint { font-size: 12.5px; color: var(--muted); }
.dlink { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; font-size: 13px; }
.bigstats { display: flex; justify-content: space-around; align-items: flex-start; flex-wrap: wrap; gap: 14px 24px; text-align: center; }
.bigstat { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--fg); text-decoration: none; min-width: 90px; }
a.bigstat:hover .bv { color: var(--link); }
.bigstat .bv { font-size: 38px; font-weight: 650; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bigstat .bl { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.bigstat .bh { font-size: 12px; color: var(--muted); }
.bdot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; display: inline-block; }
.sbar { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.sbar .fill { height: 100%; border-radius: 6px; background: var(--ok); }
.sbar .k-bg-warn { background: var(--warn); } .sbar .k-bg-crit { background: var(--crit); } .sbar .k-bg-info { background: var(--info); }
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rbar { position: relative; height: 28px; border-radius: 14px; background: var(--surface-2); overflow: hidden; }
.rfill { position: absolute; inset: 0 auto 0 0; border-radius: 14px; }
.rfill.c0 { background: #0E7FB8; } .rfill.c1 { background: #C0307A; } .rfill.c2 { background: #7C4DCC; } .rfill.c3 { background: #D1862A; } .rfill.c4 { background: #2A9D6E; }
.rname { position: relative; display: block; padding: 0 12px; line-height: 28px; font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0,0,0,.45); }
.rank small { color: var(--muted); font-size: 12px; padding: 0 12px; }
.savedviews { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sechead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 10px; }
.sechead h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.alertlist { display: flex; flex-direction: column; gap: 8px; }
.alertrow { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); text-decoration: none; color: var(--fg); }
.alertrow:hover { border-color: var(--link); }
.alertrow.critical { border-left: 4px solid var(--crit); } .alertrow.warning { border-left: 4px solid var(--warn); } .alertrow.info { border-left: 4px solid var(--info); }
.alertrow .mod { margin-left: auto; font-size: 12px; color: var(--muted); }
.chart { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.chart svg { flex: none; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend b { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; }
.k-ok { color: var(--ok); } .k-warn { color: var(--warn); } .k-crit { color: var(--crit); } .k-info { color: var(--info); } .k-neutral { color: var(--neutral-fg); }
.sw.k-ok { background: var(--ok); } .sw.k-warn { background: var(--warn); } .sw.k-crit { background: var(--crit); } .sw.k-info { background: var(--info); } .sw.k-neutral { background: var(--neutral-fg); }
.linechart { width: 100%; height: 150px; display: block; }
.linechart .grid-l { stroke: var(--line); stroke-width: 1; } .linechart .ln { fill: none; stroke: var(--info); stroke-width: 2; } .linechart .ln2 { fill: none; stroke: var(--ok); stroke-width: 2; stroke-dasharray: 5 3; }
.linechart text { fill: var(--muted); font-size: 11px; }

/* --------------------------------------------------------------------------------- formularios */
fieldset.sec { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 14px; padding: 12px 16px 4px; min-width: 0; }
fieldset.sec legend { font-size: 12px; font-weight: 650; padding: 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.field { margin-bottom: 14px; }
.field .lbl { display: block; font-size: 14px; color: var(--fg); margin-bottom: 5px; font-weight: 500; }
.field .lbl .req { color: var(--crit-fg); }
.help { font-size: 12.5px; color: var(--muted); margin-top: 4px; max-width: 680px; }
.field-error { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--crit-fg); margin-top: 4px; font-weight: 500; }
details.doc { font-size: 12.5px; color: var(--muted); margin-top: 4px; } details.doc summary { cursor: pointer; } details.doc p { margin: 4px 0; }
.tabbar { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 14px; flex-wrap: wrap; overflow-x: auto; }
.tabbar button, .tabs button { min-height: 38px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); }
.tabbar button[aria-selected="true"], .tabs button.on { border-bottom-color: var(--primary); color: var(--fg); font-weight: 600; }
.tabbar button .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--crit); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.formbar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0 2px; background: linear-gradient(to top, var(--bg) 70%, transparent); margin-top: 6px; }
.optrows .row { margin-bottom: 8px; padding: 8px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); align-items: center; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; margin: 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.kv.stack { grid-template-columns: 1fr; gap: 0; } .kv.stack dt { margin-top: 10px; font-size: 12.5px; }

/* ------------------------------------------------------------------- dialogos, painel e avisos */
dialog { border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); color: var(--fg); padding: 0; box-shadow: var(--shadow); max-width: min(520px, 94vw); width: 100%; }
dialog::backdrop { background: var(--overlay); }
dialog .dlg-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; } dialog .dlg-head h3 { margin: 0; font-size: 17px; }
dialog .dlg-head .glyph { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, currentColor 14%, transparent); flex: none; }
dialog .dlg-head .glyph.danger { color: var(--crit-fg); } dialog .dlg-head .glyph.info { color: var(--info-fg); }
dialog .dlg-body { padding: 10px 20px 4px; color: var(--fg); } dialog .dlg-body p { margin: 6px 0; }
dialog .dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; flex-wrap: wrap; }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; max-width: min(560px, 100vw); border-radius: 14px 0 0 14px; display: flex; flex-direction: column; }
dialog.drawer[open] { display: flex; animation: slidein .18s ease; }
@keyframes slidein { from { transform: translateX(30px); opacity: .4; } }
dialog.drawer .dlg-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); } dialog.drawer .dlg-head h3 { flex: 1; }
dialog.drawer .dlg-body { flex: 1; overflow-y: auto; padding: 14px 20px; }
dialog.drawer .dlg-foot { border-top: 1px solid var(--line); padding: 12px 20px; justify-content: flex-start; }
dialog.drawer section { background: transparent; border: 0; padding: 0; margin: 0 0 16px; }
dialog.modal { max-width: min(860px, 96vw); max-height: 92vh; flex-direction: column; } dialog.modal.narrow { max-width: min(520px, 96vw); }
dialog.modal[open] { display: flex; }
dialog.modal .dlg-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); } dialog.modal .dlg-head h3 { flex: 1; }
dialog.modal .dlg-body { flex: 1; overflow-y: auto; padding: 14px 20px 18px; } dialog.modal .dlg-foot { border-top: 1px solid var(--line); padding: 12px 20px; }
dialog.modal section { background: transparent; border: 0; padding: 0; margin: 0 0 18px; } dialog.modal section > h3 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
dialog.modal .kv { grid-template-columns: max-content 1fr; } dialog.modal .twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; } dialog.modal .twocol > * { min-width: 0; }
dialog.modal .choice { display: flex; gap: 10px; flex-wrap: wrap; } dialog.modal .choice label { flex: 1 1 220px; flex-direction: row; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--fg); cursor: pointer; }
dialog.modal .choice label:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); } dialog.modal .choice small { display: block; color: var(--muted); }
dialog.modal .steps { counter-reset: step; } dialog.modal .steps > section > h3::before { counter-increment: step; content: counter(step) ". "; }
dialog.modal .hint { font-size: 13px; color: var(--muted); margin: 4px 0 8px; }
@media (max-width: 640px) { dialog.modal .twocol { grid-template-columns: 1fr; } }
#toasts { position: fixed; inset: auto 16px 16px auto; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-strong); border-left: 4px solid var(--info); box-shadow: var(--shadow); font-size: 14px; animation: slidein .18s ease; }
.toast.ok { border-left-color: var(--ok); } .toast.err { border-left-color: var(--crit); } .toast.warn { border-left-color: var(--warn); }
.toast .t { flex: 1; word-break: break-word; } .toast .icon.ok { color: var(--ok-fg); } .toast .icon.err { color: var(--crit-fg); } .toast .icon.info { color: var(--info-fg); }
.toast button { min-height: 26px; padding: 0 4px; border: 0; background: transparent; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .spinner { animation: none; border-top-color: var(--line-strong); border-right-color: var(--link); }
}
@media print { #side, #top, #toasts { display: none; } #app { display: block; } }

/* relatorios */
.periodbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; border-radius: 0; background: var(--surface-2); min-height: 34px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.filterbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.filterbar .grow { flex: 1 1 220px; max-width: 360px; position: relative; }
.filterbar .grow .icon { position: absolute; left: 10px; top: 10px; color: var(--muted); pointer-events: none; }
.filterbar .grow input { width: 100%; padding-left: 32px; }
.barchart { width: 100%; height: auto; display: block; }
.barchart .grid-l { stroke: var(--line); stroke-width: 1; } .barchart text { fill: var(--muted); font-size: 10px; }
.barchart .bar-total { fill: var(--info); opacity: .55; } .barchart .bar-ok { fill: var(--ok); }
.barchart g:hover .bar-total { opacity: .9; }
.trace td, .trace th { font-size: 12.5px; }


/* paleta de comandos (Ctrl+K) e botao de busca do topo */
.searchbtn { width: 100%; height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 44px 0 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font: inherit; text-align: left; cursor: pointer; position: relative; }
.searchbtn:hover { border-color: var(--link); color: var(--fg); }
.searchbtn .icon { position: static; flex: none; }
.searchbtn .ph { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.searchbtn kbd { position: absolute; right: 9px; top: 9px; }
body.palette-open { overflow: hidden; }
.palette-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(2, 8, 23, .55); display: flex; align-items: flex-start; justify-content: center; padding: 11vh 16px 16px; }
.palette { width: min(640px, 100%); max-height: 70vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line-strong); color: var(--muted); }
.palette-input input { flex: 1; min-width: 0; height: 50px; border: 0; background: transparent; color: var(--fg); font-size: 16px; outline: none; box-shadow: none; padding: 0; }
.palette-list { overflow: auto; padding: 6px; }
.palette-group { padding: 10px 10px 4px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.palette-item { display: grid; grid-template-columns: auto auto 1fr; align-items: baseline; gap: 4px 8px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--fg); text-decoration: none; }
.palette-item[aria-selected="true"] { background: var(--surface-2); outline: 1px solid var(--link); outline-offset: -1px; }
.palette-label { font-weight: 600; }
.palette-item .tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 7px; }
.palette-path { font-size: 12px; grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-empty { padding: 18px 12px; color: var(--muted); }
.palette-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--line-strong); font-size: 12px; color: var(--muted); }
.palette-foot kbd { font: 11px var(--mono); border: 1px solid var(--line-strong); border-radius: 5px; padding: 0 5px; margin-right: 3px; }
@media (max-width: 560px) { .palette-backdrop { padding-top: 6vh; } .palette-foot { display: none; } }

/* menu em dois niveis: rotulo do grupo no menu lateral e abas das paginas da secao */
#side .subnav .grouplabel { padding: 12px 10px 4px; font-size: 10.5px; }
#side .subnav .grouplabel:first-child { padding-top: 4px; }
.sectabs { display: flex; gap: 2px; margin: 0 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.sectabs[hidden] { display: none; }
.sectabs a { flex: none; padding: 9px 14px; border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; white-space: nowrap; font-size: 14px; }
.sectabs a:hover { color: var(--fg); background: var(--surface-2); }
.sectabs a[aria-current="page"] { color: var(--fg); font-weight: 600; border-bottom-color: var(--primary); }
.sectabs a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* indicadores de estado no menu e nas abas; favoritos */
.navstate { margin-left: auto; flex: none; min-width: 8px; height: 8px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; line-height: 1; color: #fff; }
.navstate:has(span:not(:empty):not(.sr-only)) { height: 16px; min-width: 16px; padding: 0 4px; }
.navstate.crit { background: var(--crit); }
.navstate.warn { background: var(--warn); color: #1b1300; }
.sectabs a .navstate { margin-left: 8px; vertical-align: middle; }
#side .favs { margin: 2px 0 6px; }
#side .favs .grouplabel { padding-top: 8px; }
#side .favs a.item .icon { color: var(--warn-fg); fill: currentColor; }
#app.rail #side .favs .grouplabel { display: none; }
#app.rail #side .item .navstate { position: absolute; margin: 0; right: 6px; top: 6px; }
#app.rail #side a.item { position: relative; }
.crumbbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.crumbbar .crumbs { margin: 0; }
.favbtn { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--muted); cursor: pointer; flex: none; }
.favbtn:hover { background: var(--surface-2); color: var(--fg); }
.favbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.favbtn.on { color: var(--warn-fg); }
.favbtn.on .icon { fill: currentColor; }
dialog.modal .stepper { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 14px; flex-wrap: wrap; }
dialog.modal .stepper li { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line-strong); }
dialog.modal .stepper li span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); font-weight: 600; font-size: 12px; }
dialog.modal .stepper li.now { color: var(--fg); border-color: var(--primary); } dialog.modal .stepper li.now span { background: var(--primary); color: #fff; }
dialog.modal .stepper li.done span { background: var(--ok-fg); color: #fff; }
dialog.modal .portgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 10px; }
dialog.modal .portcard { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
dialog.modal .portcard.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, transparent); }
dialog.modal .portcard .ph { display: flex; align-items: center; gap: 8px; font-weight: 600; }
dialog.modal .portcard .led { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); } dialog.modal .portcard.on .led { background: var(--ok-fg); }
dialog.modal .portcard small { font-size: 12px; color: var(--muted); } dialog.modal .portcard small.field-error { color: var(--danger-fg, #f66); }
dialog.modal .wizard [hidden] { display: none !important; }

/* GPON: legenda das siglas de cada pagina */
.gpon-legend { margin-top: 20px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.gpon-legend summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--fg); }
.gpon-legend-list { margin-top: 10px; grid-template-columns: minmax(84px, max-content) 1fr; font-size: 13px; }
.gpon-legend-list dt { font-weight: 600; color: var(--fg); }
.gpon-legend-list dd b { font-weight: 600; }
.gpon-page p.small { color: var(--muted); line-height: 1.55; max-width: 118ch; }
.gpon-page p.small b { color: var(--fg); }
.gpon-page h3 { margin: 22px 0 8px; font-size: 15px; }
.gpon-legend-list dd { color: var(--muted); } .gpon-legend-list dd b { color: var(--fg); }
.gpon-page table th, .gpon-page table td { white-space: nowrap; }
.gpon-page table td.wrap { white-space: normal; min-width: 240px; max-width: 540px; }
.gpon-page .metrics { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.gpon-toolbar { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.gpon-toolbar > div { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gpon-more { margin: -4px 0 12px; font-size: 13px; } .gpon-more summary { cursor: pointer; color: var(--link); width: max-content; }
.gpon-more p.small { margin: 6px 0 0; }
.gpon-page .metric .lbl { flex-wrap: wrap; row-gap: 2px; } .gpon-page .metric .st { white-space: nowrap; }
.gpon-page .metrics { grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); }

/* GPON: aviso de alteracoes ainda nao gravadas na memoria da OLT */
.gpon-unsaved { margin: 0 0 16px; border: 1px solid var(--warn); border-left-width: 4px; border-radius: 10px; background: var(--surface); }
.gpon-unsaved[hidden] { display: none; }
.gpon-unsaved-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 10px 14px; font-size: 14px; }
.gpon-unsaved-row + .gpon-unsaved-row { border-top: 1px solid var(--line); }
.gpon-diff { max-height: 46vh; overflow: auto; margin: 6px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 12.5px; line-height: 1.5; white-space: pre; }
.gpon-diff-line.add { color: var(--ok-fg); } .gpon-diff-line.del { color: var(--crit-fg); } .gpon-diff-line.hunk { color: var(--muted); }
/* ACS: botao com cara de link (abrir objeto da arvore de parametros, trilha de caminho) */
button.linklike { min-height: 0; padding: 2px 4px; border: 0; background: transparent; color: var(--link, var(--fg)); text-decoration: underline; text-underline-offset: 2px; white-space: normal; text-align: left; }

/* ---- ACS: lista de equipamentos, cartoes, cabecalho e acoes do CPE (tudo por token; vale nos dois temas) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg); font-size: 13.5px; cursor: pointer; }
.chip b { font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--link); }
.chip[aria-pressed="true"] { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, transparent); }
.chip[aria-pressed="true"] b { color: var(--fg); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; justify-content: space-between; margin: 0 0 12px; }
.toolbar .grow { flex: 1 1 260px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; border-radius: 0; min-height: 34px; background: var(--surface); color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--fg); font-weight: 600; }
.cell2 { display: flex; flex-direction: column; gap: 1px; min-width: 150px; }
.cell2 b { font-weight: 600; }
.cell2 small { color: var(--muted); font-size: 12.5px; }
.cell2 .mono { font-size: 12px; }
.devcards { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin: 0 0 var(--gap); }
.devcard { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); cursor: pointer; position: relative; overflow: hidden; text-align: left; color: var(--fg); }
.devcard::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--neutral-fg); }
.devcard.on::before { background: var(--ok); } .devcard.bad::before { background: var(--crit); }
.devcard:hover { border-color: var(--link); }
.devcard:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.devcard .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.devcard .nm { display: flex; flex-direction: column; gap: 1px; min-width: 0; } .devcard .nm b { font-size: 15px; } .devcard .nm small { color: var(--muted); }
.devcard dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 0; font-size: 13px; } .devcard dt { color: var(--muted); } .devcard dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.devhero { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 14px 16px; margin: 0 0 14px; border-radius: var(--radius); border: 1px solid var(--line); background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 12%, var(--surface)), var(--surface)); }
.devhero .ava { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: color-mix(in srgb, var(--primary) 20%, transparent); color: var(--link); }
.devhero .who { flex: 1 1 220px; min-width: 0; } .devhero .who h2 { margin: 0; font-size: 18px; } .devhero .who p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.devhero .facts { display: flex; flex-wrap: wrap; gap: 8px 22px; } .devhero .fact { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); } .devhero .fact b { font-size: 14px; color: var(--fg); font-weight: 600; }
.panels { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin: 0 0 var(--gap); }
.panel { padding: 12px 16px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); min-width: 0; }
.panel > h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.panel .kv { grid-template-columns: max-content 1fr; }
.actgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin: 0 0 14px; }
.actcard { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.actcard.risk { border-color: color-mix(in srgb, var(--crit) 55%, var(--line)); }
.actcard h4 { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 8px; } .actcard p { margin: 0; color: var(--muted); font-size: 13px; flex: 1; }
.actcard .actions { margin-top: 2px; }
/* acoes do equipamento: linhas compactas agrupadas (rotulo + dica de uma linha + botoes) */
.agroup { margin: 0 0 16px; } .agroup > h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.arows { display: grid; gap: 6px 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.arow { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 6px 10px; min-height: 46px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.arow.risk { border-color: color-mix(in srgb, var(--crit) 55%, var(--line)); }
.arow .alabel { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; min-width: 0; flex: 1 1 240px; }
.arow .alabel svg { grid-row: 1 / span 2; color: var(--muted); } .arow .alabel b { font-size: 13.5px; font-weight: 600; }
.arow .alabel small { grid-column: 2; color: var(--muted); font-size: 12.5px; line-height: 1.3; display: block; }
.arow .actions { margin: 0 0 0 auto; flex-wrap: wrap; } .arow .actions button { min-height: 32px; padding: 4px 10px; }
.grouphead { margin: 18px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.netgrid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin: 0 0 14px; }
.netcard { padding: 12px 16px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.netcard .hd { display: flex; align-items: center; gap: 10px; justify-content: space-between; } .netcard .hd b { font-size: 15px; overflow-wrap: anywhere; }
.netcard .meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; } .netcard .meter i { display: block; height: 100%; background: var(--info); }
.formsec { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 14px; margin: 0 0 12px; min-width: 0; }
.formsec legend { padding: 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.formsec .row label { flex: 1 1 170px; } .formsec input, .formsec select { width: 100%; }
.formsec .cur { font-size: 12px; color: var(--muted); }
.advice { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.advice li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; }
@media (max-width: 640px) { .devhero { padding: 12px; } .devcards, .actgrid, .netgrid { grid-template-columns: 1fr; } }
.metrics.compact { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin-bottom: 12px; }
.metrics.compact .metric { padding: 9px 12px; gap: 2px; } .metrics.compact .metric .val { font-size: 22px; } .metrics.compact .metric .hint { display: none; }

dialog.modal .actions + h3 { margin-top: 18px; }

/* Aviso em destaque de lote pausado (ACS): fica no topo de Tarefas e de Firmware */
.pausebanner { border: 1px solid var(--line); border-left: 4px solid var(--warn); background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px; }
.pausebanner .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0 0; }
.pausebanner .row > span { flex: 1 1 280px; min-width: 0; }
/* tamanhos de janela: sm (confirmar, 1 a 3 campos), md (formulario curto), narrow (520), wide (lista ou formulario longo, padrao) */
dialog.modal.sm { max-width: min(420px, 96vw); } dialog.modal.md { max-width: min(640px, 96vw); }
.dbody { display: flex; flex-direction: column; gap: 12px; }

/* ---- Administração de acesso (usuários, perfis, permissões) ---- */
form.stack { display: grid; gap: 12px; } form.stack label { display: grid; gap: 4px; } form.stack label.inline { display: flex; gap: 6px; align-items: center; }
.rolepick { display: grid; gap: 2px; margin: 6px 0; } .rolepick label.inline { display: flex; align-items: baseline; gap: 6px; padding: 5px 0; }
.filters label { display: grid; gap: 3px; font-size: 12.5px; color: var(--muted); } .filters { margin-bottom: 10px; }
pre.code { margin: 0; padding: 10px; max-height: 280px; overflow: auto; font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); white-space: pre-wrap; word-break: break-word; }
.roleeditor { display: grid; gap: 12px; } .roleeditor textarea { resize: vertical; }
.permtree { display: grid; gap: 8px; }
details.permmod { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
details.permmod > summary { padding: 10px 12px; cursor: pointer; } details.permmod[open] > summary { border-bottom: 1px solid var(--line); }
.permtools { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 12px 0; }
.permrow { padding: 10px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 4px; } .permrow:last-child { border-bottom: 0; }
.permhead code, .permrow code { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.permpages summary { cursor: pointer; font-size: 12.5px; color: var(--link); } .permpages ul { margin: 4px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); }
.tristate { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tristate label.tri { position: relative; display: inline-flex; flex-direction: row; align-items: center; width: auto; min-height: 0; padding: 5px 14px; border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer; font-size: 13px; line-height: 1.2; background: var(--surface); color: var(--fg); }
.tristate label.tri input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tristate label.tri:has(input:checked).none { background: var(--surface-2); border-color: var(--fg); font-weight: 650; }
.tristate label.tri:has(input:checked).allow { background: color-mix(in srgb, var(--ok-fg) 18%, transparent); border-color: var(--ok-fg); color: var(--ok-fg); font-weight: 650; }
.tristate label.tri:has(input:checked).deny { background: color-mix(in srgb, var(--crit-fg) 18%, transparent); border-color: var(--crit-fg); color: var(--crit-fg); font-weight: 650; }
.tristate label.tri:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.rolesummary { padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); } .rolesummary h4 { margin: 0 0 6px; }
.rolesummary ul { margin: 0; padding-left: 18px; } .rolesummary li.add::marker { content: "＋ "; } .rolesummary li.rem::marker { content: "− "; } .rolesummary li.deny::marker { content: "✕ "; }
.policy ul { padding-left: 18px; }
