:root {
  --urbis-green: #0f8a4b;
  --urbis-green-dark: #0a6b39;
  --urbis-gold: #e6c200;
  --urbis-bg: #f4f6f5;
  --urbis-panel: #ffffff;
  --urbis-border: #e5ebe8;
  --panel-width: 400px;
  --panel-min: 320px;
  --panel-max: calc(100vw - 160px);
  --navbar-h: 56px;
  --bs-body-font-family: "Source Sans 3", system-ui, -apple-system, sans-serif;
  --bs-body-bg: var(--urbis-bg);
  --bs-success: #0f8a4b;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-weight: 500;
  color: #1f2933;
  background: var(--urbis-bg);
}

body {
  overflow: hidden;
}

.fw-bold,
.h1, .h2, .h3, .h4, .h5,
.card-title,
.navbar-brand {
  font-weight: 700 !important;
}

.form-label {
  font-weight: 600;
  font-size: 0.8rem;
  color: #52606d;
}

/* Login */
.login-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  overflow: auto;
  background: #ffffff;
}

.login-gate.d-none {
  display: none !important;
}

.login-stage {
  width: min(420px, 100%);
  animation: loginRise 0.55s ease-out both;
}

@keyframes loginRise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-brasao {
  display: block;
  width: min(168px, 42vw);
  height: auto;
  margin: 0 auto 1.1rem;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(15, 60, 35, 0.12));
  animation: loginBrasao 0.7s ease-out both;
}

@keyframes loginBrasao {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.login-municipio {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5b6b63;
}

.login-city {
  margin: 0.2rem 0 0;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(1.85rem, 5vw, 2.35rem);
  font-weight: 700;
  line-height: 1.15;
  color: #123528;
}

.login-uf {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: #6b7c73;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.35rem 1.4rem 1.45rem;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(18, 53, 40, 0.08);
  backdrop-filter: blur(8px);
  animation: loginRise 0.65s ease-out 0.08s both;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.login-label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #3d4f46;
}

.login-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.95rem;
  border: 1px solid #c9d5ce;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-input-wrap:focus-within {
  border-color: var(--urbis-green);
  box-shadow: 0 0 0 3px rgba(15, 138, 75, 0.15);
}

.login-input-wrap i {
  color: #7a8b82;
  font-size: 1.05rem;
}

.login-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0.85rem 0;
  font-size: 1rem;
  font-weight: 500;
  color: #1a2b23;
  letter-spacing: 0.02em;
}

.login-input::placeholder {
  color: #9aa89f;
  font-weight: 400;
}

.login-submit {
  margin-top: 0.35rem;
  border: 0;
  padding: 0.95rem 1rem;
  background: linear-gradient(180deg, #129653 0%, var(--urbis-green-dark) 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.login-submit:hover:not(:disabled) {
  filter: brightness(1.05);
}

.login-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.login-submit:disabled {
  opacity: 0.72;
  cursor: wait;
}

.login-msg {
  min-height: 1.25rem;
  margin: 0;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: #8a3b3b;
}

.login-msg:empty {
  display: none;
}

.brand-logo {
  display: block;
  object-fit: contain;
}

.brand-logo-nav {
  height: 40px;
  width: 40px;
  max-width: 48px;
  object-fit: contain;
  background: #fff;
  border-radius: 0.35rem;
  padding: 0.15rem;
}

.navbar-city {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
}

/* Shell */
.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--urbis-bg);
}

.app-navbar {
  height: var(--navbar-h);
  min-height: var(--navbar-h);
  z-index: 1030;
}

.workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
  background: #dfe7e3;
}

.map-pane {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
  background: #cfd8d3;
}

.map-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-floating-tools {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 2;
}

.measure-chip {
  position: absolute;
  top: 3.4rem;
  left: 0.85rem;
  z-index: 2;
  font-weight: 600;
  padding: 0.45rem 0.7rem;
}

.map-hover-tip {
  position: fixed;
  z-index: 5;
  pointer-events: none;
  background: rgba(33, 37, 41, 0.92);
  color: #fff;
  padding: 0.4rem 0.65rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  max-width: 260px;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.pick-banner {
  position: absolute;
  top: 0.85rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  max-width: min(520px, calc(100% - 8rem));
  padding: 0.7rem 0.85rem;
  border-radius: 0.6rem;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
}

.pick-banner.d-none {
  display: none !important;
}

.map-canvas.is-picking {
  cursor: pointer;
}

.resize-handle {
  width: 6px;
  cursor: col-resize;
  background: transparent;
  align-items: stretch;
  justify-content: center;
  flex: 0 0 6px;
  z-index: 3;
}

.resize-handle::after {
  content: "";
  width: 2px;
  margin: 0 auto;
  background: var(--urbis-border);
  border-radius: 2px;
  transition: background 0.15s ease, width 0.15s ease;
}

.resize-handle:hover::after,
.workspace.resizing .resize-handle::after {
  width: 4px;
  background: var(--urbis-green);
}

.side-panel {
  width: var(--panel-width);
  min-width: var(--panel-min);
  max-width: var(--panel-max);
  flex: 0 0 var(--panel-width);
  background: var(--urbis-panel);
  border-left: 1px solid var(--urbis-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: flex-basis 0.2s ease, width 0.2s ease, opacity 0.2s ease;
}

.side-panel.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  flex-basis: 0 !important;
  opacity: 0;
  overflow: hidden;
  border-left: none;
  pointer-events: none;
}

.workspace.map-expanded .side-panel,
.workspace.map-expanded .resize-handle {
  display: none !important;
}

.side-panel-inner,
#mobilePanelInner {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.panel-card {
  border: 1px solid var(--urbis-border);
  border-radius: 0.85rem;
  box-shadow: 0 0.15rem 0.5rem rgba(15, 40, 30, 0.04);
}

.panel-card .card-header {
  background: #f8faf9;
  border-bottom: 1px solid var(--urbis-border);
  font-weight: 700;
  padding: 0.7rem 0.9rem;
}

.panel-card .card-body {
  padding: 0.9rem;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.dash-card {
  border: 1px solid var(--urbis-border);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: #fff;
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.dash-card .icon-wrap {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.6rem;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 1.1rem;
}

.dash-card .value {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.1;
  color: #1f2933;
}

.dash-card .label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7c73;
  margin-top: 0.15rem;
}

.icon-wrap.bg-soft-success { background: #e8f6ee; color: #198754; }
.icon-wrap.bg-soft-warning { background: #fff4e0; color: #b78103; }
.icon-wrap.bg-soft-danger { background: #fdeceb; color: #b02a37; }
.icon-wrap.bg-soft-secondary { background: #eef1f0; color: #5c6b63; }
.icon-wrap.bg-soft-info { background: #e7f5f2; color: #0f766e; }

.detail-tabs .nav-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: #5c6b63;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.55rem 0.65rem;
}

.detail-tabs .nav-link.active {
  color: var(--urbis-green);
  border-bottom-color: var(--urbis-green);
  background: transparent;
}

.detail-tabs .nav-link:hover {
  color: var(--urbis-green-dark);
}

.info-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #eef2f0;
  font-size: 0.9rem;
}

.info-row:last-child {
  border-bottom: none;
}

.info-row .k {
  color: #6b7c73;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-top: 0.15rem;
}

.info-row .v {
  font-weight: 600;
  word-break: break-word;
}

.photo-thumb-wrap {
  position: relative;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #e8eee9;
  border: 1px solid var(--urbis-border);
  aspect-ratio: 4 / 3;
  width: 100%;
  display: block;
}

.photo-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.2s ease;
}

.photo-thumb-wrap img.rot-odd {
  object-fit: contain;
  background: #e8eee9;
}

.photo-modal-stage {
  min-height: 50vh;
  max-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #111827;
  border-radius: 0.5rem;
}

.photo-modal-img {
  max-height: 70vh;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.photo-modal-img.rot-odd {
  /* 90°/270°: troca limites para a imagem preencher a área */
  max-height: min(90vw, 70vh);
  max-width: min(70vh, 100%);
}

.photo-empty {
  min-height: 140px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
  background: #f8faf9;
  border: 1px dashed var(--urbis-border);
  border-radius: 0.75rem;
  color: #6b7c73;
}

.list-pick .list-group-item {
  cursor: pointer;
}

.list-pick .list-group-item:hover {
  background: #e8f6ee;
}

.layer-list .form-check {
  padding: 0.35rem 0 0.35rem 1.7rem;
}

.section-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7c73;
  margin-bottom: 0.65rem;
}

.compat-box {
  background: #f8faf9;
  border: 1px solid var(--urbis-border);
  border-radius: 0.75rem;
  padding: 0.75rem;
}

.skeleton {
  background: linear-gradient(90deg, #eef2f0 25%, #f8faf9 50%, #eef2f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 0.5rem;
  height: 1rem;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.maplibregl-popup-content {
  font-family: "Inter", system-ui, sans-serif;
  border-radius: 0.65rem;
  padding: 0.75rem 0.9rem;
  box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.12);
}

.maplibregl-ctrl-group {
  border-radius: 0.5rem !important;
  overflow: hidden;
}

@media (max-width: 991.98px) {
  .workspace {
    display: block;
  }
  .map-pane {
    height: calc(100vh - var(--navbar-h));
  }
}

@media print {
  .app-navbar,
  .side-panel,
  .resize-handle,
  .map-floating-tools,
  .measure-chip,
  .upload-overlay {
    display: none !important;
  }
  .map-pane {
    height: 100vh;
  }
}

.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 23, 20, 0.45);
  display: grid;
  place-items: center;
}

.upload-overlay.d-none {
  display: none !important;
}

.upload-overlay-card {
  background: #fff;
  border-radius: 1rem;
  padding: 1.5rem 1.75rem;
  min-width: min(320px, 90vw);
  text-align: center;
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.18);
}

/* Seleção de visão — alinhada ao shell do mapa */
.view-gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: auto;
  background: #dfe7e3;
}

.view-gate.d-none {
  display: none !important;
}

.view-gate-bar {
  flex: 0 0 auto;
  height: var(--navbar-h);
  min-height: var(--navbar-h);
  display: flex;
  align-items: center;
  background: linear-gradient(180deg, #129653 0%, var(--urbis-green-dark) 100%);
  color: #fff;
  box-shadow: 0 0.15rem 0.45rem rgba(10, 50, 30, 0.18);
}

.view-gate-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.16);
  font-size: 1.05rem;
}

.view-gate-bar-title {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.15;
}

.view-gate-bar-sub {
  font-size: 0.75rem;
  opacity: 0.88;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-gate-body {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  padding: 1.75rem 1rem 2.5rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 28%),
    #dfe7e3;
}

.view-gate-stage {
  width: min(1040px, 100%);
}

.view-gate-intro {
  max-width: 34rem;
  margin-bottom: 1.75rem;
}

.view-gate-title {
  margin: 0;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(1.55rem, 3.4vw, 2.05rem);
  font-weight: 700;
  color: #123528;
  letter-spacing: -0.015em;
}

.view-gate-sub {
  margin: 0.65rem auto 0;
  color: #5b6b63;
  font-size: 0.98rem;
  line-height: 1.5;
}

.view-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
  width: 100%;
  min-height: 100%;
  text-align: left;
  border: 1px solid var(--urbis-border);
  background: #fff;
  border-radius: 0.85rem;
  padding: 1.2rem 1.15rem 1.1rem;
  box-shadow: 0 0.15rem 0.5rem rgba(15, 40, 30, 0.05);
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.view-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 3px;
  background: var(--urbis-green);
}

.view-card-comparative::before {
  background: #f0a202;
}

.view-card-consolidated::before {
  background: #0f766e;
}

.view-card:hover:not(:disabled) {
  border-color: #b7cfc0;
  box-shadow: 0 0.55rem 1.35rem rgba(15, 60, 35, 0.11);
  transform: translateY(-2px);
}

.view-card:focus-visible {
  outline: 3px solid rgba(15, 138, 75, 0.35);
  outline-offset: 3px;
}

.view-card.is-selected,
.view-card:disabled.is-selected {
  border-color: var(--urbis-green);
  box-shadow: 0 0 0 3px rgba(15, 138, 75, 0.16);
}

.view-card:disabled {
  cursor: wait;
  opacity: 0.88;
}

.view-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.view-card-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 0.65rem;
  font-size: 1.2rem;
}

.view-card-research .view-card-icon-wrap {
  background: #e8f6ee;
  color: var(--urbis-green-dark);
}

.view-card-comparative .view-card-icon-wrap {
  background: #fff7ed;
  color: #c2410c;
}

.view-card-consolidated .view-card-icon-wrap {
  background: #e7f5f2;
  color: #0f766e;
}

.view-card-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--urbis-green-dark);
  background: #e8f6ee;
  border: 1px solid #c7e6d4;
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  white-space: nowrap;
}

.view-card-tag-ops {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fdba74;
}

.view-card-tag-result {
  color: #0f766e;
  background: #e7f5f2;
  border-color: #9ed4cb;
}

.view-card-name {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #123528;
  line-height: 1.15;
}

.view-card-desc {
  color: #5b6b63;
  font-size: 0.92rem;
  line-height: 1.5;
}

.view-card-points {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  margin-top: 0.15rem;
  padding-top: 0.8rem;
  border-top: 1px solid #eef2f0;
  font-size: 0.86rem;
  color: #3d4f46;
}

.view-card-points li {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.view-card-points .bi-check2 {
  color: var(--urbis-green);
  margin-top: 0.12rem;
  flex: 0 0 auto;
}

.view-card-cta {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  border-radius: 0.55rem;
  border: 1px solid #b7dfc8;
  background: #f6fbf8;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--urbis-green-dark);
}

.view-card:hover:not(:disabled) .view-card-cta {
  background: linear-gradient(180deg, #129653 0%, var(--urbis-green-dark) 100%);
  border-color: transparent;
  color: #fff;
}

.view-gate-status {
  color: #5b6b63;
}

.view-gate-status:empty {
  display: none;
}

@media (max-width: 767.98px) {
  .view-gate-body {
    place-items: start center;
    padding-top: 1.25rem;
  }

  .view-gate-intro {
    margin-bottom: 1.25rem;
  }

  .view-card {
    min-height: auto;
  }

  .view-gate-bar-sub {
    max-width: 58vw;
  }
}
