/* MapaBase Interno · estilo comum das telas internas
   Mesmo desenho das telas internas do Portal (Gestão, Inspeções): lateral marinho,
   item ativo em verde da marca, títulos em Barlow Condensed, texto em Inter,
   códigos em IBM Plex Mono, cartões de 14 px com sombra suave.
   Tema escuro: html[data-tema="escuro"], igual ao Portal. A lateral não muda de cor. */
:root {
  color-scheme: light;
  --bg: #EEF1F5; --surface: #FFFFFF; --surface-2: #F3F6F9; --ink: #22314A; --muted: #4E5C71; --soft: #5A6678;
  --line: #DCE2EA; --line-2: #C9D1DC;
  --brand-deep: #1E2C42; --nav-ink: #C4CFDD; --nav-muted: #9FB0C6; --nav-sec: #6E8199;
  --green: #78B448; --green-h: #6AA33D; --on-green: #16240E; --green-soft: #E9F7EC; --green-ink: #23733A;
  --red: #B8302A; --red-soft: #FBEAE8; --amber: #8A5A00; --amber-soft: #FBF3E0;
  --gray-soft: #EDF0F4; --focus: #2F6FDB;
  --radius: 14px; --shadow: 0 6px 20px rgba(30,44,66,.06), 0 1px 3px rgba(30,44,66,.05);
  --f-titulo: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --f-corpo: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, monospace;
}
html[data-tema="escuro"] {
  color-scheme: dark;
  --bg: #0E151F; --surface: #162030; --surface-2: #1C2839; --ink: #E3E9F1; --muted: #C3CDDB; --soft: #9AA6B8;
  --line: #2B384B; --line-2: #3A4A60;
  --green-soft: #1E3320; --green-ink: #A6D98A; --red: #F2A397; --red-soft: #3A1E1B; --amber: #F0C46B; --amber-soft: #3A2C10;
  --gray-soft: #222E3E; --focus: #7FA8F0;
  --shadow: 0 6px 20px rgba(0,0,0,.25), 0 1px 3px rgba(0,0,0,.2);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-corpo); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- estrutura ---------- */
.shell { min-height: 100%; display: flex; }
#sidebar { width: 236px; flex-shrink: 0; background: var(--brand-deep); color: #EDF1F6; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; height: 100dvh; color-scheme: dark; }
.brand { padding: 22px 20px 10px; }
.brand-logo { display: block; width: 100%; max-width: 190px; height: auto; }
.brand .s { font-size: 11px; color: var(--nav-muted); letter-spacing: .14em; text-transform: uppercase; margin-top: 8px; font-weight: 600; }
#sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 12px; overflow: auto; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent 100%);
          mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent 100%); }
#sidebar nav::-webkit-scrollbar { width: 0; height: 0; }
.nav-sec { font-size: 9.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--nav-sec); padding: 11px 12px 5px; }
.navbtn { display: flex; align-items: flex-start; gap: 11px; padding: 10px 12px; border: 0; border-radius: 10px; background: none;
  color: var(--nav-ink); font-size: 13.5px; font-weight: 500; text-align: left; width: 100%; text-decoration: none; line-height: 1.3; }
.navbtn .ic { width: 19px; height: 19px; flex: none; display: flex; margin-top: -1px; }
.navbtn .ic svg { width: 19px; height: 19px; }
a.navbtn:hover { background: rgba(255,255,255,.06); color: #fff; }
.navbtn.active { background: var(--green); color: var(--on-green); font-weight: 600; }
.navbtn.breve { color: #8193AA; cursor: default; }
.navbtn .sub-breve { display: block; margin-top: 2px; font-size: 9.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--nav-sec); }
.sidebar-foot { margin-top: auto; padding: 14px 18px 18px; font-size: 11.5px; color: var(--nav-muted); line-height: 1.5; border-top: 1px solid rgba(255,255,255,.08); }
.sb-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sb-user .avatar { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.sb-user .nome { color: #fff; font-size: 13px; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user .papel { display: block; }
.sidebar-foot .sb-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 36px; margin-top: 10px;
  padding: 0 12px; font-size: 12.5px; font-weight: 600; line-height: 1; border-radius: 9px; background: transparent; color: var(--nav-ink);
  border: 1px solid rgba(255,255,255,.22); text-decoration: none; }
.sidebar-foot .sb-btn:first-of-type { margin-top: 14px; }
.sidebar-foot .sb-btn:hover { background: rgba(255,255,255,.07); color: #fff; border-color: rgba(255,255,255,.32); }
.sidebar-foot .sb-btn svg { width: 16px; height: 16px; flex: none; }
.sb-btn .tema-sol { display: none; }
html[data-tema="escuro"] .sb-btn .tema-lua { display: none; }
html[data-tema="escuro"] .sb-btn .tema-sol { display: block; }

.main { flex: 1; min-width: 0; padding: 26px 32px 90px; display: flex; flex-direction: column; gap: 18px; }
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.overline { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); }
.pagehead h1 { font-family: var(--f-titulo); font-size: 34px; font-weight: 700; line-height: 1.05; margin-top: 4px; }
.pagehead p { margin: 7px 0 0; font-size: 15px; color: var(--muted); line-height: 1.6; max-width: 82ch; }

/* ---------- componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 13.5px; font-weight: 600; border-radius: 10px; padding: 9px 14px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--soft); }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--on-green); }
.btn.primary:hover { background: var(--green-h); border-color: var(--green-h); }
.btn.sm { padding: 6px 10px; font-size: 12.5px; }
.btn.perigo { color: var(--red); border-color: var(--red-soft); }
.btn.perigo:hover { background: var(--red-soft); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.input { min-height: 42px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 12px; width: 100%; font-size: 14.5px; }
textarea.input { padding: 10px 12px; }
.input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(120,180,72,.2); }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); }
.pill { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 6px; white-space: nowrap; background: var(--gray-soft); color: var(--muted); }
.pill.ok { background: var(--green-soft); color: var(--green-ink); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.code { font-family: var(--f-mono); font-weight: 500; font-size: 12.5px; background: var(--gray-soft); color: var(--ink); padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.msg { padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.msg.error { background: var(--red-soft); color: var(--red); }
.msg.ok { background: var(--green-soft); color: var(--green-ink); }
.msg.warn { background: var(--amber-soft); color: var(--amber); }
.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--soft);
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1E2C42; color: #fff; padding: 10px 16px;
  border-radius: 10px; font-size: 13.5px; box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 50; max-width: min(560px, 90vw); }
.carregando { color: var(--muted); padding: 24px; text-align: center; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  #sidebar { width: 100%; height: auto; position: static; }
  .main { padding: 18px 16px 60px; }
}
