/* MoniMaps - interface. O mapa é o protagonista: a interface fica neutra (tinta + papel)
   para que as cores dos pinos de cada usuário sejam o que salta aos olhos. */
:root {
  --ink: #010735;          /* azul-marinho do logotipo: texto, botões principais */
  --ink-2: #17215e;
  --muted: #5f6b78;
  --line: #e2e6ea;
  --wash: #f2f4f5;         /* fundo de campos e linhas em destaque */
  --surface: #ffffff;
  --accent: #0077b6;       /* azul do logotipo, escurecido para texto legível */
  --accent-bright: #00a5e3; /* azul-claro do logotipo: foco e detalhes */
  --accent-wash: #dff3fc;
  --danger: #c8322b;
  --danger-wash: #fbe9e7;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --shadow: 0 1px 2px rgba(1, 7, 53, .14), 0 10px 28px rgba(1, 7, 53, .16);
  --shadow-sm: 0 1px 2px rgba(1, 7, 53, .16), 0 2px 8px rgba(1, 7, 53, .10);
  --panel-w: 348px;
  --gap: 12px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--wash);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

/* ---------- glifo de pino (legenda, listas, tabelas) ---------- */
.dot {
  display: inline-block; flex: none; width: 13px; height: 13px;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .22);
  position: relative;
}
.dot::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%; background: rgba(255, 255, 255, .92);
}
.dot.big { width: 20px; height: 20px; }
.dot.big::after { inset: 6px; }
.count {
  color: var(--muted); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums;
  background: var(--wash); border-radius: 10px; padding: 1px 8px; min-width: 26px; text-align: center;
}

/* ---------- botões ---------- */
.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 9px 16px; border-radius: var(--r-sm); font: inherit; font-weight: 600; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--wash); border-color: #cfd5da; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-wash); border-color: #f1c6c1; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.icon-btn {
  border: 0; background: none; color: var(--muted); cursor: pointer; flex: none;
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 15px;
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--wash); color: var(--ink); }
.link { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ---------- formulários ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 14px; }
input:not([type=checkbox]):not([type=color]), textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font: inherit; font-weight: 400; color: var(--ink); background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
input:not([type=checkbox]):not([type=color]):focus, textarea:focus, select:focus {
  outline: 0; border-color: var(--accent-bright); box-shadow: 0 0 0 3px var(--accent-wash);
}
input::placeholder, textarea::placeholder { color: #94a0ab; }
input[type=checkbox] { accent-color: var(--ink); width: 16px; height: 16px; margin: 0; flex: none; }
textarea { resize: vertical; }
.row { display: flex; gap: 12px; }
.row > label { flex: 1; min-width: 0; }

/* ---------- mapa ---------- */
.map-page { overflow: hidden; height: 100dvh; }
#map { position: absolute; inset: 0; z-index: 0; background: #e8ebe6; }
body.adding #map, body.adding .leaflet-interactive { cursor: crosshair; }

.mm-pin { background: none; border: 0; filter: drop-shadow(0 3px 3px rgba(1, 7, 53, .35)); }
.mm-pin svg { display: block; transform-origin: 16px 100%; transition: transform .12s; }
.mm-pin:hover svg { transform: scale(1.12); }
.mm-pin text { font: 700 13px "Segoe UI", system-ui, Arial, sans-serif; }

/* controles do Leaflet no mesmo estilo */
.leaflet-container { font: inherit; }
.leaflet-bar, .leaflet-control-layers {
  border: 0 !important; border-radius: var(--r-md) !important; box-shadow: var(--shadow-sm) !important; overflow: hidden;
}
.leaflet-bar a { color: var(--ink-2) !important; width: 36px !important; height: 36px !important; line-height: 36px !important; }
.leaflet-bar a:hover { background: var(--wash) !important; }
.leaflet-control-layers-expanded { padding: 10px 14px !important; color: var(--ink); }
.leaflet-control-layers label { margin: 2px 0; font-weight: 500; color: var(--ink); font-size: 13.5px; }
.leaflet-control-layers input { accent-color: var(--ink); }
.leaflet-touch .leaflet-control-layers-toggle, .leaflet-control-layers-toggle { width: 40px !important; height: 40px !important; }
.leaflet-top.leaflet-right { top: 2px; right: 2px; }
body.panel-open .leaflet-bottom.leaflet-left { left: calc(var(--panel-w) + var(--gap)); }

/* ---------- barra de busca ---------- */
.topbar {
  position: absolute; z-index: 1000; top: var(--gap); left: var(--gap);
  width: min(420px, calc(100vw - 84px));
  display: flex; align-items: center; flex-wrap: wrap;
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 4px;
  transition: left .22s ease;
}
body.panel-open .topbar { left: calc(var(--panel-w) + var(--gap) * 2); }
body.panel-open #btnMenu { display: none; }
.search { display: flex; flex: 1; min-width: 0; align-items: center; }
.search input, .search input:focus {
  border: 0 !important; box-shadow: none !important; margin: 0 !important; background: none !important;
  padding: 10px 10px !important; font-size: 15px;
}
.search-results {
  flex-basis: 100%; list-style: none; margin: 4px 0 0; padding: 4px;
  border-top: 1px solid var(--line); max-height: 50vh; overflow: auto;
}
.search-results li { padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; }
.search-results li:hover { background: var(--wash); }
.search-results li.empty { color: var(--muted); cursor: default; background: none; }

/* ---------- botões flutuantes ---------- */
.fab {
  position: absolute; z-index: 1000; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: #fff; border: 0; border-radius: 28px; padding: 14px 24px 14px 20px;
  font: inherit; font-weight: 650; font-size: 15px; box-shadow: var(--shadow); cursor: pointer;
  transition: left .22s ease, background .12s, transform .12s;
}
.fab:hover { background: var(--ink-2); }
.fab:active { transform: translateX(-50%) scale(.97); }
body.panel-open .fab { left: calc(50% + (var(--panel-w) + var(--gap)) / 2); }
body.adding .fab { background: var(--danger); }
.round-btn {
  position: absolute; z-index: 1000; right: 10px; bottom: 112px;
  width: 36px; height: 36px; border-radius: var(--r-md); border: 0; background: var(--surface); color: var(--ink-2);
  display: grid; place-items: center; box-shadow: var(--shadow-sm); cursor: pointer;
}
.round-btn:hover { color: var(--accent); }

/* ---------- painel (a "legenda" do mapa) ---------- */
.panel {
  position: absolute; z-index: 1100; top: var(--gap); bottom: var(--gap); left: var(--gap);
  width: var(--panel-w); max-width: calc(100vw - 24px);
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateX(calc(-100% - 28px)); transition: transform .22s ease;
}
body.panel-open .panel { transform: none; }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 10px 12px 18px; flex: none; border-bottom: 3px solid var(--accent-bright);
}
.app-logo { display: block; height: 46px; width: auto; }

.panel-nav { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex: none; }
.panel-nav a {
  flex: 1; text-align: center; font-size: 13px; font-weight: 600; color: var(--ink);
  background: var(--wash); border-radius: var(--r-sm); padding: 8px 6px; text-decoration: none;
}
.panel-nav a:hover { background: var(--accent-wash); color: var(--accent); }

.panel-foot {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 10px 12px 10px 14px; border-top: 1px solid var(--line); background: #fafbfc;
}
.panel-foot form { margin: 0; }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 15px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
}
.me-text { min-width: 0; flex: 1; }
.me-name { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { display: block; font-size: 12px; color: var(--muted); }
.foot-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 6px 10px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.foot-btn:hover { background: var(--wash); }

.panel-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 2px 10px 14px; }
.panel h2 {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13.5px; color: var(--ink); margin: 14px 0 8px; padding: 0 8px;
}
.legend, .pin-list { list-style: none; margin: 0; padding: 0; }
.legend { margin: 0; }
.legend label {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 7px 8px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer;
}
.legend label:hover { background: var(--wash); }
.legend li.off .legend-name { color: #94a0ab; }
.legend li.off .dot { opacity: .35; }
.legend-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.list-filter { margin: 0 8px 8px !important; width: calc(100% - 16px) !important; background: var(--wash) !important; border-color: transparent !important; }
.list-filter:focus { background: var(--surface) !important; border-color: var(--accent) !important; }
.pin-list { margin: 0; }
.pin-list li {
  display: flex; gap: 12px; align-items: flex-start; padding: 10px 8px; border-radius: var(--r-sm); cursor: pointer;
}
.pin-list li:hover { background: var(--wash); }
.pin-list li .dot { margin: 4px 2px 0; }
.pin-list li.empty { color: var(--muted); cursor: default; background: none; padding: 18px 8px; line-height: 1.5; }
.pin-item { min-width: 0; }
.pin-item strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-item small { color: var(--muted); font-size: 12.5px; }

/* ---------- projetos (cidades) e submenus ---------- */
.mini-btn {
  border: 0; background: var(--ink); color: #fff; border-radius: 14px; padding: 4px 12px;
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.mini-btn:hover { background: var(--ink-2); }
.tree, .tree-sub { list-style: none; margin: 0; padding: 0; }
.tree { margin: 0; }
.tree-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: none; border-radius: var(--r-sm); padding: 8px 8px; cursor: pointer;
  font: inherit; font-weight: 500; color: var(--ink);
}
.tree-row:hover { background: var(--wash); }
.tree-row.active { background: var(--ink); color: #fff; box-shadow: inset 3px 0 0 var(--accent-bright); }
.tree-row.active .count { background: rgba(255, 255, 255, .18); color: #fff; }
.tree-row.muted:not(.active) { color: var(--muted); }
.tree-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row.has-sub .tree-label::after {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 9px; vertical-align: 2px;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; opacity: .55;
  transform: rotate(-45deg); transition: transform .15s;
}
.tree-row.has-sub.open .tree-label::after { transform: rotate(45deg); }
.tree-sub { margin: 2px 0 4px 14px; padding-left: 8px; border-left: 2px solid var(--line); }
.tree-sub .tree-row { padding: 7px 8px; font-size: 13.5px; }
.tree-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 8px 8px; }
.tree-actions button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 3px 11px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.tree-actions button:hover { background: var(--wash); }
.tree-actions .danger { color: var(--danger); }
.tree-actions .danger:hover { background: var(--danger-wash); border-color: #f1c6c1; }
.tree li.empty { color: var(--muted); padding: 8px; line-height: 1.5; }

.inline { display: flex; gap: 8px; align-items: stretch; margin-top: 6px; }
.inline input { margin-top: 0 !important; }
.inline .btn { flex: none; }
.search-results.boxed { border: 1px solid var(--line); border-radius: var(--r-sm); margin: -4px 0 12px; max-height: 190px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; line-height: 1.5; }

.tree-label .ro {
  margin-left: 8px; font-size: 11.5px; font-weight: 600; color: var(--muted);
  background: var(--wash); border-radius: 9px; padding: 1px 7px;
}
.tree-row.active .ro { background: rgba(255, 255, 255, .18); color: #fff; }

/* ---------- acesso do usuário por projeto / submenu ---------- */
.dialog { max-height: 92vh; overflow-y: auto; }
.dialog.wide { width: min(540px, 94vw); }
.access { border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 14px; }
.access-title { display: block; font-size: 13.5px; margin-bottom: 10px; }
.acc-project { border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 8px; }
.acc-head {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.acc-rows { border-top: 1px solid var(--line); padding: 6px 12px 8px; background: #fafbfb; border-radius: 0 0 var(--r-sm) var(--r-sm); }
.acc-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 4px 0;
  font-size: 13.5px; font-weight: 500; color: var(--ink);
}
.acc-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-row select { width: 170px !important; flex: none; margin: 0 !important; padding: 6px 8px !important; }

/* ---------- balão do pino ---------- */
.leaflet-popup-content-wrapper { border-radius: var(--r-md); box-shadow: var(--shadow); padding: 0; overflow: hidden; }
.leaflet-popup-content { margin: 0; font: inherit; color: var(--ink); line-height: 1.45; }
.leaflet-popup-content p { margin: 0; }
.leaflet-container a.leaflet-popup-close-button {
  top: 8px; right: 8px; width: 26px; height: 26px; line-height: 24px; text-align: center; font-size: 18px;
  color: var(--ink-2); background: #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(1, 7, 53, .3);
}
.leaflet-container a.leaflet-popup-close-button:hover { color: var(--ink); background: var(--wash); }

.pin-card { width: 320px; max-width: 100%; }
.pc-band { height: 6px; }
.pc-cover {
  display: block; position: relative; width: 100%; height: 150px; padding: 0; border: 0; cursor: zoom-in; background: var(--wash);
}
.pc-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pc-count {
  position: absolute; left: 10px; bottom: 10px; background: rgba(1, 7, 53, .78); color: #fff;
  font-size: 12px; font-weight: 600; border-radius: 10px; padding: 2px 9px;
}
.pc-thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 4px 4px 0; }
.pc-thumbs .thumb { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 6px; overflow: hidden; cursor: zoom-in; background: var(--wash); }
.pc-thumbs .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pc-thumbs .more {
  position: absolute; inset: 0; display: grid; place-items: center; background: rgba(1, 7, 53, .6); color: #fff; font-weight: 700; font-size: 13px;
}

.pc-body { padding: 14px 16px 12px; }
.pc-path { color: var(--accent); font-size: 12.5px; font-weight: 600; margin: 0 28px 3px 0 !important; overflow-wrap: anywhere; }
.pc-body h3 { font-size: 17px; line-height: 1.25; margin: 0 28px 0 0; overflow-wrap: anywhere; }
.pc-cover ~ .pc-body .pc-path, .pc-cover ~ .pc-body h3 { margin-right: 0 !important; }
.pc-desc {
  margin: 8px 0 0 !important; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 110px; overflow-y: auto;
}
.pc-meta {
  display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; align-items: center;
  margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px;
}
.pc-meta dt { color: var(--muted); }
.pc-meta dd { margin: 0; display: flex; align-items: center; gap: 7px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.pc-avatar {
  flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
}
.pc-coords { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-copy {
  flex: none; border: 0; background: none; padding: 3px; border-radius: 6px; color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.pc-copy:hover { background: var(--wash); color: var(--ink); }

.pc-row { display: flex; gap: 6px; }
.pc-actions { display: grid; gap: 6px; padding: 10px 12px; background: #fafbfc; border-top: 1px solid var(--line); }
.pc-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--r-sm); padding: 7px 9px; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink) !important; cursor: pointer; text-decoration: none !important;
}
.pc-btn:hover { background: var(--wash); }
.pc-btn.primary { background: var(--ink); border-color: var(--ink); color: #fff !important; }
.pc-btn.primary:hover { background: var(--ink-2); }
.pc-btn.danger { margin-left: auto; color: var(--danger) !important; padding: 7px 9px; }
.pc-btn.danger:hover { background: var(--danger-wash); border-color: #f1c6c1; }

/* balão simples (resultado da busca de endereço) */
.pin-popup { padding: 14px 16px 12px; max-width: 280px; }
.pin-popup .desc { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); margin: 0 26px 10px 0 !important; }
.popup-actions { display: flex; flex-wrap: wrap; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 2px; }
.popup-actions a, .popup-actions button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 5px 12px;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink) !important; cursor: pointer; text-decoration: none;
}
.popup-actions a:hover, .popup-actions button:hover { background: var(--wash); text-decoration: none; }
.popup-actions .danger { color: var(--danger) !important; }
.popup-actions .danger:hover { background: var(--danger-wash); border-color: #f1c6c1; }

/* ---------- fotos ---------- */
.photos { border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 14px; }
.photos-title { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.photos-title small { font-weight: 500; color: var(--muted); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin-bottom: 10px; }
.photo-grid:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--wash); padding: 0; border: 0; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.thumb-x {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0;
  background: rgba(1, 7, 53, .78); color: #fff; font-size: 12px; line-height: 1; cursor: pointer;
}
.thumb .more {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(1, 7, 53, .6); color: #fff; font-weight: 700; font-size: 15px;
}
.photo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-actions .btn { flex: 1 1 130px; }
.photo-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 0 0 10px; }

.viewer {
  position: fixed; inset: 0; z-index: 4000; background: rgba(1, 4, 28, .94);
  display: grid; place-items: center; padding: 12px;
}
.viewer img { max-width: 100%; max-height: calc(100dvh - 24px); object-fit: contain; border-radius: 6px; }
.viewer-btn {
  position: absolute; border: 0; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer;
  width: 46px; height: 46px; border-radius: 50%; font-size: 24px; line-height: 1; display: grid; place-items: center;
}
.viewer-btn:hover { background: rgba(255, 255, 255, .26); }
.viewer-btn.close { top: 14px; right: 14px; font-size: 18px; }
.viewer-btn.prev { left: 14px; top: 50%; transform: translateY(-50%); }
.viewer-btn.next { right: 14px; top: 50%; transform: translateY(-50%); }
.viewer-count { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); color: #fff; font-weight: 600; font-size: 13px; }

/* ---------- escolha do local do pino ---------- */
.choice-list { display: grid; gap: 10px; margin-bottom: 16px; }
.choice {
  text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md);
  padding: 14px 16px; cursor: pointer; font: inherit; color: var(--ink);
}
.choice:hover:not(:disabled) { border-color: var(--accent-bright); background: var(--accent-wash); }
.choice:disabled { opacity: .7; cursor: progress; }
.choice strong { display: block; font-size: 15px; margin-bottom: 2px; }
.choice span { color: var(--muted); font-size: 13px; }

.panel-backdrop { display: none; }

/* ---------- diálogos e avisos ---------- */
.dialog {
  border: 0; border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 24px; width: min(440px, 92vw); color: var(--ink);
}
.dialog::backdrop { background: rgba(1, 7, 53, .55); }
.dialog h3 { font-size: 19px; margin-bottom: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.color-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.color-row input[type=color] {
  width: 46px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); flex: none;
}
.palette { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); cursor: pointer; padding: 0; }
.swatch:hover { transform: scale(1.12); }

.toast {
  position: fixed; z-index: 3000; left: 50%; bottom: 92px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: var(--r-md); box-shadow: var(--shadow);
  max-width: 90vw; text-align: center; font-weight: 500;
}
.toast.error { background: var(--danger); }

/* ---------- login: curvas de nível sobre tinta ---------- */
.login-page {
  display: grid; place-items: center; padding: 20px; min-height: 100%;
  background-color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='700' viewBox='0 0 900 700' fill='none' stroke='%2300a5e3' stroke-opacity='.22' stroke-width='1.4'%3E%3Cpath d='M-40 520c120-90 210-40 300-110s80-190 220-210 200 80 330 40 150-150 150-150'/%3E%3Cpath d='M-40 580c140-100 230-50 330-120s90-180 210-200 190 90 320 50 140-140 140-140'/%3E%3Cpath d='M-40 640c160-110 250-60 360-130s100-170 200-190 180 100 310 60 130-130 130-130'/%3E%3Cpath d='M-40 460c100-80 190-30 270-100s70-200 230-220 210 70 340 30 160-160 160-160'/%3E%3Cpath d='M-40 400c80-70 170-20 240-90s60-210 240-230 220 60 350 20 170-170 170-170'/%3E%3Cpath d='M250 250c40-50 120-60 160-20s30 110-30 130-170-60-130-110z'/%3E%3Cpath d='M285 262c25-30 70-35 95-10s15 65-20 75-100-35-75-65z'/%3E%3Cpath d='M620 520c50-40 130-30 150 20s-30 100-90 100-110-80-60-120z'/%3E%3Cpath d='M650 540c30-22 78-16 90 14s-20 60-55 60-65-50-35-74z'/%3E%3Cpath d='M-40 120c90 30 150-40 240-30s120 80 220 60 130-110 240-120 180 60 280 30'/%3E%3Cpath d='M-40 60c90 30 160-40 250-30s120 80 210 60 140-110 250-120 170 60 270 30'/%3E%3C/svg%3E");
  background-size: cover; background-position: center;
}
.login-card {
  background: var(--surface); border-radius: var(--r-lg); padding: 34px 30px 30px; width: min(380px, 100%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.brand-logo { display: block; width: 270px; max-width: 100%; height: auto; margin: 0 auto 14px; }
.brand-sub { color: var(--muted); margin: 0 0 24px; text-align: center; }
.login-card .btn { width: 100%; padding: 12px; margin-top: 4px; font-size: 15px; }
.form-error {
  background: var(--danger-wash); color: #9c241e; padding: 10px 12px; border-radius: var(--r-sm); margin: 0 0 16px; font-weight: 500;
}

/* ---------- páginas internas (Relatórios, Importar, Usuários) ---------- */
html, body.inner-page, body.login-page { overflow-x: hidden; }
.topnav {
  display: flex; align-items: center; gap: 8px 22px; flex-wrap: wrap;
  background: var(--surface); padding: 10px 24px; border-bottom: 3px solid var(--accent-bright);
}
.topnav-logo img { display: block; height: 40px; width: auto; }
.topnav-links { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topnav-links a {
  color: var(--ink-2); font-weight: 600; padding: 8px 14px; border-radius: var(--r-sm); text-decoration: none;
}
.topnav-links a:hover { background: var(--wash); }
.topnav-links a.active { background: var(--ink); color: #fff; }
.topnav-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topnav-user form { margin: 0; }
.topnav-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }

.page { max-width: 1120px; margin: 0 auto; padding: 22px 20px 48px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-actions .btn { text-decoration: none; }
.actions-label { color: var(--muted); font-size: 13px; font-weight: 600; margin-right: 2px; }

.card {
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  padding: 18px 20px; margin-bottom: 18px; min-width: 0;
}
.card h2 { display: flex; align-items: center; gap: 10px; font-size: 16px; margin-bottom: 12px; }
.card.table-card { padding: 18px 0 6px; }
.card.table-card > h2, .card.table-card > .pick-bar, .card.table-card > .step-actions { padding: 0 20px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.two-col .card { margin-bottom: 18px; }

.filters { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; }
.filters label { margin: 0; flex: 1 1 150px; min-width: 0; }
.filters label.grow { flex: 2 1 220px; }
.filters .btn { flex: none; }
.filters.plain label { flex: 1 1 200px; }
.hint.lead { max-width: 760px; margin: -6px 2px 18px; font-size: 14px; }
.summary { font-size: 16px; font-weight: 600; margin: 0 2px 16px; }

.table { width: 100%; border-collapse: collapse; table-layout: auto; }
.table th, .table td {
  padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle;
  overflow-wrap: anywhere;
}
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tr:last-child td { border-bottom: 0; }
.table th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: #fafbfc; white-space: nowrap; }
.table td.name { font-weight: 600; }
.table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.empty { color: var(--muted); }
.table tr.inactive td { color: #94a0ab; }
.table tr.inactive .dot { opacity: .4; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn { margin-left: 6px; }
.table.compact th:first-child, .table.compact td:first-child { padding-left: 0; }
.table.compact th:last-child, .table.compact td:last-child { padding-right: 0; }
.table.compact td { padding: 8px 10px; }
.table tr.sub td:first-child { padding-left: 18px; }
.table tr.muted td:first-child { color: var(--muted); }
.cell-sub { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; max-height: 2.9em; overflow: hidden; }
.clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-2); }
.who { display: inline-flex; align-items: center; gap: 8px; }
.bar-cell { width: 42%; }
.bar { display: block; height: 8px; border-radius: 4px; background: var(--accent-bright); }
tr.sub .bar { background: #9fdcf5; }
.col-check { width: 44px; }
.bulk-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 20px 12px; padding: 10px 14px; background: var(--accent-wash); border-radius: var(--r-sm);
}
.bulk-bar strong { flex: 1; min-width: 140px; }

.badge { display: inline-block; font-size: 12.5px; font-weight: 600; border-radius: 12px; padding: 2px 10px; background: var(--wash); color: var(--ink-2); }
.badge.admin { background: var(--ink); color: #fff; }
.badge.on { background: var(--accent-wash); color: var(--accent); }
.badge.warn { background: #fff3d6; color: #8a5a00; margin-left: 8px; }

.step input[type=file] { display: block; max-width: 100%; font: inherit; }
.step .hint strong { color: var(--ink); }
.pick-bar { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.pick-bar input[type=search] { flex: 1 1 220px; width: auto !important; margin: 0 !important; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; }
.step-actions { display: flex; justify-content: flex-end; margin: 14px 0 12px; }
#stepDone .btn { margin-right: 8px; text-decoration: none; display: inline-block; }

@media print {
  .topnav, .filters, .page-actions, .toast, .bulk-bar, .col-check { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .card.table-card { break-inside: auto; }
  .hide-sm { display: table-cell !important; }
}

/* ---------- celular ---------- */
@media (max-width: 760px) {
  /* celular: painel vira gaveta com fundo escurecido; formulários sobem da base da tela */
  body.panel-open .panel-backdrop { display: block; position: absolute; inset: 0; z-index: 1090; background: rgba(1, 7, 53, .45); }
  .dialog {
    width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 94dvh;
  }
  .dialog.wide { width: 100vw; }
  input:not([type=checkbox]):not([type=color]), textarea, select { font-size: 16px; }   /* evita zoom do iPhone ao focar */
  .btn, .foot-btn, .panel-nav a { min-height: 42px; }
  .dialog-actions .btn { flex: 1; }
  .fab { bottom: calc(22px + env(safe-area-inset-bottom)); padding: 15px 26px; font-size: 16px; }
  .topbar { width: calc(100vw - 24px); }
  .leaflet-top.leaflet-right { top: 62px; }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); width: max-content; }
  .panel-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .panel { top: 0; bottom: 0; left: 0; border-radius: 0 var(--r-lg) var(--r-lg) 0; width: min(var(--panel-w), 88vw); }
  body.panel-open .topbar { left: var(--gap); }
  body.panel-open #btnMenu { display: grid; }
  body.panel-open .fab { left: 50%; }
  body.panel-open .leaflet-bottom.leaflet-left { left: 0; }
  .row { flex-direction: column; gap: 0; }
  .hide-sm { display: none; }
  .topnav { padding: 10px 14px; }
  .page { padding: 16px 12px 40px; }
  .table th, .table td { padding: 10px 8px; }
  .table th:first-child, .table td:first-child { padding-left: 14px; }
  .table th:last-child, .table td:last-child { padding-right: 14px; }
  .card.table-card > h2, .card.table-card > .pick-bar, .card.table-card > .step-actions { padding: 0 14px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
