/* Central GPS Vista. Layout: barra fixa com abas; painel de indicadores em grade; lista de solicitações em tabela (cartões no celular);
   edição em painel lateral. Cores em variáveis (tema claro e escuro). */
:root { box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body { margin: 0; padding: 0; }
img { max-width: 100%; }
[hidden]:not([hidden=until-found i]) { display: none !important; }
:root {
  --bg: #f3f5f6; --surface: #ffffff; --surface-2: #e9eef0; --line: #d3dcdf;
  --fg: #16232a; --muted: #5a6b73; --accent: #0b6e72; --accent-ink: #ffffff; --accent-soft: #d6ecec;
  --good: #2f7d32; --good-soft: #e1f1e1; --warn: #a86400; --warn-soft: #fbedd6;
  --bad: #b3261e; --bad-soft: #f8e0dd; --info: #2c5d9b; --info-soft: #e0e9f6; --mute-soft: #e7eaeb;
  --f-display: "Archivo", "Segoe UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0f1719; --surface: #162125; --surface-2: #1d2b30; --line: #2b3c42;
  --fg: #e4ecee; --muted: #93a7ae; --accent: #4fb8b5; --accent-ink: #062022; --accent-soft: #173a3b;
  --good: #7cc37f; --good-soft: #1b3320; --warn: #e5a54a; --warn-soft: #3a2a12;
  --bad: #f0857c; --bad-soft: #3d1c1a; --info: #8db4ec; --info-soft: #1b2b42; --mute-soft: #22302f;
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0f1719; --surface: #162125; --surface-2: #1d2b30; --line: #2b3c42;
  --fg: #e4ecee; --muted: #93a7ae; --accent: #4fb8b5; --accent-ink: #062022; --accent-soft: #173a3b;
  --good: #7cc37f; --good-soft: #1b3320; --warn: #e5a54a; --warn-soft: #3a2a12;
  --bad: #f0857c; --bad-soft: #3d1c1a; --info: #8db4ec; --info-soft: #1b2b42; --mute-soft: #22302f;
  color-scheme: dark; }

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 14px; line-height: 1.45; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

header.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.wrap { max-width: 1240px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.top-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-block: 12px 0; }
.brand { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.brand h1 { margin: 0; font-family: var(--f-display); font-weight: 800; font-size: 20px; letter-spacing: -0.01em; }
.brand small { color: var(--muted); font-size: 12px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live.on i { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.live.warn i { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.live.warn { color: var(--warn); font-weight: 600; }
.btn { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
nav.tabs { display: flex; gap: 4px; margin-top: 10px; overflow-x: auto; }
nav.tabs button { border: 0; background: none; padding: 10px 12px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
nav.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
nav.tabs .count { font-family: var(--f-mono); font-size: 11px; background: var(--surface-2); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }

main.wrap { padding-block: 18px 48px; display: grid; gap: 18px; }
.banner { border: 1px dashed var(--warn); background: var(--warn-soft); color: var(--fg); border-radius: var(--r); padding: 10px 14px; font-size: 13px; }
.banner strong { color: var(--warn); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.field { display: grid; gap: 4px; min-width: 0; }
.field label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; width: 100%; }
.field textarea { min-height: 72px; resize: vertical; }
.filters .field { width: 160px; }
.filters .field.grow { flex: 1 1 200px; width: auto; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 4px; min-width: 0; }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .value { font-family: var(--f-display); font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.kpi.alert .value { color: var(--bad); }
.kpi.ok .value { color: var(--good); }
.kpi.warn .value { color: var(--warn); }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; display: grid; gap: 12px; align-content: start; }
.card h2 { margin: 0; font-family: var(--f-display); font-size: 15px; font-weight: 700; }
.card h2 small { font-family: var(--f-body); font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
.empty-note { color: var(--muted); font-size: 13px; }

.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 6px; min-width: 2px; }
.bar-row .v { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.t-good .bar-fill { background: var(--good); } .t-warn .bar-fill { background: var(--warn); }
.t-bad .bar-fill { background: var(--bad); } .t-info .bar-fill { background: var(--info); }
.t-mute .bar-fill { background: var(--muted); }

.cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; align-items: end; height: 170px; padding-top: 18px; border-bottom: 1px solid var(--line); }
.col { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; align-items: end; height: 100%; position: relative; }
.col span { display: block; border-radius: 4px 4px 0 0; position: relative; min-height: 2px; }
.col span b { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-family: var(--f-mono); font-size: 10px; font-weight: 500; color: var(--muted); }
.col .s1 { background: var(--info); } .col .s2 { background: var(--good); }
.stack { display: flex; flex-direction: column-reverse; justify-content: flex-start; height: 100%; position: relative; }
.stack span { display: block; min-height: 0; }
.stack b { position: absolute; left: 50%; transform: translate(-50%, -16px); font-family: var(--f-mono); font-size: 10px; font-weight: 500; color: var(--muted); }
.r-CE { background: var(--accent); } .r-MA { background: var(--info); } .r-PI { background: var(--warn); }
.col-labels { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; font-size: 11px; color: var(--muted); text-align: center; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.r, th.r { text-align: right; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--surface-2); }
tr.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }

.pill { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; background: var(--mute-soft); color: var(--fg); }
.pill.good { background: var(--good-soft); color: var(--good); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.info { background: var(--info-soft); color: var(--info); }
.pill.neutral { background: var(--accent-soft); color: var(--accent); }
.late { color: var(--bad); font-weight: 600; }
.code { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.cards-m { display: none; gap: 10px; }
.mcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 6px; text-align: left; width: 100%; }
.mcard .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }

.feed { display: grid; gap: 0; }
.feed-item { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed-item img { width: 28px; height: 28px; border-radius: 50%; }
.feed-item .when { font-size: 12px; color: var(--muted); }

.overlay { position: fixed; inset: 0; background: rgba(8, 18, 20, .45); z-index: 20; display: flex; justify-content: flex-end; }
.panel { background: var(--bg); width: min(760px, 100%); height: 100%; overflow-y: auto; padding: calc(16px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) 20px; display: grid; gap: 16px; align-content: start; }
.panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-head h2 { margin: 0 auto 0 0; font-family: var(--f-display); font-size: 19px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px 14px; margin: 0; display: grid; gap: 12px; background: var(--surface); min-width: 0; }
legend { font-family: var(--f-display); font-weight: 700; font-size: 13px; padding: 0 6px; }
.hint { font-size: 12px; color: var(--muted); }
.path { font-family: var(--f-mono); font-size: 12px; word-break: break-all; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.err { color: var(--bad); font-size: 13px; font-weight: 600; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 30; font-weight: 600; font-size: 13px; max-width: calc(100% - 32px); }

.auto { border-color: var(--accent); }
.steps { display: flex; flex-wrap: wrap; gap: 4px; }
.steps span { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.steps span.done { background: var(--accent-soft); color: var(--accent); }
.steps span.now { background: var(--accent); color: var(--accent-ink); }
.steps span.err { background: var(--bad-soft); color: var(--bad); }
.robo-msg { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: 13px; white-space: pre-wrap; }
.robo-msg .hint { display: block; margin-top: 4px; }
.who { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.who.voce { color: var(--warn); } .who.robo { color: var(--info); }
.mini { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.mini table { font-size: 12px; } .mini td, .mini th { padding: 5px 8px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stats div { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; display: grid; }
.stats b { font-family: var(--f-display); font-size: 20px; font-variant-numeric: tabular-nums; }
.stats small { color: var(--muted); font-size: 11px; }
ul.tight { margin: 0; padding-left: 18px; display: grid; gap: 2px; font-size: 13px; }
.sub-robo { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
/* campos: mesma altura, automáticos com cara de leitura, anexo no estilo do sistema */
.field input:not([type=file]):not([type=checkbox]), .field select { height: 38px; }
.field input[readonly], .field input:disabled, .field select:disabled, .field textarea:disabled { background: var(--surface-2); color: var(--muted); cursor: default; }
.field input[readonly]:focus-visible { outline: none; }
.hint:empty, .err:empty { display: none; }
.field select[size], .picker select[size] { height: auto; padding: 4px; }
.picker { display: grid; gap: 10px; }
.picker input[type=search], .picker select { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0; }
.picker option { padding: 4px 6px; }
.field input[type=file] { padding: 5px 6px; cursor: pointer; }
.field input[type=file]::file-selector-button { border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); border-radius: 6px; padding: 6px 12px; margin-right: 10px; font: inherit; font-weight: 600; cursor: pointer; }
.field input[type=file]:hover::file-selector-button { border-color: var(--accent); }
.robo-msg, .path, .mini td, .feed-item, .kpi .sub, .card h2 { overflow-wrap: anywhere; }
.chip .num { margin-left: 3px; opacity: .75; }
.live { white-space: nowrap; }
.feed-item img { display: block; background: var(--surface-2); }
@media (max-width: 640px) { #chMesELbl span:nth-child(even) { visibility: hidden; } .col span b, .stack b { font-size: 9px; } .live { white-space: normal; } }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .form-grid, .form-grid3 { grid-template-columns: minmax(0, 1fr); }
  .filters .field { width: calc(50% - 4px); }
  .list-table { display: none; } .cards-m { display: grid; }
  .kpi .value { font-size: 24px; }
  .bar-row { grid-template-columns: minmax(80px, 120px) minmax(0, 1fr) 36px; }
}
@media (prefers-reduced-motion: reduce) { tr.flash { animation: none; } }

/* entrada (login), conta e acessos */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; width: min(400px, 100%); display: grid; gap: 14px; }
.login-card h2 { margin: 0; font-family: var(--f-display); font-size: 18px; }
.login-card .brand { margin: 0; }
.login-card .btn.primary { width: 100%; padding: 10px 14px; }
.overlay.center { justify-content: center; align-items: center; padding: 16px; }
.menu-conta { position: relative; }
#btnConta { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 8; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px; display: grid; min-width: 220px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
.menu .hint { padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu button { border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 6px; font-weight: 500; }
.menu button:hover { background: var(--surface-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.avatar.robo { background: var(--info-soft); color: var(--info); }
#aLista select { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
#aLista .acoes { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
#aLista .acoes .btn { padding: 5px 10px; font-size: 12px; }
