/* Panorama Municipal • Dashboards no mobile (Figma "Dashboards • Mobile")
 * Tela cheia com a lista de painéis (como o Boas-vindas) + tela do painel aberto.
 * Ativo apenas no layout mobile (#pmMobileUi, até 980px). */

#pmMobileUi .pm-mdash-sheet,
#pmMobileUi .pm-mdash-view {
  --md-blue: #2476ce;
  --md-ink: #172438;
  --md-muted: #65798f;
  --md-canvas: #f3f6fa;
  --md-sheet: #f5f6f8;
  --md-line: #e1e8f0;
  --md-soft: #eaf3ff;
  --md-ease: cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
  font-family: Roboto, "Inter", system-ui, sans-serif;
  color: var(--md-ink);
  -webkit-tap-highlight-color: transparent;
}

#pmMobileUi .pm-mdash-sheet *,
#pmMobileUi .pm-mdash-view * {
  box-sizing: border-box;
}

@keyframes pmMdashFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ───────────── Lista (tela cheia, mesmo fundo e entrada do Boas-vindas) ───────────── */
#pmMobileUi .pm-mdash-sheet {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: none;
  flex-direction: column;
  background:
    radial-gradient(120% 60% at 50% 0%, #f7f9fc 0%, rgba(247, 249, 252, 0) 70%),
    #f2f4f7;
}
#pmMobileUi .pm-mdash-sheet.is-open {
  display: flex;
  pointer-events: auto;
  animation: pmMdashIn 0.28s ease both;
}
@keyframes pmMdashIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
#pmMobileUi .pm-mdash-view.is-open {
  pointer-events: auto;
}

#pmMobileUi .pm-mdash-sheet__head {
  flex: 0 0 auto;
  padding: calc(var(--pm-safe-top, env(safe-area-inset-top, 0px)) + 24px) 20px 4px;
}
#pmMobileUi .pm-mdash-sheet__title {
  margin: 0;
  font: 600 26px/32px Roboto, sans-serif;
  letter-spacing: -0.01em;
  color: var(--md-ink);
}
#pmMobileUi .pm-mdash-sheet__sub {
  margin: 4px 0 0;
  font: 400 15px/20px Roboto, sans-serif;
  color: var(--md-muted);
}

#pmMobileUi .pm-mdash-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  margin-top: 16px;
  padding: 0 16px;
  border: 1px solid var(--md-line);
  border-radius: 23px;
  background: #fff;
  color: var(--md-muted);
  cursor: text;
}
#pmMobileUi .pm-mdash-search svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}
#pmMobileUi .pm-mdash-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font: 400 16px/20px Roboto, sans-serif;
  color: var(--md-ink);
  -webkit-appearance: none;
  appearance: none;
}
#pmMobileUi .pm-mdash-search input::placeholder {
  color: #8a9bae;
}
#pmMobileUi .pm-mdash-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

#pmMobileUi .pm-mdash-chips {
  display: flex;
  gap: 8px;
  margin: 14px -20px 0;
  padding: 0 20px 6px;
  overflow-x: auto;
  scrollbar-width: none;
  touch-action: pan-x;
  cursor: default;
}
#pmMobileUi .pm-mdash-chips::-webkit-scrollbar {
  display: none;
}
#pmMobileUi .pm-mdash-cat {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 15px;
  border: 1px solid var(--md-line);
  border-radius: 18px;
  background: #fff;
  color: #33475b;
  font: 500 14px/18px Roboto, sans-serif;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
#pmMobileUi .pm-mdash-cat i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
#pmMobileUi .pm-mdash-cat.is-active {
  background: var(--md-blue);
  border-color: var(--md-blue);
  color: #fff;
}
#pmMobileUi .pm-mdash-cat.is-active i {
  box-shadow: 0 0 0 2px #fff;
}

#pmMobileUi .pm-mdash-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 6px 20px calc(118px + env(safe-area-inset-bottom, 0px));
}

#pmMobileUi .pm-mdash-kicker {
  margin: 16px 2px 10px;
  font: 600 12.5px/16px Roboto, sans-serif;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--md-muted);
}
#pmMobileUi .pm-mdash-kicker span {
  color: var(--md-ink);
}

#pmMobileUi .pm-mdash-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 0 0 12px;
  padding: 14px 14px 14px 16px;
  border: 1px solid var(--md-line);
  border-radius: 20px;
  background: #fff;
  text-align: left;
  color: inherit;
  font: inherit;
  transition: transform 0.15s var(--md-ease), box-shadow 0.2s ease;
}
#pmMobileUi .pm-mdash-item:active {
  transform: scale(0.98);
}
#pmMobileUi .pm-mdash-item__ico {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
}
#pmMobileUi .pm-mdash-item__ico svg {
  width: 24px !important;
  height: 24px !important;
}
#pmMobileUi .pm-mdash-item__txt {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#pmMobileUi .pm-mdash-item__txt strong {
  font: 600 16.5px/22px Roboto, sans-serif;
  color: var(--md-ink);
}
#pmMobileUi .pm-mdash-item__txt small {
  font: 400 14px/19px Roboto, sans-serif;
  color: var(--md-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#pmMobileUi .pm-mdash-item__go {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: #4d5e71;
}
#pmMobileUi .pm-mdash-item__go svg {
  width: 22px;
  height: 22px;
}

#pmMobileUi .pm-mdash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 42px 16px;
  text-align: center;
  color: var(--md-muted);
  font: 400 14px/20px Roboto, sans-serif;
}
#pmMobileUi .pm-mdash-empty strong {
  font: 600 16px/22px Roboto, sans-serif;
  color: var(--md-ink);
}

#pmMobileUi .pm-mdash-spin {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(36, 118, 206, 0.18);
  border-top-color: var(--md-blue, #2476ce);
  animation: pmMdashSpin 0.8s linear infinite;
}
@keyframes pmMdashSpin {
  to { transform: rotate(360deg); }
}
/* Escondido (visibility) o giro sai da GPU e recalcula o estilo da página a cada quadro, travando o mapa. */
#pmMobileUi .pm-mdash-view:not(.is-open) .pm-mdash-spin,
#pmMobileUi .pm-mdash-sheet:not(.is-open) .pm-mdash-spin {
  animation-play-state: paused;
}

/* ───────────── Painel aberto ───────────── */
#pmMobileUi .pm-mdash-view {
  --mdash-accent: #2476ce;
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  background: var(--md-canvas);
  transform: translate3d(100%, 0, 0);
  visibility: hidden;
  transition: transform 0.38s var(--md-ease), visibility 0s linear 0.38s;
}
#pmMobileUi .pm-mdash-view.is-open {
  transform: translate3d(0, 0, 0);
  visibility: visible;
  transition: transform 0.38s var(--md-ease), visibility 0s linear 0s;
}

#pmMobileUi .pm-mdash-vh {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  padding: calc(var(--pm-safe-top, env(safe-area-inset-top, 0px)) + 14px) 16px 12px;
  background: rgba(243, 246, 250, 0.96);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#pmMobileUi .pm-mdash-view.is-compact .pm-mdash-vh {
  border-bottom-color: var(--md-line);
  box-shadow: 0 6px 18px rgba(23, 46, 77, 0.06);
}
#pmMobileUi .pm-mdash-vh__bar {
  display: flex;
  align-items: center;
  gap: 10px;
}
#pmMobileUi .pm-mdash-cbtn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 20px;
  background: #fff;
  color: var(--md-blue);
  box-shadow: 0 2px 8px rgba(23, 46, 77, 0.08);
  transition: transform 0.15s var(--md-ease);
}
#pmMobileUi .pm-mdash-cbtn:active {
  transform: scale(0.92);
}
#pmMobileUi .pm-mdash-cbtn svg {
  width: 20px;
  height: 20px;
}
#pmMobileUi .pm-mdash-vh__titles {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
#pmMobileUi .pm-mdash-vh__over {
  font: 600 10.5px/14px Roboto, sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--mdash-accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#pmMobileUi .pm-mdash-vh__title {
  margin: 0;
  font: 700 20px/26px Roboto, sans-serif;
  letter-spacing: -0.01em;
  color: var(--md-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#pmMobileUi .pm-mdash-vh__meta {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  max-height: 40px;
  overflow-x: auto;
  scrollbar-width: none;
  transition: max-height 0.25s ease, margin 0.25s ease, opacity 0.2s ease;
}
#pmMobileUi .pm-mdash-vh__meta::-webkit-scrollbar {
  display: none;
}
#pmMobileUi .pm-mdash-view.is-compact .pm-mdash-vh__meta {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
}
#pmMobileUi .pm-mdash-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  max-width: 78vw;
  padding: 0 11px;
  border-radius: 14px;
  background: var(--md-soft);
  color: var(--md-blue);
  font: 500 12px/16px Roboto, sans-serif;
  white-space: nowrap;
}
#pmMobileUi .pm-mdash-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
}
#pmMobileUi .pm-mdash-chip svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

#pmMobileUi .pm-mdash-modes {
  display: flex;
  gap: 4px;
  margin-top: 12px;
  padding: 4px;
  border-radius: 16px;
  background: #e4eaf2;
}
#pmMobileUi .pm-mdash-modes[hidden] {
  display: none;
}
#pmMobileUi .pm-mdash-mode {
  flex: 1 1 0;
  height: 34px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--md-muted);
  font: 600 13px/16px Roboto, sans-serif;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
#pmMobileUi .pm-mdash-mode.is-active {
  background: #fff;
  color: var(--md-ink);
  box-shadow: 0 2px 8px rgba(23, 46, 77, 0.1);
}

#pmMobileUi .pm-mdash-tabs {
  display: flex;
  gap: 8px;
  margin: 12px -16px 0;
  padding: 0 16px 2px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-padding: 0 16px;
}
#pmMobileUi .pm-mdash-tabs::-webkit-scrollbar {
  display: none;
}
#pmMobileUi .pm-mdash-tabs:empty {
  min-height: 36px;
}
#pmMobileUi .pm-mdash-tab {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--md-line);
  border-radius: 18px;
  background: #fff;
  color: #33475b;
  font: 500 13.5px/18px Roboto, sans-serif;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
#pmMobileUi .pm-mdash-tab:active {
  transform: scale(0.96);
}
#pmMobileUi .pm-mdash-tab.is-active {
  background: var(--md-blue);
  border-color: var(--md-blue);
  color: #fff;
  font-weight: 600;
}

#pmMobileUi .pm-mdash-vbody {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
#pmMobileUi .pm-mdash-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  visibility: hidden;
  background: var(--md-canvas);
}
#pmMobileUi .pm-mdash-frame.is-active {
  visibility: visible;
}
#pmMobileUi .pm-mdash-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-bottom: 110px;
  background: var(--md-canvas);
  color: var(--md-muted);
  font: 500 14px/18px Roboto, sans-serif;
}
#pmMobileUi .pm-mdash-loading[hidden] {
  display: none;
}

#pmMobileUi .pm-mdash-pop {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: flex-start;
  padding: calc(var(--pm-safe-top, env(safe-area-inset-top, 0px)) + 66px) 16px 0;
  background: rgba(15, 23, 42, 0.22);
  animation: pmMdashFade 0.2s ease both;
}
#pmMobileUi .pm-mdash-pop[hidden] {
  display: none;
}
#pmMobileUi .pm-mdash-pop__card {
  width: 100%;
  padding: 18px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(23, 46, 77, 0.18);
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: pmMdashPop 0.28s var(--md-ease) both;
}
@keyframes pmMdashPop {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
#pmMobileUi .pm-mdash-pop__over {
  font: 600 10.5px/14px Roboto, sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--mdash-accent);
}
#pmMobileUi .pm-mdash-pop__card strong {
  font: 700 18px/24px Roboto, sans-serif;
}
#pmMobileUi .pm-mdash-pop__card p {
  margin: 0 0 6px;
  font: 400 14px/20px Roboto, sans-serif;
  color: var(--md-muted);
}
#pmMobileUi .pm-mdash-pop__row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--md-canvas);
}
#pmMobileUi .pm-mdash-pop__row span {
  font: 500 11px/14px Roboto, sans-serif;
  color: var(--md-muted);
}
#pmMobileUi .pm-mdash-pop__row b {
  font: 600 13.5px/18px Roboto, sans-serif;
  color: var(--md-ink);
}
#pmMobileUi .pm-mdash-pop__ok {
  margin-top: 8px;
  height: 44px;
  border: 0;
  border-radius: 22px;
  background: var(--md-blue);
  color: #fff;
  font: 600 15px/20px Roboto, sans-serif;
}

#pmMobileUi .pm-mdash-toast {
  position: absolute;
  left: 50%;
  bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  z-index: 9;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 16px;
  background: rgba(23, 36, 56, 0.92);
  color: #fff;
  font: 500 13.5px/18px Roboto, sans-serif;
  text-align: center;
  transform: translate(-50%, 10px);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.25s var(--md-ease);
}
#pmMobileUi .pm-mdash-toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ───────────── Convivência com o resto da UI mobile ───────────── */
html.pm-mdash-sheet-open #pmMobileUi .pm-mui__map-tools,
html.pm-mdash-sheet-open #pmMobileUi .pm-mui__fabs,
html.pm-mdash-view-open #pmMobileUi .pm-mui__map-tools,
html.pm-mdash-view-open #pmMobileUi .pm-mui__fabs,
html.pm-mdash-view-open #pmMobileUi .pm-mui__header,
html.pm-mdash-view-open #pmMobileUi .pm-mui__services,
html.pm-mdash-view-open #pmMobileUi .pm-mui__sheet {
  visibility: hidden !important;
  pointer-events: none !important;
}
html.pm-mdash-sheet-open .pm-map-sidebar,
html.pm-mdash-view-open .pm-map-sidebar {
  visibility: hidden !important;
}

@media (prefers-reduced-motion: reduce) {
  #pmMobileUi .pm-mdash-view {
    transition-duration: 0.01s !important;
  }
  #pmMobileUi .pm-mdash-sheet.is-open {
    animation: none;
  }
}

@media (min-width: 981px) {
  #pmMobileUi .pm-mdash-sheet,
  #pmMobileUi .pm-mdash-view {
    display: none !important;
  }
}

/* Host no Panorama oficial (a UI mobile atual não usa #pmMobileUi). */
#pmMobileUi.pm-mdash-host {
  position: fixed;
  inset: 0;
  z-index: 8550;
  pointer-events: none;
}
@media (max-width: 767px) {
  #pmMobileDock {
    z-index: 8600;
  }
  #pmMobileUi.pm-mdash-host .pm-mdash-view {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}
@media (min-width: 768px) {
  #pmMobileUi.pm-mdash-host {
    display: none !important;
  }
}
