:root {
  --bg: #f6f7f9; --card: #fff; --ink: #1c2330; --muted: #667085; --line: #e3e6eb;
  --accent: #1f6feb; --danger: #d92d20; --bar: #1f6feb; --bar2: #d92d20;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 13px/1.4 -apple-system, system-ui, "Segoe UI", sans-serif; }
header { padding: 12px 18px 2px; }
h1 { margin: 0; font-size: 17px; }
.rel { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px; margin-top: 8px; }
.rel h3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rel h3 select { width: auto; font-size: 12px; padding: 2px 4px; }
.rbar { margin: 7px 0; } .rbar .lin { display: flex; justify-content: space-between; font-size: 12px; }
.rbar .tr { height: 9px; background: var(--line); border-radius: 5px; overflow: hidden; margin-top: 2px; }
.rbar .tr i { display: block; height: 100%; background: var(--bar); border-radius: 5px; }
.rel .nota { color: var(--muted); font-size: 11px; margin-top: 8px; }
.chave { font: 12px ui-monospace, Menlo, monospace; background: var(--bg); border: 1px dashed var(--line); padding: 8px; border-radius: 6px; word-break: break-all; margin: 8px 0; }
header p { margin: 2px 0 0; color: var(--muted); }
.layout { display: grid; grid-template-columns: 264px 1fr; gap: 12px; padding: 10px 18px 28px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; padding: 12px 16px 40px; } header { padding: 16px 16px 4px; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
aside { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
@media (max-width: 900px) { aside { position: static; max-height: none; } }
label.t { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin: 9px 0 3px; text-transform: uppercase; letter-spacing: .03em; }
label.t:first-child { margin-top: 0; }
input, select, button { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
input[type=text], input[type=date], select { width: 100%; }
.row { display: flex; gap: 6px; }
.row > * { min-width: 0; flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 12px; padding: 1px 4px 1px 9px; font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
.chip button { border: 0; background: none; padding: 0 4px; cursor: pointer; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.check input { width: auto; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); cursor: pointer; }
button.ghost { cursor: pointer; }
.actions { display: flex; gap: 8px; margin-top: 16px; }
.actions button { flex: 1; padding: 8px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.kpi .v { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12px; }
.kpi.danger .v { color: var(--danger); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 8px; margin-top: 8px; }
.card h3 { margin: 0 0 8px; font-size: 13px; }
.chart { position: relative; height: 190px; }
.chart.tall { height: 240px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 3px 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; cursor: pointer; user-select: none; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 10px; color: var(--muted); }
.fatal { color: var(--danger); font-weight: 600; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; border: 0; border-radius: 0; padding: 8px 4px; cursor: pointer; background: transparent; }
.seg button.on { background: var(--accent); color: #fff; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.hint.off { color: var(--danger); }
.layers { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 8px; }
.layers label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.layers input { width: auto; }
header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.conta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.conta button, .btn { cursor: pointer; border-radius: 6px; padding: 5px 10px; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.rodape { color: var(--muted); font-size: 11px; padding: 0 18px 16px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: none; align-items: center; justify-content: center; z-index: 5000; padding: 12px; }
.modal.on { display: flex; }
.modal .box { background: var(--card); border: 1px solid var(--line); border-radius: 12px; width: min(480px, 100%); max-height: 92vh; overflow: auto; padding: 18px 18px 14px; }
.modal h2 { margin: 0 0 2px; font-size: 17px; }
.modal .sub { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; margin: 8px 0 12px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 6px 10px; cursor: pointer; color: var(--muted); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.campo { margin-bottom: 9px; }
.campo label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.campo input, .campo select { width: 100%; padding: 7px 8px; }
.campo .erro { color: var(--danger); font-size: 11.5px; margin-top: 2px; min-height: 0; }
.campo.bad input, .campo.bad select { border-color: var(--danger); }
.linha2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 520px) { .linha2 { grid-template-columns: 1fr; } }
.consent { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; margin: 6px 0 10px; }
.consent input { width: auto; margin-top: 2px; }
.modal .acoes { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.modal .msg { font-size: 12px; margin-top: 8px; min-height: 16px; }
.modal .msg.err { color: var(--danger); } .modal .msg.ok { color: #12b76a; }
.codigo { font-size: 22px; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.search { position: relative; margin-bottom: 8px; }
.search input { width: 100%; padding: 8px 10px; }
.sugg { position: absolute; z-index: 1200; left: 0; right: 0; top: 100%; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; margin-top: 2px; max-height: 300px; overflow: auto; box-shadow: 0 6px 20px rgba(0,0,0,.25); display: none; }
.sugg.on { display: block; }
.sugg div { padding: 7px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.sugg div:hover, .sugg div.sel { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.sugg small { color: var(--muted); white-space: nowrap; }
.vchecks { display: grid; grid-template-columns: 1fr; gap: 4px; margin-top: 4px; }
.vchecks label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.vchecks input, .vmodo input { width: auto; }
.vmodo { display: flex; gap: 12px; margin-top: 6px; font-size: 13px; }
.vmodo label { display: inline-flex; gap: 5px; align-items: center; }
.mapopts { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.mapopts label { display: inline-flex; gap: 6px; align-items: center; }
.mapopts input[type=number] { width: 76px; }
.hexlbl { font: 600 11px/1 -apple-system, system-ui, sans-serif; color: #1c2330; text-align: center; text-shadow: 0 0 3px #fff, 0 0 3px #fff; pointer-events: none; white-space: nowrap; }
.grp { border-radius: 50%; color: #fff; font: 700 12px/1 -apple-system, system-ui, sans-serif; display: flex; align-items: center; justify-content: center; border: 2px solid rgba(255,255,255,.85); box-shadow: 0 0 0 3px rgba(31,111,235,.25); cursor: pointer; }
.popup b { display: inline-block; min-width: 62px; }
.popup { font-size: 12px; line-height: 1.5; color: #1c2330; }
.popup .nope { color: #b42318; }
.popup .dup { color: #b54708; margin-top: 4px; }
#map { height: clamp(420px, 64vh, 700px); border-radius: 8px; background: var(--line); }
.maptools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.maptools select { width: auto; min-width: 150px; }
.maptools .grow { flex: 1; text-align: right; color: var(--muted); font-size: 12px; }
[data-theme="dark"] .leaflet-tile { filter: brightness(.75) contrast(1.1) saturate(.7); }
#status { color: var(--muted); font-size: 12px; margin: 8px 0 0; min-height: 18px; }

/* InfoSinistro — tema */
:root { --bg:#f3f1ec; --card:#fbfaf7; --ink:#1b1a17; --muted:#6b675e; --line:#dedad1; --accent:#c2410c; --danger:#b91c1c;
  --bar:#2f4858; --bar2:#c2410c; --hero:#1b1a17; --heroink:#f3f1ec; --field:#fff; --fline:#cfcabe;
  --sans:"IBM Plex Sans",system-ui,-apple-system,"Segoe UI",sans-serif; --disp:"Bricolage Grotesque",var(--sans); --mono:"IBM Plex Mono",ui-monospace,monospace; }
:root[data-theme="dark"] { --bg:#14130f; --card:#1d1b17; --ink:#f3f1ec; --muted:#a8a396; --line:#34312a; --accent:#d9480f; --danger:#f87171;
  --bar:#7fb0c8; --bar2:#f08a4b; --hero:#2a2822; --field:#26241f; --fline:#3d3a31; }
body { font:14px/1.45 var(--sans); }
h1,h2,h3 { font-family:var(--disp); letter-spacing:-.01em; }
header { padding:24px 32px 18px; border-bottom:1px solid var(--line); align-items:center; }
.brand { display:flex; align-items:center; gap:14px; }
.brand svg { width:52px; height:52px; flex:none; }
.brand .wm { color:var(--ink); }
.brand .wm b { font-weight:700; color:var(--accent); }
.brand .wm { color:var(--ink); }
.brand .wm b { font-weight:700; color:var(--accent); }
.brand p { margin:4px 0 0; font-size:13px; max-width:640px; }
.layout { grid-template-columns:300px 1fr; gap:24px; padding:24px 32px 40px; }
@media (max-width:900px) { .layout { grid-template-columns:minmax(0,1fr); padding:16px 16px 40px; } header { padding:18px 16px 14px; } }
.card { border-radius:16px; padding:18px; }
aside.card { padding:20px; }
label.t { font-size:12px; letter-spacing:.06em; margin:18px 0 8px; }
input, select, button { border-color:var(--fline); background:var(--field); border-radius:10px; padding:0 10px; min-height:40px; }
input[type=checkbox], input[type=radio] { min-height:0; accent-color:var(--accent); width:18px; height:18px; }
input:focus-visible, select:focus-visible, button:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.chip { border-radius:16px; padding:3px 6px 3px 12px; }
.chip button { min-height:28px; background:none; border:0; }
.check { margin-top:6px; min-height:40px; gap:12px; }
.vchecks label { min-height:36px; gap:12px; } .vmodo { gap:18px; } .vmodo label { min-height:36px; gap:8px; }
.actions { margin-top:20px; } .actions button { min-height:44px; border-radius:12px; font-weight:600; }
button.primary, .btn.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
.kpis { grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; }
.kpi { padding:18px 20px; }
.kpi .v { font:600 28px/1.1 var(--mono); letter-spacing:-.02em; }
.kpi .l { font-size:13px; margin-top:6px; }
.kpi:first-child { grid-column:span 2; background:var(--hero); border-color:var(--hero); color:var(--heroink); padding:20px 24px; }
.kpi:first-child .v { font-size:42px; } .kpi:first-child .l { color:inherit; opacity:.75; }
.kpi.danger .v { color:var(--accent); }
.grid { gap:12px; margin-top:12px; grid-template-columns:repeat(auto-fit,minmax(320px,1fr)); }
.grid .card:first-child { grid-column:1 / -1; }
.card h3 { font-size:18px; margin:0 0 14px; }
.chart { height:210px; } .chart.tall { height:260px; }
.seg { background:#e8e5dd; border:0; border-radius:12px; padding:4px; gap:2px; }
[data-theme="dark"] .seg { background:#2a2822; }
.seg button { border-radius:9px; min-height:40px; font-weight:600; color:var(--muted); }
.seg button.on { background:var(--ink); color:var(--bg); }
.hint { font-size:12px; }
.mapcard { --card:#26241f; --ink:#f3f1ec; --muted:#b9b4a8; --line:#3a382f; --field:#26241f; --fline:#3a382f;
  background:#1b1a17; border-color:#1b1a17; color:#f3f1ec; padding:20px; }
.mapcard h3 { font-size:22px; }
.layers label { border:1px solid var(--line); border-radius:20px; padding:0 14px; min-height:40px; gap:8px; }
.layers label:has(input:checked) { background:#f3f1ec; color:#1b1a17; border-color:#f3f1ec; }
.mapopts label { min-height:40px; } .mapopts input[type=number] { width:72px; font-family:var(--mono); }
#map { border-radius:14px; border:1px solid var(--line); }
.search input { min-height:48px; border-radius:12px; padding:0 16px; }
th, td { padding:11px 12px; } th { font-size:12px; letter-spacing:.06em; text-transform:uppercase; }
tbody tr:hover td { background:color-mix(in srgb, var(--accent) 6%, transparent); }
td.fatal { font-family:var(--mono); }
.pager button { min-width:44px; min-height:44px; font-size:18px; border-radius:10px; }
.pager button:disabled { opacity:.45; }
.conta button, .btn { min-height:40px; padding:0 14px; border-radius:10px; font-weight:500; }
.rodape { padding:0 32px 24px; font-size:12px; }
.modal .box { border-radius:20px; padding:24px; }
.campo input, .campo select { min-height:44px; }
/* compacto / dinâmico */
.layout > *, main > *, .card, .kpis > *, .grid > * { min-width:0; }
html, body { max-width:100%; overflow-x:hidden; }
#map { width:100%; max-width:100%; }
.mapopts, .maptools, .layers { max-width:100%; }
.maptools select { min-width:0; max-width:100%; }
.chart { width:100%; overflow:hidden; }

html { font-size:100%; color-scheme:light; } html[data-theme="dark"] { color-scheme:dark; }
body { font-size:13px; }
.hdr-right { display:flex; align-items:center; gap:10px; }
.tema-btn { width:36px; padding:0; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; border-radius:10px; }
.tema-btn svg { width:18px; height:18px; stroke:currentColor; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
header { padding:14px 24px 12px; }
.brand { gap:11px; } .brand svg { width:38px; height:38px; } .brand .wm { font-size:25px !important; }
.brand p { font-size:12px; margin-top:3px; }
.layout { grid-template-columns:minmax(240px,17vw) minmax(0,1fr); gap:16px; padding:16px 24px 32px; max-width:1800px; margin:0 auto; }
@media (max-width:900px) { .layout { grid-template-columns:1fr; padding:12px 12px 32px; } header { padding:12px; } }
.card { padding:14px; border-radius:12px; } aside.card { padding:14px; }
label.t { margin:12px 0 6px; font-size:11px; }
input, select, button { min-height:34px; border-radius:8px; }
.seg button { min-height:32px; } .seg { border-radius:10px; }
.actions { margin-top:14px; } .actions button { min-height:38px; border-radius:10px; }
.check { min-height:32px; margin-top:4px; gap:10px; } .vchecks label, .vmodo label { min-height:30px; }
.kpis { grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:10px; }
.kpi { padding:12px 14px; } .kpi .v { font-size:21px; } .kpi .l { font-size:12px; margin-top:3px; }
.kpi:first-child { padding:14px 18px; } .kpi:first-child .v { font-size:30px; }
.grid { gap:10px; margin-top:10px; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); }
.card h3 { font-size:15px; margin-bottom:10px; } .mapcard h3 { font-size:17px; }
.chart { height:180px; } .chart.tall { height:220px; }
.mapcard { padding:14px; }
.layers label, .mapopts label { min-height:32px; } .layers label { padding:0 12px; }
.search input { min-height:40px; }
#map { height:clamp(380px, 62vh, 760px); }
th, td { padding:7px 10px; } .pager button { min-width:36px; min-height:36px; }
.conta button, .btn { min-height:34px; padding:0 12px; }
.rodape { padding:0 24px 16px; }
.modal .box { padding:20px; } .campo input, .campo select { min-height:38px; }
@media (pointer:coarse) { input, select, button, .layers label, .check, .vchecks label { min-height:44px; } }

.chat-fab { position:fixed; right:20px; bottom:20px; z-index:900; min-height:44px; padding:0 18px; border-radius:22px; background:var(--accent); color:#fff; border:0; font-weight:600; cursor:pointer; box-shadow:0 4px 16px rgba(0,0,0,.25); }
.chat { position:fixed; right:20px; bottom:20px; z-index:901; width:min(400px, calc(100vw - 24px)); height:min(620px, calc(100vh - 40px)); display:none; flex-direction:column; background:var(--card); border:1px solid var(--line); border-radius:12px; box-shadow:0 8px 32px rgba(0,0,0,.3); overflow:hidden; }
.chat.on { display:flex; }
.chat header { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:10px 12px; border-bottom:1px solid var(--line); background:transparent; }
.chat header b { font-size:14px; } .chat header span { color:var(--muted); font-size:11px; display:block; }
.chat header button { border:0; background:transparent; cursor:pointer; font-size:18px; line-height:1; color:var(--muted); min-height:32px; padding:0 8px; }
.chat-msgs { flex:1; overflow-y:auto; padding:12px; display:flex; flex-direction:column; gap:10px; }
.cm { max-width:92%; padding:8px 11px; border-radius:10px; line-height:1.45; word-wrap:break-word; }
.cm.user { align-self:flex-end; background:var(--accent); color:#fff; white-space:pre-wrap; }
.cm.bot { align-self:flex-start; background:var(--bg); border:1px solid var(--line); }
.cm.bot p { margin:0 0 6px; } .cm.bot p:last-child { margin:0; } .cm.bot ul { margin:4px 0 6px; padding-left:18px; }
.cm.err { align-self:flex-start; color:var(--danger); font-size:12px; }
.cm.wait { color:var(--muted); font-style:italic; }
.cm details { margin-top:6px; font-size:11px; color:var(--muted); } .cm details summary { cursor:pointer; }
.chat-sugg { display:flex; flex-wrap:wrap; gap:6px; }
.chat-sugg button { font-size:12px; border-radius:14px; padding:4px 10px; cursor:pointer; text-align:left; }
.chat-form { display:flex; gap:6px; padding:10px; border-top:1px solid var(--line); }
.chat-form textarea { flex:1; resize:none; height:40px; font:inherit; color:var(--ink); background:var(--card); border:1px solid var(--line); border-radius:6px; padding:8px; }
.chat-note { padding:0 12px 8px; font-size:10.5px; color:var(--muted); }
