/* Portal de Acesso GpsGate — estilos (público + painel) */
:root {
  --asphalt: #22303A;
  --asphalt-2: #2C3D49;
  --lane: #E9B44C;
  --paper: #F5F6F4;
  --mist: #DCE1E3;
  --ink: #1A2228;
  --muted: #5B6870;
  --good: #1F7A4D;
  --good-bg: #E3F2EA;
  --warn: #8A5A00;
  --warn-bg: #FBF1DC;
  --bad: #B3261E;
  --bad-bg: #FBE7E5;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--paper); font-size: 16px; line-height: 1.5; }
a { color: var(--asphalt); }
h1, h2 { line-height: 1.2; }
code, pre { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .9em; }

/* ---------- Campos e botões ---------- */
label { display: block; font-weight: 600; font-size: .9375rem; margin: 0 0 6px; }
input[type=text], input[type=password], input[type=url], input[type=number],
input[type=search], input[type=date], select {
  width: 100%; font: inherit; padding: 11px 13px; border: 1px solid var(--mist);
  border-radius: 6px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--asphalt); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lane) 45%, transparent); }
.field { margin-bottom: 18px; }
.field-check label { font-weight: 500; display: flex; gap: 8px; align-items: center; }
.hint { color: var(--muted); font-size: .875rem; margin: 6px 0 0; }
.btn-primary, .btn-secondary {
  display: inline-block; font: inherit; font-weight: 600; text-decoration: none; text-align: center;
  padding: 11px 18px; border-radius: 6px; cursor: pointer;
}
.btn-primary { border: 0; border-bottom: 3px solid var(--lane); background: var(--asphalt); color: var(--on-primary, #fff); }
.btn-primary:hover { background: var(--asphalt-2); }
.btn-secondary { border: 1px solid var(--mist); background: #fff; color: var(--ink); }
.btn-secondary:hover { border-color: var(--asphalt); }
.btn-primary:focus-visible, .btn-secondary:focus-visible, .link-btn:focus-visible, a:focus-visible {
  outline: 3px solid var(--lane); outline-offset: 2px;
}
.btn-primary[disabled], .btn-secondary[disabled] { opacity: .7; cursor: progress; }
.btn-block { width: 100%; }
.link-btn { border: 0; background: none; padding: 4px 6px; font: inherit; color: var(--asphalt); text-decoration: underline; cursor: pointer; }
.link-btn.danger { color: var(--bad); }

.notice { padding: 10px 14px; border-radius: 6px; margin: 0 0 16px; border-left: 4px solid; }
.notice-good { background: var(--good-bg); border-color: var(--good); }
.notice-bad { background: var(--bad-bg); border-color: var(--bad); }
.notice-info { background: #EAF0F3; border-color: var(--asphalt); }

/* ---------- Portal público ---------- */
body.public { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr); min-height: 100vh; }
.road {
  background-color: var(--asphalt); background-size: cover; background-position: center;
  color: var(--on-primary, #fff); position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px;
}
.road svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.road .brand, .road .tag { position: relative; }
.road .brand { font-weight: 700; font-size: 1.375rem; letter-spacing: .01em; display: grid; gap: 14px; max-width: 32ch; }
.road .brand img { max-height: 56px; max-width: 240px; width: auto; height: auto; }
.road .tag { font-size: 1.125rem; max-width: 24ch; opacity: .82; margin: 0; }
.road-band { stroke: var(--road-band, #2F414E); }
.lane { stroke: var(--lane); stroke-dasharray: 28 22; animation: drive 1.6s linear 1; }
.pin-halo { fill: var(--lane); opacity: .18; }
.pin { fill: var(--lane); }
.pin-core { fill: var(--asphalt); }
@keyframes drive { from { stroke-dashoffset: 200; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .lane { animation: none; } }

.public-main { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.public-inner { width: 100%; max-width: 360px; }
.login { width: 100%; }
.support { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--mist); font-size: .9375rem; }
.support p { margin: 0 0 6px; font-weight: 600; }
.support ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; color: var(--muted); }
.public-footer { margin-top: 24px; color: var(--muted); font-size: .8125rem; }
.preview-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 10; background: var(--lane); color: #1A2228; text-align: center; font-weight: 600; padding: 6px 12px; font-size: .875rem; }
body.handoff { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.login h1 { font-size: 2rem; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 28px; }
.pw { position: relative; }
.pw input { padding-right: 76px; }
.pw button {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none;
  font: inherit; font-size: .875rem; color: var(--muted); padding: 6px 8px; cursor: pointer; border-radius: 4px;
}
.pw button:focus-visible { outline: 2px solid var(--lane); }
.login .btn-primary { margin-top: 6px; }
.form-msg { min-height: 24px; margin: 14px 0 0; color: var(--bad); font-size: .9375rem; }
.error-page h1 { font-size: 1.75rem; }

@media (max-width: 820px) {
  body.public { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .road { padding: 22px 24px; min-height: 120px; }
  .road .tag { display: none; }
  .public-main { align-items: flex-start; padding-top: 32px; }
}

/* ---------- Telas de autenticação do painel ---------- */
body.admin-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: var(--asphalt); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 8px; padding: 32px; border-top: 4px solid var(--lane); }
.auth-card h1 { margin: 0 0 6px; font-size: 1.5rem; }
.code { background: var(--paper); padding: 10px 12px; border-radius: 6px; overflow-x: auto; }

/* ---------- Painel ---------- */
body.admin { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--asphalt); color: #fff; display: flex; flex-direction: column; padding: 24px 0; }
.side-brand { padding: 0 22px 20px; border-bottom: 1px solid rgba(255,255,255,.12); }
.side-brand strong { display: block; font-size: 1.05rem; }
.side-brand span { color: #C9D2D7; font-size: .875rem; }
.side ul { list-style: none; margin: 16px 0; padding: 0; flex: 1; }
.side li a { display: block; padding: 9px 22px; color: #E4E9EC; text-decoration: none; border-left: 3px solid transparent; }
.side li a:hover { background: rgba(255,255,255,.06); }
.side li a[aria-current="page"] { border-left-color: var(--lane); background: rgba(255,255,255,.08); color: #fff; font-weight: 600; }
.side-foot { padding: 16px 22px 0; border-top: 1px solid rgba(255,255,255,.12); font-size: .875rem; color: #C9D2D7; display: grid; gap: 4px; }
.side-foot form { margin: 0; }
.side-foot .link-btn, .side-foot a { color: #fff; padding: 0; }

.admin-main { padding: 32px 40px 56px; max-width: 1480px; }
.admin-main > h1 { margin: 0 0 24px; font-size: 1.75rem; }
.panel { background: #fff; border: 1px solid var(--mist); border-radius: 8px; padding: 22px 24px; margin-bottom: 20px; }
.panel h2 { font-size: 1.125rem; margin: 0 0 12px; }
.panel h2:not(:first-child) { margin-top: 28px; }
.panel > p:first-child { margin-top: 0; }
.empty { color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--mist); border-radius: 8px; background: #fff; }
.stat { padding: 18px 20px; display: grid; gap: 2px; color: var(--muted); font-size: .9rem; }
.stat + .stat { border-left: 1px solid var(--mist); }
.stat .num { font-size: 1.875rem; font-weight: 700; color: var(--ink); line-height: 1.1; }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li { padding: 9px 12px 9px 14px; border-radius: 6px; border-left: 4px solid var(--mist); background: var(--paper); }
.checklist li.good { border-left-color: var(--good); }
.checklist li.warn { border-left-color: var(--lane); }
.checklist li.bad { border-left-color: var(--bad); background: var(--bad-bg); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--mist); vertical-align: top; }
th { font-size: .8125rem; color: var(--muted); font-weight: 600; background: var(--paper); }
td.detail { color: var(--muted); font-size: .875rem; max-width: 380px; }
td.nowrap { white-space: nowrap; }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.block-form input { width: 170px; padding: 6px 8px; font-size: .875rem; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-neutral { background: #EAF0F3; color: var(--asphalt); }

.form-grid { max-width: 760px; }
.field-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-top: 14px; }
.field-row .field { flex: 1 1 180px; margin-bottom: 0; }
.field-row .field-btn { flex: 0 0 auto; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.inline-form { margin: 0 0 20px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar form { margin: 0; }
.search { display: flex; gap: 8px; }
.search input { width: 240px; }
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.filters .field { margin: 0; flex: 1 1 150px; }
.filters .field-btn { flex: 0 0 auto; }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; margin-top: 16px; flex-wrap: wrap; }

@media (max-width: 900px) {
  body.admin { grid-template-columns: 1fr; }
  .side { padding: 14px 0; }
  .side ul { display: flex; flex-wrap: wrap; margin: 8px 0; }
  .side li a { border-left: 0; border-bottom: 3px solid transparent; padding: 8px 14px; }
  .side li a[aria-current="page"] { border-bottom-color: var(--lane); }
  .admin-main { padding: 24px 18px 48px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--mist); }
}
.stats + .hint { margin: 8px 0 20px; }

/* ---------- 1.1: editor, filtros, duas etapas ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.notice-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.notice-row form { margin: 0; }
fieldset.field { border: 0; padding: 0; margin: 0 0 18px; }
fieldset.field legend { font-weight: 600; font-size: .9375rem; margin-bottom: 6px; padding: 0; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin-right: 18px; }
.color-pair { display: flex; gap: 8px; align-items: center; }
.color-pair input[type=color] { width: 48px; height: 44px; padding: 2px; border: 1px solid var(--mist); border-radius: 6px; background: #fff; cursor: pointer; }
.color-pair input[type=text] { max-width: 120px; text-transform: uppercase; }
.image-current { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.image-current img { max-height: 64px; max-width: 220px; border: 1px solid var(--mist); border-radius: 6px; padding: 4px; background: repeating-conic-gradient(#EEE 0 25%, #FFF 0 50%) 0 0 / 16px 16px; }
input[type=file] { font: inherit; font-size: .9375rem; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.bulk-bar span { margin-right: auto; color: var(--muted); }
.bulk-bar select, .bulk-bar input[type=text] { width: auto; padding: 8px 10px; }
.steps { padding-left: 20px; margin: 0 0 12px; }
.steps li { margin-bottom: 8px; }
.secret code { font-size: 1.125rem; letter-spacing: .08em; background: var(--paper); padding: 8px 12px; border-radius: 6px; display: inline-block; }
.is-preview { padding-top: 32px; }

/* ---------- 1.2: modelo centralizado, alinhamentos, bloco de informações ---------- */
.al-left { text-align: left; }
.al-center { text-align: center; }
.al-right { text-align: right; }
.al-justify { text-align: justify; hyphens: auto; }
.brand.al-center { justify-items: center; }
.brand.al-right { justify-items: end; }
.titles-serif .form-title, .titles-serif .info-title, .titles-serif .brand-text { font-family: Georgia, "Times New Roman", serif; letter-spacing: 0; }
.form-title { font-size: 1.75rem; margin: 0 0 8px; }
.label-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.label-row label { margin: 0; }
.forgot { font-size: .875rem; color: var(--asphalt); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--lane) 70%, transparent); }
.forgot:hover { border-bottom-color: var(--lane); }
.btn-login { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-icon { width: 18px; height: 18px; flex: none; }
.info-block { margin-top: 12px; }
.info-title { font-size: 1.25rem; margin: 0 0 12px; }
.info-lines p { margin: 0 0 2px; font-size: .9375rem; line-height: 1.45; }
.info-lines.is-bold p { font-weight: 700; }
.info-lines a { color: var(--asphalt); font-weight: inherit; }

.logo-p .brand img { max-height: 40px; }
.logo-m .brand img { max-height: 72px; }
.logo-g .brand img { max-height: 120px; max-width: 360px; }

body.layout-card { display: block; min-height: 100vh; background-color: var(--page-bg, #F2F4F5); }
.card-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 16px; gap: 22px; }
.card-head { width: 100%; max-width: var(--card-w, 440px); display: grid; gap: 6px; color: var(--on-page, #1A2228); }
.card-head .brand { display: grid; gap: 10px; font-weight: 700; font-size: 1.375rem; }
.card-head .brand img { width: auto; height: auto; max-width: 100%; }
.card-head .tag { margin: 0; opacity: .8; }
.layout-card .card {
  width: 100%; max-width: var(--card-w, 440px); background: #fff; border-radius: 8px; padding: 34px 32px 30px;
  box-shadow: 0 18px 40px -18px rgba(16, 24, 32, .45), 0 2px 6px rgba(16, 24, 32, .08);
}
.width-narrow { --card-w: 380px; }
.width-normal { --card-w: 440px; }
.width-wide { --card-w: 540px; }
.layout-card .public-footer { color: var(--on-page, #5B6870); opacity: .75; margin: 0; }
.layout-card .support { border-top-color: var(--mist); }
@media (max-width: 520px) {
  .layout-card .card { padding: 26px 20px; }
}

/* ---------- 1.2: grades ---------- */
.th-sort { color: inherit; text-decoration: none; display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.th-sort:hover { color: var(--ink); }
.th-arrow { opacity: .35; font-size: .75em; }
.th-sort.is-active { color: var(--ink); }
.th-sort.is-active .th-arrow { opacity: 1; color: var(--asphalt); }
.grid-count { color: var(--muted); font-size: .9rem; }
.grid-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; font-size: .9rem; }
.grid-foot .pager { margin: 0; gap: 4px; }
.pager a, .pager .pg-current, .pager .pg-gap { min-width: 32px; padding: 4px 8px; text-align: center; border-radius: 6px; text-decoration: none; }
.pager a { border: 1px solid var(--mist); }
.pager a:hover { border-color: var(--asphalt); }
.pg-current { background: var(--asphalt); color: #fff; font-weight: 600; border-radius: 6px; padding: 2px 8px; }
.per-page { color: var(--muted); }
.per-page a { padding: 2px 6px; }
.summary-line { color: var(--muted); }
.summary-line strong { color: var(--ink); }
.chip { display: inline-block; background: #EAF0F3; color: var(--asphalt); border-radius: 999px; padding: 1px 8px; font-size: .8125rem; margin: 0 4px 4px 0; white-space: nowrap; }
.muted { color: var(--muted); }
details.devs summary { cursor: pointer; white-space: nowrap; }
details.devs ul { margin: 6px 0 0; padding-left: 18px; font-size: .875rem; color: var(--muted); }
.filters { margin-top: 18px; }

/* ---------- 1.2: editor ---------- */
.editor .panel h2 { margin-bottom: 14px; }
textarea { width: 100%; font: inherit; padding: 11px 13px; border: 1px solid var(--mist); border-radius: 6px; resize: vertical; }
textarea:focus { outline: none; border-color: var(--asphalt); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lane) 45%, transparent); }
.layout-options { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.layout-option { display: grid; gap: 8px; width: 220px; padding: 12px; border: 2px solid var(--mist); border-radius: 8px; cursor: pointer; font-weight: 500; }
.layout-option:has(input:checked) { border-color: var(--asphalt); background: #F7F9FA; }
.layout-option input { position: absolute; opacity: 0; }
.layout-option:has(input:focus-visible) { outline: 3px solid var(--lane); outline-offset: 2px; }
.layout-thumb { display: block; height: 96px; border-radius: 4px; background: #EEF1F2; position: relative; overflow: hidden; }
.layout-thumb-split i { position: absolute; inset: 0 55% 0 0; background: var(--asphalt); }
.layout-thumb-split b { position: absolute; left: 56%; right: 10%; top: 30%; height: 40%; border-radius: 3px; background: #fff; border: 1px solid var(--mist); }
.layout-thumb-card i { position: absolute; left: 38%; right: 38%; top: 9%; height: 14%; border-radius: 3px; background: var(--asphalt); opacity: .8; }
.layout-thumb-card b { position: absolute; left: 28%; right: 28%; top: 30%; bottom: 10%; border-radius: 4px; background: #fff; box-shadow: 0 6px 12px -6px rgba(0,0,0,.35); }
.align-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px 24px; }
.seg { display: inline-flex; border: 1px solid var(--mist); border-radius: 6px; overflow: hidden; }
.seg label { margin: 0; font-weight: 500; font-size: .875rem; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 6px 10px; cursor: pointer; border-left: 1px solid var(--mist); }
.seg label:first-child span { border-left: 0; }
.seg input:checked + span { background: var(--asphalt); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--lane); outline-offset: -3px; }
.sticky-actions { position: sticky; bottom: 0; background: color-mix(in srgb, var(--paper) 92%, transparent); padding: 12px 0; align-items: center; }

/* ---------- 1.3: colunas, abas, linhas expansíveis ---------- */
.toolbar-actions { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.toolbar-actions form { margin: 0; }
.col-chooser { position: relative; }
.col-chooser > summary { list-style: none; cursor: pointer; display: inline-block; }
.col-chooser > summary::-webkit-details-marker { display: none; }
.col-chooser[open] > summary { border-color: var(--asphalt); }
.col-chooser form { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 300px; background: #fff;
  border: 1px solid var(--mist); border-radius: 8px; padding: 14px; box-shadow: 0 12px 28px -12px rgba(16,24,32,.35); }
.col-list { display: grid; gap: 6px; max-height: 320px; overflow: auto; margin-bottom: 12px; }
.col-list label { font-weight: 500; display: flex; gap: 8px; align-items: center; margin: 0; }
.col-actions { display: flex; gap: 8px; }
.col-actions button { padding: 8px 14px; }
.btn-sm { padding: 6px 12px; font-size: .875rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--mist); }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--lane); }
.tab-count { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 999px; background: #EAF0F3; color: var(--asphalt); font-size: .75rem; text-align: center; }
.col-expand { width: 34px; padding-right: 0; }
button.expand { width: 28px; height: 28px; border: 1px solid var(--mist); border-radius: 6px; background: #fff; cursor: pointer; color: var(--asphalt); line-height: 1; }
button.expand span { display: inline-block; transition: transform .15s ease; }
button.expand[aria-expanded="true"] span { transform: rotate(90deg); }
button.expand:focus-visible { outline: 3px solid var(--lane); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) { button.expand span { transition: none; } }
tr.is-open > td { background: #F7F9FA; border-bottom-color: transparent; }
tr.detail-row > td { background: #F7F9FA; padding: 4px 16px 18px 48px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 32px; }
.detail-grid section { min-width: 0; }
.detail-grid .span-2 { grid-column: 1 / -1; }
.detail-grid h3 { font-size: .9375rem; margin: 8px 0 8px; }
dl.kv { display: grid; grid-template-columns: minmax(130px, max-content) 1fr; gap: 4px 14px; margin: 0 0 10px; font-size: .9rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
table.mini { font-size: .875rem; background: #fff; }
table.mini th { background: #fff; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .85em; }
ul.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: .9rem; }
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
  tr.detail-row > td { padding-left: 12px; }
  .col-chooser form { right: auto; left: 0; }
}
.scroll-box { max-height: 420px; overflow: auto; border: 1px solid var(--mist); border-radius: 6px; }
.scroll-box table.mini thead th { position: sticky; top: 0; z-index: 1; }

/* ---------- 1.3.2: tempo sem comunicação ---------- */
.silence { display: inline-grid; gap: 2px; }
.silence small { color: var(--muted); font-size: .75rem; white-space: nowrap; }
tr.st-ok > td:first-child { box-shadow: inset 4px 0 0 var(--good); }
tr.st-warn > td:first-child { box-shadow: inset 4px 0 0 #D99A1E; }
tr.st-bad > td:first-child { box-shadow: inset 4px 0 0 var(--bad); }
tr.st-none > td:first-child { box-shadow: inset 4px 0 0 #9AA6AD; }
.comm-summary { margin: 18px 0 14px; }
.comm-bar { display: block; width: 100%; height: 10px; border-radius: 999px; overflow: hidden; background: var(--mist); }
.seg-ok, .comm-ok strong { fill: var(--good); }
.seg-warn { fill: #D99A1E; }
.seg-bad { fill: var(--bad); }
.seg-none { fill: #9AA6AD; }
.comm-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.comm-card { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 14px;
  border: 1px solid var(--mist); border-left-width: 5px; border-radius: 8px; text-decoration: none; color: var(--ink); background: #fff; }
.comm-card:hover { border-color: var(--asphalt); }
.comm-card strong { font-size: 1.6rem; line-height: 1; }
.comm-card span { font-size: .875rem; font-weight: 600; line-height: 1.25; }
.comm-card small { font-weight: 400; color: var(--muted); }
.comm-card em { font-style: normal; color: var(--muted); font-size: .875rem; }
.comm-card.comm-ok { border-left-color: var(--good); }
.comm-card.comm-warn { border-left-color: #D99A1E; }
.comm-card.comm-bad { border-left-color: var(--bad); }
.comm-card.comm-none { border-left-color: #9AA6AD; }
.comm-card.comm-ok strong { color: var(--good); }
.comm-card.comm-warn strong { color: #A86F00; }
.comm-card.comm-bad strong { color: var(--bad); }
.comm-card.is-active { background: #F2F6F8; outline: 2px solid var(--asphalt); outline-offset: -1px; }
.pct { display: inline-flex; align-items: center; gap: 8px; min-width: 120px; }
.pct svg { width: 70px; height: 8px; border-radius: 999px; overflow: hidden; }
.pct-track { fill: var(--mist); }
.pct-ok .pct-fill { fill: var(--good); }
.pct-warn .pct-fill { fill: #D99A1E; }
.pct-bad .pct-fill { fill: var(--bad); }
.pct b { font-size: .875rem; }
@media (max-width: 900px) { .comm-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.comm-summary h2 { margin-bottom: 12px; }
.comm-cards-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.comm-card.comm-sem { border-left-color: var(--mist); }
@media (max-width: 1200px) { .comm-cards-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.comm-cards-5 .comm-card { grid-template-columns: auto 1fr; grid-template-areas: "num pct" "lbl lbl"; row-gap: 4px; }
.comm-cards-5 .comm-card strong { grid-area: num; }
.comm-cards-5 .comm-card em { grid-area: pct; justify-self: end; align-self: start; }
.comm-cards-5 .comm-card span { grid-area: lbl; }

/* ---------- 1.4: URL, exclusão de logs, liberação do painel ---------- */
.url-row { display: flex; gap: 8px; }
.url-row select { width: auto; }
.url-row .port-input { width: 100px; flex: none; }
details.danger-zone > summary { cursor: pointer; font-weight: 600; color: var(--bad); }
.danger-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 12px; }
.danger-grid form { border: 1px solid var(--mist); border-radius: 8px; padding: 14px; display: grid; gap: 10px; align-content: start; }
.danger-grid h3 { margin: 0; font-size: 1rem; }
.danger-grid p { margin: 0; color: var(--muted); font-size: .9rem; }
.danger-btn { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--mist)); }
.danger-btn:hover { border-color: var(--bad); }
.field-row.compact { margin-top: 0; }
.panel-alert { border-color: var(--bad); }
@media (max-width: 900px) { .danger-grid { grid-template-columns: 1fr; } }

/* =====================================================================
   1.5: revitalização visual do painel
   ===================================================================== */
body.admin { background: #EEF2F4; }
.side { background: #1A262E; }
.side li a { color: #D5DEE3; border-left-width: 4px; padding: 11px 22px; }
.side li a:hover { background: rgba(255,255,255,.05); color: #FFFFFF; }
.side li a[aria-current="page"] { background: #2C3D49; border-left-color: var(--lane); color: #FFFFFF; }
.admin-main > h1 { font-size: 1.75rem; letter-spacing: -.01em; }
.panel { border-radius: 10px; border-color: #DCE3E7; box-shadow: 0 1px 2px rgba(20, 32, 40, .05); }

/* Botões */
.btn-primary, .btn-secondary, .btn-ghost { min-height: 42px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-secondary { border-color: #C9D3D9; }
.btn-ghost { padding: 9px 16px; font: inherit; font-weight: 600; color: #4A5860; background: transparent; border: 1px dashed #B8C4CB; text-decoration: none; cursor: pointer; }
.btn-ghost:hover { color: var(--ink); border-color: var(--asphalt); border-style: solid; }
.btn-ghost.is-idle { opacity: .55; }
.btn-ghost:focus-visible { outline: 3px solid var(--lane); outline-offset: 2px; }
.ico { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.btn-sm { min-height: 34px; }

/* Campos */
input[type=text], input[type=password], input[type=url], input[type=number], input[type=search], input[type=date], select { border-color: #C9D3D9; border-radius: 8px; }
.filters .field label, .field label { color: #33414A; }

/* Filtros ativos */
.active-filters { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .875rem; color: var(--muted); }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: #E4EEF4; color: #1F4A66; text-decoration: none; font-weight: 600; font-size: .8125rem; }
.filter-chip:hover { background: #D3E3EE; }
.filter-chip .ico { width: 12px; height: 12px; }

/* Grades: cabeçalho colorido, linhas alternadas */
.table-wrap > table:not(.mini) { border-collapse: separate; border-spacing: 0; }
.table-wrap > table:not(.mini) > thead th { background: #2C3D49; color: #FFFFFF; font-size: .78rem; letter-spacing: .02em; padding: 11px 12px; border-bottom: 0; }
.table-wrap > table:not(.mini) > thead th:first-child { border-top-left-radius: 8px; }
.table-wrap > table:not(.mini) > thead th:last-child { border-top-right-radius: 8px; }
.table-wrap > table:not(.mini) > thead th .th-sort { color: #FFFFFF; }
.table-wrap > table:not(.mini) > thead th .th-arrow { color: #8FA3AF; opacity: 1; }
.table-wrap > table:not(.mini) > thead th .th-sort.is-active .th-arrow { color: var(--lane); }
.table-wrap > table:not(.mini) > thead th input[type=checkbox] { accent-color: var(--lane); }
.table-wrap > table:not(.mini) > tbody > tr > td { border-bottom-color: #E6ECEF; padding: 11px 12px; }
.table-wrap > table:not(.mini) > tbody > tr.z > td { background: #F4F8FA; }
.table-wrap > table:not(.mini) > tbody > tr:not(.detail-row):hover > td { background: #E6F0F6; }
tr.is-open > td { background: #EAF1F5 !important; }
tr.st-warn > td:first-child { box-shadow: inset 4px 0 0 #D99A1E; }

/* Botão de expandir */
button.expand { width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--lane); color: #1A2228; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
button.expand svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
button.expand:hover { filter: brightness(1.06); }
button.expand[aria-expanded="true"] { background: var(--asphalt); color: #FFFFFF; }
button.expand[aria-expanded="true"] svg { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { button.expand svg { transition: none; } }

/* Detalhe expandido */
tr.detail-row > td { background: #F7FAFC; padding: 6px 18px 20px 58px; }
.detail-body > .detail-grid { background: #FFFFFF; border: 1px solid #DCE3E7; border-left: 4px solid var(--asphalt); border-radius: 8px; padding: 14px 18px; }
.detail-body > .detail-grid + .detail-grid { margin-top: 12px; }
.detail-grid h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: #33414A; }

/* Badges com ponto */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; flex: none; }
.badge-good { background: #E1F2E8; color: #155C39; }
.badge-warn { background: #FCEFD2; color: #7A5200; }
.badge-bad { background: #FBE3E1; color: #8E1D17; }
.badge-neutral { background: #E8EEF1; color: #33414A; }

/* Quadros de indicadores: faixa de cor no topo */
.stats { border: 0; background: transparent; gap: 14px; }
.stat { position: relative; overflow: hidden; background: #FFFFFF; border: 1px solid #DCE3E7; border-radius: 10px; padding: 18px 20px 16px; }
.stat + .stat { border-left: 1px solid #DCE3E7; }
.stat::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: #8C989F; }
.stat .num { font-size: 2rem; }
.stat span:last-child { color: #33414A; font-weight: 600; }
.stat-ok::before { background: var(--good); } .stat-ok .num { color: #155C39; }
.stat-warn::before { background: #D99A1E; } .stat-warn .num { color: #7A5200; }
.stat-bad::before { background: var(--bad); } .stat-bad .num { color: #8E1D17; }
@media (max-width: 900px) { .stat:nth-child(n+3) { border-top: 1px solid #DCE3E7; } .stat:nth-child(3) { border-left: 1px solid #DCE3E7; } }

.comm-card { position: relative; overflow: hidden; border: 1px solid #DCE3E7; border-left-width: 1px; border-radius: 10px; padding: 16px 16px 14px; }
.comm-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: #DCE3E7; }
.comm-card.comm-ok::before { background: var(--good); }
.comm-card.comm-warn::before { background: #D99A1E; }
.comm-card.comm-bad::before { background: var(--bad); }
.comm-card.comm-none::before { background: #8C989F; }
.comm-card.is-active { outline: 2px solid var(--asphalt); outline-offset: -2px; background: #F7FAFC; }
.comm-bar { height: 10px; }

/* Paginação */
.pager a, .pager .pg-current { min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }
.pager a { border-color: #C9D3D9; color: var(--ink); }
.pg-current { background: var(--asphalt); }

/* Abas */
.tabs { border-bottom-width: 2px; }
.tabs a { padding: 10px 16px; margin-bottom: -2px; }
.tabs a[aria-current="page"] .tab-count { background: var(--asphalt); color: #FFFFFF; }

/* Verificação em duas etapas */
.totp-setup { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(260px, 1fr); gap: 28px; align-items: start; margin-bottom: 8px; }
.totp-steps { list-style: none; counter-reset: st; margin: 0; padding: 0; display: grid; gap: 18px; }
.totp-steps li { counter-increment: st; display: grid; grid-template-columns: 30px 1fr; column-gap: 14px; row-gap: 4px; }
.totp-steps li::before { content: counter(st); grid-row: 1 / span 4; width: 28px; height: 28px; border-radius: 50%; background: var(--asphalt); color: #FFFFFF; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: .875rem; }
.totp-steps li > * { grid-column: 2; }
.totp-steps li span { color: var(--muted); font-size: .9rem; }
.secret-row { display: flex !important; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.secret-key { font-size: 1.05rem; letter-spacing: .1em; background: #F2F5F7; border: 1px solid #DCE3E7; border-radius: 8px; padding: 8px 12px; color: var(--ink); }
.totp-qr { margin: 0; display: grid; justify-items: center; gap: 10px; padding: 20px; background: #F7FAFC; border: 1px solid #DCE3E7; border-radius: 12px; text-align: center; }
.qr-box { width: 240px; height: 240px; background: #FFFFFF; border-radius: 10px; border: 1px solid #DCE3E7; display: flex; align-items: center; justify-content: center; padding: 6px; box-sizing: border-box; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.totp-qr figcaption { display: grid; gap: 4px; font-size: .875rem; }
.totp-qr figcaption span { color: var(--muted); }
.otp-input { font-size: 1.25rem !important; letter-spacing: .2em; text-align: center; max-width: 200px; }
@media (max-width: 900px) { .totp-setup { grid-template-columns: 1fr; } }

/* =====================================================================
   1.6: largura total e layout responsivo (celular)
   ===================================================================== */
.admin-main { max-width: none; width: 100%; box-sizing: border-box; min-width: 0; }
.side-head { display: block; }
.menu-toggle { display: none; }
.side-menu { display: flex; flex-direction: column; flex: 1; }
.veh-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
table.mini.zebra tbody tr.z td { background: #F4F8FA; }
table.mini.zebra tbody tr td { background: #FFFFFF; }
table.mini.zebra tbody tr:hover td { background: #E6F0F6; }
.scroll-box { max-height: 520px; }
.admin-tools { position: relative; display: inline-block; }
.admin-tools > summary { list-style: none; cursor: pointer; }
.admin-tools > summary::-webkit-details-marker { display: none; }
.admin-tools-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 300px; background: #FFFFFF; border: 1px solid #DCE3E7;
  border-radius: 10px; box-shadow: 0 12px 28px -12px rgba(16,24,32,.35); padding: 14px; display: grid; gap: 14px; white-space: normal; }
.admin-tools-body form { display: grid; gap: 8px; margin: 0; }
.admin-tools-body form + form { border-top: 1px solid #E6ECEF; padding-top: 12px; }
.admin-tools-body label { display: grid; gap: 4px; font-size: .8125rem; font-weight: 600; margin: 0; }
.admin-tools-body input { padding: 8px 10px; }

@media (max-width: 1100px) {
  .comm-cards-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  body.admin { display: block; }
  .side { position: sticky; top: 0; z-index: 30; padding: 0; min-height: 0; }
  .side-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
  .side-brand { padding: 0; border: 0; }
  .side-brand strong { font-size: 1rem; }
  .menu-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid rgba(255,255,255,.25);
    border-radius: 8px; background: transparent; color: #FFFFFF; font: inherit; font-weight: 600; cursor: pointer; }
  .menu-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
  .menu-toggle:focus-visible { outline: 3px solid var(--lane); outline-offset: 2px; }
  .side-menu { display: none; border-top: 1px solid rgba(255,255,255,.1); padding-bottom: 12px; }
  .side.open .side-menu { display: flex; }
  .side ul { display: block; margin: 6px 0; }
  .side li a { border-left: 4px solid transparent; border-bottom: 0; padding: 12px 18px; }
  .side li a[aria-current="page"] { border-left-color: var(--lane); }
  .side-foot { padding: 12px 18px 0; }
  .admin-main { padding: 18px 14px 40px; }
  .admin-main > h1 { font-size: 1.4rem; margin-bottom: 14px; }
  .panel { padding: 16px 14px; }
  .toolbar { align-items: stretch; }
  .toolbar-actions { width: 100%; }
  .filters .field, .field-row .field { flex: 1 1 100%; }
  .filters .field-btn, .field-row .field-btn { flex: 1 1 auto; }
  .filters .field-btn > *, .field-row .field-btn > * { width: 100%; }
  .bulk-bar { flex-direction: column; align-items: stretch; }
  .bulk-bar select, .bulk-bar input[type=text] { width: 100%; }
  .comm-cards, .comm-cards-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
  tr.detail-row > td { padding: 6px 8px 14px; }
  .detail-body > .detail-grid { padding: 12px; }
  dl.kv { grid-template-columns: 1fr; gap: 0 0; }
  dl.kv dt { margin-top: 6px; }
  .table-wrap { margin: 0 -14px; padding: 0 14px; -webkit-overflow-scrolling: touch; }
  .grid-foot { flex-direction: column; align-items: flex-start; }
  .col-chooser form, .admin-tools-body { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; max-height: 80vh; overflow: auto; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tabs a { white-space: nowrap; }
  .totp-setup { grid-template-columns: 1fr; }
  .qr-box { width: 220px; height: 220px; }
  .danger-grid { grid-template-columns: 1fr; }
  .layout-option { width: 100%; }
  .align-grid { grid-template-columns: 1fr; }
  .url-row { flex-wrap: wrap; }
  .url-row input[type=text]:not(.port-input) { flex: 1 1 100%; order: -1; }
  .sticky-actions { flex-direction: column; align-items: stretch; }
  .sticky-actions .btn-primary, .sticky-actions .btn-secondary { width: 100%; }
}

@media (max-width: 480px) {
  .stats, .comm-cards, .comm-cards-5 { grid-template-columns: 1fr; }
  .comm-card strong { font-size: 1.35rem; }
  .auth-card { padding: 22px 18px; }
}

/* =====================================================================
   1.6.1: lista compacta no detalhe, densidade e modo escuro
   ===================================================================== */

/* Tabelas do detalhe expandido: largura pelo conteúdo, espaçamento curto */
table.mini { width: auto; min-width: 60%; font-size: .85rem; border-collapse: collapse; }
table.mini th { background: #EAF0F3; color: #33414A; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  padding: 7px 14px 7px 10px; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
table.mini td { padding: 5px 14px 5px 10px; border-bottom: 1px solid #E6ECEF; line-height: 1.35; }
table.mini .badge { padding: 1px 8px; font-size: .75rem; }
table.mini tr.st-ok > td:first-child, table.mini tr.st-warn > td:first-child,
table.mini tr.st-bad > td:first-child, table.mini tr.st-none > td:first-child { padding-left: 12px; }
.scroll-box { display: block; width: fit-content; max-width: 100%; }
.veh-summary .badge { font-size: .78rem; }

/* Preferências no rodapé do menu */
.prefs { display: grid; gap: 4px; margin-top: 10px; }
.prefs > span { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #8FA3AF; }
.seg-mini { display: inline-flex; border: 1px solid rgba(255,255,255,.2); border-radius: 7px; overflow: hidden; }
.seg-mini button { border: 0; background: transparent; color: #D5DEE3; font: inherit; font-size: .8rem; padding: 5px 9px; cursor: pointer; }
.seg-mini button + button { border-left: 1px solid rgba(255,255,255,.2); }
.seg-mini button[aria-pressed="true"] { background: var(--lane); color: #1A2228; font-weight: 700; }
.seg-mini button:focus-visible { outline: 2px solid var(--lane); outline-offset: -2px; }

/* Densidade compacta */
[data-density="compact"] .table-wrap > table:not(.mini) > tbody > tr > td { padding: 6px 10px; font-size: .875rem; }
[data-density="compact"] .table-wrap > table:not(.mini) > thead th { padding: 8px 10px; }
[data-density="compact"] button.expand { width: 26px; height: 26px; }
[data-density="compact"] .badge { padding: 2px 8px; font-size: .75rem; }
[data-density="compact"] .panel { padding: 14px 16px; margin-bottom: 14px; }
[data-density="compact"] .silence small { font-size: .7rem; }
[data-density="compact"] .admin-main { padding-top: 22px; }
[data-density="compact"] .comm-card { padding: 10px 12px; }
[data-density="compact"] .stat { padding: 12px 16px 10px; }

/* ---------------- Modo escuro ---------------- */
[data-theme="dark"] {
  --ink: #E3EAEE; --muted: #9AABB5; --mist: #2B3A43; --paper: #10191E;
  --good: #3FB37A; --bad: #E5625A; --good-bg: #123826; --bad-bg: #3D1715; --warn: #F2C46B; --warn-bg: #3A2C0E;
  color-scheme: dark;
}
[data-theme="dark"] body.admin, [data-theme="dark"] body.admin-auth { background: #0D151A; color: var(--ink); }
[data-theme="dark"] a { color: #8CC4E8; }
[data-theme="dark"] .side { background: #0A1115; }
[data-theme="dark"] .side li a[aria-current="page"] { background: #1D2A32; }
[data-theme="dark"] .panel, [data-theme="dark"] .auth-card, [data-theme="dark"] .stat, [data-theme="dark"] .comm-card,
[data-theme="dark"] .col-chooser form, [data-theme="dark"] .admin-tools-body, [data-theme="dark"] .danger-grid form,
[data-theme="dark"] .layout-option, [data-theme="dark"] .totp-qr { background: #162127; border-color: #2B3A43; color: var(--ink); }
[data-theme="dark"] .stat + .stat { border-left-color: #2B3A43; }
[data-theme="dark"] .stat span:last-child, [data-theme="dark"] .field label, [data-theme="dark"] .filters .field label { color: #C9D5DC; }
[data-theme="dark"] .stat-ok .num { color: #7FD4A6; } [data-theme="dark"] .stat-warn .num { color: #F2C46B; } [data-theme="dark"] .stat-bad .num { color: #F29B94; }
[data-theme="dark"] .comm-card.comm-ok strong { color: #7FD4A6; } [data-theme="dark"] .comm-card.comm-warn strong { color: #F2C46B; } [data-theme="dark"] .comm-card.comm-bad strong { color: #F29B94; }
[data-theme="dark"] .comm-card.is-active { background: #1D2A32; outline-color: var(--lane); }
[data-theme="dark"] input[type=text], [data-theme="dark"] input[type=password], [data-theme="dark"] input[type=url], [data-theme="dark"] input[type=number],
[data-theme="dark"] input[type=search], [data-theme="dark"] input[type=date], [data-theme="dark"] select, [data-theme="dark"] textarea {
  background: #0F181D; border-color: #34454F; color: var(--ink); }
[data-theme="dark"] .btn-primary { background: #2E4554; color: #FFFFFF; }
[data-theme="dark"] .btn-primary:hover { background: #38536A; }
[data-theme="dark"] .btn-secondary { background: #1A262E; border-color: #34454F; color: var(--ink); }
[data-theme="dark"] .btn-ghost { color: #B7C4CC; border-color: #45565F; }
[data-theme="dark"] .link-btn { color: #8CC4E8; }
[data-theme="dark"] .link-btn.danger, [data-theme="dark"] .danger-btn { color: #F29B94; }
[data-theme="dark"] .table-wrap > table:not(.mini) > thead th { background: #22313A; }
[data-theme="dark"] .table-wrap > table:not(.mini) > tbody > tr > td { border-bottom-color: #24323A; background: #162127; }
[data-theme="dark"] .table-wrap > table:not(.mini) > tbody > tr.z > td { background: #1A262E; }
[data-theme="dark"] .table-wrap > table:not(.mini) > tbody > tr:not(.detail-row):hover > td { background: #22333D; }
[data-theme="dark"] tr.is-open > td { background: #22333D !important; }
[data-theme="dark"] tr.detail-row > td { background: #111B21 !important; }
[data-theme="dark"] .detail-body > .detail-grid { background: #162127; border-color: #2B3A43; border-left-color: var(--lane); }
[data-theme="dark"] .detail-grid h3 { color: #C9D5DC; }
[data-theme="dark"] table.mini, [data-theme="dark"] table.mini.zebra tbody tr td { background: #162127; }
[data-theme="dark"] table.mini th { background: #22313A; color: #C9D5DC; }
[data-theme="dark"] table.mini td { border-bottom-color: #24323A; }
[data-theme="dark"] table.mini.zebra tbody tr.z td { background: #1A262E; }
[data-theme="dark"] table.mini.zebra tbody tr:hover td { background: #22333D; }
[data-theme="dark"] .scroll-box { border-color: #2B3A43; }
[data-theme="dark"] button.expand[aria-expanded="true"] { background: #E3EAEE; color: #0D151A; }
[data-theme="dark"] .badge-good { background: #123826; color: #7FD4A6; }
[data-theme="dark"] .badge-warn { background: #3A2C0E; color: #F2C46B; }
[data-theme="dark"] .badge-bad { background: #3D1715; color: #F29B94; }
[data-theme="dark"] .badge-neutral { background: #26333B; color: #C3CFD6; }
[data-theme="dark"] .chip, [data-theme="dark"] .filter-chip, [data-theme="dark"] .tab-count { background: #22333D; color: #B9D6EA; }
[data-theme="dark"] .tabs { border-bottom-color: #2B3A43; }
[data-theme="dark"] .tabs a[aria-current="page"] .tab-count { background: var(--lane); color: #1A2228; }
[data-theme="dark"] .notice-good { background: #123826; }
[data-theme="dark"] .notice-bad { background: #3D1715; }
[data-theme="dark"] .notice-info { background: #1D2A32; border-color: #8CC4E8; }
[data-theme="dark"] .checklist li { background: #1A262E; }
[data-theme="dark"] .checklist li.bad { background: #3D1715; }
[data-theme="dark"] .pager a { border-color: #34454F; color: var(--ink); }
[data-theme="dark"] .pg-current { background: var(--lane); color: #1A2228; }
[data-theme="dark"] .comm-bar, [data-theme="dark"] .pct-track { background: #24323A; fill: #24323A; }
[data-theme="dark"] .secret-key, [data-theme="dark"] .code { background: #0F181D; border-color: #34454F; color: var(--ink); }
[data-theme="dark"] .qr-box { background: #FFFFFF; }
[data-theme="dark"] .seg span { border-color: #34454F; }
[data-theme="dark"] .seg { border-color: #34454F; }
[data-theme="dark"] .image-current img { border-color: #34454F; }
[data-theme="dark"] .sticky-actions { background: color-mix(in srgb, #0D151A 92%, transparent); }
[data-theme="dark"] .menu-toggle { border-color: rgba(255,255,255,.2); }
[data-theme="dark"] .auth-card { border-top-color: var(--lane); }
[data-theme="dark"] .danger-zone > summary { color: #F29B94; }
[data-theme="dark"] .tabs a { color: var(--muted); }
[data-theme="dark"] .tabs a[aria-current="page"] { color: var(--ink); }
/* Detalhe expandido acompanha a área visível mesmo quando a grade rola na horizontal */
.detail-body { position: sticky; left: 0; box-sizing: border-box; }

/* =====================================================================
   1.7: faixas de comunicação, Applications reformulada, barra superior
   ===================================================================== */
:root { --b-ok: #1F7A4D; --b-h24: #F2C27B; --b-d7: #E07B1A; --b-d90: #E5736B; --b-in: #9E1F18; --b-nv: #8C989F; --b-ig: #B7C2C8; }
.seg-ok { fill: var(--b-ok); } .seg-h24 { fill: var(--b-h24); } .seg-d7 { fill: var(--b-d7); } .seg-d90 { fill: var(--b-d90); }
.seg-in { fill: var(--b-in); } .seg-nv { fill: var(--b-nv); } .seg-ig { fill: var(--b-ig); }
.seg-bg-ok { background: var(--b-ok); } .seg-bg-h24 { background: var(--b-h24); } .seg-bg-d7 { background: var(--b-d7); }
.seg-bg-d90 { background: var(--b-d90); } .seg-bg-in { background: var(--b-in); } .seg-bg-nv { background: var(--b-nv); } .seg-bg-ig { background: var(--b-ig); }

.badge-ok { background: #E1F2E8; color: #155C39; }
.badge-h24 { background: #FDF1DF; color: #7A4F0E; }
.badge-d7 { background: #FBE3CC; color: #7F3E00; }
.badge-d90 { background: #FBE1DE; color: #8E2A22; }
.badge-in { background: var(--b-in); color: #FFFFFF; }
.badge-nv { background: #E8EEF1; color: #33414A; }
.badge-ig { background: #EEF1F3; color: #5B6870; box-shadow: inset 0 0 0 1px #C9D3D9; }

tr.st-ok > td:first-child { box-shadow: inset 4px 0 0 var(--b-ok); }
tr.st-h24 > td:first-child { box-shadow: inset 4px 0 0 var(--b-h24); }
tr.st-d7 > td:first-child { box-shadow: inset 4px 0 0 var(--b-d7); }
tr.st-d90 > td:first-child { box-shadow: inset 4px 0 0 var(--b-d90); }
tr.st-in > td:first-child { box-shadow: inset 4px 0 0 var(--b-in); }
tr.st-nv > td:first-child { box-shadow: inset 4px 0 0 var(--b-nv); }
tr.st-ig > td:first-child { box-shadow: inset 4px 0 0 var(--b-ig); }

svg.mini-stack { display: block; width: 130px; height: 8px; border-radius: 999px; overflow: hidden; background: #E6ECEF; }
svg.comm-bar { display: block; width: 100%; height: 10px; border-radius: 999px; overflow: hidden; background: #E6ECEF; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: -12px 0 16px; }
.page-head p { margin: 0; }
.page-head form { margin: 0; }
.summary-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.summary-head h2 { margin: 0; }
.summary-head .muted { font-size: .85rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.kpi-grid-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.kpi { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 3px; padding: 14px 14px 12px; border: 1px solid #DCE3E7;
  border-radius: 10px; background: #FFFFFF; color: var(--ink); text-decoration: none; }
.kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--b-nv); }
.kpi:hover { border-color: var(--asphalt); }
.kpi.is-active { outline: 2px solid var(--asphalt); outline-offset: -2px; background: #F7FAFC; }
.kpi-n { font-size: 1.6rem; font-weight: 700; line-height: 1.05; }
.kpi-l { font-size: .85rem; font-weight: 600; }
.kpi-s { font-size: .75rem; color: var(--muted); }
.kpi-ok::before { background: var(--b-ok); } .kpi-ok .kpi-n { color: #155C39; }
.kpi-h24::before { background: var(--b-h24); } .kpi-h24 .kpi-n { color: #7A4F0E; }
.kpi-d7::before { background: var(--b-d7); } .kpi-d7 .kpi-n { color: #7F3E00; }
.kpi-d90::before { background: var(--b-d90); } .kpi-d90 .kpi-n { color: #8E2A22; }
.kpi-in::before { background: var(--b-in); } .kpi-in .kpi-n { color: var(--b-in); }
.kpi-nv::before { background: var(--b-nv); }
.kpi-ig::before { background: var(--b-ig); } .kpi-ig .kpi-n { color: var(--muted); }
.summary-note { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: #F4F8FA; font-size: .85rem; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.leg { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: #33414A; }
.leg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.grid-toolbar { margin-top: 14px; }
.app-cell, .veh-cell { display: inline-grid; gap: 3px; }
.app-cell small { font-size: .78rem; }
.veh-cell > span:first-child { font-size: .875rem; }
.api-warn { display: inline-flex; align-items: center; gap: 4px; color: #8E2A22; font-weight: 600; cursor: help; }
.api-warn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.col-check { width: 30px; }
.field-wide { flex: 2 1 240px !important; }
.bulk-menu form { display: grid; gap: 8px; }
.bulk-menu form label { font-size: .8rem; font-weight: 600; margin: 0; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-actions form { margin: 0; }

/* Barra superior */
body.admin { grid-template-columns: 230px minmax(0, 1fr); }
.content-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 25; display: flex; justify-content: flex-end; padding: 10px 40px; background: #FFFFFF; border-bottom: 1px solid #DCE3E7; }
.user-actions { display: flex; align-items: center; gap: 8px; }
.user-actions form { margin: 0; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; background: #EEF2F4; font-weight: 600; font-size: .9rem; }
.user-chip svg, .icon-btn svg, .logout-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.user-chip svg { width: 16px; height: 16px; }
.mfa-pill { font-size: .7rem; padding: 1px 7px; border-radius: 999px; background: #E1F2E8; color: #155C39; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; border: 1px solid #C9D3D9;
  background: #FFFFFF; color: var(--ink); cursor: pointer; padding: 0; }
.icon-btn:hover { border-color: var(--asphalt); }
.icon-btn:focus-visible, .logout-btn:focus-visible { outline: 3px solid var(--lane); outline-offset: 2px; }
.icon-btn .fillc { fill: currentColor; stroke: none; }
.logout-btn { min-height: 40px; padding: 0 14px; gap: 6px; }
[data-cycle-theme] svg { display: none; }
[data-theme-pref="auto"] [data-cycle-theme] .ico-auto, :root:not([data-theme-pref]) [data-cycle-theme] .ico-auto,
[data-theme-pref="light"] [data-cycle-theme] .ico-light, [data-theme-pref="dark"] [data-cycle-theme] .ico-dark { display: block; }
[data-cycle-density] .ico-compact { display: none; }
[data-density="compact"] [data-cycle-density] .ico-compact { display: block; }
[data-density="compact"] [data-cycle-density] .ico-normal { display: none; }
.head-actions { display: none; }

@media (max-width: 1280px) { .kpi-grid, .kpi-grid-7 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .topbar { display: none; }
  .side-head { flex-wrap: wrap; }
  .head-actions { display: flex; gap: 6px; margin-left: auto; }
  .head-actions .user-chip { display: none; }
  .head-actions .icon-btn, .head-actions .logout-btn { background: transparent; color: #FFFFFF; border-color: rgba(255,255,255,.25); }
  .head-actions .logout-btn span { display: none; }
  .head-actions .logout-btn { width: 40px; padding: 0; justify-content: center; }
  .kpi-grid, .kpi-grid-7 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head { margin-top: 0; }
  .page-head form, .page-head form button { width: 100%; }
  svg.mini-stack { width: 100%; max-width: 160px; }
  .legend .leg { font-size: .75rem; }
}
@media (max-width: 420px) {
  .side-brand span { display: none; }
  .menu-toggle span { display: none; }
}

/* Modo escuro das novidades */
[data-theme="dark"] { --b-ig: #5E6C74; }
[data-theme="dark"] .badge-ok { background: #123826; color: #7FD4A6; }
[data-theme="dark"] .badge-h24 { background: #3A2E14; color: #F5D199; }
[data-theme="dark"] .badge-d7 { background: #3F260C; color: #F5A55C; }
[data-theme="dark"] .badge-d90 { background: #3F1A17; color: #F29B94; }
[data-theme="dark"] .badge-in { background: #B3261E; color: #FFFFFF; }
[data-theme="dark"] .badge-nv { background: #26333B; color: #C3CFD6; }
[data-theme="dark"] .badge-ig { background: #1A262E; color: #9AABB5; box-shadow: inset 0 0 0 1px #34454F; }
[data-theme="dark"] .kpi { background: #162127; border-color: #2B3A43; color: var(--ink); }
[data-theme="dark"] .kpi.is-active { background: #1D2A32; outline-color: var(--lane); }
[data-theme="dark"] .kpi-ok .kpi-n { color: #7FD4A6; } [data-theme="dark"] .kpi-h24 .kpi-n { color: #F5D199; }
[data-theme="dark"] .kpi-d7 .kpi-n { color: #F5A55C; } [data-theme="dark"] .kpi-d90 .kpi-n { color: #F29B94; }
[data-theme="dark"] .kpi-in .kpi-n { color: #F07067; }
[data-theme="dark"] svg.mini-stack, [data-theme="dark"] svg.comm-bar { background: #24323A; }
[data-theme="dark"] .summary-note { background: #1A262E; }
[data-theme="dark"] .leg { color: #C9D5DC; }
[data-theme="dark"] .api-warn { color: #F29B94; }
[data-theme="dark"] .topbar { background: #111B21; border-bottom-color: #24323A; }
[data-theme="dark"] .user-chip { background: #1D2A32; color: var(--ink); }
[data-theme="dark"] .mfa-pill { background: #123826; color: #7FD4A6; }
[data-theme="dark"] .icon-btn { background: #1A262E; border-color: #34454F; color: var(--ink); }
@media (max-width: 900px) {
  .side-head { flex-wrap: nowrap; gap: 8px; }
  .head-actions { gap: 4px; }
  .head-actions .icon-btn, .head-actions .logout-btn { width: 36px; height: 36px; min-height: 36px; }
  .menu-toggle { min-height: 36px; padding: 0 10px; flex: none; }
}
@media (max-width: 480px) {
  .head-actions a.icon-btn { display: none; }
  .side-brand strong { font-size: .95rem; }
}

/* Modal sobreposta (<dialog>) */
dialog.modal { width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid #DCE3E7; border-radius: 12px;
  background: #FFFFFF; color: var(--ink); box-shadow: 0 24px 60px -20px rgba(10, 20, 28, .55); overflow: hidden; }
dialog.modal[open] { display: flex; flex-direction: column; }
dialog.modal::backdrop { background: rgba(13, 21, 26, .55); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #E6ECEF; }
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-body { padding: 4px 20px 8px; overflow-y: auto; }
.modal-section { display: grid; gap: 4px; padding: 16px 0; margin: 0; }
.modal-section + .modal-section { border-top: 1px solid #E6ECEF; }
.modal-section h3 { margin: 0 0 4px; font-size: .95rem; }
.modal-section .field { margin-bottom: 10px; }
.modal-section > button { justify-self: start; margin-top: 4px; }
.modal-foot { display: flex; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid #E6ECEF; background: #F7FAFC; }
[data-theme="dark"] dialog.modal { background: #162127; border-color: #2B3A43; }
[data-theme="dark"] .modal-head, [data-theme="dark"] .modal-section + .modal-section, [data-theme="dark"] .modal-foot { border-color: #2B3A43; }
[data-theme="dark"] .modal-foot { background: #111B21; }
@media (max-width: 600px) {
  dialog.modal { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 14px 14px 0 0; }
  .modal-section > button { justify-self: stretch; }
}
.head-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 900px) { .head-buttons { width: 100%; } .head-buttons button { flex: 1 1 100%; } }
/* A modal fica dentro da célula da grade: neutraliza estilos herdados da linha */
dialog.modal { white-space: normal; text-align: left; font-weight: 400; }
.row-actions dialog.modal form.modal-section { display: grid; align-items: stretch; gap: 4px; }
dialog.modal .field input { width: 100%; box-sizing: border-box; }
