/* ——— Design system ——— */
:root {
  --bg-root: #030303;
  --bg-surface: #0a0a0a;
  --bg-elevated: #111111;
  --bg-overlay: #1a1a1a;
  --bg-glass: rgba(10, 10, 10, 0.72);

  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.14);
  --border-focus: rgba(255, 255, 255, 0.28);

  --text-primary: #fafafa;
  --text-secondary: #a1a1a1;
  --text-tertiary: #525252;

  --accent: #ffffff;
  --accent-muted: rgba(255, 255, 255, 0.06);
  --accent-line: linear-gradient(90deg, #6366f1, #8b5cf6, #a78bfa);

  --success: #22c55e;
  --success-muted: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --warning-muted: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-muted: rgba(239, 68, 68, 0.12);
  --info: #3b82f6;
  --info-muted: rgba(59, 130, 246, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-glow: 0 0 0 1px var(--border), 0 8px 32px rgba(0, 0, 0, 0.48);
  --sidebar-w: 260px;
  --modal-map-h: clamp(220px, 42vh, 320px);
  --font: 'Geist', 'Inter', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg-root);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(139, 92, 246, 0.1), transparent),
    radial-gradient(ellipse 50% 30% at 0% 100%, rgba(59, 130, 246, 0.06), transparent);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black, transparent);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3 { font-weight: 600; letter-spacing: -0.03em; }
.mono { font-family: var(--font-mono); }

/* ——— Layout app ——— */
.app {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 220;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  isolation: isolate;
}

@media (min-width: 769px) {
  .sidebar {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
}

.sidebar-header {
  padding: 8px 10px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.brand { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.brand-tag { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 10px;
  background: var(--accent-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #374151, #1f2937);
  border: 1px solid var(--border-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.user-meta { min-width: 0; }
.user-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  opacity: 0.55;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item:hover svg { opacity: 0.9; }

.nav-item.active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.2);
}

.nav-item.active svg { opacity: 1; color: #a5b4fc; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px 8px;
  border-top: 1px solid var(--border);
}

.nav-logout {
  color: var(--text-tertiary);
  font-size: 12px;
}

.nav-logout:hover { color: var(--danger); background: var(--danger-muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-info { background: var(--info-muted); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-success { background: var(--success-muted); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.2); }
.badge-default { background: var(--accent-muted); color: var(--text-secondary); border: 1px solid var(--border); }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 28px 36px 48px;
  min-width: 0;
  animation: fadeUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-header {
  margin-bottom: 28px;
}

.page-header .topbar {
  border: none;
  padding: 0;
  margin: 0;
}

.page-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.page-desc {
  font-size: 14px;
  color: var(--text-secondary);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.topbar-text { min-width: 0; flex: 1 1 200px; }

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.topbar h1 { font-size: 22px; }

.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding: 6px 12px;
  background: var(--accent-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.breadcrumb-readonly {
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.25);
  background: rgba(99, 102, 241, 0.08);
}

/* ——— Métricas ——— */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 20px 18px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-line);
  opacity: 0.6;
}

.metric-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.metric-card--green::before { background: linear-gradient(90deg, #22c55e, #4ade80); }
.metric-card--blue::before { background: linear-gradient(90deg, #3b82f6, #6366f1); }
.metric-card--amber::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.metric-card--violet::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.metric-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted);
  border: 1px solid var(--border);
}

.metric-icon svg { width: 18px; height: 18px; opacity: 0.7; }

.metric-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* ——— Cards e tabelas ——— */
.card-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-glow);
}

.card-block h3,
.section-title {
  font-size: 11px;
  margin-bottom: 16px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  -webkit-overflow-scrolling: touch;
}

.table-wrap--scroll {
  position: relative;
}

.table-wrap--scroll::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 28px;
  background: linear-gradient(90deg, transparent, var(--bg-surface));
  pointer-events: none;
  opacity: 0;
}

@media (max-width: 900px) {
  .table-wrap--scroll:not(:has(.table--responsive))::after {
    opacity: 1;
  }
}

.table-wrap .card-block {
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

tbody tr { transition: background 0.12s; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
tbody tr:last-child td { border-bottom: none; }

.cell-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cell-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #c4b5fd;
  flex-shrink: 0;
}

/* ——— Botões ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: #fff;
  color: #0a0a0a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
  background: #f4f4f5;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.08);
}

.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-overlay);
  border-color: var(--border-hover);
}

.btn-danger {
  background: transparent;
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-danger:hover { background: var(--danger-muted); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover { color: var(--text-primary); background: var(--accent-muted); }

.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

.btn-group--stack {
  justify-content: flex-end;
}

/* ——— Formulários ——— */
label.field-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  background: var(--bg-root);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  margin-bottom: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

input[list] {
  background-image: linear-gradient(45deg, transparent 50%, var(--text-tertiary) 50%),
    linear-gradient(135deg, var(--text-tertiary) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.search-box {
  position: relative;
  max-width: 360px;
  width: 100%;
  margin-bottom: 20px;
}

.search-box input {
  margin: 0;
  padding-left: 40px;
  background: var(--bg-surface);
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.voto-bar {
  height: 6px;
  background: var(--bg-overlay);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}

.voto-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
}

.pill-ativo {
  background: var(--success-muted);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.pill-ativo::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.pill-inativo {
  background: var(--danger-muted);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.pill-inativo::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
}

/* ——— Agenda ——— */
.agenda-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

.agenda-drill-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-glow);
}

.agenda-drill-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.agenda-drill-back--placeholder {
  width: 56px;
}

.agenda-drill-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
  text-align: center;
  text-transform: capitalize;
}

.agenda-drill-nav {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.agenda-drill-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 0;
  padding: 10px 14px 0;
}

.agenda-year-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  margin: 12px 0 0;
}

.agenda-month-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 72px;
  padding: 12px 8px;
  background: var(--bg-surface);
  border: none;
  cursor: pointer;
  transition: background 0.12s;
}

.agenda-month-tile:hover {
  background: rgba(99, 102, 241, 0.08);
}

.agenda-month-tile.current {
  background: rgba(99, 102, 241, 0.12);
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.45);
}

.agenda-month-tile-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.agenda-month-tile-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #c4b5fd;
  background: rgba(99, 102, 241, 0.15);
  padding: 2px 8px;
  border-radius: 999px;
}

.agenda-month-tile-count.muted {
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.04);
}

.agenda-month-grid--drill {
  margin-top: 8px;
}

.agenda-month-grid--drill .agenda-day {
  min-height: 52px;
  align-items: center;
  justify-content: center;
}

.agenda-day-btn {
  border: none;
  background: var(--bg-surface);
  cursor: pointer;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding: 8px 4px;
  width: 100%;
}

.agenda-day-btn:hover:not(.muted) {
  background: rgba(99, 102, 241, 0.08);
}

.agenda-day-panel--embedded {
  border: none;
  border-radius: 0;
  margin: 0;
  box-shadow: none;
}

.agenda-day-panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px 0;
}

.agenda-day-panel--embedded .agenda-timeline {
  margin: 0 0 12px;
}

@media (max-width: 600px) {
  .agenda-year-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .agenda-drill-head {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .agenda-drill-back {
    justify-self: start;
  }

  .agenda-drill-title-wrap {
    order: -1;
  }

  .agenda-drill-nav {
    width: 100%;
    justify-content: space-between;
  }
}

.agenda-month {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 20px;
}

.agenda-month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.agenda-month-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.agenda-month-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.agenda-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.agenda-weekday {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.01);
}

.agenda-day {
  min-height: 112px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.agenda-day:nth-child(7n) { border-right: none; }
.agenda-day.muted { background: rgba(255, 255, 255, 0.01); color: var(--text-tertiary); }
.agenda-day.today { box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.55); }

.agenda-day:not(.muted) {
  cursor: pointer;
  transition: background 0.12s;
}

.agenda-day:not(.muted):hover {
  background: rgba(99, 102, 241, 0.06);
}

.agenda-day.selected {
  background: rgba(99, 102, 241, 0.1);
  box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.65);
}

.agenda-day.selected.today {
  box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.85);
}

.agenda-day-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.agenda-day.today .agenda-day-num {
  color: #c4b5fd;
  font-weight: 600;
}

.agenda-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.agenda-day-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  padding: 2px 6px;
  border-radius: 999px;
}

.agenda-day.today .agenda-day-count {
  color: #c4b5fd;
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.12);
}

.agenda-week .agenda-day {
  min-height: 170px;
}

.agenda-event-chip {
  font-size: 10px;
  line-height: 1.25;
  border-radius: 7px;
  padding: 4px 6px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.12);
  color: #ddd6fe;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  text-align: left;
}

.agenda-week .agenda-event-chip {
  width: 100%;
  display: block;
  white-space: normal;
  padding: 5px 8px;
}

.agenda-event-chip:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.5);
}

.agenda-event-time {
  font-family: var(--font-mono);
  font-size: 9px;
  color: #c4b5fd;
  display: block;
  margin-bottom: 2px;
}

.agenda-more {
  font-size: 10px;
  color: #c4b5fd;
  padding: 2px 4px;
  margin-top: 2px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.agenda-more:hover {
  text-decoration: underline;
}

/* ——— Agenda: visão do dia (linha do tempo) ——— */
.agenda-day-panel:not(.agenda-day-panel--embedded) {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 16px;
}

.agenda-day-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.agenda-day-panel-title {
  font-size: 15px;
  font-weight: 600;
  text-transform: capitalize;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.agenda-day-panel-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 0;
}

.agenda-day-unscheduled {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(245, 158, 11, 0.06);
}

.agenda-day-unscheduled-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fbbf24;
  width: 100%;
}

.agenda-unscheduled-chip {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
  color: #fde68a;
  cursor: pointer;
}

.agenda-day-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.agenda-timeline {
  display: grid;
  grid-template-columns: 52px 1fr;
  max-height: min(640px, 70vh);
  overflow-y: auto;
}

.agenda-tl-hours {
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.agenda-tl-hour {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 4px 8px 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  box-sizing: border-box;
}

.agenda-tl-hour span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
}

.agenda-tl-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  margin: 0;
  padding: 8px 14px 0;
}

.agenda-timeline--interactive {
  cursor: pointer;
}

.agenda-timeline--interactive .agenda-tl-body {
  cursor: crosshair;
}

.agenda-timeline--interactive .agenda-tl-grid-line {
  transition: background 0.1s;
}

.agenda-timeline--interactive:hover .agenda-tl-grid-line {
  background: rgba(99, 102, 241, 0.04);
}

.agenda-tl-body {
  position: relative;
}

.agenda-tl-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.agenda-tl-grid-line {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  box-sizing: border-box;
}

.agenda-now-needle {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 3;
  pointer-events: none;
  border-top: 2px solid #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.45);
}

.agenda-now-label {
  position: absolute;
  left: 8px;
  top: -10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: #fca5a5;
  background: rgba(127, 29, 29, 0.9);
  padding: 2px 6px;
  border-radius: 4px;
}

.agenda-tl-event {
  position: absolute;
  left: 8px;
  right: 12px;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.18);
  color: #ede9fe;
  text-align: left;
  cursor: pointer;
  z-index: 3;
  overflow: hidden;
  transition: background 0.12s, border-color 0.12s;
}

.agenda-tl-event:hover {
  background: rgba(99, 102, 241, 0.28);
  border-color: rgba(99, 102, 241, 0.65);
}

.agenda-tl-event-time {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: #c4b5fd;
  display: block;
  margin-bottom: 2px;
}

.agenda-tl-event-title {
  font-size: 13px;
  font-weight: 500;
  display: block;
  line-height: 1.3;
}

.agenda-tl-event-meta {
  font-size: 10px;
  color: var(--text-tertiary);
  display: block;
  margin-top: 2px;
}

.agenda-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.agenda-section-head .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-future { background: #6366f1; box-shadow: 0 0 8px rgba(99, 102, 241, 0.6); }
.dot-past { background: var(--text-tertiary); }

.agenda-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 12px;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
  padding-left: 22px;
}

.agenda-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--accent-line);
}

.agenda-card:hover {
  border-color: var(--border-hover);
  transform: translateX(2px);
}

.agenda-card h4 { font-size: 15px; margin-bottom: 8px; }

.agenda-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.agenda-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.tag {
  font-size: 11px;
  padding: 3px 10px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 999px;
  color: #c4b5fd;
}

/* ——— Modais ——— */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  animation: fadeIn 0.2s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: min(90vh, 90dvh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  margin: auto;
}

.modal.wide { max-width: 560px; }

.modal.modal-map {
  max-width: 640px;
}

.modal-map-section {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  margin: 12px 0;
  height: var(--modal-map-h);
  min-height: var(--modal-map-h);
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #2a2a2e;
}

.modal.modal-map {
  max-height: min(94vh, 94dvh);
}

.modal.modal-map .modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.modal-header {
  padding: 22px 24px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h2 { font-size: 18px; margin: 0; }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.modal-body--with-close {
  padding-top: 48px;
}

.modal-body h2 {
  font-size: 18px;
  margin-bottom: 16px;
  padding-right: 36px;
}

.modal-body > .btn,
.modal-body .modal-footer {
  margin-top: 4px;
}

.modal-footer {
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: var(--bg-surface);
}

.modal-body .modal-footer {
  margin: 20px -24px -20px;
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.modal-footer--actions {
  flex-wrap: wrap;
}

.modal-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 5;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--bg-overlay);
  color: var(--text-primary);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }

.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.4;
}

.geo-field { position: relative; }

.geo-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 4px);
  z-index: 20;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.geo-suggestions.hidden { display: none; }

.geo-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s;
}

.geo-item:last-child { border-bottom: none; }

.geo-item:hover,
.geo-item:focus-visible {
  background: var(--bg-overlay);
  outline: none;
}

.checkbox-list {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 14px;
  background: var(--bg-root);
}

.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.12s;
}

.checkbox-list label:hover { background: var(--accent-muted); }
.checkbox-list input { width: auto; margin: 0; accent-color: #6366f1; }

/* ——— Skeleton, empty, toast ——— */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-overlay) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 6px;
  height: 16px;
  margin-bottom: 10px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  opacity: 0.25;
  margin-bottom: 12px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  z-index: 300;
  display: none;
  font-size: 13px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  align-items: center;
  gap: 10px;
}

.toast.show {
  display: flex;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.2s ease;
}

.sidebar-backdrop.open { display: block; }

.hamburger {
  display: none;
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 230;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 18px;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

body.sidebar-open .hamburger {
  opacity: 0;
  pointer-events: none;
}

body.modal-open {
  overflow: hidden;
}

.card-block--narrow {
  max-width: 440px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ——— Painel: card compacto ——— */
.painel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow);
  overflow: hidden;
}

.painel-card-head {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.painel-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.painel-card-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 0;
  line-height: 1.4;
}

.painel-charts-compact {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}

.pchart {
  background: var(--bg-surface);
  padding: 10px 10px 8px;
  min-width: 0;
}

.pchart--full {
  grid-column: 1 / -1;
}

.pchart-label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.pchart-canvas {
  position: relative;
  height: 132px;
}

.pchart--full .pchart-canvas {
  height: 120px;
}

.painel-card-map {
  padding: 10px 12px 12px;
}

.painel-card-map .pchart-label {
  margin-bottom: 8px;
}

.map-previsao--compact {
  min-height: 260px !important;
  height: 260px;
  border-radius: var(--radius-md);
}

@media (max-width: 700px) {
  .painel-charts-compact {
    grid-template-columns: 1fr 1fr;
  }

  .pchart--full {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .painel-charts-compact {
    grid-template-columns: 1fr;
  }

  .map-previsao--compact {
    min-height: 220px !important;
    height: 220px;
  }
}

.map-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.map-previsao {
  width: 100%;
  min-height: 360px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.map-heat-legend-slot:empty {
  display: none;
}

.map-heat-legend-slot .map-heat-legend {
  width: 100%;
  max-width: none;
  min-width: 0;
  box-shadow: none;
}

.map-modal-picker {
  width: 100%;
  height: var(--modal-map-h);
  min-height: var(--modal-map-h);
  position: relative;
  background: #2a2a2e;
}

.map-modal-picker.leaflet-container,
.map-modal-picker .leaflet-container {
  width: 100% !important;
  height: var(--modal-map-h) !important;
  min-height: var(--modal-map-h) !important;
  background: #2a2a2e;
  font-family: inherit;
  z-index: 1;
}

.lid-map-pin-wrap {
  background: transparent;
  border: none;
}

.lid-map-pin {
  width: 22px;
  height: 22px;
  margin: 0 auto;
  background: #6366f1;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.lid-local-label {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.map-hint {
  background: rgba(10, 10, 12, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
  max-width: 220px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.section-subtitle {
  margin: -8px 0 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.map-heat-legend {
  background: rgba(10, 10, 12, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text-secondary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  min-width: 168px;
}

.map-heat-legend-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 12px;
}

.map-heat-legend-bar {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    rgb(59, 130, 246) 0%,
    rgb(34, 211, 238) 35%,
    rgb(234, 179, 8) 65%,
    rgb(239, 68, 68) 100%
  );
  margin-bottom: 6px;
}

.map-heat-legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  margin-bottom: 6px;
}

.map-heat-legend-hint {
  font-size: 10px;
  line-height: 1.35;
  color: var(--text-tertiary);
}

.map-heat-popup {
  font-size: 13px;
  line-height: 1.45;
  min-width: 180px;
}

.map-heat-popup-list {
  margin: 8px 0 0;
  padding-left: 18px;
  max-height: 140px;
  overflow-y: auto;
}

.map-heat-popup-list li {
  margin-bottom: 4px;
}

.map-heat-more {
  color: var(--text-tertiary);
  font-style: italic;
}

.rank-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
  width: 28px;
}

.rank-num.top { color: #a5b4fc; font-weight: 600; }

/* ——— Lideranças: lista sanfona (mobile) ——— */
.lid-view--mobile {
  display: none;
}

.lid-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lid-acc-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
  box-shadow: var(--shadow-glow);
}

.lid-acc-item[open] {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.15), var(--shadow-glow);
}

.lid-acc-summary {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 14px 40px 14px 14px;
  cursor: pointer;
  list-style: none;
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.lid-acc-summary::-webkit-details-marker {
  display: none;
}

.lid-acc-summary::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-tertiary);
  border-bottom: 2px solid var(--text-tertiary);
  transform: translateY(-65%) rotate(45deg);
  transition: transform 0.2s ease;
}

.lid-acc-item[open] .lid-acc-summary::after {
  transform: translateY(-35%) rotate(-135deg);
}

.lid-acc-summary-main .cell-name {
  width: 100%;
}

.lid-acc-summary-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 42px;
}

.lid-acc-votos {
  font-size: 12px;
  color: var(--text-secondary);
}

.lid-pill {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
}

.lid-pill--forte {
  background: var(--success-muted);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.lid-pill--fraca {
  background: var(--warning-muted);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.lid-acc-panel {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
  animation: fadeUp 0.2s ease;
}

.lid-acc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  padding-top: 14px;
}

.lid-acc-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  min-width: 0;
}

.lid-acc-field--full {
  grid-column: 1 / -1;
}

.lid-acc-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 500;
}

.lid-acc-actions {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.lid-acc-actions .btn {
  width: 100%;
  justify-content: center;
  min-height: 44px;
}

@media (max-width: 768px) {
  .lid-view--desktop {
    display: none !important;
  }

  .lid-view--mobile {
    display: block;
  }

  .lid-acc-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) {
  .lid-view--mobile {
    display: none !important;
  }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ——— Tabelas em cards (mobile) ——— */
@media (max-width: 768px) {
  .table--responsive { min-width: 0 !important; }

  .table--responsive thead {
    display: none;
  }

  .table--responsive tbody tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    overflow: hidden;
  }

  .table--responsive tbody tr:last-child {
    margin-bottom: 0;
  }

  .table--responsive tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    text-align: right;
  }

  .table--responsive tbody td:last-child {
    border-bottom: none;
  }

  .table--responsive tbody td::before {
    content: attr(data-label);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    font-weight: 500;
    text-align: left;
    flex: 0 0 auto;
    max-width: 46%;
    padding-top: 2px;
  }

  .table--responsive tbody td[data-label='Nome'] {
    display: block;
    text-align: left;
    padding: 14px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
  }

  .table--responsive tbody td[data-label='Nome']::before {
    display: none;
  }

  .table--responsive tbody td[data-label='Ações'] {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  .table--responsive tbody td[data-label='Ações']::before {
    margin-bottom: 4px;
  }

  .table--responsive .btn-group--stack {
    flex-direction: column;
    width: 100%;
  }

  .table--responsive .btn-group--stack .btn {
    width: 100%;
    justify-content: center;
  }

  .table--responsive .cell-name {
    justify-content: flex-start;
  }

  .table-wrap--scroll::after {
    display: none;
  }
}

/* ——— Tablet ——— */
@media (max-width: 1024px) {
  .main {
    padding: 24px 24px 40px;
  }

  .page-title {
    font-size: 22px;
  }

  .metric-value {
    font-size: 26px;
  }

  .modal.wide,
  .modal.modal-map {
    max-width: min(560px, 100%);
  }
}

/* ——— Mobile ——— */
@media (max-width: 768px) {
  .sidebar {
    width: min(var(--sidebar-w), 88vw);
    transform: translateX(-100%);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg-surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: 220;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 24px 0 48px rgba(0, 0, 0, 0.55);
  }

  .main {
    margin-left: 0;
    padding: calc(64px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
  }

  .hamburger {
    display: flex;
  }

  .page-header {
    margin-bottom: 20px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
  }

  .page-actions .btn-primary {
    flex: 1 1 100%;
  }

  .card-block {
    padding: 16px;
  }

  .agenda-grid,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .map-previsao {
    min-height: min(52vh, 320px);
  }

  .agenda-month-head {
    flex-wrap: wrap;
    gap: 10px;
  }

  .agenda-month-nav {
    width: 100%;
    justify-content: space-between;
  }

  .agenda-month-nav .btn {
    flex: 1;
  }

  .agenda-weekday {
    padding: 6px 4px;
    font-size: 9px;
  }

  .agenda-month .agenda-day {
    min-height: 72px;
    padding: 4px;
  }

  .agenda-week .agenda-day {
    min-height: 120px;
  }

  .agenda-event-chip {
    font-size: 9px;
    padding: 3px 4px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .metric-card {
    padding: 14px;
  }

  .metric-value {
    font-size: 22px;
  }

  .search-box {
    max-width: none;
  }

  .breadcrumb {
    font-size: 11px;
    flex-wrap: wrap;
  }

  .toast {
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    max-width: none;
  }

  .card-block--narrow {
    max-width: none;
  }
}

/* ——— Modais mobile ——— */
@media (max-width: 640px) {
  :root {
    --modal-map-h: clamp(200px, 38vh, 280px);
  }

  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    max-width: 100%;
    max-height: min(92dvh, 92vh);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    animation: modalSheetIn 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .modal.modal-map {
    max-height: min(96dvh, 96vh);
  }

  .modal-body {
    padding: 16px;
  }

  .modal-body--with-close {
    padding-top: 52px;
  }

  .modal-body .modal-footer {
    margin: 16px -16px -16px;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  }

  .modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  }

  .modal-footer .btn,
  .modal-body > .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .modal-close {
    top: 10px;
    right: 10px;
  }

  .checkbox-list {
    max-height: min(40vh, 200px);
  }

  .geo-suggestions {
    max-height: min(36vh, 180px);
  }
}

@media (max-width: 480px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .page-title {
    font-size: 20px;
  }

  .agenda-month-grid {
    font-size: 10px;
  }

  .agenda-month .agenda-day {
    min-height: 56px;
  }

  .agenda-day-num {
    font-size: 10px;
  }

  td,
  th {
    padding: 10px 12px;
  }
}

@keyframes modalSheetIn {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
