/* ============ TERRITORIA · tema claro ============ */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #1d2733;
  --ink-soft: #5a6776;
  --ink-faint: #8a96a3;
  --line: #e4e9ee;
  --line-strong: #d2dae2;
  --brand: #1f7a5c;
  --brand-strong: #155f47;
  --brand-soft: #e6f4ee;
  --accent: #2f7dd1;
  --danger: #d14a3c;
  --warn: #c9881f;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(16, 35, 54, .08), 0 1px 2px rgba(16, 35, 54, .06);
  --shadow: 0 8px 28px rgba(16, 35, 54, .12);
  --shadow-lg: 0 18px 48px rgba(16, 35, 54, .18);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.hidden { display: none !important; }
code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: .85em;
  color: var(--brand-strong);
}

/* ============ Topbar ============ */
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-icon { display: block; object-fit: contain; flex-shrink: 0; border-radius: 6px; }
.brand-logo { display: block; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.brand-text small { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.auth-slot { display: flex; align-items: center; min-height: 38px; }
.auth-disabled { white-space: nowrap; }
.auth-profile {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 10px 5px 5px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  max-width: 190px;
}
.auth-profile.attention {
  border-color: rgba(82,183,136,.9);
  box-shadow: 0 0 0 0 rgba(82,183,136,.42), 0 8px 22px rgba(31,122,92,.16);
  animation: profilePulse 1.7s ease-in-out infinite;
}
.auth-profile.attention::after {
  content: 'Painel';
  margin-left: 2px;
  padding: 3px 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), #2f7dd1);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .02em;
}
@keyframes profilePulse {
  0% { box-shadow: 0 0 0 0 rgba(82,183,136,.42), 0 8px 22px rgba(31,122,92,.16); transform: translateY(0); }
  50% { box-shadow: 0 0 0 7px rgba(82,183,136,0), 0 10px 26px rgba(31,122,92,.24); transform: translateY(-1px); }
  100% { box-shadow: 0 0 0 0 rgba(82,183,136,0), 0 8px 22px rgba(31,122,92,.16); transform: translateY(0); }
}
.auth-profile img,
.auth-avatar-fallback {
  width: 26px; height: 26px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.auth-profile span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-avatar-fallback {
  display: grid; place-items: center;
  background: var(--brand-soft);
  color: var(--brand-strong);
}
.auth-profile .auth-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-login-btn { white-space: nowrap; }
.auth-menu { position: relative; }
.auth-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 190px;
  padding: 6px;
  z-index: 60;
  display: flex; flex-direction: column;
}
.auth-dd-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  color: var(--ink); padding: 9px 11px; border-radius: 8px;
  cursor: pointer; text-decoration: none;
}
.auth-dd-item:hover { background: var(--surface-2); color: var(--brand-strong); }

/* Modal de login */
.auth-card { max-width: 380px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.auth-form label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.auth-form input {
  width: 100%; box-sizing: border-box; margin-top: 5px;
  padding: 11px 13px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); font-size: 14px; font-family: var(--font);
}
.password-field { position: relative; display: block; margin-top: 5px; }
.password-field input { margin-top: 0; padding-right: 44px; }
.password-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border: none; border-radius: 8px;
  background: transparent; color: var(--ink-faint); cursor: pointer;
  display: grid; place-items: center;
}
.password-toggle:hover { background: var(--surface-2); color: var(--ink); }
.auth-note { font-size: 12px; color: var(--ink-faint); margin: 14px 0 0; text-align: center; }

/* Aviso "enviando como" nos formulários de sugestão */
.suggest-as { font-size: 12.5px; color: var(--ink-soft); margin: 0 0 10px; }
.suggest-as a { color: var(--brand-strong); font-weight: 700; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: .15s;
}
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand-strong); border-color: var(--brand-soft); }

/* ============ Layout ============ */
.layout {
  display: flex;
  height: calc(100% - 60px);
}
.map-area { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: #e8edf1; }

/* ============ Botoes ============ */
.btn-primary {
  background: var(--brand);
  color: #fff; border: none;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  transition: .15s;
}
.btn-primary:hover { background: var(--brand-strong); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-full { width: 100%; }
.btn-sm { padding: 9px 14px; font-size: 13px; }

/* ============ Controles do mapa ============ */
.map-controls {
  position: absolute;
  top: 14px; right: 14px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 10;
}
.map-ctrl {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink-soft);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: .15s;
}
.map-ctrl:hover { color: var(--brand); border-color: var(--brand-soft); }
.map-ctrl.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ============ Legenda ============ */
.legend {
  position: absolute;
  left: 14px; bottom: 14px;
  width: 230px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 10;
  overflow: hidden;
}
.legend-head {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  background: none; border: none;
  padding: 11px 14px;
  font-size: 13px; font-weight: 700; color: var(--ink);
  cursor: pointer;
  font-family: var(--font);
}
.legend-caret { transition: transform .2s; color: var(--ink-faint); }
.legend.collapsed .legend-caret { transform: rotate(-90deg); }
.legend-body {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 8px 10px;
  border-top: 1px solid var(--line);
}
.legend.collapsed .legend-body { display: none; }
.legend-item {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 6px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink-soft);
  transition: .12s;
}
.legend-item:hover { background: var(--surface-2); color: var(--ink); }
.legend-item.off .legend-swatch { opacity: .25; }
.legend-item.off .lg-code { opacity: .45; }
.legend-item.off .legend-eye { opacity: .5; }
.legend-eye {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: none; background: none;
  color: var(--ink-faint);
  border-radius: 5px;
  cursor: pointer;
  transition: .12s;
  padding: 0;
}
.legend-eye:hover { background: var(--brand-soft); color: var(--brand-strong); }
.legend-item.off .legend-eye svg { opacity: .45; }
.legend-swatch {
  width: 14px; height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,.14);
}
.legend-item .lg-code { font-weight: 700; color: var(--ink); }

/* ============ Painel de zona clicada ============ */
.zone-info {
  position: absolute;
  left: 14px; top: 66px;
  width: 300px; max-width: calc(100% - 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  z-index: 12;
}
.zone-info-close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none;
  font-size: 22px; line-height: 1;
  color: var(--ink-faint); cursor: pointer;
}
.zone-info-badge {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  color: #fff; background: var(--brand);
  margin-bottom: 8px;
}
.zone-info h3 { margin: 0 0 6px; font-size: 16px; }
.zone-info p { margin: 0 0 10px; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.zone-info-area {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--brand-strong);
  background: var(--brand-soft);
  padding: 8px 11px; border-radius: var(--radius-sm);
  margin-bottom: 13px;
}
.zone-info-area svg { flex-shrink: 0; }
.zone-info-scope {
  font-size: 12px; line-height: 1.45; color: #7a5a12;
  background: linear-gradient(135deg, #fffaf0, #fff6e0);
  border: 1px solid #ffe0a3; border-radius: var(--radius-sm);
  padding: 8px 11px; margin: 0 0 12px;
}
.zone-info-scope span { display: block; margin-bottom: 7px; }
.zone-info-scope label {
  display: inline-flex; align-items: center; gap: 5px;
  margin: 0 10px 0 0; font-weight: 700; color: #5c4108;
}
.zone-info-scope input { accent-color: #b88a18; }
.zone-info-scope.hidden { display: none; }

/* ============ Chat interno PlaneiA ============ */
.planeia-chat {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  font-family: var(--font);
}
.pc-launch {
  border: none;
  border-radius: 999px;
  padding: 10px 14px 10px 10px;
  background: linear-gradient(135deg, var(--brand-strong), #2f7dd1);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(18, 75, 56, .28);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.pc-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.18);
  font-size: 11px;
  letter-spacing: .04em;
}
.pc-panel {
  display: none;
  position: absolute;
  right: 0;
  bottom: 54px;
  width: min(380px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 110px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(16, 36, 28, .28);
  overflow: hidden;
}
.planeia-chat.open .pc-panel { display: flex; flex-direction: column; }
.pc-head {
  padding: 14px 16px;
  background: linear-gradient(135deg, #10241c, #1f7a5c);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pc-head b { display: block; font-size: 15px; }
.pc-head small { display: block; color: rgba(255,255,255,.74); font-size: 11.5px; margin-top: 2px; }
.pc-close {
  border: none;
  background: rgba(255,255,255,.14);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.pc-messages {
  flex: 1;
  overflow: auto;
  padding: 14px;
  background: #f7faf8;
}
.pc-intro {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px;
}
.pc-msg { display: flex; margin: 9px 0; }
.pc-msg.user { justify-content: flex-end; }
.pc-bubble {
  max-width: 84%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.pc-msg.user .pc-bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
.pc-msg.assistant .pc-bubble { background: #fff; color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.pc-quick {
  display: flex;
  gap: 7px;
  padding: 9px 12px 0;
  background: #fff;
  border-top: 1px solid var(--line);
  overflow-x: auto;
}
.pc-quick button {
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--brand-strong);
  border-radius: 999px;
  padding: 6px 10px;
  font: 700 11.5px var(--font);
  cursor: pointer;
}
.pc-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px 12px;
  background: #fff;
}
.pc-form textarea {
  resize: none;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 9px 10px;
  font: 13px var(--font);
  min-height: 42px;
}
.pc-form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(82,183,136,.16); }
.pc-form button {
  border: none;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font: 800 12.5px var(--font);
  padding: 0 13px;
  cursor: pointer;
}
.pc-form button:disabled { opacity: .55; cursor: wait; }
@media (max-width: 640px) {
  .planeia-chat { right: 12px; bottom: 12px; }
  .pc-launch span:last-child { display: none; }
  .pc-panel { right: -2px; bottom: 48px; height: min(520px, calc(100vh - 84px)); }
}

/* ============ Busca de endereco ============ */
.map-search {
  position: absolute;
  top: 14px; left: 14px;
  width: 340px; max-width: calc(100% - 76px);
  z-index: 13;
}
.map-search input {
  width: 100%;
  padding: 11px 38px 11px 38px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-family: var(--font); font-size: 14px; color: var(--ink);
}
.map-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.map-search-ico { position: absolute; left: 12px; top: 12px; color: var(--ink-faint); pointer-events: none; }
.map-search-clear {
  position: absolute; right: 8px; top: 7px;
  width: 26px; height: 26px; border: none; background: none;
  font-size: 20px; line-height: 1; color: var(--ink-faint); cursor: pointer; border-radius: 50%;
}
.map-search-clear:hover { background: var(--surface-2); color: var(--ink); }
.map-search-results {
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  max-height: 280px; overflow-y: auto;
}
.addr-result {
  display: block; width: 100%; text-align: left;
  padding: 10px 13px; border: none; background: none;
  border-bottom: 1px solid var(--line);
  font-family: var(--font); font-size: 12.5px; color: var(--ink-soft);
  cursor: pointer; line-height: 1.4;
}
.addr-result:last-child { border-bottom: none; }
.addr-result:hover { background: var(--brand-soft); }
.addr-result strong { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.addr-result span { display: block; font-size: 11.5px; color: var(--ink-faint); margin-top: 1px; }
.addr-empty { padding: 12px 13px; font-size: 12.5px; color: var(--ink-faint); }

/* ============ Assistente de IA ============ */
.ai-helper {
  background: linear-gradient(135deg, #f3f0ff, #eef6ff);
  border: 1px solid #ddd6f7;
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 4px;
}
.ai-helper-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; color: #6a4ddb;
  margin-bottom: 8px;
}
.ai-helper textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  border: 1px solid #d9d2f2; border-radius: 9px;
  padding: 9px 11px; font-family: var(--font); font-size: 13px; color: var(--ink);
  background: #fff;
}
.ai-helper textarea:focus { outline: none; border-color: #8a6cf0; box-shadow: 0 0 0 3px rgba(138,108,240,.15); }
.btn-ai {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 9px;
  background: linear-gradient(135deg, #7c5cf0, #5b8def);
  color: #fff; border: none; border-radius: 9px;
  padding: 9px 15px; font-family: var(--font); font-size: 13px; font-weight: 700;
  cursor: pointer; transition: .15s;
}
.btn-ai:hover:not(:disabled) { filter: brightness(1.06); }
.btn-ai:disabled { opacity: .55; cursor: not-allowed; }
.ai-hint { margin: 8px 0 0; font-size: 12px; color: #7a5bd0; }

/* ============ Pagina inicial (landing comercial) ============ */
body.home { overflow: auto; display: block; height: auto; background: #fbfcfd; }
a.brand { text-decoration: none; color: inherit; }
.home-topbar { position: sticky; top: 0; z-index: 30; }
.home-topbar .topbar-actions { gap: 8px; }
.home-topbar .btn-ghost { text-decoration: none; }

.btn-outline {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--brand-strong);
  border: 1.5px solid var(--brand);
  padding: 11px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none;
  font-family: var(--font); transition: .15s;
}
.btn-outline:hover { background: var(--brand-soft); }
.btn-lg { padding: 14px 24px; font-size: 15px; border-radius: 12px; }
.grad { background: linear-gradient(100deg, var(--brand), #2f7dd1); -webkit-background-clip: text; background-clip: text; color: transparent; }

main { display: block; }

.hero-lg {
  max-width: 1140px; margin: 0 auto;
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center;
  padding: 64px 24px 56px;
}
.hero-tag {
  display: inline-block; font-size: 12px; font-weight: 700;
  color: var(--brand-strong); background: var(--brand-soft);
  padding: 6px 13px; border-radius: 999px; margin-bottom: 18px;
}
.hero-text h1 { font-size: 46px; line-height: 1.08; margin: 0 0 18px; letter-spacing: -.025em; font-weight: 900; }
.hero-text > p { font-size: 17px; color: var(--ink-soft); line-height: 1.6; margin: 0 0 28px; max-width: 560px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-actions.center { justify-content: center; }
.hero-trust { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 22px; font-size: 13px; color: var(--ink-soft); font-weight: 600; }

/* Mock visual do mapa no hero */
.hero-visual { display: flex; justify-content: center; }
.mock-map {
  position: relative; width: 100%; max-width: 440px; aspect-ratio: 4/3;
  border-radius: 20px; overflow: hidden;
  background: linear-gradient(135deg, #e9f3ee, #eef6ff 60%, #e7f0e8);
  background-color: #eaf3ee;
  border: 1px solid var(--line); box-shadow: var(--shadow-lg, 0 20px 50px rgba(20,40,60,.16));
}
.mock-zone { position: absolute; border-radius: 16px; opacity: .55; filter: blur(.3px); }
.mock-zone.z1 { width: 46%; height: 40%; top: 12%; left: 10%; background: #C8E374; }
.mock-zone.z2 { width: 52%; height: 46%; bottom: 8%; right: 6%; background: #8ACBF5; }
.mock-zone.z3 { width: 34%; height: 30%; bottom: 14%; left: 16%; background: #F06C65; opacity: .5; }
.mock-pin { position: absolute; width: 16px; height: 16px; border-radius: 50% 50% 50% 0; background: var(--c); transform: rotate(-45deg); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.mock-card {
  position: absolute; left: 18px; bottom: 18px; right: auto;
  background: rgba(255,255,255,.96); backdrop-filter: blur(4px);
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 2px; min-width: 160px;
}
.mock-badge { align-self: flex-start; font-size: 10px; font-weight: 800; color: #41510f; background: #C8E374; padding: 2px 9px; border-radius: 999px; }
.mock-card strong { font-size: 14px; }
.mock-card small { font-size: 11.5px; color: var(--ink-soft); }

/* Secoes */
.section { max-width: 1140px; margin: 0 auto; padding: 56px 24px; }
.section-alt { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); max-width: none; }
.section-alt > * { max-width: 1140px; margin-left: auto; margin-right: auto; }
.section-head { text-align: center; margin-bottom: 36px; }
.section-head h2 { font-size: 30px; margin: 0 0 8px; letter-spacing: -.02em; }
.section-head p { margin: 0; font-size: 16px; color: var(--ink-soft); }

.benefits { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.benefit { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.b-ico { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); margin-bottom: 14px; }
.benefit h4 { margin: 0 0 7px; font-size: 16px; }
.benefit p { margin: 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }

/* Aplicações / instrumentos */
.use-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.use-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; transition: .15s; }
.use-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.use-ico { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); margin-bottom: 12px; }
.use-card h4 { margin: 0 0 6px; font-size: 15.5px; }
.use-card p { margin: 0; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.use-note { text-align: center; margin: 28px auto 0; max-width: 640px; font-size: 13.5px; color: var(--ink-soft); }
.use-note strong { color: var(--ink); }

/* Pitch para prefeitura */
.pitch { display: grid; grid-template-columns: 1.05fr .95fr; gap: 44px; align-items: center; padding: 56px 24px; }
.pitch-text h2 { font-size: 30px; margin: 6px 0 18px; letter-spacing: -.02em; }
.pitch-list { list-style: none; margin: 0 0 26px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.pitch-list li { position: relative; padding-left: 30px; font-size: 14.5px; color: var(--ink-soft); line-height: 1.5; }
.pitch-list li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 20px; height: 20px; background: var(--brand-soft); color: var(--brand-strong); border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.pitch-list strong { color: var(--ink); }
.pitch-steps { display: flex; flex-direction: column; gap: 14px; }
.step-card { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.step-n { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.step-card strong { display: block; font-size: 15px; margin-bottom: 3px; }
.step-card p { margin: 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }

/* CTA final */
.cta-band { text-align: center; padding: 64px 24px; background: linear-gradient(135deg, var(--brand-strong), #2f7dd1); color: #fff; }
.cta-band h2 { font-size: 32px; margin: 0 0 12px; letter-spacing: -.02em; }
.cta-band p { margin: 0 auto 26px; font-size: 16px; max-width: 560px; opacity: .92; }
.cta-band .btn-primary { background: #fff; color: var(--brand-strong); }
.cta-band .btn-primary:hover { background: #f0f4f8; }
.cta-band .btn-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }
.cta-band .btn-outline:hover { background: rgba(255,255,255,.12); }

.home-footer { border-top: 1px solid var(--line); padding: 26px; text-align: center; background: #fff; }
.home-footer p { margin: 0; font-size: 12.5px; color: var(--ink-faint); }

@media (max-width: 900px) {
  .hero-lg { grid-template-columns: 1fr; gap: 32px; padding: 36px 22px 36px; }
  .hero-text h1 { font-size: 34px; }
  .hero-visual { order: -1; }
  .benefits { grid-template-columns: repeat(2, 1fr); }
  .use-grid { grid-template-columns: repeat(2, 1fr); }
  .pitch { grid-template-columns: 1fr; gap: 30px; padding: 40px 22px; }
}
@media (max-width: 560px) {
  .benefits { grid-template-columns: 1fr; }
  .use-grid { grid-template-columns: 1fr; }
  .hero-text h1 { font-size: 28px; }
  .section-head h2, .pitch-text h2, .cta-band h2 { font-size: 24px; }
  .home-topbar .btn-ghost { display: none; }
}

/* ============ Página de revisão de documento ============ */
body.doc-review-page { overflow: auto; display: block; height: auto; background: var(--surface-2); }

/* Alternador mobile (escondido no desktop) */
.doc-mobile-tabs { display: none; }
.dm-tab {
  flex: 1; background: none; border: none; padding: 13px 10px;
  font-family: var(--font); font-size: 13.5px; font-weight: 700; color: var(--ink-soft);
  cursor: pointer; border-bottom: 2.5px solid transparent; position: relative;
}
.dm-tab.active { color: var(--brand-strong); border-bottom-color: var(--brand); }
.dm-badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  margin-left: 4px; background: var(--brand); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 800;
}

.doc-review {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 18px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px;
}

/* ---- Coluna do documento (texto selecionável) ---- */
.doc-reader {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: sticky;
  top: 86px;
  align-self: start;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 106px);
}
.doc-reader-head { padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.doc-reader-head h1 { margin: 4px 0 8px; font-size: 23px; letter-spacing: -.02em; }
.doc-reader-hint { margin: 0 0 12px; color: var(--ink-soft); line-height: 1.5; font-size: 13px; }
.doc-search-wrap {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px; padding: 0 11px; background: var(--surface-2);
}
.doc-search-wrap svg { color: var(--ink-faint); flex-shrink: 0; }
.doc-search-wrap input {
  flex: 1; border: none; background: none; outline: none;
  font-family: var(--font); font-size: 13.5px; color: var(--ink); padding: 10px 0;
}

.doc-body {
  overflow-y: auto;
  padding: 18px 22px 28px;
  line-height: 1.6;
  color: var(--ink);
  -webkit-overflow-scrolling: touch;
}
.doc-body ::selection, .doc-body::selection { background: #ffe08a; color: #3a2a00; }
.doc-loading { color: var(--ink-faint); font-size: 14px; padding: 20px 0; }

.db-titulo, .db-capitulo, .db-secao {
  font-weight: 800; color: var(--brand-strong); letter-spacing: -.01em;
}
.db-titulo { font-size: 16px; margin: 26px 0 6px; text-transform: uppercase; }
.db-capitulo { font-size: 14.5px; margin: 20px 0 4px; }
.db-secao { font-size: 13.5px; margin: 16px 0 4px; color: var(--ink-soft); }
.db-art { margin: 13px 0; font-size: 14px; }
.db-par { margin: 8px 0 8px 14px; font-size: 13.5px; color: #36424f; }
.db-item { margin: 5px 0 5px 26px; font-size: 13.5px; color: #36424f; }
.db-alinea { margin: 4px 0 4px 40px; font-size: 13px; color: #46525f; }
.db-texto { margin: 10px 0; font-size: 13.5px; color: var(--ink-soft); }
.db-match { background: #fff6d6; border-radius: 4px; box-shadow: 0 0 0 4px #fff6d6; }

/* ---- Coluna de trabalho (propostas) ---- */
.doc-ai-panel { display: flex; flex-direction: column; gap: 12px; }
.doc-ai-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px;
}
.doc-ai-card h2 { margin: 0; font-size: 18px; }

.work-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.work-count {
  font-size: 12px; font-weight: 700; color: var(--brand-strong);
  background: var(--brand-soft); padding: 4px 10px; border-radius: 999px;
}
.work-intro { margin: 12px 0 0; font-size: 13px; color: var(--ink-soft); line-height: 1.55; }

#trechos-list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
#trechos-list:empty { margin-top: 0; }

/* Card de trecho */
.trecho-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  background: var(--surface-2);
}
.trecho-card.editing { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.trecho-card.editing { display: flex; flex-direction: column; gap: 12px; }
.trecho-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.trecho-num { font-size: 12px; font-weight: 800; color: var(--brand-strong); text-transform: uppercase; letter-spacing: .04em; }
.trecho-num.done { display: inline-flex; align-items: center; gap: 5px; }
.trecho-num.done svg { color: var(--brand); }
.trecho-head-actions { display: flex; gap: 4px; }
.trecho-edit, .trecho-remove {
  background: none; border: none; font-family: var(--font); font-size: 12px; font-weight: 700;
  cursor: pointer; padding: 4px 8px; border-radius: 7px; transition: .15s;
}
.trecho-edit { color: var(--brand-strong); }
.trecho-edit:hover { background: var(--brand-soft); }
.trecho-remove { color: var(--ink-faint); }
.trecho-remove:hover { color: var(--danger); background: #fdeceb; }

.trecho-quote {
  margin: 10px 0 0; padding: 9px 12px; border-left: 3px solid var(--line-strong);
  background: var(--surface); border-radius: 0 8px 8px 0;
  font-size: 12.5px; color: var(--ink-soft); font-style: italic; line-height: 1.5;
}
.trecho-prop {
  margin-top: 9px; font-size: 13px; color: var(--ink); line-height: 1.5;
  display: flex; gap: 7px;
}
.trecho-prop-ico { color: var(--brand); font-weight: 800; flex-shrink: 0; }

/* Rótulos e campos (compartilhados) */
.dr-label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12.5px; font-weight: 700; color: var(--ink-soft);
}
.dr-label textarea, .dr-label input {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; font-family: var(--font); font-size: 13px;
  color: var(--ink); background: var(--surface); resize: vertical; transition: .15s;
}
.dr-label textarea:focus, .dr-label input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.trecho-actions { display: flex; gap: 8px; }
.trecho-actions .btn-primary { flex: 1; }

/* Botão adicionar manual */
.btn-add-trecho {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  background: none; border: 1.5px dashed var(--line-strong); border-radius: 11px;
  padding: 10px 16px; font-family: var(--font); font-size: 13px; font-weight: 700;
  color: var(--ink-soft); cursor: pointer; width: 100%; justify-content: center; transition: .15s;
}
.btn-add-trecho:hover { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-soft); }

.btn-link-danger {
  display: block; width: 100%; margin-top: 10px; background: none; border: none;
  color: var(--ink-faint); font-family: var(--font); font-size: 12.5px; font-weight: 600;
  cursor: pointer; padding: 6px; transition: .15s;
}
.btn-link-danger:hover { color: var(--danger); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* Botão flutuante de seleção */
.sel-action {
  position: fixed; z-index: 60;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--brand); color: #fff; border: none;
  padding: 10px 16px; border-radius: 999px;
  font-family: var(--font); font-size: 13.5px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 20px rgba(20,60,45,.35); animation: selPop .12s ease-out;
}
.sel-action:hover { background: var(--brand-strong); }
.sel-action.mobile {
  left: 12px; right: 12px; bottom: 16px; top: auto !important;
  justify-content: center; padding: 15px; font-size: 15px; border-radius: 14px;
}
@keyframes selPop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Sucesso */
.doc-success-card { text-align: center; padding: 36px 24px; }
.doc-success-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); margin-bottom: 16px;
}
.doc-success-card h2 { margin: 0 0 8px; font-size: 22px; }
.doc-success-card p { margin: 0; font-size: 14px; color: var(--ink-soft); line-height: 1.55; }

/* Utilitários */
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

@media (max-width: 960px) {
  .doc-mobile-tabs {
    display: flex; position: sticky; top: 0; z-index: 25;
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .doc-review { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .doc-reader {
    position: static; max-height: none; border-radius: 0; border-left: none; border-right: none; border-top: none;
  }
  .doc-body { max-height: none; padding: 16px 18px 90px; }
  .doc-ai-panel { padding: 14px; gap: 12px; }
  /* Alterna entre documento e propostas */
  body.doc-review-page .doc-reader { display: flex; }
  body.doc-review-page .doc-ai-panel { display: none; }
  body.doc-review-page.show-work .doc-reader { display: none; }
  body.doc-review-page.show-work .doc-ai-panel { display: flex; }
}

/* ============ Aviso do mapa ============ */
.map-warning {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 26px;
  text-align: center;
  max-width: 340px;
  z-index: 14;
}
.map-warning strong { display: block; font-size: 16px; margin-bottom: 6px; }
.map-warning p { margin: 0; font-size: 13px; color: var(--ink-soft); }

/* ============ Painel lateral ============ */
.panel {
  width: 384px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.panel-handle { display: none; }
.panel-tabs {
  display: flex;
  padding: 12px 12px 0;
  gap: 6px;
  border-bottom: 1px solid var(--line);
}
.panel-tab {
  flex: 1;
  background: none; border: none;
  padding: 11px 6px 13px;
  font-size: 13.5px; font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  font-family: var(--font);
  transition: .15s;
}
.panel-tab:hover { color: var(--ink); }
.panel-tab.active { color: var(--brand-strong); border-bottom-color: var(--brand); }
.panel-content { flex: 1; overflow-y: auto; padding: 18px; }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.pane-intro { margin: 0 0 16px; font-size: 13px; color: var(--ink-soft); line-height: 1.55; }

/* ============ Lista de zonas ============ */
.zone-list { display: flex; flex-direction: column; gap: 6px; }
.zone-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: .12s;
}
.zone-row:hover { border-color: var(--line-strong); background: var(--surface-2); }
.zone-row.off { opacity: .45; }
.zone-row .zr-swatch { width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0; border: 1px solid rgba(0,0,0,.12); }
.zone-row .zr-text { min-width: 0; }
.zone-row .zr-code { font-size: 13px; font-weight: 700; }
.zone-row .zr-label { font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zone-row .zr-eye { margin-left: auto; color: var(--ink-faint); flex-shrink: 0; }

/* ============ Documentos ============ */
.doc-list { display: flex; flex-direction: column; gap: 11px; }
.doc-card {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  transition: .15s;
}
.doc-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.doc-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 11px; font-weight: 800;
}
.doc-info strong { display: block; font-size: 14px; margin-bottom: 3px; }
.doc-info p { margin: 0; font-size: 12.5px; color: var(--ink-soft); line-height: 1.45; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.doc-actions a {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 10px; border-radius: 8px;
  background: var(--brand-soft); color: var(--brand-strong);
  font-size: 12px; font-weight: 700; text-decoration: none;
}
.doc-actions a:hover { background: #d9eee5; }

/* ============ Sugerir ============ */
.suggest-tools { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.tool-btn {
  flex: 1; min-width: 96px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--font);
  transition: .15s;
}
.tool-btn:hover { border-color: var(--brand); color: var(--brand-strong); }
.tool-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tool-btn.tool-clear { flex: 0 0 auto; min-width: 0; }
.tool-btn.tool-clear:hover { border-color: var(--danger); color: var(--danger); }
.draw-status {
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin: 0 0 16px;
}
.draw-status.has-geom { color: var(--brand-strong); background: var(--brand-soft); border-style: solid; border-color: var(--brand-soft); font-weight: 600; }

.suggest-form { display: flex; flex-direction: column; gap: 13px; }
.suggest-form label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
}
.suggest-form input,
.suggest-form select,
.suggest-form textarea {
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 400;
  transition: .15s;
}
.suggest-form input:focus,
.suggest-form select:focus,
.suggest-form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.suggest-form textarea { resize: vertical; }
.form-row { display: flex; gap: 10px; }
.form-row label { flex: 1; }
.form-feedback {
  font-size: 13px; padding: 11px 13px; border-radius: var(--radius-sm); line-height: 1.45;
}
.form-feedback.ok { background: var(--brand-soft); color: var(--brand-strong); }
.form-feedback.err { background: #fde9e7; color: var(--danger); }

/* ============ Modal ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(16, 35, 54, .42);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
  animation: fade .15s ease;
}
.modal-card {
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 28px;
  max-width: 440px; width: 100%;
  position: relative;
}
.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none;
  font-size: 26px; line-height: 1;
  color: var(--ink-faint); cursor: pointer;
}
.modal-card h2 { margin: 0 0 6px; font-size: 21px; }
.modal-lead { margin: 0 0 20px; font-size: 14px; color: var(--ink-soft); line-height: 1.5; }
.help-steps { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.help-steps li { display: flex; gap: 13px; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }
.help-steps strong { color: var(--ink); }
.step-num {
  width: 28px; height: 28px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-strong);
  font-weight: 800; font-size: 13px;
}

/* ============ Toasts ============ */
.toast-container {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200; pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease;
}
.toast.ok { background: var(--brand); }
.toast.err { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============ Mobile ============ */
@media (max-width: 880px) {
  body { overflow: hidden; }
  .layout { display: block; height: calc(100% - 56px); position: relative; }
  .topbar { height: 56px; padding: 0 14px; }
  .btn-ghost span { display: none; }
  .btn-ghost { padding: 9px; }
  .map-area { position: absolute; inset: 0; }

  .panel {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    width: auto;
    height: 46vh;
    border-left: none;
    border-top: 1px solid var(--line);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(16,35,54,.16);
    transform: translateY(calc(100% - 116px));
    transition: transform .28s cubic-bezier(.4,0,.2,1);
  }
  .panel.open { transform: translateY(0); }
  .panel-handle {
    display: block;
    width: 44px; height: 5px;
    background: var(--line-strong);
    border: none; border-radius: 999px;
    margin: 9px auto 3px;
    cursor: pointer;
  }
  .legend { bottom: calc(116px + 14px); width: 190px; }
  .zone-info { top: 62px; }
  .map-controls { top: 12px; right: 12px; }
  .map-search { top: 12px; left: 12px; max-width: calc(100% - 72px); }
}

@media (max-width: 420px) {
  .form-row { flex-direction: column; gap: 13px; }
  .legend { display: none; }
}
