:root {
    --green: #0b6e4f;
    --green-dark: #08523b;
    --ink: #1c2321;
    --muted: #5f6b67;
    --line: #dfe5e2;
    --bg: #ffffff;
    --radius: 12px;
    --shadow: 0 6px 24px rgba(0, 0, 0, .15);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { display: flex; flex-direction: column; background: var(--bg); }

/* Barra do topo */
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px; background: var(--green); color: #fff; z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-pin { font-size: 26px; }
.brand strong { display: block; font-size: 18px; }
.brand small { opacity: .85; font-size: 12px; }

#map { flex: 1; }

/* Botões */
.btn {
    border: 0; border-radius: 999px; padding: 10px 16px; font: inherit; font-weight: 600;
    cursor: pointer; white-space: nowrap;
}
.btn-primary { background: #ffd23f; color: #1c2321; }
.btn-primary:hover { background: #ffc800; }
.btn-light { background: #fff; color: var(--green); }
.btn-ghost { background: transparent; color: inherit; border: 1px solid currentColor; }
.topbar .btn-ghost { border-color: rgba(255, 255, 255, .6); }
.btn:disabled { opacity: .6; cursor: wait; }

/* Painel de filtros */
.panel {
    position: absolute; left: 12px; bottom: 24px; z-index: 900; width: 250px;
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.panel-toggle {
    width: 100%; border: 0; background: #f3f6f5; padding: 10px 14px; text-align: left;
    font: inherit; font-weight: 600; cursor: pointer;
}
.panel-body { padding: 4px 14px 14px; max-height: 55vh; overflow-y: auto; }
.panel.collapsed .panel-body { display: none; }
.panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 0 6px; }
.stats { margin: 10px 0 0; font-size: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 3px 0; cursor: pointer; }
.legend { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }

/* Faixa de escolha do local */
.pick-banner {
    position: absolute; top: 72px; left: 50%; transform: translateX(-50%); z-index: 950;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
    background: var(--green-dark); color: #fff; padding: 10px 14px; border-radius: var(--radius);
    box-shadow: var(--shadow); width: max-content; max-width: calc(100% - 32px);
}
.pick-banner span { font-weight: 600; }
.picking #map { cursor: crosshair; }
/* Enquanto escolhe o local, os pontos existentes não "roubam" o toque no mapa. */
.picking #map .leaflet-interactive { pointer-events: none; }

/* Topo: conta do usuário */
.top-actions { display: flex; align-items: center; gap: 8px; }
.user-menu { position: relative; }
.user-menu-list {
    position: absolute; right: 0; top: calc(100% + 6px); background: #fff; color: var(--ink);
    border-radius: 10px; box-shadow: var(--shadow); min-width: 160px; overflow: hidden; z-index: 1100;
}
.user-menu-list button {
    display: block; width: 100%; padding: 10px 14px; border: 0; background: none; font: inherit;
    text-align: left; cursor: pointer;
}
.user-menu-list button:hover { background: #f3f6f5; }

/* Janelas de conta e meus reports */
.dialog-form { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dialog-form h2 { margin: 0; }
.dialog-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
.dialog-form input {
    font: inherit; font-weight: 400; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; width: 100%;
}
.dialog-form .actions .btn-primary { background: var(--green); color: #fff; }
.auth-tabs { display: flex; background: #f3f6f5; border-radius: 999px; padding: 4px; }
.auth-tabs button {
    flex: 1; border: 0; background: none; padding: 8px; border-radius: 999px; font: inherit; font-weight: 600;
    color: var(--muted); cursor: pointer;
}
.auth-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
#auth-reason { margin: 0; }
.link-btn {
    align-self: flex-start; border: 0; background: none; padding: 0; font: inherit; font-size: 14px;
    color: var(--green); text-decoration: underline; cursor: pointer;
}
.form-info { background: #e6f4ee; color: var(--green-dark); padding: 8px 10px; border-radius: 8px; margin: 0; }

/* Página de nova senha */
.page-center { flex: 1; display: grid; place-items: center; padding: 16px; background: #f3f6f5; }
.page-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); width: min(420px, 100%); }
.page-card .btn-primary { background: var(--green); color: #fff; }
.page-card a.btn { text-decoration: none; text-align: center; }

.mine-list { list-style: none; padding: 0; margin: 0; max-height: 60vh; overflow-y: auto; }
.mine-list li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mine-list img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.mine-list p { margin: 4px 0 0; }
.badge { padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.gray { background: #eceff1; color: #546e7a; }
.badge.bad { background: #fdecea; color: #a12a1e; }

/* "Eu também vi" no popup */
.confirm { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.btn-confirm { background: var(--green); color: #fff; padding: 8px 12px; }
.btn-confirm.active { background: #e6f4ee; color: var(--green); }

/* Formulário */
dialog {
    border: 0; border-radius: 16px; padding: 0; width: min(460px, calc(100% - 32px));
    box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
#report-form { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
#report-form h2 { margin: 0; }
#report-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
#report-form select, #report-form textarea, #report-form input[type=text], #report-form input[type=file] {
    font: inherit; font-weight: 400; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; width: 100%;
}
.photo-preview { max-width: 100%; max-height: 180px; border-radius: 8px; object-fit: cover; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.actions .btn-ghost { color: var(--muted); }
.actions .btn-primary { background: var(--green); color: #fff; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 12px; margin: 0; }
.form-error { background: #fdecea; color: #a12a1e; padding: 8px 10px; border-radius: 8px; margin: 0; }

/* Popup do mapa */
.popup { width: 230px; font-size: 14px; }
.popup img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; display: block; margin-bottom: 8px; }
.popup .tag { display: inline-block; padding: 2px 8px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 600; }
.popup p { margin: 6px 0; }

.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 2000;
    background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--radius);
    box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center;
}

@media (max-width: 640px) {
    .brand small { display: none; }
    .btn { padding: 9px 12px; }
    .panel { left: 8px; right: 8px; bottom: 12px; width: auto; }
}
