:root {
  --navy: #0B1B30; --navy-2: #12294A; --line: #3D6E9C; --accent: #5FA8E0;
  --bg: #F3F6FA; --card: #FFFFFF; --text: #14202E; --muted: #5E6E82; --border: #DCE3EC;
  --ok: #1E9E5A; --off: #A9B4C2; --danger: #C62828; --warn: #C77700;
  --radius: 10px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { margin: 0 0 8px; }
small { color: var(--muted); }
code { font-family: Consolas, ui-monospace, monospace; font-size: 12px; }

.top {
  display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 60px;
  background: linear-gradient(90deg, var(--navy), var(--navy-2)); color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand small { display: block; color: #9FBBD8; font-size: 11px; }
.logo {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  border: 2px solid var(--accent); color: var(--accent); font-weight: 800; font-size: 18px;
}
#tabs { display: flex; gap: 2px; }
#tabs button {
  background: none; border: 0; color: #C8D8EA; padding: 20px 14px; cursor: pointer; font: inherit;
  border-bottom: 3px solid transparent;
}
#tabs button.active { color: #fff; border-bottom-color: var(--accent); }
.summary { margin-left: auto; color: #C8D8EA; display: flex; align-items: center; gap: 6px; }

main { padding: 24px; max-width: 1400px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar h2 { margin: 0; }
.hint { color: var(--muted); margin: 0 0 14px; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.empty { color: var(--muted); text-align: center; padding: 24px; }

input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); width: 100%;
}
textarea { resize: vertical; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; }
.inline input { width: auto; min-width: 140px; }

.btn {
  font: inherit; border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; display: inline-block;
}
.btn:hover { border-color: var(--line); }
.btn.primary { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn.danger-outline { color: var(--danger); border-color: #EFC2C2; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }

table.grid { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.grid th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; background: #F8FAFC; }
.grid th, .grid td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid tr.muted td { opacity: .5; }
.actions { text-align: right; white-space: nowrap; }
.actions .btn + .btn { margin-left: 6px; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--off); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(30,158,90,.18); }
.warn { color: var(--warn); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; background: #EAF1F8; color: var(--navy-2); }
.tag.red { background: #FDE7E7; color: var(--danger); }
.tag.gray { background: #EEF1F4; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #0B1B30; display: block; }
.thumb.ph { display: grid; place-items: center; color: #9FBBD8; font-size: 13px; }
.card .meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .row { display: flex; justify-content: space-between; align-items: center; }
.progress { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin: 6px 0 12px; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.split { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.list li:hover { background: #F2F6FA; }
.list li.sel { background: #E4EEF8; }
.pl-items { list-style: none; padding: 0; margin: 12px 0; }
.pl-items li { display: grid; grid-template-columns: 64px 1fr 120px auto; gap: 10px; align-items: center; padding: 6px; border-bottom: 1px solid var(--border); }
.pl-items img, .pl-items .mini { width: 64px; height: 36px; object-fit: cover; border-radius: 4px; background: #0B1B30; color: #9FBBD8; display: grid; place-items: center; font-size: 11px; }
.pl-items input { padding: 5px 8px; }
.pl-add { display: flex; gap: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; align-items: end; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.form-grid label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.form-grid label.check input { width: auto; }
.form-grid .wide, .form-grid fieldset, .form-grid .form-actions, .form-grid h3 { grid-column: 1 / -1; }
.form-grid .urgent { color: var(--danger); font-weight: 600; }
fieldset { border: 1px solid var(--border); border-radius: 8px; display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 12px; }
fieldset legend { font-size: 12px; color: var(--muted); }
fieldset label { flex-direction: row !important; align-items: center; gap: 6px !important; color: var(--text) !important; font-size: 14px !important; }
fieldset input { width: auto; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.spacer { flex: 1; }

dialog { border: 0; border-radius: 12px; padding: 20px; width: min(560px, 92vw); }
dialog::backdrop { background: rgba(11,27,48,.45); }

#toast { position: fixed; right: 20px; bottom: 20px; padding: 12px 16px; border-radius: 8px; background: var(--navy); color: #fff; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; max-width: 420px; }
#toast.show { opacity: 1; transform: none; }
#toast.err { background: var(--danger); }

@media (max-width: 900px) {
  .top { flex-wrap: wrap; height: auto; padding: 10px 16px; }
  #tabs { overflow-x: auto; width: 100%; }
  .split { grid-template-columns: 1fr; }
  main { padding: 16px; }
}

/* ===================================================================== v2 */
h3 { font-size: 15px; margin: 18px 0 10px; }
h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; border-left: 5px solid var(--off); }
.kpi b { display: block; font-size: 30px; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi.ok { border-left-color: var(--ok); } .kpi.bad { border-left-color: var(--danger); } .kpi.warn { border-left-color: var(--warn); }
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.grid.compact td, .grid.compact th { padding: 8px 10px; }
.bar { height: 8px; background: #E8EDF3; border-radius: 99px; overflow: hidden; min-width: 120px; }
.bar > i { display: block; height: 100%; background: var(--ok); }
.bar.blue > i { background: var(--accent); }
.events { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; }
.events li { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.events li small { margin-left: auto; white-space: nowrap; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; border-left: 5px solid var(--off); cursor: pointer; background: #fff; }
.tile.on { border-left-color: var(--ok); } .tile.off { border-left-color: var(--danger); background: #FFF7F7; }
.tile b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile small { display: block; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.status.online { background: #E3F5EC; color: var(--ok); }
.status.offline { background: #FDE7E7; color: var(--danger); }
.status.unknown { background: #EEF1F4; color: var(--muted); }
.dot.bad { background: var(--danger); }

/* editor de layout + prévia */
.layout-editor { display: grid; grid-template-columns: 1fr 190px; gap: 14px; align-items: start; }
.layout-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.layout-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.layout-fields select.inherit { color: var(--muted); font-style: italic; }
/* v5.3 · editor modular de layout */
.layout-fields { grid-template-columns: 1fr !important; }
.mod-source { display: flex; gap: 18px; flex-wrap: wrap; padding: 8px 10px; background: #F4F7FA; border-radius: 8px; }
.mod-source label { flex-direction: row !important; align-items: center; gap: 6px !important; font-size: 13px !important; color: var(--text) !important; }
.mod-body.disabled { opacity: .5; }
.mod-title { font-weight: 700; font-size: 13px; } .mod-title small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin: 8px 0; }
.layout-fields .mod-card { flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 10px; cursor: pointer; background: #fff; color: var(--text); transition: border-color .15s, background .15s; }
.mod-card input { position: absolute; opacity: 0; pointer-events: none; }
.mod-card .mod-ic { font-size: 20px; width: 28px; text-align: center; }
.mod-card b { display: block; font-size: 13px; } .mod-card small { display: block; color: var(--muted); font-size: 11px; }
.mod-card.on { border-color: #2E6DB0; background: #EEF5FC; box-shadow: inset 0 0 0 1px #2E6DB0; }
.mod-card:has(input:focus-visible) { outline: 2px solid #5FA8E0; outline-offset: 2px; }
.layout-fields .mod-sub { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: var(--text); margin: 0 0 8px 4px; }
.mod-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mod-opts [hidden] { display: none !important; }
.pv-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pv-wrap small { text-align: center; }
/* miniatura com as MESMAS regras do player (Grid externo + Flex no palco) */
.pv { display: grid; grid-template-rows: 1fr auto; background: #000; border-radius: 6px; overflow: hidden; border: 3px solid #1C2B3E; }
.pv[data-orientation="landscape"] { width: 180px; height: 101px; }
.pv[data-orientation="portrait"]  { width: 101px; height: 180px; }
.pv .st { display: flex; min-height: 0; }
.pv[data-orientation="landscape"] .st { flex-direction: row; }
.pv[data-orientation="portrait"] .st { flex-direction: column; }
.pv .m { flex: 1 1 0; background: #2E6DB0; display: grid; place-items: center; color: #fff; font-size: 9px; }
.pv .n { background: #12294A; color: #9FBBD8; display: grid; place-items: center; font-size: 8px; }
.pv[data-orientation="landscape"] .n { flex: 0 0 20%; }
.pv[data-orientation="portrait"] .n { flex: 1 1 0; }
.pv[data-orientation="portrait"][data-notices="on"] .m { flex: 0 0 auto; aspect-ratio: 16/9; }
.pv[data-pos="start"] .n { order: -1; }
.pv .f { background: #0A1729; color: #9FBBD8; font-size: 7px; display: grid; place-items: center; border-top: 1px solid #3D6E9C; }
.pv[data-orientation="landscape"] .f { height: 20%; }
.pv[data-orientation="landscape"][data-notices="off"] .f { height: 13%; }
.pv[data-orientation="portrait"] .f { height: 9%; }
.pv[data-main="off"] .m, .pv[data-notices="off"] .n, .pv[data-footer="off"] .f { display: none; }
.pv[data-main="off"] .n { flex: 1 1 0; }

.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.dlg-cols { display: grid; grid-template-columns: 260px 1fr; gap: 20px; }
.form-grid.one { grid-template-columns: 1fr; }
#dlg-device { width: min(980px, 96vw); }
.cmds { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 16px 0 8px; padding-top: 12px; border-top: 1px solid var(--border); }
details { margin: 8px 0 14px; } summary { cursor: pointer; color: var(--muted); }
.group-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; width: 100%; padding-top: 6px; }
.group-checks[hidden] { display: none; }
.dev-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.dev-checks label { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.dev-checks input { width: auto; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.card.paused { opacity: .55; }
.card .actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 900px) {
  .dash-grid, .dlg-cols, .layout-editor { grid-template-columns: 1fr; }
}
.inline select, #media-filter { width: auto; min-width: 180px; }
.cards > .empty { grid-column: 1 / -1; }

/* ===================================================================== v3 */
.health { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; font-size: 13px; }
.health .bar { min-width: 90px; }
.hw-cell { display: flex; flex-direction: column; gap: 3px; min-width: 170px; font-size: 12px; }
.hw-cell .row { display: flex; gap: 8px; align-items: center; justify-content: flex-start; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: #E3F5EC; color: var(--ok); } .pill.warn { background: #FFF1DC; color: var(--warn); }
.pill.crit { background: #FDE7E7; color: var(--danger); } .pill.unknown { background: #EEF1F4; color: var(--muted); }
.bar.warn > i { background: var(--warn); } .bar.crit > i { background: var(--danger); }
.alerts { margin: 8px 0 0; padding-left: 18px; color: var(--danger); font-size: 12px; }
.chart svg { width: 100%; height: 90px; display: block; margin-top: 10px; }
.chart small { display: block; }
.dlg-cols.two { grid-template-columns: 1fr 1fr; margin-top: 14px; }
.panel.flat { margin: 0; padding: 12px; background: #FAFBFD; }
label.stack { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.geo { display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--muted); }
.geo .inline input { min-width: 0; flex: 1; }
.geo-results { display: flex; flex-direction: column; gap: 4px; }
.geo-results button { text-align: left; }
.geo-coords { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.wx-test { color: var(--text); font-size: 13px; }
.news-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.news-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.news-card b { display: block; margin: 4px 0; }
.news-thumb { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; margin-bottom: 8px; background: #EEF1F4; }
.kpi.crit { border-left-color: var(--danger); }
.tile .hw { font-size: 11px; }
@media (max-width: 900px) { .dlg-cols.two { grid-template-columns: 1fr; } }

/* ===================================================================== v4: acesso, usuários, permissões */
.no-perm { display: none !important; }
body.locked > header, body.locked > main { visibility: hidden; }
.auth { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(ellipse at 20% 0%, #17406E 0%, #0B1B30 60%, #071222 100%); }
.auth[hidden] { display: none; }
.auth::before { content: ""; position: absolute; inset: 0; opacity: .35; pointer-events: none;
  background-image:
    linear-gradient(90deg, transparent 49.6%, #3D6E9C 49.6% 50.4%, transparent 50.4%),
    linear-gradient(0deg, transparent 49.6%, #3D6E9C 49.6% 50.4%, transparent 50.4%);
  background-size: 160px 120px; mask-image: radial-gradient(ellipse at center, transparent 30%, #000 80%); }
.auth-card { position: relative; width: min(440px, 100%); background: #fff; border-radius: 14px; padding: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35); max-height: calc(100vh - 40px); overflow: auto; }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.auth-brand .logo { color: var(--navy-2); border-color: var(--accent); }
.auth-brand small { display: block; color: var(--muted); }
.auth-view { display: flex; flex-direction: column; gap: 12px; }
.auth-view[hidden] { display: none; }
.auth-view h2 { margin: 0; }
.auth-view label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.auth-msg { color: var(--danger); min-height: 1.2em; margin: 12px 0 0; font-weight: 600; }
.btn.wide { width: 100%; padding: 11px; font-size: 15px; }
.hint.small, small.small { font-size: 12px; }
.link { background: none; border: 0; color: var(--line); cursor: pointer; padding: 6px 0; font: inherit; text-decoration: underline; }

.user-box { position: relative; margin-left: 12px; }
.user-btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); color: #fff; border-radius: 8px;
  padding: 6px 12px; cursor: pointer; font: inherit; text-align: left; }
.user-btn small { display: block; color: #9FBBD8; font-size: 11px; }
.user-menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.15); min-width: 220px; overflow: hidden; z-index: 20; }
.user-menu button { display: block; width: 100%; text-align: left; padding: 11px 14px; border: 0; background: #fff; cursor: pointer; font: inherit; }
.user-menu button:hover { background: #F2F6FA; }
.user-menu button[hidden] { display: none; }

.subtabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.subtabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; font: inherit; color: var(--muted); border-bottom: 2px solid transparent; }
.subtabs button.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.checks { display: flex; flex-direction: column; gap: 6px; }
.checks.indent { margin: 6px 0 0 26px; }
.check-row { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.check-row input { width: auto; margin-top: 3px; }
.perm-table td:nth-child(2) { text-align: center; width: 100px; color: var(--muted); }
.perm-table td:nth-child(3) { width: 170px; }
.perm-table td:nth-child(4) { width: 100px; }
.perm-table tr.mod td { background: #F3F6FA; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.perm-table.muted select { opacity: .5; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.perm-grid .panel b { display: block; margin-bottom: 8px; }
.perm-grid .check-row { margin-bottom: 6px; }
tr.warn-row td { background: #FFF7F0; }
code.fp { font-size: 12px; word-break: break-all; }
pre.cmd { background: #0B1B30; color: #CFE3F7; padding: 12px; border-radius: 8px; white-space: pre-wrap; word-break: break-all; font-size: 12px; }
body.in-client .top { -webkit-app-region: no-drag; }
.split[hidden], .tab [hidden] { display: none !important; }
#tabs button { padding: 20px 11px; }
.summary { white-space: nowrap; font-size: 12px; }
@media (max-width: 1500px) { .summary { display: none; } .brand small { display: none; } }
@media (max-width: 1500px) { .user-box { margin-left: auto; } }

/* ---------- v4.1 · Segurança de Conexão ---------- */
.tag.amber { background: #FFF1D6; color: #8A5A00; }
.badge { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--warn, #E8A33B);
  color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
.badge[hidden] { display: none; }
.countdown { font: 600 20px/1.1 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--navy-2); }
.countdown.urgent { color: var(--danger); }
.kpi.clickable { cursor: pointer; }
ol.steps { margin: 6px 0 0 18px; padding: 0; line-height: 1.7; }
#tab-security .panel { margin-top: 14px; }
#tab-security .panel h4 { margin: 0 0 8px; }

/* Configurações: rede e servidor */
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 16px; }
.set-grid .panel { margin: 0; }
.info-list { grid-template-columns: minmax(150px, auto) 1fr; }
.info-list > span:nth-child(odd) { color: var(--muted, #8a97a8); }
.mono { font-family: ui-monospace, Consolas, monospace; }
code.wrap { word-break: break-all; }
.set-grid { margin-bottom: 16px; }
.info-list code { word-break: break-all; }
@media (max-width: 520px) { .set-grid { grid-template-columns: 1fr; } }

/* v4.2 · cards do dashboard viram filtros */
button.kpi { font: inherit; text-align: left; border: 1px solid var(--border); border-left: 5px solid var(--off); cursor: pointer; color: inherit; width: 100%; }
.kpi.clickable { cursor: pointer; transition: box-shadow .15s, border-color .15s, transform .15s; }
.kpi.clickable:hover { border-color: var(--navy-2, #10284A); transform: translateY(-1px); }
.kpi.active { border-color: var(--navy-2, #10284A); box-shadow: 0 0 0 2px var(--navy-2, #10284A) inset; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #EAF1FA; color: var(--text); border-radius: 99px; padding: 3px 4px 3px 12px; font-size: 13px; }
.chip-x { border: 0; background: #fff; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; line-height: 1; font-size: 14px; color: var(--muted); }

/* v4.2 · histórico da Segurança de Conexão */
.hist-filters { display: flex; gap: 8px; margin-left: auto; }
.hist-filters select, .hist-filters input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 13px; }
.hist-stats { margin-left: 12px; color: var(--muted); }
.hist-more { text-align: center; padding-top: 10px; }
.tag.green { background: #E3F5EA; color: #1E7B45; }

/* v4.3 · menu expansível: pai só texto, submenu oculto até hover/clique */
#tabs { align-items: stretch; }
.nav-group { position: relative; display: flex; }
.nav-group.nav-hidden { display: none; }
#tabs .nav-parent { display: inline-flex; align-items: center; gap: 6px; user-select: none; }
#tabs .nav-parent::after { content: ""; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid currentColor; opacity: .7; transition: transform .15s; }
.nav-group.open > .nav-parent::after { transform: rotate(180deg); }
.nav-group.has-active > .nav-parent { color: #fff; border-bottom-color: var(--accent); }
.nav-group.open > .nav-parent, .nav-group:hover > .nav-parent { color: #fff; }
/* oculto por padrão */
.nav-sub { display: none; position: absolute; top: 100%; left: 0; min-width: 230px; z-index: 60; padding: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 28px rgba(11,27,48,.18); }
/* aparece no hover (dispositivos com mouse) ou quando aberto por clique */
@media (hover: hover) { .nav-group:hover > .nav-sub { display: flex; flex-direction: column; } }
.nav-group.open > .nav-sub { display: flex; flex-direction: column; }
.nav-group.suppress > .nav-sub { display: none !important; }
#tabs .nav-sub button { color: var(--text); padding: 9px 12px; border: 0; border-radius: 7px; text-align: left; white-space: nowrap;
  display: flex; align-items: center; gap: 8px; justify-content: space-between; }
#tabs .nav-sub button:hover, #tabs .nav-sub button:focus-visible { background: #EEF3F9; outline: none; }
#tabs .nav-sub button.active { background: #E4EDF8; color: var(--navy-2, #10284A); font-weight: 600; border: 0; }
#tabs .nav-sub button.no-perm { display: none; }
.nav-badge { margin-left: 2px; }
@media (max-width: 900px) { #tabs { overflow: visible; flex-wrap: wrap; } .nav-sub { min-width: 200px; } }

/* v4.2 · notícias */
.warn-box { background: #FFF7E6; border: 1px solid #F3D9A4; border-radius: 8px; padding: 10px 12px; color: #6B4A00; }
.panel.inline.wrap { flex-wrap: wrap; }
.check-row.small { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-top: 4px; }
#feeds-body select, #feeds-body input:not([type=checkbox]) { padding: 5px 7px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 13px; }

/* v4.3 · arte do comunicado (envio direto) */
/* v5.3 · comunicados: bloco da arte e validade */
.ann-art { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 8px; margin: 0; min-width: 0; }
.ann-art legend { font-size: 12px; color: var(--muted); padding: 0 4px; } .ann-art legend small { font-size: 11px; }
.ann-art-row { display: flex; align-items: center; gap: 10px; }
.ann-art-row select { flex: 1 1 auto; min-width: 0; height: 38px; }
.ann-art-row .ann-upload { flex: 0 0 auto; height: 38px; display: inline-flex; align-items: center; white-space: nowrap; margin: 0; }
.ann-art-or { color: var(--muted); font-size: 12px; }
.ann-art #ann-upload-status { display: block; min-height: 1em; margin-top: 6px; }
.ann-validity { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.ann-validity > label:first-child { flex: 1 1 200px; }
.ann-validity .check-row { padding-bottom: 9px; }
.ann-validity input:disabled { opacity: .5; }

/* chaves (switch) e música ambiente */
.switches { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.switches.compact { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.switch { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; cursor: pointer;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch > span { grid-row: span 2; width: 40px; height: 22px; border-radius: 99px; background: #CBD5E1; position: relative; transition: background .15s; }
.switch > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: #1E9E5A; }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--navy-2, #10284A); outline-offset: 2px; }
.switch b { font-size: 14px; } .switch small { color: var(--muted); font-size: 12px; }
.ok-text { color: #1E7B45 !important; }
.tracks { margin: 8px 0 10px; padding-left: 22px; }
.tracks li { padding: 3px 0; display: flex; gap: 10px; align-items: center; }
.tracks li small { color: var(--muted); }
.cat-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.g-feat { margin-bottom: 16px; }
.g-feat output { font-weight: 600; margin-left: 6px; }
.cat-checks label.check-row { flex-direction: row; display: inline-flex; color: var(--text); font-size: 13px; }

/* v4.5 · acesso remoto */
#form-remote .switch.wide { grid-column: 1 / -1; }
#form-remote details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.remote-checks { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.remote-checks li { display: grid; grid-template-columns: 26px 190px 1fr; gap: 8px; align-items: start; padding: 8px 10px; border-radius: 8px; background: #F8FAFC; font-size: 13px; }
.remote-checks .rc-ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: #94A3B8; }
.remote-checks .rc-ok .rc-ico { background: #1E9E5A; } .remote-checks .rc-warn .rc-ico, .remote-checks .rc-unknown .rc-ico { background: #D99A00; }
.remote-checks .rc-error .rc-ico { background: var(--danger); } .remote-checks .rc-error { background: #FDF1F1; }
.remote-checks span:last-child { word-break: break-word; }
.remote-guide { margin-top: 12px; } .remote-guide summary { cursor: pointer; }
.remote-guide code { word-break: break-all; }
@media (max-width: 700px) { .remote-checks li { grid-template-columns: 26px 1fr; } .remote-checks li span:last-child { grid-column: 2; } }
.form-grid label.switch { display: grid; grid-template-columns: 44px 1fr; justify-items: start; text-align: left; color: var(--text); font-size: 14px; }

/* v4.6 · backup */
#backup-panel .dlg-cols { gap: 14px; }
#backup-panel form.panel.flat { display: flex; flex-direction: column; gap: 10px; margin: 0; }
#backup-panel details ul { margin: 6px 0 0 18px; padding: 0; }
.backup-review { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:disabled { opacity: .45; }

/* v4.7 · validade "Não expirar", playlists e música ambiente */
dialog [hidden], form [hidden] { display: none !important; }
.legal-box { margin: 10px 0 14px; line-height: 1.5; font-size: 13px; }
.legal-box b { color: #4A3300; }

/* v4.8 · termo de aceite e conformidade */
.terms-text { white-space: pre-wrap; max-height: 50vh; overflow: auto; background: #F8FAFC; border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; font: 13px/1.5 inherit; font-family: inherit; }
#dlg-terms { max-width: 760px; }
.terms-status { margin: 4px 0 10px; }

/* v5.0 · saída de áudio por dispositivo e grupos da música */
.btn.audio-on { background: #E3F5EC; border-color: #9FD9BC; color: var(--ok); }
.audio-box { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: grid; gap: 8px; }
.src-groups { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 6px; }

/* v5.2 · liga/desliga das fotos e vídeos das notícias */
.news-media-switch { margin-right: 12px; }
.news-media-switch small { color: var(--muted); font-weight: 400; }

/* v5.3 · ajustes de alinhamento (form-grid força rótulos em coluna) */
.layout-fields label.mod-sub { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px; }
.layout-fields label.mod-sub input { width: auto; margin: 0; }
#form-ann .ann-art-row select { flex: 1 1 auto; width: auto; max-width: none; }
#form-ann .ann-validity { grid-column: 1 / -1; flex-wrap: nowrap; align-items: flex-end; }
#form-ann .ann-validity > label:first-child { flex: 0 1 280px; }
#form-ann .ann-validity label.check-row { display: flex; flex-direction: row; align-items: center; gap: 8px; white-space: nowrap; }
#form-ann .ann-validity label.check-row input { width: auto; margin: 0; }
#form-ann .ann-validity label.check-row small { color: var(--muted); }
#form-ann fieldset.ann-art { display: block; }
#form-ann .ann-art-row { width: 100%; }

/* ===================== Cloud 6.0: cliente atual, pareamento ===================== */
.tenant-box { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border: 1px solid var(--line, #2a3442);
  border-radius: 999px; background: var(--panel-2, rgba(255,255,255,.04)); white-space: nowrap; }
.tenant-box[hidden], .tenant-box [hidden] { display: none !important; }
.tenant-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.tenant-box select { border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600; max-width: 260px; }
.tenant-box select option { color: #111; }
.pair-grid { display: grid; grid-template-columns: 170px 1.4fr 1fr 1fr auto; gap: 12px; align-items: end; }
.pair-code { font: 700 18px/1 ui-monospace, "DejaVu Sans Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
@media (max-width: 900px) { .pair-grid { grid-template-columns: 1fr 1fr; } }

/* ===================== Cloud 6.0: assistente de primeiro acesso + 2FA ===================== */
.wizard-steps { display: flex; gap: 8px; margin: 0 0 4px; padding: 0; list-style: none; counter-reset: w; }
.wizard-steps li { flex: 1; counter-increment: w; font-size: 12px; color: var(--muted); padding-top: 8px;
  border-top: 3px solid var(--border); }
.wizard-steps li::before { content: counter(w) ". "; font-weight: 700; }
.wizard-steps li.on { color: var(--navy-2); border-color: var(--accent); font-weight: 600; }
.wizard-steps li.done { color: var(--ok); border-color: var(--ok); }
.pw-meter { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; margin-top: -4px; }
.pw-meter span { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }
.pw-meter span[data-level="mid"] { background: var(--warn); }
.pw-meter span[data-level="strong"] { background: var(--ok); }
.pw-rules { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.pw-rules li::before { content: "○ "; }
.pw-rules li.ok { color: var(--ok); }
.pw-rules li.ok::before { content: "✓ "; }
.enroll-qr { display: grid; place-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 12px;
  background: #fff; width: 232px; height: 232px; margin: 0 auto; }
.enroll-qr svg { width: 216px; height: 216px; }
.enroll-secret { display: inline-block; margin-top: 6px; font-size: 13px; letter-spacing: .06em; user-select: all; }
.otp-input { font: 700 24px/1 Consolas, ui-monospace, monospace; letter-spacing: .4em; text-align: center; }
#setup-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ===================== Cloud 6.0: aviso de inatividade ===================== */
.idle-dialog { width: min(420px, 92vw); text-align: center; padding: 28px 24px 22px; }
.idle-dialog h3 { font-size: 18px; margin: 14px 0 6px; }
.idle-dialog p { margin: 0 0 20px; color: var(--muted); }
.idle-dialog .actions { display: flex; gap: 10px; justify-content: center; }
.idle-ring { position: relative; width: 84px; height: 84px; margin: 0 auto; }
.idle-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.idle-ring circle { fill: none; stroke-width: 4; stroke: var(--border); }
#idle-arc { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.idle-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; color: var(--navy-2); }

/* ===================== Configurações → Sessão e segurança ===================== */
.seg-group { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px;
  background: var(--bg); margin: 4px 0 8px; flex-wrap: wrap; }
.seg-group input { position: absolute; opacity: 0; pointer-events: none; }
.seg-group span { display: block; padding: 7px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg-group input:checked + span { background: var(--navy-2); color: #fff; }
.seg-group input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ===================== Modais da interface (ui.js): substituem prompt/confirm/alert ===================== */
.ui-dialog { padding: 0; border: 0; border-radius: 14px; box-shadow: 0 24px 60px rgba(11,27,48,.35); overflow: visible; }
.ui-dialog::backdrop { background: rgba(11,27,48,.55); backdrop-filter: blur(2px); }
.ui-dialog[open] { animation: ui-in .16s ease-out; }
@keyframes ui-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.ui-form { display: flex; flex-direction: column; gap: 14px; padding: 22px 24px 20px; }
.ui-head { display: flex; align-items: center; gap: 12px; }
.ui-head h3 { flex: 1; margin: 0; font-size: 17px; color: var(--navy-2); }
.ui-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: #E7F1FB; color: var(--navy-2); font-weight: 800; }
.ui-ico.danger { background: #FBEBEB; color: var(--danger); }
.ui-x { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.ui-x:hover { background: var(--bg); color: var(--text); }
.ui-msg { margin: 0; color: var(--muted); line-height: 1.45; }
.ui-fields { display: flex; flex-direction: column; gap: 12px; }
.ui-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.ui-field > span { font-weight: 600; color: var(--text); }
.ui-field input, .ui-field select, .ui-field textarea { padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-size: 14px; background: #fff; }
.ui-field input:focus, .ui-field select:focus, .ui-field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.ui-field[hidden] { display: none; }
.ui-hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.ui-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.ui-check input { margin-top: 3px; }
.ui-check span { display: flex; flex-direction: column; gap: 2px; }
.ui-error { margin: 0; padding: 8px 11px; border-radius: 8px; background: #FBEBEB; color: var(--danger); font-size: 13px; }
.ui-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(1.08); }


/* =====================================================================
   MOBILE / TABLET (ELTEC Mídia PRO) — menu em gaveta, cabeçalho em 2 linhas,
   cards fluidos e tabelas com rolagem própria. Lógica em mobile.js.
   ===================================================================== */
.nav-toggle, .drawer-head, .user-ini, .user-menu-head { display: none; }
.nav-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(11,27,48,.55); backdrop-filter: blur(2px); }
.nav-backdrop[hidden] { display: none; }

/* tabelas: a rolagem fica no contêiner, nunca na página */
.table-scroll { position: relative; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-radius: var(--radius); overscroll-behavior-x: contain; }
.table-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.table-scroll > table.grid { min-width: 100%; }
.table-scroll.more-right { box-shadow: inset -14px 0 12px -12px rgba(11,27,48,.35); }
.table-scroll.more-left { box-shadow: inset 14px 0 12px -12px rgba(11,27,48,.35); }
.table-scroll.more-left.more-right { box-shadow: inset 14px 0 12px -12px rgba(11,27,48,.35), inset -14px 0 12px -12px rgba(11,27,48,.35); }

/* cards de resumo: colunas se ajustam à largura, texto nunca vaza */
.kpis { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.kpi { min-width: 0; }
.kpi span { display: block; overflow-wrap: anywhere; line-height: 1.35; }

@media (max-width: 1100px) {
  /* ---- cabeçalho: linha 1 = ☰ · marca · avatar | linha 2 = seletor de cliente (100%) */
  .top { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "menu brand user" "tenant tenant tenant";
    gap: 10px 12px; height: auto; padding: 10px 16px 12px; align-items: center; }
  .nav-toggle { grid-area: menu; display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 42px; height: 42px; padding: 0 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.18);
    background: rgba(255,255,255,.06); cursor: pointer; }
  .nav-toggle span { display: block; height: 2px; border-radius: 2px; background: #fff; }
  .nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .brand { grid-area: brand; min-width: 0; }
  .brand strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .brand small, .summary { display: none !important; }
  .user-box { grid-area: user; margin: 0; }
  .user-btn { width: 42px; height: 42px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
  .user-txt { display: none; }
  .user-ini { display: block; font-weight: 700; font-size: 14px; letter-spacing: .02em; }
  .user-menu { right: 0; left: auto; min-width: 220px; }
  .user-menu-head { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; margin: -4px -4px 4px;
    border-bottom: 1px solid var(--border); }
  .user-menu-head small { color: var(--muted); }
  .tenant-box { grid-area: tenant; width: 100%; box-sizing: border-box; border-radius: 12px; padding: 6px 12px; min-height: 44px; }
  .tenant-box select { flex: 1; min-width: 0; max-width: none; width: 100%; text-overflow: ellipsis; padding: 6px 0; font-size: 15px; }
  .tenant-box select:focus-visible { outline: none; }
  .tenant-box:focus-within { border-color: var(--accent); }
  .tenant-box strong#tenant-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* ---- menu vira gaveta lateral */
  #tabs { position: fixed; z-index: 80; top: 0; bottom: 0; left: 0; width: min(86vw, 320px); height: 100dvh;
    display: flex; flex-direction: column; gap: 2px; padding: 0 10px 24px; overflow-y: auto; overflow-x: hidden;
    background: linear-gradient(180deg, var(--navy), var(--navy-2)); box-shadow: 12px 0 40px rgba(0,0,0,.35);
    transform: translateX(-104%); transition: transform .22s ease; visibility: hidden; flex-wrap: nowrap; }
  body.nav-open #tabs { transform: none; visibility: visible; }
  body.nav-open { overflow: hidden; }
  .drawer-head { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 1;
    padding: 16px 4px 14px; margin-bottom: 6px; background: var(--navy); border-bottom: 1px solid rgba(255,255,255,.1); color: #fff; }
  .drawer-head strong { flex: 1; }
  .drawer-close { width: 38px; height: 38px; border-radius: 10px; border: 1px solid rgba(255,255,255,.18);
    background: none; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
  #tabs button[data-tab] { text-align: left; padding: 12px 14px; border: 0; border-radius: 10px; color: #DCE7F3;
    min-height: 44px; white-space: normal; }
  #tabs button[data-tab].active { background: rgba(95,168,224,.18); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
  #tabs button[data-tab]:hover { background: rgba(255,255,255,.06); }
  /* grupos ficam sempre abertos: o "pai" vira título da seção */
  .nav-group { display: flex; flex-direction: column; margin-top: 8px; }
  #tabs .nav-parent { pointer-events: none; padding: 10px 14px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    color: #8FA9C6; border: 0; min-height: 0; }
  #tabs .nav-parent::after { display: none; }
  .nav-group.has-active > .nav-parent { color: #8FA9C6; border: 0; }
  .nav-sub, .nav-group:hover > .nav-sub, .nav-group.suppress > .nav-sub { display: flex !important; position: static; flex-direction: column;
    min-width: 0; padding: 0; background: none; box-shadow: none; border: 0; }
  #tabs .nav-sub button { color: #DCE7F3; }
  #tabs .nav-sub button:hover, #tabs .nav-sub button:focus-visible { background: rgba(255,255,255,.08); }
  #tabs .nav-sub button.active { background: rgba(95,168,224,.18); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
}

@media (max-width: 600px) {
  main { padding: 14px 12px 28px; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px 14px 14px 16px; }
  .kpi b { font-size: 26px; }
  .kpi span { font-size: 13px; }
  .table-scroll > table.grid { min-width: 560px; }                 /* colunas legíveis; rola para o lado */
  .table-scroll > table.grid th { white-space: nowrap; }
  .toolbar { flex-wrap: wrap; gap: 8px; }
  #toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
@media (max-width: 380px) {
  .kpis { grid-template-columns: 1fr; }                             /* telas extra pequenas: 1 coluna */
  .brand strong { font-size: 15px; }
}

/* itens de grid/flex podem encolher: a tabela rola no próprio contêiner em vez de alargar a página */
.dash-grid > *, .split > *, .dlg-cols > *, .panel, .card { min-width: 0; }
@media (max-width: 600px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }            /* celular: 2 colunas */
  .kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }      /* card que sobra ocupa a linha inteira */
}
@media (max-width: 380px) {
  .kpis { grid-template-columns: 1fr; }                                  /* extra pequeno: 1 coluna */
}
.user-menu-head b { color: var(--text); font-size: 14px; }
@media (max-width: 600px) {
  .table-scroll > table.grid { width: max-content; min-width: 100%; }
  .table-scroll > table.grid th, .table-scroll > table.grid td { white-space: nowrap; }
  .table-scroll > table.grid td :is(p, .hint, details) { white-space: normal; min-width: 220px; }
}
