/* Layout: barra superior fina + área de trabalho que ocupa toda a tela; mapa em tela cheia com gavetas sobrepostas */
:root {
  --bg: #EEF0EC;
  --surface: #FFFFFF;
  --surface-2: #F6F7F4;
  --ink: #18211D;
  --muted: #5B6862;
  --line: #D6DBD5;
  --line-strong: #B9C1BA;
  --accent: #0E6B57;
  --accent-ink: #FFFFFF;
  --accent-soft: #DCEDE7;
  --route: #C8641E;
  --ok: #2F7D4A; --ok-soft: #E1F0E5;
  --warn: #9A6A06; --warn-soft: #FBF0D4;
  --bad: #B3362B; --bad-soft: #F8E1DE;
  --sel: #111614;
  --shadow: 0 1px 2px rgba(20,30,25,.08), 0 6px 20px rgba(20,30,25,.10);
  --map-bg: #E4E7E2;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-cond: "IBM Plex Sans Condensed", "IBM Plex Sans", "Arial Narrow", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 6px;
  --lasso: #0B63CE; --cmp-a: #2F6FB3; --cmp-b: #C2512B; --feriado: #B83A5E;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0F1412; --surface: #171D1A; --surface-2: #1D2421; --ink: #E3E9E5; --muted: #8E9C95;
  --line: #2A3330; --line-strong: #3A4541; --accent: #3BB394; --accent-ink: #06231B; --accent-soft: #163A31;
  --route: #E8873F; --ok: #5BBE7C; --ok-soft: #173424; --warn: #E0B04A; --warn-soft: #3A2E10; --bad: #EE7266; --bad-soft: #3D1C19;
  --sel: #FFFFFF; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.45); --map-bg: #1A201D; color-scheme: dark;
  --lasso: #4FA3FF; --cmp-a: #4A8FD6; --cmp-b: #D06A2A; --feriado: #E06A8C;
} }
:root[data-theme="dark"] {
  --bg: #0F1412; --surface: #171D1A; --surface-2: #1D2421; --ink: #E3E9E5; --muted: #8E9C95;
  --line: #2A3330; --line-strong: #3A4541; --accent: #3BB394; --accent-ink: #06231B; --accent-soft: #163A31;
  --route: #E8873F; --ok: #5BBE7C; --ok-soft: #173424; --warn: #E0B04A; --warn-soft: #3A2E10; --bad: #EE7266; --bad-soft: #3D1C19;
  --sel: #FFFFFF; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.45); --map-bg: #1A201D; color-scheme: dark;
  --lasso: #4FA3FF; --cmp-a: #4A8FD6; --cmp-b: #D06A2A; --feriado: #E06A8C;
}

html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--f-body); overflow: hidden; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
* { box-sizing: border-box; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num, td.n, .mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

#app { display: flex; flex-direction: column; height: 100%; }

/* ---------- Barra superior ---------- */
.top { display: flex; align-items: center; gap: 8px; background: var(--surface); border-bottom: 1px solid var(--line);
  padding-block: 2px; padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); min-height: 34px; flex: none; font-size: 12.5px; }
.brand { display: flex; align-items: center; gap: 5px; font-family: var(--f-cond); font-weight: 600; font-size: 13px; letter-spacing: .01em; white-space: nowrap; border: 0; background: transparent; color: inherit; cursor: pointer; padding: 3px 6px; border-radius: 4px; }
.brand:hover { background: var(--surface-2); }
.brand b { color: var(--accent); font-weight: 600; }
.brand svg { color: var(--accent); }
.amb-pick { display: flex; align-items: center; gap: 6px; min-width: 0; }
.amb-pick select { max-width: 180px; min-width: 0; min-height: 24px; padding: 1px 4px; font-size: 12px; border-color: var(--line); }
.tabs { display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: transparent; padding: 3px 8px; border-radius: 4px; cursor: pointer; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.tab:hover { background: var(--surface-2); color: var(--ink); }
.tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.save:not(.err) .txt { display: none; }
.save { font-size: 12px; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.save .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.save.pending .dot { background: var(--warn); }
.save.err .dot { background: var(--bad); }
.save button { border: 1px solid var(--line); background: var(--surface); border-radius: 4px; padding: 1px 6px; cursor: pointer; font-size: 12px; }

/* ---------- Controles base ---------- */
select, input[type=text], input[type=password], input[type=number], input[type=search], textarea {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 5px; padding: 5px 8px; min-height: 30px; }
textarea { width: 100%; min-height: 120px; font-family: var(--f-mono); font-size: 12px; }
input[type=color] { width: 30px; height: 26px; padding: 0; border: 1px solid var(--line-strong); border-radius: 4px; background: none; cursor: pointer; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: 5px; padding: 5px 11px; min-height: 30px; cursor: pointer; white-space: nowrap; font-weight: 500; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.btn.danger.armed { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 2px 8px; min-height: 26px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 5px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 4px 9px; cursor: pointer; font-size: 12.5px; color: var(--muted); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.chk { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; }
.chk input { accent-color: var(--accent); width: 15px; height: 15px; }
.lbl { font-family: var(--f-cond); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; }
.pill { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 99px; font-weight: 600; white-space: nowrap; font-family: var(--f-cond); letter-spacing: .02em; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.idle { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; flex: none; }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.daychips { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.daychips button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 4px; padding: 2px 7px; font-size: 12px; cursor: pointer; min-width: 34px; }
.daychips button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

main { position: relative; flex: 1; min-height: 0; }

/* ---------- Mapa ---------- */
#mapView { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; background: var(--map-bg); }
body.immersive .top { display: none; }
body.tool-lasso #map, body.tool-rect #map { touch-action: none; }
body.tool-lasso #map .leaflet-container, body.tool-lasso #map, body.tool-rect #map, body.tool-ruler #map, body.tool-place #map, body.tool-place #map .leaflet-interactive { cursor: crosshair; }

.float { position: absolute; z-index: 1001; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
#toolbar { top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; align-items: center; }
#toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.tb { width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 6px; cursor: pointer; color: var(--ink); position: relative; }
.tb:hover { background: var(--surface-2); }
.tb[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.tb svg { width: 18px; height: 18px; }

.drawer { top: 58px; bottom: 60px; width: 320px; display: flex; flex-direction: column; overflow: hidden; }
.drawer.left { left: max(10px, env(safe-area-inset-left, 0px)); }
.drawer.right { right: max(10px, env(safe-area-inset-right, 0px)); }
.drawer header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); flex: none; }
.drawer header h2 { margin: 0; font-family: var(--f-cond); font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.drawer .body { overflow-y: auto; padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.drawer-toggle { position: absolute; z-index: 1001; top: 58px; }
#btnLayers { left: max(10px, env(safe-area-inset-left, 0px)); }
#btnSel { right: max(10px, env(safe-area-inset-right, 0px)); }
.drawer-toggle .count { background: var(--route); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; font-family: var(--f-mono); }

/* Painel Roteirizar: rotas, formato e botão primeiro; o resto fica recolhível */
.rz { display: flex; flex-direction: column; gap: 14px; }
.rzl { display: grid; grid-template-columns: 62px 1fr; gap: 8px; align-items: center; }
.seg.rzvisao { grid-template-columns: repeat(3, 1fr); flex: none; }
.bzlist { display: flex; flex-direction: column; gap: 2px; max-height: 188px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.bzlist .chk { padding: 2px 0; font-size: 12.5px; }
.bzlist .chk[hidden] { display: none; }
.bznm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rkrow { width: 100%; text-align: left; cursor: pointer; }
.rkrow:hover { border-color: var(--accent); }
.rzsetor { padding: 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface-2); }
.rzsetor .tsec { background: var(--surface); }
.rzl select { width: 100%; min-width: 0; }
.rzl .daychips button, #selPanel .daychips button { min-width: 0; padding: 2px 5px; }
.rzn { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; }
.rzseg { display: grid; grid-template-columns: 1fr 1fr; }
.rzseg button { padding: 6px 9px; font-size: 13px; font-weight: 500; }
.rzhint { margin: 0; font-size: 12px; color: var(--muted); }
.rzgo { justify-content: center; width: 100%; min-height: 36px; white-space: normal; }
.rzsec { border-top: 1px solid var(--line); padding-top: 10px; }
.rzb { border-top: 1px solid var(--line); padding-top: 12px; }
.nmbtn { display: block; width: 100%; padding: 0; border: 0; background: transparent; font-weight: 600; font-size: 13px; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nmbtn:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.arvbtn svg { transition: transform .12s; }
.arvbtn[aria-expanded="true"] svg { transform: rotate(180deg); }
.rzsec > summary { cursor: pointer; font-family: var(--f-cond); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; }
.rzsec > summary:hover { color: var(--ink); }
.rzsec[open] > summary { margin-bottom: 10px; }
.rzsec > .stack + .stack { margin-top: 14px; }

.tree { display: flex; flex-direction: column; gap: 2px; }
.tsec { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.tsec > .th { display: grid; grid-template-columns: auto auto 1fr auto auto; gap: 7px; align-items: center; padding: 6px 7px; cursor: default; }
.tsec .th .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 13px; }
.tsec .th .sub { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.tsec .th .meta { font-size: 11px; color: var(--muted); text-align: right; line-height: 1.25; }
.iconbtn { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 2px 4px; border-radius: 4px; line-height: 0; }
.iconbtn:hover { color: var(--ink); background: var(--surface-2); }
.iconbtn svg { width: 15px; height: 15px; }
.tsec .grid { padding: 4px 8px 8px 26px; display: grid; gap: 3px; }
.wkrow { display: grid; grid-template-columns: 26px 1fr; gap: 5px; align-items: center; }
.wkrow .wk { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.rchips { display: grid; gap: 3px; }
.rchip { border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); padding: 1px 4px; font-size: 11px; cursor: pointer; display: inline-flex; gap: 3px; align-items: baseline; justify-content: space-between; color: var(--muted); min-width: 0; white-space: nowrap; }
.rchip b { color: var(--ink); font-weight: 600; }
.rchip.on { background: var(--surface-2); border-color: var(--rc, var(--accent)); box-shadow: inset 0 -2px 0 var(--rc, var(--accent)); color: var(--ink); }
.rchip.over b { color: var(--bad); }

#mapSummary { left: 50%; transform: translateX(-50%); bottom: 12px; display: flex; gap: 0; padding: 0; overflow: hidden; max-width: calc(100% - 20px); }
#mapSummary .kpi { padding: 6px 12px; border-right: 1px solid var(--line); white-space: nowrap; }
#mapSummary .kpi:last-child { border-right: 0; }
#mapSummary .kpi .v { font-family: var(--f-mono); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
#mapSummary .kpi .k { font-family: var(--f-cond); font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
#legend { left: max(10px, env(safe-area-inset-left, 0px)); bottom: 70px; padding: 7px 10px; font-size: 12px; max-width: 220px; max-height: 40vh; overflow: auto; }
#legend .li { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.panel-left #legend { display: none; }
#mapNote { top: 58px; z-index: 1002; left: 50%; transform: translateX(-50%); padding: 7px 12px; font-size: 12.5px; max-width: min(560px, calc(100% - 20px)); display: flex; gap: 10px; align-items: center; }
#mapNote.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
#rulerBox { bottom: 66px; left: 50%; transform: translateX(-50%); padding: 8px 12px; font-size: 13px; display: flex; gap: 12px; align-items: center; }
#rulerBox .big { font-family: var(--f-mono); font-size: 18px; font-weight: 600; }

.basepick { position: absolute; z-index: 1001; right: max(10px, env(safe-area-inset-right, 0px)); bottom: 54px; }
body.panel-right .basepick { right: 340px; }
.basepick select { font-size: 12px; min-height: 28px; box-shadow: var(--shadow); }

/* Leaflet (essencial, embutido) */
.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}
.leaflet-container{overflow:hidden;-webkit-tap-highlight-color:transparent;background:var(--map-bg);font:12px/1.4 var(--f-body);outline-offset:1px}
.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;user-select:none;-webkit-user-drag:none}
.leaflet-tile::selection{background:transparent}
.leaflet-marker-icon,.leaflet-marker-shadow{display:block}
.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}
.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}
.leaflet-container.leaflet-touch-zoom{touch-action:pan-x pan-y}
.leaflet-container.leaflet-touch-drag{touch-action:none;touch-action:pinch-zoom}
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{touch-action:none}
.leaflet-tile{filter:inherit;visibility:hidden}
.leaflet-tile-loaded{visibility:inherit}
.leaflet-zoom-box{width:0;height:0;box-sizing:border-box;z-index:800}
.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}
.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}
.leaflet-control{position:relative;z-index:800;pointer-events:auto;float:left;clear:both}
.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}
.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}
.leaflet-right .leaflet-control{float:right}
.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-right .leaflet-control{margin-right:10px}
.leaflet-zoom-animated{transform-origin:0 0}
svg.leaflet-zoom-animated{will-change:transform}
.leaflet-zoom-anim .leaflet-zoom-animated{transition:transform .25s cubic-bezier(0,0,.25,1)}
.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{transition:none}
.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}
.leaflet-interactive{cursor:pointer}
.leaflet-grab{cursor:grab}
.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}
.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive{cursor:grabbing}
.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}
.leaflet-marker-icon.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive{pointer-events:auto}
.leaflet-control-scale{margin-bottom:92px!important}
.leaflet-control-scale-line{border:2px solid var(--ink);border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;box-sizing:border-box;background:color-mix(in srgb,var(--surface) 85%,transparent);font-family:var(--f-mono);font-size:11px;color:var(--ink)}
.leaflet-control-attribution{background:color-mix(in srgb,var(--surface) 80%,transparent);margin:0;padding:0 5px;color:var(--muted);font-size:10px;line-height:1.5}
.leaflet-control-attribution a{color:var(--muted)}
.leaflet-tooltip{position:absolute;padding:6px 8px;background:var(--surface);border:1px solid var(--line);border-radius:5px;color:var(--ink);white-space:nowrap;-webkit-user-select:none;user-select:none;pointer-events:none;box-shadow:var(--shadow);font-size:12px}
.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}
.leaflet-tooltip.rl{padding:1px 6px;font-family:var(--f-mono);font-size:11.5px;font-weight:600;background:var(--ink);color:var(--surface);border:0}
.tip b { font-weight: 600; }
.tip .t2 { color: var(--muted); font-size: 11.5px; }
.seqm { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font: 600 10px/1 var(--f-mono); color: #fff; border: 1.5px solid var(--surface); }
.basem { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 4px; color: #fff; border: 2px solid var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.basem svg { width: 13px; height: 13px; }
/* Clientes sem coordenada: pinos empilhados no mar */
.seapin { width: 16px; height: 16px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--warn); border: 2px solid var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.45); cursor: grab; }
.seacount { width: max-content; white-space: nowrap; font: 600 12px/1.25 var(--f-body); color: var(--ink); background: var(--surface); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); border-radius: 6px; padding: 4px 8px; box-shadow: var(--shadow); }
.seacount small { font-weight: 400; color: var(--muted); }
#seaChip { left: 50%; transform: translateX(-50%); bottom: 64px; padding: 5px 6px 5px 11px; font-size: 12.5px; display: flex; gap: 8px; align-items: center; background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); white-space: nowrap; max-width: calc(100% - 20px); }
body.tool-ruler #seaChip { display: none; }
#geoBar { position: fixed; z-index: 2500; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); width: min(380px, calc(100% - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 9px 12px; font-size: 12.5px; display: flex; flex-direction: column; gap: 6px; }
body.view-map:not(.screen-home) #geoBar { bottom: 96px; }
body.view-map.panel-right:not(.screen-home) #geoBar { right: 340px; }
@media (max-width: 640px) { body.view-map:not(.screen-home) #geoBar { bottom: auto; top: 110px; right: 12px; } }
#geoBar .gt { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#geoBar .gbar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
#geoBar .gbar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }

/* ---------- Páginas ---------- */
#pageView { position: absolute; inset: 0; overflow-y: auto; }
.page { max-width: 1320px; margin: 0 auto; padding-block: 20px 60px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 16px; }
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ph h1 { margin: 0; font-family: var(--f-cond); font-weight: 600; font-size: 24px; letter-spacing: .005em; text-wrap: balance; }
.ph p { margin: 2px 0 0; color: var(--muted); max-width: 70ch; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.card > .ch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card > .ch h2 { margin: 0; font-family: var(--f-cond); font-size: 15px; font-weight: 600; }
.card > .cb { padding: 14px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar .grow { flex: 1; min-width: 160px; }
.toolbar input[type=search] { width: 100%; }

.tblwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
table.t { border-collapse: collapse; width: 100%; font-size: 13px; }
table.t th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-family: var(--f-cond); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td.wrap { white-space: normal; min-width: 180px; }
table.t th.n, table.t td.n { text-align: right; }
table.t tr.clk { cursor: pointer; }
table.t tr.clk:hover td { background: var(--surface-2); }
table.t tr.sub td { background: var(--surface-2); font-weight: 600; }
table.t tr.tot td { background: var(--accent-soft); font-weight: 700; border-bottom: 0; }
table.t input[type=checkbox] { accent-color: var(--accent); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 8px; font-size: 12.5px; color: var(--muted); }

.empty { padding: 34px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.empty h3 { margin: 0; color: var(--ink); font-family: var(--f-cond); font-size: 18px; font-weight: 600; }
.empty p { margin: 0; max-width: 56ch; }

.cols2 { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.cols2 > * { min-width: 0; }
.amblist { display: flex; flex-direction: column; gap: 6px; }
.ambi { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 9px 11px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.ambi:hover { border-color: var(--line-strong); }
.ambi[aria-current="true"] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.ambi .nm { font-weight: 600; }
.ambi .mt { font-size: 12px; color: var(--muted); }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field input:not([type=checkbox]):not([type=color]), .field select { width: 100%; }
.field .hint { font-size: 11.5px; color: var(--muted); }

.banner { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 7px; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line)); flex-wrap: wrap; }
.banner.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }

/* Grade semanal */
.wgrid { display: grid; gap: 4px; }
.wgrid .hd { font-family: var(--f-cond); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); text-align: center; }
.wgrid .wl { font-family: var(--f-mono); font-size: 12px; color: var(--muted); align-self: center; }
.cell { border: 1px solid var(--line); border-radius: 5px; padding: 5px 6px; cursor: pointer; background: var(--surface); text-align: left; display: flex; flex-direction: column; gap: 1px; min-height: 52px; }
.cell:hover { border-color: var(--line-strong); }
.cell .c1 { font-family: var(--f-mono); font-weight: 600; font-size: 13px; }
.cell .c2 { font-size: 11px; color: var(--muted); }
.cell .bar { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; margin-top: 3px; }
.cell .bar i { display: block; height: 100%; }
.cell.empty-c { background: var(--surface-2); cursor: default; color: var(--muted); }

/* Lista de rota (arrastar) */
.rlist { display: flex; flex-direction: column; gap: 3px; }
.rit { display: grid; grid-template-columns: 22px 1fr auto; gap: 7px; align-items: center; padding: 5px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); cursor: grab; font-size: 12.5px; }
.rit .q { font: 600 11px/1 var(--f-mono); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.rit .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rit.base { cursor: default; background: var(--surface-2); }
.rit.dragging { opacity: .4; }
.rit.over { border-color: var(--accent); box-shadow: 0 -2px 0 var(--accent); }
.mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 12.5px; }
.mgrid .v { font-family: var(--f-mono); font-weight: 600; text-align: right; }

/* Modal */
#modal { position: fixed; inset: 0; z-index: 3000; background: rgba(10,16,13,.45); display: grid; place-items: center; padding: 16px; }
#modal .dlg { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); width: min(760px, 100%); max-height: calc(100% - 20px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); }
#modal .dlg.sm { width: min(480px, 100%); }
#modal .dh { padding: 13px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
#modal .dh h2 { margin: 0; font-family: var(--f-cond); font-size: 17px; font-weight: 600; }
#modal .db { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
#modal .df { padding: 11px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.maptbl td select { min-width: 160px; }
.steps { display: flex; gap: 6px; font-size: 12px; color: var(--muted); }
.steps span.on { color: var(--accent); font-weight: 600; }

#toast { position: fixed; z-index: 4000; left: 50%; top: calc(134px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); pointer-events: none; background: var(--ink); color: var(--surface); padding: 8px 14px; border-radius: 7px; font-size: 13px; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
#toast.acao { pointer-events: auto; display: flex; align-items: center; gap: 12px; }
#toast.acao .btn { flex: none; }
.hist { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; max-height: 50vh; overflow: auto; }
.hist-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--line); }
.hist-row:first-child { border-top: 0; }
.hist-row .muted { font-size: 12px; }
.hist-row.desfeito b { color: var(--muted); font-weight: 500; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); z-index: 2000; background: var(--bg); }

/* ---------- Página inicial ---------- */
body.screen-home .amb-pick, body.screen-home .tabs { display: none; }
body:not(.screen-home) #openPlanner { display: none; }
body.screen-home #openPlanner { margin-left: auto; }
#openPlanner { min-height: 24px; padding: 1px 10px; font-size: 12px; }
#homeView { position: absolute; inset: 0; overflow-y: auto; }
.home { gap: 14px; }
.home .ph h2.sec { margin: 10px 0 0; font-family: var(--f-cond); font-weight: 600; font-size: 18px; }
.btn.lg { min-height: 40px; padding: 8px 18px; font-size: 14.5px; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap; padding: 24px 26px; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); }
.hero h1 { margin: 2px 0 6px; font-family: var(--f-cond); font-weight: 600; font-size: 34px; letter-spacing: .005em; }
.hero h1 b { color: var(--accent); font-weight: 600; }
.hero p { margin: 0; max-width: 62ch; color: var(--muted); }
.hero .row { min-width: 0; max-width: 100%; }
.hero .btn { white-space: normal; text-align: left; }
.kgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kc { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kc .k { font-family: var(--f-cond); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; }
.kc .v { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 600; line-height: 1.15; }
.kc .v .of { font-size: 15px; color: var(--muted); font-weight: 400; }
.kc .s { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cols-b { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.hbars { display: flex; flex-direction: column; gap: 4px; }
.hb { display: grid; grid-template-columns: minmax(80px, 44%) 1fr auto; gap: 10px; align-items: center; width: calc(100% + 8px); margin: 0 -4px; padding: 4px; border: 0; border-radius: 5px; background: transparent; text-align: left; font-size: 12.5px; color: var(--ink); }
button.hb { cursor: pointer; }
button.hb:hover, .hb:focus-visible { background: var(--surface-2); }
.hl { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hl > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl.strong { font-weight: 600; }
.ht { height: 10px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.ht i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.hv { min-width: 70px; text-align: right; font-size: 12px; }
.vcols { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; align-items: end; }
.vc { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; border-radius: 5px; }
.vc:focus-visible { outline-offset: 4px; }
.vb { width: 100%; height: 150px; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line-strong); }
.vb i { display: block; width: min(46px, 70%); border-radius: 4px 4px 0 0; }
.vv { font: 600 12.5px var(--f-mono); }
.vl { font-size: 12px; text-align: center; line-height: 1.25; }
.vs { font-size: 11px; color: var(--muted); }
.scatter { width: 100%; height: auto; display: block; background: var(--surface-2); border-radius: 6px; }
.legend-row { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.legend-row .li { display: inline-flex; align-items: center; gap: 6px; }
.sw.sq { border-radius: 3px; }
.dbrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.dbrow b { font-size: 18px; }
.choose { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 12px; }
.opt { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 14px; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
button.opt { cursor: pointer; align-items: stretch; }
button.opt:hover { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.opt h3 { margin: 0; font-family: var(--f-cond); font-size: 16px; font-weight: 600; }
.opt p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.oh { display: flex; gap: 11px; align-items: flex-start; }
.oi { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.oi svg { width: 20px; height: 20px; }
.pick { max-height: 250px; overflow-y: auto; }
#modal .dlg.lg { width: min(980px, 100%); }
/* Importação e modelos */
.impgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.impgrid .card { display: flex; flex-direction: column; }
.impgrid .cb { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.impgrid .cb > p { margin: 0; color: var(--muted); font-size: 12.5px; }
.cols-list { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; margin: 0; padding: 0; list-style: none; }
.cols-list li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.cols-list li span:last-child { color: var(--muted); font-size: 11.5px; text-align: right; }
.impgrid .row.end { margin-top: auto; }
@media (max-width: 1000px) { .impgrid { grid-template-columns: 1fr; } }
.atalhos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.atalhos .opt { justify-content: center; }
.atalhos .oh { align-items: center; }
@media (max-width: 1000px) { .atalhos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .atalhos { grid-template-columns: 1fr; } }

/* ---------- Acesso: ambientes, login e conta ---------- */
body.screen-login #app { display: none; }
#loginView { position: fixed; inset: 0; overflow-y: auto; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
body:not(.screen-login) #loginView { display: none; }
.lg { width: min(600px, 100%); display: flex; flex-direction: column; gap: 14px; }
.lg-brand { display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--f-cond); font-weight: 600; font-size: 19px; }
.lg-brand svg { color: var(--accent); }
.lg-brand b { color: var(--accent); font-weight: 600; }
.lg-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.lg-card h1 { margin: 0; font-family: var(--f-cond); font-weight: 600; font-size: 22px; text-wrap: balance; }
.lg-card > p, .lg-card p.sub { margin: 0; color: var(--muted); }
.lg-card form { display: flex; flex-direction: column; gap: 12px; }
.lg-emps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lg-emps .opt { justify-content: center; }
.lg-emps .oh { align-items: center; }
.oi.sg { font: 600 13px var(--f-mono); }
.lg-env { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.lg-env b { flex: 1; min-width: 0; font-size: 15px; }
.lg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.lg-go { justify-content: center; width: 100%; min-height: 38px; }
.lg-link { border: 0; background: transparent; padding: 2px 0; color: var(--accent); cursor: pointer; font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }
.lg-code { font: 600 22px var(--f-mono); letter-spacing: .05em; text-align: center; padding: 14px 8px; border-radius: 7px; background: var(--surface-2); border: 1px dashed var(--line-strong); overflow-wrap: anywhere; user-select: all; }
.lg-foot { margin: 0; text-align: center; font-size: 12px; color: var(--muted); }
#lgMsg:empty, #ctMsg:empty { display: none; }
body:not(.screen-home) .acct .an { display: none; }
.pwrap { position: relative; display: block; }
.pwrap input { padding-right: 64px; }
.pwrap button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.pwrap button:hover { color: var(--ink); background: var(--surface-2); }
.banner.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.acct { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; color: inherit; cursor: pointer; padding: 2px 4px; border-radius: 4px; white-space: nowrap; font-size: 12px; min-width: 0; }
.acct:hover { background: var(--surface-2); }
.acct .sg { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font: 600 10px var(--f-mono); }
.acct .an { font-family: var(--f-cond); font-weight: 600; }
.acct-sec { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.acct-sec h3 { margin: 0; font-family: var(--f-cond); font-size: 15px; font-weight: 600; }
.acct-sec form { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 480px) { .lg-emps { grid-template-columns: 1fr; } .lg-card { padding: 16px; } .lg-code { font-size: 18px; } }
#ctx { position: fixed; z-index: 3500; min-width: 230px; max-width: 300px; padding: 4px; font-size: 13px; display: flex; flex-direction: column; }
#ctx[hidden] { display: none; }
#ctx button { display: flex; align-items: center; gap: 7px; width: 100%; border: 0; background: transparent; text-align: left; padding: 5px 9px; border-radius: 4px; cursor: pointer; }
#ctx button:hover, #ctx button:focus-visible { background: var(--accent-soft); color: var(--accent); outline: 0; }
#ctx button.forte { font-weight: 600; color: var(--accent); }
#ctx hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.ctx-h { padding: 5px 9px 2px; font-family: var(--f-cond); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ctx-l { max-height: 150px; overflow-y: auto; }
#tip { position: fixed; z-index: 5000; pointer-events: none; max-width: 300px; padding: 6px 10px; border-radius: 6px; background: var(--ink); color: var(--surface); font-size: 12px; line-height: 1.4; white-space: pre-line; box-shadow: var(--shadow); }
@media (max-width: 900px) { .cols-b, .choose, .cgrid { grid-template-columns: 1fr; } .hero h1 { font-size: 28px; } }

@media (max-width: 1100px) { #mapSummary .kpi:nth-child(n+6) { display: none; } }
@media (max-width: 860px) {
  .cols2 { grid-template-columns: 1fr; }
  .brand span { display: none; }
  .save .txt { display: none; }
  .acct .an { display: none; }
}
@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: 8px; }
  .tabs { order: 3; flex-basis: 100%; }
  .amb-pick { flex: 1; } .amb-pick select { max-width: none; width: 100%; }
  .drawer { width: calc(100% - 20px); left: 10px !important; right: 10px !important; top: 56px; bottom: 60px; }
  #toolbar { top: auto; bottom: 64px; left: 50%; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 20px); }
  #mapSummary .kpi:nth-child(n+4) { display: none; }
  #legend { display: none; }
  #rulerBox { bottom: 120px; }
  #seaChip { bottom: 120px; }
  .basepick { bottom: 112px; }
  body.panel-right .basepick { right: 10px; }
  body.panel-left #btnSel, body.panel-right #btnLayers, body.panel-left .basepick, body.panel-right .basepick, body.panel-left #toolbar, body.panel-right #toolbar { display: none; }
}
@media (prefers-reduced-motion: reduce) { .leaflet-zoom-anim .leaflet-zoom-animated { transition: none; } }

/* ---------- Pendências e histórico de importações ---------- */
.pendchip { display: inline-flex; gap: 0; }
.pendchip > .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pendchip > .btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 0; color: var(--muted); }
textarea.msg { min-height: 64px; font-family: inherit; font-size: 13px; resize: vertical; }
.imp-reg { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.imp-ult { margin: 6px 0 0; font-size: 13px; }
.imp-ult .linkbtn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; border-bottom: 1px dashed var(--muted); }
.imp-t td { vertical-align: top; }
.imp-t td.imp-arq { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.imp-t td.imp-msg { max-width: 280px; min-width: 160px; }
.pill.imp-roteiro { background: var(--accent); color: var(--surface); }
.pill.imp-clientes { background: var(--ok-soft); color: var(--ok); }
.pill.imp-colaboradores { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.imp-det { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.imp-res { margin: 4px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
@media (max-width: 560px) { .imp-det { grid-template-columns: 1fr; } }
.pill.imp-rotas { background: color-mix(in srgb, var(--cmp-a) 18%, var(--surface)); color: var(--ink); border: 1px solid color-mix(in srgb, var(--cmp-a) 40%, var(--line)); }

/* ---------- Seleção no mapa: contador junto ao cursor ---------- */
#selCount { position: fixed; z-index: 2500; pointer-events: none; background: var(--lasso); color: #fff; font-size: 12.5px; padding: 4px 9px; border-radius: 99px; box-shadow: 0 2px 8px rgba(0,0,0,.3); white-space: nowrap; border: 2px solid #fff; }
#selCount.sub { background: var(--bad); }
#selCount b { font-size: 13.5px; }

/* ---------- Início: módulos ---------- */
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.crumb b { color: var(--ink); font-weight: 600; }
.hub-hero { padding: 26px 4px 4px; }
.hub-hero h1 { margin: 2px 0 6px; font-family: var(--f-cond); font-weight: 600; font-size: 32px; text-wrap: balance; }
.hub-hero p { margin: 0; color: var(--muted); max-width: 64ch; }
.mods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.mod { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.mod:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow); }
.mod-go { position: absolute; inset: 0; border: 0; background: transparent; cursor: pointer; border-radius: 10px; }
.mod-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mod-h { display: flex; gap: 14px; align-items: flex-start; }
.mod-h h2 { margin: 0; font-family: var(--f-cond); font-size: 20px; font-weight: 600; }
.mod-h p { margin: 3px 0 0; color: var(--muted); font-size: 13px; max-width: 52ch; }
.mod-i { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.mod-i svg { width: 24px; height: 24px; }
.mod-i.xl { width: 60px; height: 60px; } .mod-i.xl svg { width: 32px; height: 32px; }
.mod-s { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; }
.ms { display: flex; flex-direction: column; } .ms b { font-size: 20px; font-weight: 600; line-height: 1.1; } .ms span { font-size: 11.5px; color: var(--muted); }
.mod-a { display: flex; flex-wrap: wrap; gap: 8px; position: relative; z-index: 1; }
.mod.breve { background: var(--surface-2); } .mod.breve .mod-i { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
@media (max-width: 760px) { .mods { grid-template-columns: 1fr; } .hub-hero h1 { font-size: 26px; } }

/* ---------- Segurança ---------- */
.priv { display: flex; flex-direction: column; gap: 8px; font-size: 13px; max-height: 46vh; overflow-y: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.priv p { margin: 0; }
details > summary { cursor: pointer; }
.mfa-cad { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: start; }
.mfa-passos { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.mfa-qr { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mfa-qr img { background: #fff; padding: 6px; border-radius: 8px; border: 1px solid var(--line); image-rendering: pixelated; }
.mfa-key { font: 600 12.5px var(--f-mono); letter-spacing: .04em; user-select: all; max-width: 190px; overflow-wrap: anywhere; text-align: center; }
.mfa-res { font-size: 17px; line-height: 1.6; }
@media (max-width: 560px) { .mfa-cad { grid-template-columns: 1fr; } }
#atvAviso { position: fixed; right: 16px; bottom: 16px; z-index: 3500; display: flex; flex-direction: column; gap: 6px; max-width: 320px; padding: 14px 16px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); border-left: 4px solid var(--warn); border-radius: 8px; box-shadow: var(--shadow); }

/* ---------- Rotas ---------- */
.rotas { max-width: 1480px; }
.rt-base .cb { gap: 10px 14px; }
.sp { flex: 1; }
.rt-abas { align-self: flex-start; max-width: 100%; overflow-x: auto; }
.rt-abas button { padding: 6px 14px; font-size: 13.5px; white-space: nowrap; }
.rt-filtros { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rt-filtros select, .rt-filtros input[type=search] { min-height: 30px; }
.rt-filtros input[type=search] { width: 170px; }
.fdd { position: relative; }
.fdd > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); font-size: 13px; user-select: none; }
.fdd > summary::-webkit-details-marker { display: none; }
.fdd > summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg) translateY(-2px); margin-left: 2px; }
.fdd > summary b { background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 0 6px; font-size: 11.5px; }
.fdd[open] > summary { border-color: var(--accent); }
.fdd-b { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; width: 290px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.fdd-l { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.fdd-l .chk span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-hb { cursor: pointer; }
.rt-hb:hover .hl span { text-decoration: underline; }
.rt-mapbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.rt-mapwrap { position: relative; }
.rt-map { height: calc(100vh - 300px); min-height: 460px; border: 1px solid var(--line); border-radius: 8px; background: var(--map-bg); }
.rt-map.sm { height: 440px; min-height: 320px; }
.rt-legend { position: absolute; top: 10px; right: 10px; z-index: 500; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 3px; max-height: 60%; overflow-y: auto; box-shadow: var(--shadow); }
.rt-legend .li { display: flex; align-items: center; gap: 6px; }
.rt-mapinfo { position: absolute; left: 10px; bottom: 10px; z-index: 500; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 3px 9px; font-size: 12px; color: var(--muted); }
table.t tr.sub2 td { background: var(--surface-2); font-size: 12.5px; }
table.t tr.on td { background: var(--accent-soft); }
table.t.heat td.n { font-size: 12.5px; }
.up { color: var(--bad); } .down { color: var(--ok); }
.rt-cmpctl { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.rt-cmpctl .field { min-width: 220px; flex: 1; }
.rt-vs { font: 600 20px var(--f-cond); color: var(--muted); padding-bottom: 6px; }
.cmpmaps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cmpm { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cmph { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.cmpbars { display: flex; flex-direction: column; gap: 10px; }
.cb2 .cn { font-size: 12px; color: var(--muted); }
.cb2 .cr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; align-items: center; }
.cb2 .ct { height: 9px; background: var(--surface-2); border-radius: 0 4px 4px 0; overflow: hidden; }
.cb2 .ct i { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.cb2 .cv { font-size: 12px; min-width: 76px; text-align: right; }
.cmpcli { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; max-height: 240px; overflow-y: auto; }
.cmpcli .mono { color: var(--muted); margin-right: 6px; }
@media (max-width: 900px) { .cmpmaps { grid-template-columns: 1fr; } .rt-map { height: 60vh; min-height: 360px; } }
/* Controle de zoom do Leaflet (mapas do módulo Rotas) */
.leaflet-control-zoom { margin: 10px 0 0 10px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; box-shadow: var(--shadow); }
.leaflet-control-zoom a { display: grid; place-items: center; width: 30px; height: 30px; background: var(--surface); color: var(--ink); text-decoration: none; font: 600 17px/1 var(--f-body); }
.leaflet-control-zoom a + a { border-top: 1px solid var(--line); }
.leaflet-control-zoom a:hover { background: var(--surface-2); }
.leaflet-control-zoom a.leaflet-disabled { color: var(--muted); cursor: default; }
#mfaCad, #sgOff { flex-direction: row !important; align-items: flex-end !important; justify-content: flex-start; flex-wrap: wrap; }
#mfaCad .field, #sgOff .field { width: 190px; }
.kc .v.rs { font-size: 21px; white-space: nowrap; padding-top: 4px; }

/* ---------- Planejamento enxuto ---------- */
.mods { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.kgrid.k4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.tblwrap.flat { border: 0; border-radius: 0; }
.plan .card > .ch h2 { font-size: 16px; }
.foco { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 18px; align-items: start; }
.minis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mini { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.mini b { font-size: 20px; font-weight: 600; } .mini .muted { font-size: 12px; }
details.mais > summary { list-style: none; display: flex; gap: 10px; align-items: baseline; padding: 12px 14px; flex-wrap: wrap; }
details.mais > summary::-webkit-details-marker { display: none; }
details.mais > summary::before { content: "▸"; color: var(--muted); }
details.mais[open] > summary::before { content: "▾"; }
details.mais > summary .muted { font-size: 12.5px; }
@media (max-width: 900px) { .foco { grid-template-columns: 1fr; } }

/* ---------- Semanas do ciclo (Calendário, Verba e extrato) ---------- */
.wk { display: inline-grid; place-items: center; min-width: 26px; padding: 1px 5px; border-radius: 5px; font: 600 11px var(--f-mono); color: #fff; background: var(--c, var(--muted)); }
.qz { display: inline-grid; place-items: center; min-width: 30px; padding: 1px 5px; border-radius: 5px; font: 600 11px var(--f-mono); border: 1px solid var(--line-strong); color: var(--ink); }
.qz.q13 { background: color-mix(in srgb, var(--cmp-a) 16%, var(--surface)); border-color: color-mix(in srgb, var(--cmp-a) 45%, var(--line)); }
.qz.q24 { background: color-mix(in srgb, var(--cmp-b) 16%, var(--surface)); border-color: color-mix(in srgb, var(--cmp-b) 45%, var(--line)); }
.wk.gr, .qz.gr { font-size: 12.5px; padding: 3px 9px; }

/* ---------- Calendário ---------- */
.cal-hoje .cb { gap: 10px 14px; }
.cal-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.cal-tit { font-size: 18px; min-width: 64px; text-align: center; }
.cal-legs { display: flex; flex-wrap: wrap; gap: 6px; }
.cal-leg { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; color: var(--ink); }
.cal-leg i { width: 10px; height: 10px; border-radius: 3px; }
.cal-leg.off { opacity: .45; text-decoration: line-through; }
.cal-leg.fixa { cursor: default; border-style: dashed; }
.cal-leg .hojei { border: 2px solid var(--accent); background: transparent; }
.cal-leg .fdsi { background: var(--surface-2); border: 1px solid var(--line); }
.cal-ano { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.cal-mes { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 10px 8px; min-width: 0; }
.cal-mh { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 0 4px 6px; flex-wrap: wrap; }
.cal-mh b { font-family: var(--f-cond); font-size: 15.5px; font-weight: 600; }
.cal-mh .muted { font-size: 11.5px; }
table.cal { width: 100%; border-collapse: separate; border-spacing: 2px; table-layout: fixed; }
table.cal th { font: 600 10.5px var(--f-cond); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 2px 0; }
table.cal th.fds { color: color-mix(in srgb, var(--muted) 70%, transparent); }
table.cal th.cw, table.cal td.cw { width: 40px; }
table.cal td { text-align: center; padding: 0; }
table.cal td.cd { position: relative; height: 30px; border-radius: 6px; cursor: pointer; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.cal td.cd:hover { background: var(--surface-2); outline: 1px solid var(--line-strong); }
table.cal td.cd .dn { display: block; line-height: 1; padding-top: 4px; }
table.cal td.cd.fds { color: var(--muted); background: var(--surface-2); }
table.cal td.cd.fer, table.cal td.cd.semrota { background: color-mix(in srgb, var(--feriado) 18%, var(--surface)); color: var(--feriado); font-weight: 700; }
table.cal td.cd.hoje { box-shadow: inset 0 0 0 2px var(--accent); font-weight: 700; }
table.cal .dots { position: absolute; left: 0; right: 0; bottom: 3px; display: flex; justify-content: center; gap: 2px; }
table.cal .dots i { width: 5px; height: 5px; border-radius: 50%; }
table.cal tr.atual td.cw .wk, table.cal tr.atual td.cw .qz { outline: 2px solid var(--accent); outline-offset: 1px; }
table.cal tr.atual td.cd:not(.fer):not(.semrota) { background: color-mix(in srgb, var(--accent) 9%, transparent); }
table.cal tr.atual td.cd.fds:not(.fer) { background: color-mix(in srgb, var(--accent) 9%, var(--surface-2)); }
.cal-mes.grande table.cal td.cd { height: 92px; vertical-align: top; text-align: left; padding: 4px 6px; }
.cal-mes.grande table.cal td.cd .dn { padding: 0 0 4px; font-size: 14px; }
.cal-mes.grande table.cal th.cw, .cal-mes.grande table.cal td.cw { width: 54px; }
.cal-mes.grande .ev { display: block; font-size: 11.5px; line-height: 1.25; margin-top: 2px; padding: 1px 5px; border-radius: 4px; color: var(--ink); background: color-mix(in srgb, var(--c, var(--accent)) 16%, var(--surface)); border-left: 3px solid var(--c, var(--accent)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cal-mes.grande .ev.fer { --c: var(--feriado); }
.cal-mes.grande .ev.km { --c: var(--accent); font-family: var(--f-mono); }
.cal-mes.grande .ev.perd { --c: var(--feriado); }
table.cal td.cd.rota { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); color: var(--ink); font-weight: 600; }
table.cal td.cd.perdido { background: color-mix(in srgb, var(--feriado) 18%, var(--surface)); }
.cal-unico { max-width: 1100px; }
.cal-lista { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.cal-lista li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.cal-lista li:last-child { border-bottom: 0; }
.cal-lista li.passou { opacity: .55; }
.cl-d { min-width: 82px; color: var(--muted); }
.cl-c { font: 600 11px var(--f-cond); text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: var(--ink); border: 1px solid color-mix(in srgb, var(--c) 45%, var(--line)); }
.cl-t { flex: 1; min-width: 160px; }
.cat-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.cat-row input[type=color] { width: 40px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; }

/* ---------- Verba ---------- */
.vb-ctl { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.vb-ctl .field { min-width: 180px; flex: 1; max-width: 340px; }
.vb-form { padding: 9px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 0 0 8px 8px; }
.vb-form b { color: var(--ink); }
.extrato > .vb-form { border: 1px solid var(--line); border-radius: 8px; }
.kc.tot { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); background: var(--accent-soft); }
.cmpl { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 240px; }
.extrato { display: flex; flex-direction: column; gap: 14px; }
.ext-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.ext-h h2 { margin: 2px 0; font-family: var(--f-cond); font-size: 22px; font-weight: 600; }
.ext-g { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; align-items: start; }
table.t tr.perd td { color: var(--feriado); background: color-mix(in srgb, var(--feriado) 7%, transparent); }
.thumbs { display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.thumb { position: relative; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: var(--surface-2); cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs.lg .thumb { width: 72px; height: 72px; cursor: default; }
.thumb-x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; padding: 2px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; display: grid; place-items: center; }
.thumb-x svg { width: 12px; height: 12px; }
.anexo-full { max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: 6px; background: #fff; align-self: center; }
@media (max-width: 1000px) { .ext-g { grid-template-columns: 1fr; } }
@media print {
  body.imprime-extrato { overflow: visible; background: #fff; }
  body.imprime-extrato .top, body.imprime-extrato .crumb, body.imprime-extrato .ph, body.imprime-extrato .rt-abas, body.imprime-extrato .verba > .card:first-of-type, body.imprime-extrato .no-print, body.imprime-extrato .banner, body.imprime-extrato #toast { display: none !important; }
  body.imprime-extrato #app, body.imprime-extrato main, body.imprime-extrato #homeView { position: static; height: auto; overflow: visible; display: block; }
}
.ms b.longo { font: 600 14px/1.3 var(--f-body); max-width: 300px; }
.extrato .cal-mes.grande table.cal td.cd { height: 58px; }
.extrato .cal-mes.grande .ev { font-size: 11px; }
.ext-g { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ext-g table.t td, .ext-g table.t th { padding-left: 8px; padding-right: 8px; }

/* ---------- Início compacto: os cinco módulos cabem numa tela de notebook ---------- */
.hub { gap: 12px; padding-top: 14px; }
.hub-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px 20px; flex-wrap: wrap; padding: 6px 2px 2px; }
.hub-hero h1 { font-size: 26px; margin: 0 0 2px; }
.hub-hero p { font-size: 13px; }
.hub-at { justify-content: flex-end; }
.mods { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mod { padding: 14px 16px; gap: 10px; }
.mod-h { gap: 12px; }
.mod-h h2 { font-size: 17px; }
.mod-h p { font-size: 12.5px; line-height: 1.4; }
.mod-i { width: 38px; height: 38px; border-radius: 9px; }
.mod-i svg { width: 21px; height: 21px; }
.mod-s { gap: 6px 18px; margin-top: auto; }
.ms b { font-size: 17px; }
.ms b.longo { font-size: 13px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
@media (max-width: 1100px) { .mods { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .mods { grid-template-columns: 1fr; } .hub-at { justify-content: flex-start; } .hub-hero h1 { font-size: 22px; } }

/* ---------- Planejamento: seletor de estudo e setor ---------- */
.plan-sel .cb { gap: 10px 14px; align-items: flex-end; }
.plan-sel .field { min-width: 220px; flex: 0 1 300px; }
.plan-set { display: inline-flex; align-items: center; gap: 8px; padding-bottom: 6px; flex-wrap: wrap; }
.plan-set .sw { width: 12px; height: 12px; }
.plan-set .muted { font-size: 12.5px; }
button.hb:hover .hl span { text-decoration: underline; }
