/* Premium UI (mock-inspired) */
:root{
  --blue-900:#0b3f73;
  --blue-800:#0f4c81;
  --blue-700:#1f6fb2;
  --blue-100:#e9f3ff;

  --green-700:#2e7d32;
  --green-600:#43a047;
  --green-500:#4caf50;

  --orange-500:#f59e0b;
  --red-500:#ef4444;

  --bg:#f3f5f9;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;

  --radius-xl:18px;
  --radius-lg:14px;
  --radius-md:12px;

  --shadow-1: 0 10px 30px rgba(2, 6, 23, .10);
  --shadow-2: 0 6px 18px rgba(2, 6, 23, .08);

  --grad-green: linear-gradient(180deg, #52d36a 0%, #2ea84f 45%, #1f7a3b 100%);
  --grad-blue: linear-gradient(180deg, #2a8ad9 0%, #1f6fb2 45%, #0f4c81 100%);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
}

/* ---------- Generic UI ---------- */
.container{
  width:100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
}

.card{
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2);
  border: 1px solid rgba(15, 23, 42, .06);
}

.card-pad{ padding:16px; }

.muted{ color: var(--muted); }

.row{ display:flex; gap:12px; }
.col{ flex:1; }

.btn{
  border:0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
  cursor:pointer;
  transition: transform .06s ease, filter .2s ease;
}
.btn:active{ transform: translateY(1px); }
.btn-primary{
  background: var(--grad-green);
  color:#fff;
  box-shadow: 0 10px 18px rgba(34, 197, 94, .25);
}
.btn-secondary{
  background: var(--grad-blue);
  color:#fff;
  box-shadow: 0 10px 18px rgba(31, 111, 178, .22);
}
.btn-ghost{
  background: transparent;
  border:1px solid rgba(15,23,42,.12);
  color: var(--text);
}

/* Badges */
.badge{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;font-weight:900;font-size:12px;border:1px solid rgba(15,23,42,.10);}
.badge-ok{background: rgba(34,197,94,.12); color:#166534;}
.badge-muted{background: rgba(148,163,184,.18); color:#334155;}

/* Smaller button variations for tables */
.btn-soft{background: rgba(15,23,42,.05); color: var(--text); padding: 10px 12px; border-radius: 12px;}
.btn-danger{background: rgba(239,68,68,.12); color:#991b1b; padding:10px 12px; border-radius:12px; border:1px solid rgba(239,68,68,.18);} 

/* ---------- Topbar (Portal) ---------- */
.topbar{
  background: var(--blue-900);
  color:#fff;
  padding: 12px 16px;
}
.topbar-inner{
  max-width:760px;
  margin:0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
}
.brand-badge{
  width:38px; height:38px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffb14a 0%, #f97316 60%, #ea580c 100%);
  box-shadow: 0 10px 18px rgba(249,115,22,.25);
  position:relative;
}
.brand-badge:after{
  content:"";
  position:absolute;
  left:50%; top:50%;
  width:14px; height:14px;
  transform: translate(-50%,-50%);
  border-radius: 999px;
  background:#fff;
  opacity:.9;
}
.brand-title{
  line-height:1.1;
}
.brand-title strong{ display:block; font-size:16px; letter-spacing:.4px; }
.brand-title span{ font-size:12px; opacity:.85; }

.city-select{
  display:flex;
  align-items:center;
  gap:10px;
}
.pill{
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.16);
  padding: 10px 12px;
  border-radius: 14px;
  display:flex;
  align-items:center;
  gap:10px;
}
.pill select{
  background: transparent;
  border:0;
  color:#fff;
  font-weight:700;
  outline:none;
}
.pill option{ color:#111; }

.icon-btn{
  width:40px; height:40px;
  border-radius: 14px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.16);
  display:flex; align-items:center; justify-content:center;
}

/* ---------- Portal home ---------- */
.hero-btn{
  width:100%;
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 15px;
}
.stats{
  margin-top: 14px;
  display:flex;
  gap: 10px;
}
.stat{
  flex:1;
  background:#fff;
  border-radius: 16px;
  border:1px solid rgba(15,23,42,.06);
  box-shadow: var(--shadow-2);
  padding: 10px 10px;
  text-align:center;
}
.stat strong{
  font-size: 18px;
  display:block;
}
.stat span{
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.stat.badge-open strong{ color: var(--red-500); }
.stat.badge-progress strong{ color: var(--orange-500); }
.stat.badge-done strong{ color: var(--green-600); }

.recent{
  margin-top: 14px;
  overflow:hidden;
}
.recent-img{
  width:100%;
  height: 170px;
  object-fit: cover;
  display:block;
}
.recent-meta{
  padding: 12px 14px;
}
.recent-meta .line1{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 6px;
}
.tag{
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border:1px solid rgba(15,23,42,.08);
}
.tag.city{ background: #f1f5f9; }

/* Status tags (Portal - card recente) */
.tag.status{ color:#0f172a; }
.tag.status-open{ background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.22); }
.tag.status-progress{ background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.22); }
.tag.status-analysis{ background: rgba(245,158,11,.14); border-color: rgba(245,158,11,.24); }
.tag.status-done{ background: rgba(34,197,94,.14); border-color: rgba(34,197,94,.24); }
.tag.status-rejected{ background: rgba(148,163,184,.22); border-color: rgba(148,163,184,.35); }

/* ---------- List (categories) ---------- */
.list{
  margin-top: 12px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.list-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:#fff;
  border:1px solid rgba(15,23,42,.06);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow-2);
}
.li-left{
  display:flex;
  align-items:center;
  gap: 12px;
}
.li-ico{
  width:38px; height:38px;
  border-radius: 14px;
  background: var(--blue-100);
  display:flex;
  align-items:center;
  justify-content:center;
  color: var(--blue-800);
  font-weight: 900;
}
.li-title{ font-weight: 900; }
.li-sub{
  font-size: 12px;
  color: var(--muted);
  margin-top:2px;
}
.chev{
  width:34px; height:34px;
  border-radius: 12px;
  background:#f1f5f9;
  display:flex; align-items:center; justify-content:center;
  color:#334155;
  font-weight: 900;
}

/* ---------- Map card ---------- */
.map-shell{
  margin-top: 12px;
  border-radius: 20px;
  overflow:hidden;
  border:1px solid rgba(15,23,42,.06);
  box-shadow: var(--shadow-1);
}
.map{ height: 360px; }
.form-block{
  margin-top: 12px;
  padding: 14px;
  border-radius: 20px;
  border:1px solid rgba(15,23,42,.06);
  box-shadow: var(--shadow-2);
  background:#fff;
}
.input, select, textarea{
  width:100%;
  padding: 12px 12px;
  border-radius: 14px;
  border:1px solid rgba(15,23,42,.12);
  outline:none;
  background:#fff;
}
textarea{ min-height: 90px; resize: vertical; }

/* ---------- Admin ---------- */
.admin-wrap{ display:flex; min-height:100vh; }
.admin-sidebar{
  width: 260px;
  background: #fff;
  border-right:1px solid rgba(15,23,42,.06);
  padding: 16px 14px;
}
.admin-brand{
  display:flex; align-items:center; gap:10px;
  padding: 8px 8px 14px;
}
.admin-brand .brand-badge{ width:34px; height:34px; border-radius: 12px; }
.admin-menu a{
  display:flex; align-items:center; gap:10px;
  padding: 12px 12px;
  border-radius: 14px;
  text-decoration:none;
  color: var(--text);
  font-weight: 800;
  margin-bottom: 6px;
}
.admin-menu a:hover{ background:#f1f5f9; }
.admin-main{ flex:1; padding: 16px 18px; }
.admin-topbar{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  margin-bottom: 12px;
}
.search{
  flex:1; max-width: 520px;
  background:#fff;
  border:1px solid rgba(15,23,42,.08);
  border-radius: 16px;
  padding: 10px 12px;
  display:flex; align-items:center; gap: 10px;
  box-shadow: var(--shadow-2);
}
.search input{ border:0; outline:none; width:100%; font-weight:700; }
.user-pill{
  display:flex; align-items:center; gap:10px;
  background:#fff;
  border:1px solid rgba(15,23,42,.08);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: var(--shadow-2);
}
.avatar{ width:34px; height:34px; border-radius: 14px; background: #e2e8f0; }

.page{ max-width: 1180px; }
.page-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; }

.table-wrap{ overflow:auto; }

.admin-grid{
  display:grid;
  grid-template-columns: 280px 1fr;
  gap: 12px;
  align-items: start;
}
.filters{
  background:#fff;
  border:1px solid rgba(15,23,42,.06);
  border-radius: 20px;
  box-shadow: var(--shadow-2);
  padding: 12px;
}
.filters h3{ margin: 4px 6px 10px; font-size: 14px; }
.filter-row{ display:flex; gap:10px; margin-bottom: 10px; }
.filter-row .input{ padding: 10px 12px; border-radius: 14px; }

.admin-map-card{
  background:#fff;
  border:1px solid rgba(15,23,42,.06);
  border-radius: 20px;
  box-shadow: var(--shadow-1);
  overflow:hidden;
  position: relative;
}
.admin-map{ height: 520px; }
.bottom-chips{
  display:flex;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid rgba(15,23,42,.06);
}
.chip{
  flex:1;
  border-radius: 16px;
  padding: 10px 12px;
  font-weight: 900;
  color:#fff;
  display:flex;
  justify-content:space-between;
  align-items:center;
}
.chip.red{ background: linear-gradient(180deg, #ff6b6b, #ef4444); }
.chip.orange{ background: linear-gradient(180deg, #ffc34d, #f59e0b); }
.chip.yellow{ background: linear-gradient(180deg, #ffd86b, #f59e0b); }
.chip.blue{ background: linear-gradient(180deg, #60a5fa, #2563eb); }
.chip.green{ background: linear-gradient(180deg, #6be28a, #22c55e); }
.chip.gray{ background: linear-gradient(180deg, #cbd5e1, #94a3b8); color:#0f172a; }

.chip:hover{ filter: brightness(1.02); transform: translateY(-1px); transition: .15s ease; }

.chip.active{
  outline: 3px solid rgba(255,255,255,.85);
  box-shadow: 0 18px 35px rgba(0,0,0,.35);
  transform: translateY(-1px);
}


/* Legend overlay inside map card */
.map-legend{
  position:absolute;
  top: 14px;
  right: 14px;
  z-index: 600; /* acima do leaflet */
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(15,23,42,.10);
  box-shadow: 0 10px 28px rgba(2,6,23,.12);
  border-radius: 16px;
  padding: 10px 12px;
  display:flex;
  flex-direction:column;
  gap: 8px;
  backdrop-filter: blur(6px);
}
.map-legend .item{ display:flex; align-items:center; gap:10px; font-size:12px; font-weight:900; color:#0f172a; }
.map-legend .dot{ width:10px; height:10px; border-radius:999px; box-shadow: 0 0 0 3px rgba(15,23,42,.06); }

.pin svg{ filter: drop-shadow(0 10px 16px rgba(0,0,0,.28)); }

/* ---------- Admin Map layout polish ---------- */
.admin-map-header{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-map-layout{ align-items: stretch; }

.admin-map-layout .filters{
  position: sticky;
  top: 14px;
}

/* Map uses the viewport better */
.admin-map-layout .admin-map{
  height: calc(100vh - 210px);
  min-height: 520px;
}

@media (max-width: 980px){
  .admin-map-layout .admin-map{
    height: 420px;
    min-height: 420px;
  }
  .admin-map-layout .filters{ position: static; }
}

.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0 10px;
}
.table th{
  text-align:left;
  font-size:12px;
  color:var(--muted);
  padding: 0 10px 6px;
}
.table td{
  background:#fff;
  border:1px solid rgba(15,23,42,.06);
  padding: 12px 10px;
}
.table tr td:first-child{ border-top-left-radius: 14px; border-bottom-left-radius: 14px; }
.table tr td:last-child{ border-top-right-radius: 14px; border-bottom-right-radius: 14px; }

@media (max-width: 980px){
  .admin-sidebar{ display:none; }
  .admin-main{ padding: 14px; }
  .admin-grid{ grid-template-columns: 1fr; }
  .admin-map{ height: 420px; }
}

/* -------- Map page hotfix (layout) -------- */
.admin-map-card{ position: relative; }
.admin-map-card .admin-map{ height: calc(100vh - 250px); min-height: 520px; }
@media (max-width: 980px){
  .admin-map-card .admin-map{ height: 420px; min-height: 420px; }
}
/* Overlay legend/chips on top of map instead of taking vertical space */
.admin-map-card .map-legend{ position:absolute; top:14px; right:14px; z-index:600; }
.admin-map-card .bottom-chips{
  position:absolute;
  left:14px;
  right:14px;
  bottom:14px;
  z-index:600;
  padding: 10px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(15,23,42,.10);
  box-shadow: 0 10px 28px rgba(2,6,23,.12);
  border-radius: 18px;
  backdrop-filter: blur(6px);
}
/* leave room for chips overlay so leaflet attribution isn't hidden */
.leaflet-bottom.leaflet-right{ margin-bottom: 72px; }

/* Botão "i" - atribuição do mapa */
.iurban-attrib{ position: relative; background: transparent; border:0; }
.iurban-attrib-btn{ width:34px; height:34px; border-radius:999px; border:1px solid rgba(0,0,0,.15); background:rgba(255,255,255,.95); box-shadow:0 6px 18px rgba(0,0,0,.12); font-weight:900; cursor:pointer; line-height:34px; text-align:center; user-select:none; }
.iurban-attrib-pop{ position:absolute; right:0; bottom:42px; min-width:230px; padding:10px 12px; border-radius:12px; border:1px solid rgba(0,0,0,.12); background:rgba(255,255,255,.98); box-shadow:0 10px 30px rgba(0,0,0,.16); display:none; }
.iurban-attrib-pop.open{ display:block; }
.iurban-attrib-title{ font-size:12px; font-weight:900; margin-bottom:6px; }
.iurban-attrib-text{ font-size:12px; line-height:1.3; opacity:.9; }
.iurban-attrib-text a{ text-decoration:none; }
.iurban-attrib-text a:hover{ text-decoration:underline; }

/* Layout helpers */
.grid-2{ display:grid; grid-template-columns: 1fr 1fr; gap:14px; }
@media (max-width: 980px){ .grid-2{ grid-template-columns: 1fr; } }
.pill{ display:inline-flex; align-items:center; gap:6px; padding:8px 10px; border-radius:999px; background:rgba(15,23,42,.04); border:1px solid rgba(15,23,42,.06); font-size:12px; font-weight:800; }


/* ===== SCROLL GARANTIDO NO ADMIN ===== */
html, body { height: 100%; }

.admin-wrap{
  position: fixed;
  inset: 0;
  display: flex;
  overflow: hidden;
}

.admin-sidebar{
  height: 100%;
  overflow-y: auto;
}

.admin-main{
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-y: auto;       /* ✅ rolagem aqui */
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}