/* Sistema de Mobilização DF — design system do tema.
   Mobile-first: estilos base = mobile, breakpoints ampliam para desktop. */

:root {
	--mob-bg: #f5f6fa;
	--mob-surface: #ffffff;
	--mob-border: #e4e7ee;
	--mob-text: #1c2130;
	--mob-text-muted: #6b7280;
	--mob-primary: #4338ca;
	--mob-primary-dark: #362da3;
	--mob-primary-soft: #eef0fd;
	--mob-danger: #dc2626;
	--mob-danger-soft: #fdecec;
	--mob-warning: #b45309;
	--mob-warning-soft: #fef6e7;
	--mob-success: #15803d;
	--mob-success-soft: #eafbf1;
	--mob-radius: 10px;
	--mob-radius-lg: 16px;
	--mob-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
	--mob-sidebar-w: 240px;
	--mob-topbar-h: 56px;
	--mob-bottomnav-h: 60px;
}

/* Regra global — [hidden] sempre vence, não importa o que um componente
   declare como display (bug real encontrado na WP1: .mob-modal{display:flex}
   tinha a mesma especificidade que [hidden] e escondia por ordem de
   declaração; nunca mais depender disso caso a caso). */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.mob-body {
	background: var(--mob-bg);
	color: var(--mob-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
}
a { color: var(--mob-primary); text-decoration: none; }
h1, h2, h3 { margin: 0 0 4px; line-height: 1.25; }
p { margin: 0 0 8px; }
.mob-muted { color: var(--mob-text-muted); font-size: 13px; }
.mob-link { font-size: 14px; }

/* ---------- Layout: app shell ---------- */
.mob-app-shell {
	display: flex;
	min-height: 100vh;
}
.mob-sidebar {
	display: none; /* mobile: escondida, ver .mob-bottom-nav */
}
.mob-app-main {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding-bottom: var(--mob-bottomnav-h);
}
.mob-topbar {
	height: var(--mob-topbar-h);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 16px;
	background: var(--mob-surface);
	border-bottom: 1px solid var(--mob-border);
	position: sticky;
	top: 0;
	z-index: 10;
}
.mob-topbar-title { font-size: 16px; font-weight: 600; }
.mob-app-content {
	padding: 16px;
	flex: 1;
}

@media (min-width: 900px) {
	.mob-sidebar {
		display: flex;
		flex-direction: column;
		width: var(--mob-sidebar-w);
		flex-shrink: 0;
		background: var(--mob-surface);
		border-right: 1px solid var(--mob-border);
		height: 100vh;
		position: sticky;
		top: 0;
	}
	.mob-app-main { padding-bottom: 0; }
	.mob-app-content { padding: 28px 32px; max-width: 1180px; }
	.mob-only-mobile { display: none !important; }
}

/* ---------- Sidebar ---------- */
.mob-sidebar-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 20px 18px;
	font-weight: 700;
	font-size: 15px;
	border-bottom: 1px solid var(--mob-border);
}
.mob-sidebar-brand-mark {
	width: 30px; height: 30px;
	border-radius: 8px;
	background: var(--mob-primary);
	color: #fff;
	display: flex; align-items: center; justify-content: center;
	font-weight: 700;
}
.mob-sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.mob-sidebar-link {
	display: flex; align-items: center; gap: 10px;
	padding: 9px 12px;
	border-radius: var(--mob-radius);
	color: var(--mob-text);
	font-size: 14px;
	font-weight: 500;
}
.mob-sidebar-link:hover { background: var(--mob-bg); }
.mob-sidebar-link.is-active { background: var(--mob-primary-soft); color: var(--mob-primary); }
.mob-sidebar-link-sub { padding-left: 26px; font-size: 13px; font-weight: 500; color: var(--mob-text-muted); }
.mob-sidebar-link-sub .mob-icon { width: 15px; height: 15px; }
.mob-sidebar-link-sub.is-active { color: var(--mob-primary); background: var(--mob-primary-soft); }
.mob-sidebar-group-label { margin: 12px 12px 2px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--mob-text-muted); }
.mob-sidebar-footer { border-top: 1px solid var(--mob-border); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.mob-sidebar-user { display: flex; align-items: center; gap: 10px; }
.mob-sidebar-user-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mob-avatar {
	width: 30px; height: 30px; border-radius: 50%;
	background: var(--mob-primary-soft); color: var(--mob-primary);
	display: flex; align-items: center; justify-content: center;
	font-weight: 700; font-size: 13px; flex-shrink: 0; text-transform: uppercase;
}
.mob-sidebar-logout {
	display: flex; align-items: center; gap: 8px;
	background: none; border: none; color: var(--mob-text-muted);
	font-size: 13px; cursor: pointer; padding: 6px 4px;
}
.mob-sidebar-logout:hover { color: var(--mob-danger); }
.mob-icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- Bottom nav (mobile) ---------- */
.mob-bottom-nav {
	position: fixed; left: 0; right: 0; bottom: 0;
	height: var(--mob-bottomnav-h);
	background: var(--mob-surface);
	border-top: 1px solid var(--mob-border);
	display: flex;
	z-index: 20;
}
.mob-bottom-nav-link {
	flex: 1;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	gap: 2px; color: var(--mob-text-muted); font-size: 11px;
}
.mob-bottom-nav-link.is-active { color: var(--mob-primary); }

/* ---------- Auth (login) ---------- */
.mob-body-auth { background: var(--mob-primary-soft); }
.mob-auth-shell {
	min-height: 100vh;
	display: flex; align-items: center; justify-content: center;
	padding: 24px;
}
.mob-auth-card {
	background: var(--mob-surface);
	border-radius: var(--mob-radius-lg);
	box-shadow: var(--mob-shadow);
	padding: 32px 28px;
	width: 100%;
	max-width: 380px;
}
.mob-auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-weight: 700; }
.mob-auth-title { font-size: 20px; margin-bottom: 4px; }
.mob-auth-note { margin-top: 18px; text-align: center; }

/* ---------- Forms ---------- */
.mob-form { display: flex; flex-direction: column; gap: 14px; }
.mob-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--mob-text); }
.mob-field input, .mob-field select, .mob-field textarea, .mob-input {
	font: inherit;
	padding: 10px 12px;
	border: 1px solid var(--mob-border);
	border-radius: var(--mob-radius);
	background: var(--mob-surface);
	color: var(--mob-text);
	width: 100%;
}
.mob-field input:focus, .mob-field select:focus, .mob-field textarea:focus, .mob-input:focus {
	outline: none; border-color: var(--mob-primary); box-shadow: 0 0 0 3px var(--mob-primary-soft);
}
.mob-checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.mob-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ---------- Buttons ---------- */
.mob-btn {
	font: inherit; font-weight: 600; font-size: 14px;
	padding: 10px 16px;
	border-radius: var(--mob-radius);
	border: 1px solid transparent;
	cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.mob-btn-primary { background: var(--mob-primary); color: #fff; }
.mob-btn-primary:hover { background: var(--mob-primary-dark); }
.mob-btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.mob-btn-ghost { background: transparent; border-color: var(--mob-border); color: var(--mob-text); }
.mob-btn-ghost:hover { background: var(--mob-bg); }
.mob-btn-danger { background: var(--mob-danger-soft); color: var(--mob-danger); }
.mob-btn-block { width: 100%; }
.mob-btn-sm { padding: 6px 10px; font-size: 12px; }

/* ---------- Cards / page layout ---------- */
.mob-page { display: flex; flex-direction: column; gap: 18px; }
.mob-page-header { display: flex; flex-direction: column; gap: 2px; }
.mob-page-header-actions { flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mob-card {
	background: var(--mob-surface);
	border: 1px solid var(--mob-border);
	border-radius: var(--mob-radius-lg);
	padding: 18px;
	box-shadow: var(--mob-shadow);
}
.mob-stat-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
}
@media (min-width: 640px) { .mob-stat-grid { grid-template-columns: repeat(4, 1fr); } }
.mob-stat-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; }
.mob-stat-label { font-size: 12px; color: var(--mob-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.mob-stat-value { font-size: 26px; font-weight: 700; }

/* ---------- Toolbar / tables ---------- */
.mob-toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.mob-filters-panel { display: flex; flex-direction: column; gap: 12px; }
.mob-filters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.mob-filters-grid .mob-field { gap: 4px; }
.mob-table-wrap { overflow-x: auto; }
.mob-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mob-table th {
	text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
	color: var(--mob-text-muted); padding: 8px 10px; border-bottom: 1px solid var(--mob-border);
}
.mob-table td { padding: 12px 10px; border-bottom: 1px solid var(--mob-border); vertical-align: middle; }
.mob-table tr:last-child td { border-bottom: none; }
.mob-row-clickable { cursor: pointer; }
.mob-row-clickable:hover { background: var(--mob-bg); }
.mob-table-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Badges / alerts ---------- */
.mob-badge { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.mob-badge-success { background: var(--mob-success-soft); color: var(--mob-success); }
.mob-badge-muted { background: var(--mob-bg); color: var(--mob-text-muted); }
.mob-badge-danger { background: var(--mob-danger-soft); color: var(--mob-danger); }
.mob-alert { padding: 10px 14px; border-radius: var(--mob-radius); font-size: 13px; margin-bottom: 4px; }
.mob-alert-error { background: var(--mob-danger-soft); color: var(--mob-danger); }
.mob-alert-warning { background: var(--mob-warning-soft); color: var(--mob-warning); }
.mob-alert-success { background: var(--mob-success-soft); color: var(--mob-success); }

/* ---------- Empty state / skeleton ---------- */
.mob-empty-state { padding: 32px 12px; text-align: center; color: var(--mob-text-muted); }
.mob-skeleton { background: linear-gradient(90deg, #eceef3 25%, #f5f6fa 37%, #eceef3 63%); background-size: 400% 100%; animation: mob-shimmer 1.4s ease infinite; border-radius: var(--mob-radius); }
.mob-skeleton-card { height: 78px; }
.mob-skeleton-row { height: 20px; margin: 4px 0; }
@keyframes mob-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Pagination ---------- */
.mob-pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding-top: 12px; flex-wrap: wrap; }
.mob-pagination-ellipsis { color: var(--mob-text-muted); padding: 0 2px; }

/* ---------- Steps (formulário multi-etapa) ---------- */
.mob-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.mob-step { font-size: 12px; font-weight: 600; color: var(--mob-text-muted); padding: 6px 10px; border-radius: 999px; background: var(--mob-bg); }
.mob-step.is-active { background: var(--mob-primary-soft); color: var(--mob-primary); }
.mob-form-step { display: none; flex-direction: column; gap: 14px; }
.mob-form-step.is-active { display: flex; }

/* ---------- Modal ---------- */
.mob-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.mob-modal[hidden] { display: none; } /* [hidden] e .mob-modal têm a mesma especificidade — sem isso, display:flex vence e o modal aparece mesmo "escondido". */
.mob-modal-backdrop { position: absolute; inset: 0; background: rgba(17, 20, 30, .45); }
.mob-modal-content {
	position: relative; background: var(--mob-surface); border-radius: var(--mob-radius-lg);
	padding: 24px; width: 100%; max-width: 420px; box-shadow: var(--mob-shadow);
	max-height: 90vh; overflow-y: auto;
}

/* ==================================================================
 * Mapa (/mapa) — precisa ocupar a tela toda (§20 da WP3: "priorizar
 * mapa grande"), então some com o padding padrão de .mob-app-content
 * só nesta rota (classe no <body> vinda de inc/routing.php).
 * ================================================================== */
.mob-route-mapa #mob-app-content { padding: 0; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }

.mob-map-page { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.mob-map-toolbar {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	padding: 10px 12px; background: var(--mob-surface); border-bottom: 1px solid var(--mob-border);
	flex-wrap: wrap; flex-shrink: 0;
}
.mob-map-layers { display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mob-map-layer-btn {
	padding: 8px 14px; border-radius: 999px; border: 1px solid var(--mob-border);
	background: var(--mob-surface); font: inherit; font-size: 13px; font-weight: 600;
	color: var(--mob-text-muted); white-space: nowrap; cursor: pointer; flex-shrink: 0;
}
.mob-map-layer-btn.is-active { background: var(--mob-primary); color: #fff; border-color: var(--mob-primary); }
.mob-map-filter-badge {
	display: inline-flex; min-width: 16px; height: 16px; padding: 0 4px; margin-left: 4px;
	border-radius: 999px; background: var(--mob-primary); color: #fff; font-size: 10px;
	align-items: center; justify-content: center; font-weight: 700;
}

.mob-map-body { flex: 1; display: flex; min-height: 0; position: relative; }
.mob-map-canvas-wrap { flex: 1; position: relative; min-height: 240px; }
#mob-map-canvas { position: absolute; inset: 0; background: #dfe3ea; }

.mob-map-overlay {
	position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
	background: rgba(245, 246, 250, .78); pointer-events: none;
}
.mob-map-overlay-card {
	background: var(--mob-surface); padding: 18px 22px; border-radius: var(--mob-radius-lg);
	box-shadow: var(--mob-shadow); text-align: center; max-width: 300px; pointer-events: auto; font-size: 14px;
}
.mob-map-overlay-card.mob-alert-error { background: var(--mob-surface); color: var(--mob-text); }
.mob-map-overlay-card p { margin-bottom: 10px; }

.mob-map-legend {
	position: absolute; left: 10px; bottom: 10px; z-index: 20; background: rgba(255, 255, 255, .94);
	padding: 10px 12px; border-radius: var(--mob-radius); box-shadow: var(--mob-shadow); font-size: 12px; max-width: 190px;
}
.mob-map-legend-title { font-weight: 700; margin-bottom: 6px; }
.mob-map-legend-row { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.mob-map-legend-swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

.mob-map-counters {
	position: absolute; right: 10px; top: 10px; z-index: 20; background: rgba(255, 255, 255, .94);
	padding: 8px 12px; border-radius: var(--mob-radius); box-shadow: var(--mob-shadow); font-size: 12px; line-height: 1.5;
}

.mob-map-panel {
	position: relative; width: 340px; flex-shrink: 0; background: var(--mob-surface);
	border-left: 1px solid var(--mob-border); overflow-y: auto; padding: 44px 18px 18px;
}
.mob-map-panel-close {
	position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%;
	border: none; background: var(--mob-bg); font-size: 18px; line-height: 1; cursor: pointer; color: var(--mob-text-muted);
}
.mob-map-breadcrumb { font-size: 12px; color: var(--mob-text-muted); margin-bottom: 12px; word-break: break-word; }
.mob-map-breadcrumb a { color: var(--mob-primary); }
.mob-map-panel h3 { font-size: 16px; margin-bottom: 4px; }
.mob-map-panel-section { margin-top: 16px; }
.mob-map-panel-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--mob-text-muted); margin-bottom: 8px; }
.mob-map-panel-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.mob-map-panel-list li { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--mob-border); }
.mob-map-panel-list li:last-child { border-bottom: none; }

.mob-map-drawer { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: flex-end; }
.mob-map-drawer-backdrop { position: absolute; inset: 0; background: rgba(17, 20, 30, .45); }
.mob-map-drawer-content {
	position: relative; width: 100%; max-width: 340px; background: var(--mob-surface);
	height: 100%; overflow-y: auto; padding: 16px; box-shadow: var(--mob-shadow);
}
.mob-map-drawer-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

@media (max-width: 899px) {
	.mob-map-body { flex-direction: column; }
	.mob-map-panel {
		position: fixed; left: 0; right: 0; bottom: 0; width: auto; max-height: 70vh;
		border-left: none; border-radius: 16px 16px 0 0; box-shadow: 0 -4px 16px rgba(16, 24, 40, .15);
		z-index: 40;
	}
	.mob-map-drawer-content { max-width: none; }
}

@media (min-width: 900px) {
	.mob-route-mapa .mob-app-content { padding: 0; }
}

/* ==================================================================
 * Divisor + sheet "Mais" (mobile) — itens secundários (WP4), ver
 * template-parts/more-menu.php. Reaproveita o padrão visual do drawer
 * de filtros do mapa (.mob-map-drawer-backdrop/-header/-panel-close).
 * ================================================================== */
.mob-sidebar-divider { height: 1px; background: var(--mob-border); margin: 10px 12px; }

.mob-more-sheet { position: fixed; inset: 0; z-index: 50; }
.mob-more-sheet[hidden] { display: none; }
.mob-more-sheet-content {
	position: fixed; left: 0; right: 0; bottom: 0; max-height: 75vh; overflow-y: auto;
	background: var(--mob-surface); border-radius: 16px 16px 0 0; box-shadow: 0 -4px 16px rgba(16, 24, 40, .15);
	padding: 16px;
}
.mob-more-sheet-nav { display: flex; flex-direction: column; gap: 2px; }
.mob-more-sheet-nav .mob-sidebar-link { padding: 11px 12px; }
