/* ============================================================
   SISTEMA DE DESIGN — Gestão de Iluminação Pública
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- Tokens ---- */
:root {
  color-scheme: dark;

  --bg:        #060c18;
  --bg-2:      #0d1525;
  --surface:   #111c2d;
  --surface-2: #192338;
  --surface-3: #1f2d45;

  --sidebar-bg:    #070d1a;
  --sidebar-width: 240px;

  --border:       rgba(255,255,255,0.06);
  --border-muted: rgba(255,255,255,0.04);
  --border-strong:rgba(255,255,255,0.12);

  --text:   #e2e8f5;
  --text-2: #7f92b0;
  --text-3: #3d5170;

  --accent:         #3b82f6;
  --accent-hover:   #2563eb;
  --accent-subtle:  rgba(59,130,246,0.10);
  --accent-subtle2: rgba(59,130,246,0.20);

  --green:          #10b981;
  --green-subtle:   rgba(16,185,129,0.10);
  --yellow:         #f59e0b;
  --yellow-subtle:  rgba(245,158,11,0.10);
  --red:            #ef4444;
  --red-subtle:     rgba(239,68,68,0.10);
  --blue:           #06b6d4;
  --blue-subtle:    rgba(6,182,212,0.10);
  --purple:         #8b5cf6;
  --purple-subtle:  rgba(139,92,246,0.10);
  --orange:         #f97316;
  --orange-subtle:  rgba(249,115,22,0.10);

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
  --shadow:    0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.7);

  --r-xs: 4px;
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --gap:    24px;
  --gap-sm: 16px;
  --gap-xs: 10px;

  --tr:      0.18s ease;
  --tr-fast: 0.10s ease;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

img, video, svg, canvas { display: block; max-width: 100%; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   LAYOUT SHELL
   ============================================================ */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform var(--tr);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
}

.sidebar-brand-icon svg { color: #fff; }

.sidebar-brand-text h2 {
  font-size: 0.9rem; font-weight: 700;
  letter-spacing: 0.1px; color: var(--text);
  white-space: nowrap; line-height: 1.2;
}

.sidebar-brand-text small {
  font-size: 0.68rem; color: var(--text-2);
  white-space: nowrap; display: block;
}

/* Nav */
.sidebar-section { padding: 10px 8px 2px; }

.sidebar-section-label {
  font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.9px; text-transform: uppercase;
  color: var(--text-3); padding: 0 8px; margin-bottom: 3px;
}

.sidebar-nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: 0.875rem; font-weight: 500;
  transition: all var(--tr-fast); text-decoration: none;
  position: relative; margin-bottom: 1px;
}

.sidebar-nav-item:hover {
  background: var(--surface-2); color: var(--text);
  text-decoration: none;
}

.sidebar-nav-item.active {
  background: var(--accent-subtle); color: var(--accent);
}

.sidebar-nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-icon { width: 17px; height: 17px; flex-shrink: 0; }

.sidebar-nav-badge {
  margin-left: auto;
  background: var(--red); color: #fff;
  font-size: 0.65rem; font-weight: 700;
  padding: 1px 6px; border-radius: 999px; min-width: 18px;
  text-align: center;
}

/* Sidebar divider */
.sidebar-divider {
  border: none; border-top: 1px solid var(--border);
  margin: 6px 8px;
}

/* Sidebar user */
.sidebar-user {
  margin-top: auto; padding: 10px 8px;
  border-top: 1px solid var(--border); flex-shrink: 0;
}

.sidebar-user-info {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r-sm);
}

.sidebar-user-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: #fff; flex-shrink: 0;
}

.sidebar-user-details { flex: 1; min-width: 0; }

.sidebar-user-name {
  font-size: 0.82rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-user-role { font-size: 0.68rem; color: var(--text-2); }

.sidebar-logout {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; margin-top: 3px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: 0.85rem; font-weight: 500;
  transition: all var(--tr-fast); text-decoration: none;
}

.sidebar-logout:hover {
  background: var(--red-subtle); color: var(--red);
  text-decoration: none;
}

/* Overlay mobile */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 199;
  backdrop-filter: blur(3px);
}

.sidebar-overlay.active { display: block; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: 13px clamp(18px,3vw,40px);
  background: rgba(6,12,24,0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.menu-toggle {
  display: none; background: none; border: none;
  color: var(--text); padding: 6px; border-radius: var(--r-sm);
  align-items: center; justify-content: center;
}

.menu-toggle:hover { background: var(--surface-2); }

.topbar-info { flex: 1; min-width: 0; }

.topbar-title {
  font-size: clamp(1rem, 0.85rem + 0.7vw, 1.35rem);
  font-weight: 700; letter-spacing: -0.2px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.topbar-breadcrumb {
  font-size: 0.78rem; color: var(--text-2); margin-top: 1px;
}

.topbar-breadcrumb a { color: var(--text-2); }
.topbar-breadcrumb a:hover { color: var(--text); text-decoration: none; }

.topbar-actions {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto; flex-shrink: 0;
}

/* ============================================================
   PAGE BODY
   ============================================================ */
.page-body {
  padding: clamp(18px,3vw,36px) clamp(18px,3vw,40px);
  flex: 1;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: clamp(16px,2vw,24px);
  box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: var(--gap); }

.card-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 18px; gap: 12px;
}

.card-title {
  font-size: 0.95rem; font-weight: 600;
  color: var(--text); letter-spacing: -0.1px;
}

.card-subtitle {
  font-size: 0.78rem; color: var(--text-2); margin-top: 2px;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 20px 22px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color var(--tr), box-shadow var(--tr);
}

.stat-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.stat-card-top {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
}

.stat-icon {
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.stat-icon.blue   { background: var(--accent-subtle);  color: var(--accent); }
.stat-icon.green  { background: var(--green-subtle);   color: var(--green); }
.stat-icon.yellow { background: var(--yellow-subtle);  color: var(--yellow); }
.stat-icon.red    { background: var(--red-subtle);     color: var(--red); }
.stat-icon.purple { background: var(--purple-subtle);  color: var(--purple); }
.stat-icon.orange { background: var(--orange-subtle);  color: var(--orange); }
.stat-icon.blue2  { background: var(--blue-subtle);    color: var(--blue); }

.stat-label {
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-2);
}

.stat-value {
  font-size: clamp(1.6rem, 1.3rem + 1vw, 2.2rem);
  font-weight: 800; letter-spacing: -1.5px; color: var(--text);
  line-height: 1;
}

.stat-sub { font-size: 0.78rem; color: var(--text-2); }

/* ============================================================
   GRIDS
   ============================================================ */
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto-sm { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-auto    { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--r-sm);
  font-size: 0.875rem; font-weight: 600; border: none;
  cursor: pointer; transition: all var(--tr-fast);
  white-space: nowrap; text-decoration: none;
  line-height: 1.3;
}

.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 10px rgba(59,130,246,0.28);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 18px rgba(59,130,246,0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-3); }

.btn-ghost {
  background: transparent; color: var(--text-2);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger {
  background: var(--red-subtle); color: var(--red);
  border: 1px solid rgba(239,68,68,0.25);
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-success {
  background: var(--green); color: #fff;
  box-shadow: 0 2px 10px rgba(16,185,129,0.25);
}
.btn-success:hover { background: #059669; transform: translateY(-1px); }

.btn-warning {
  background: var(--yellow-subtle); color: var(--yellow);
  border: 1px solid rgba(245,158,11,0.25);
}
.btn-warning:hover { background: var(--yellow); color: #000; }

.btn-sm  { padding: 6px 12px; font-size: 0.82rem; }
.btn-lg  { padding: 12px 24px; font-size: 0.95rem; }
.btn-xl  { padding: 14px 32px; font-size: 1rem; border-radius: var(--r); }
.btn-icon{ padding: 8px; border-radius: var(--r-sm); }
.btn-block { width: 100%; justify-content: center; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.2px;
  white-space: nowrap;
}

.badge-dot {
  width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
}

.badge-green  { background: var(--green-subtle);  color: var(--green); }
.badge-green .badge-dot  { background: var(--green); }
.badge-yellow { background: var(--yellow-subtle); color: var(--yellow); }
.badge-yellow .badge-dot { background: var(--yellow); }
.badge-red    { background: var(--red-subtle);    color: var(--red); }
.badge-red .badge-dot    { background: var(--red); }
.badge-blue   { background: var(--accent-subtle); color: var(--accent); }
.badge-blue .badge-dot   { background: var(--accent); }
.badge-orange { background: var(--orange-subtle); color: var(--orange); }
.badge-orange .badge-dot { background: var(--orange); }
.badge-purple { background: var(--purple-subtle); color: var(--purple); }
.badge-purple .badge-dot { background: var(--purple); }
.badge-cyan   { background: var(--blue-subtle);   color: var(--blue); }
.badge-cyan .badge-dot   { background: var(--blue); }
.badge-gray   { background: rgba(100,116,139,0.12); color: #64748b; }
.badge-gray .badge-dot   { background: #64748b; }

/* ============================================================
   FORMS
   ============================================================ */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); gap: 16px; }

.form-group { display: grid; gap: 5px; }

.form-label {
  font-size: 0.83rem; font-weight: 500; color: var(--text-2);
}

.form-control {
  width: 100%; padding: 10px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--text); font-size: 0.9rem;
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.14);
}

.form-control::placeholder { color: var(--text-3); }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-help  { font-size: 0.75rem; color: var(--text-3); }
.form-error { font-size: 0.78rem; color: var(--red); margin-top: 2px; }

.form-section-title {
  font-size: 0.82rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-2); padding-bottom: 10px;
  border-bottom: 1px solid var(--border); margin-bottom: 14px;
}

/* ============================================================
   TABLE
   ============================================================ */
.table-wrapper {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-radius: var(--r-lg); border: 1px solid var(--border);
}

.table {
  width: 100%; border-collapse: collapse; font-size: 0.88rem;
}

.table th, .table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left; vertical-align: middle;
}

.table th {
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-2); background: var(--surface-2);
  white-space: nowrap;
}

.table th:first-child { border-radius: var(--r-lg) 0 0 0; }
.table th:last-child  { border-radius: 0 var(--r-lg) 0 0; }

.table tbody tr { transition: background var(--tr-fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   ALERTS / MESSAGES
   ============================================================ */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 15px; border-radius: var(--r-sm); font-size: 0.88rem;
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.alert-success { background: var(--green-subtle);  color: var(--green);  border: 1px solid rgba(16,185,129,0.2); }
.alert-warning { background: var(--yellow-subtle); color: var(--yellow); border: 1px solid rgba(245,158,11,0.2); }
.alert-error   { background: var(--red-subtle);    color: var(--red);    border: 1px solid rgba(239,68,68,0.2); }
.alert-info    { background: var(--accent-subtle); color: var(--accent); border: 1px solid rgba(59,130,246,0.2); }

.messages { display: grid; gap: 8px; margin-bottom: 20px; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(5px);
  z-index: 1000; align-items: center;
  justify-content: center; padding: 20px;
}

.modal-backdrop.active { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  padding: clamp(20px,3vw,30px);
  width: min(100%,520px);
  max-height: 90dvh; overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.2s ease-out;
  scrollbar-width: thin;
}

@keyframes modalIn {
  from { transform: translateY(-14px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

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

.modal-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.2px; }
.modal-subtitle { font-size: 0.82rem; color: var(--text-2); margin-top: 3px; }

.modal-close {
  background: var(--surface-2); border: none;
  color: var(--text-2); width: 30px; height: 30px;
  border-radius: var(--r-sm); display: flex;
  align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: all var(--tr-fast);
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }

.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 24px; padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   TOOLBAR / FILTERS
   ============================================================ */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; margin-bottom: 20px;
}

.filters-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px;
  margin-bottom: 20px; display: none;
}
.filters-panel.active { display: block; }

.filters-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
}

/* ============================================================
   SECTION / PAGE HEADERS
   ============================================================ */
.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px;
  margin-bottom: var(--gap); flex-wrap: wrap;
}

.page-header-left {}
.page-header-title {
  font-size: clamp(1.3rem, 1rem + 1vw, 1.8rem);
  font-weight: 800; letter-spacing: -0.5px; color: var(--text);
}
.page-header-sub { font-size: 0.85rem; color: var(--text-2); margin-top: 4px; }
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.section-title {
  font-size: 0.95rem; font-weight: 600; color: var(--text);
  letter-spacing: -0.1px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center; padding: 56px 20px; color: var(--text-2);
}

.empty-state-icon {
  width: 52px; height: 52px; margin: 0 auto 16px;
  background: var(--surface-2); border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
}

.empty-state-icon svg { width: 26px; height: 26px; color: var(--text-3); }
.empty-state h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p  { font-size: 0.85rem; max-width: 320px; margin: 0 auto; }

/* ============================================================
   DIVIDER
   ============================================================ */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ============================================================
   LOADING
   ============================================================ */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-muted    { color: var(--text-2); }
.text-sm       { font-size: 0.85rem; }
.text-xs       { font-size: 0.75rem; }
.fw-600        { font-weight: 600; }
.fw-700        { font-weight: 700; }
.ml-auto       { margin-left: auto; }
.mt-auto       { margin-top: auto; }
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.gap-sm        { gap: var(--gap-sm); }
.gap-xs        { gap: var(--gap-xs); }
.w-full        { width: 100%; }
.text-center   { text-align: center; }
.truncate      { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   AUTH LAYOUT
   ============================================================ */
.auth-layout {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(59,130,246,0.14) 0%, transparent 70%),
    var(--bg);
}

.auth-card {
  width: min(100%, 400px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  padding: clamp(28px,5vw,44px);
  box-shadow: var(--shadow-xl);
}

.auth-logo {
  display: flex; align-items: center; gap: 11px;
  margin-bottom: 32px;
}

.auth-logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(99,102,241,0.4);
}

.auth-logo-icon svg { color: #fff; width: 22px; height: 22px; }
.auth-logo-text { font-size: 1rem; font-weight: 700; color: var(--text); }

.auth-title { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.4px; margin-bottom: 6px; }
.auth-subtitle { font-size: 0.88rem; color: var(--text-2); margin-bottom: 28px; }

.auth-links {
  display: flex; flex-direction: column; gap: 10px;
  text-align: center; margin-top: 20px;
}
.auth-links a { font-size: 0.85rem; color: var(--text-2); }
.auth-links a:hover { color: var(--text); text-decoration: none; }

/* ============================================================
   CIDADÃO LAYOUT
   ============================================================ */
.cidadao-layout {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  background:
    radial-gradient(ellipse 60% 40% at 70% -5%, rgba(56,189,248,0.10) 0%, transparent 65%),
    radial-gradient(ellipse 50% 30% at 10% 90%, rgba(99,102,241,0.08) 0%, transparent 60%),
    var(--bg);
}

.cidadao-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(6,12,24,0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.cidadao-header-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 14px clamp(16px,3vw,40px);
  display: flex; align-items: center; gap: 14px;
}

.cidadao-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}

.cidadao-brand-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(56,189,248,0.3);
}

.cidadao-brand-icon svg { color: #fff; }

.cidadao-brand-name {
  font-size: 0.95rem; font-weight: 700; color: var(--text);
  white-space: nowrap;
}

.cidadao-brand-name:hover { text-decoration: none; }

.cidadao-nav {
  margin-left: auto; display: flex; gap: 4px; align-items: center;
}

.cidadao-nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--r-sm);
  font-size: 0.85rem; font-weight: 500; color: var(--text-2);
  transition: all var(--tr-fast); text-decoration: none;
}

.cidadao-nav-link:hover {
  background: var(--surface-2); color: var(--text);
  text-decoration: none;
}

.cidadao-nav-link.active {
  background: rgba(56,189,248,0.1); color: #38bdf8;
}

.cidadao-nav-link svg { width: 15px; height: 15px; }

.cidadao-main {
  flex: 1; max-width: 1100px;
  margin: 0 auto; padding: clamp(24px,4vw,48px) clamp(16px,3vw,40px);
  width: 100%;
}

.cidadao-footer {
  border-top: 1px solid var(--border);
  padding: 20px clamp(16px,3vw,40px);
  text-align: center; font-size: 0.78rem; color: var(--text-3);
}

/* ============================================================
   MAP LAYOUT (tela cheia)
   ============================================================ */
.map-layout {
  display: flex; height: 100dvh; overflow: hidden;
}

.map-sidebar {
  width: 300px; flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden; z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.map-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--border);
  gap: 10px; flex-shrink: 0;
}

.map-sidebar-title {
  font-size: 0.92rem; font-weight: 700; color: var(--text);
}

.map-sidebar-section { padding: 14px 14px 6px; }

.map-sidebar-section-title {
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text-3); margin-bottom: 8px;
}

.map-container { flex: 1; position: relative; overflow: hidden; }
#mapa, #mapa-equipe { width: 100%; height: 100%; }

/* Filter controls inside map sidebar */
.map-filter-group { margin-bottom: 12px; }
.map-filter-label { font-size: 0.78rem; color: var(--text-2); margin-bottom: 5px; display: block; }
.map-filter-select {
  width: 100%; padding: 8px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--text); font-size: 0.85rem;
}
.map-filter-select:focus { outline: none; border-color: var(--accent); }

/* Chamado items */
.chamado-lista { list-style: none; padding: 0; margin: 0; }
.chamado-lista-item {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 11px 13px;
  margin-bottom: 7px; cursor: pointer;
  transition: all var(--tr-fast);
  display: flex; align-items: center; gap: 10px;
}
.chamado-lista-item:hover { border-color: var(--border-strong); background: var(--surface-3); }
.chamado-lista-item.aberto  { border-left: 3px solid var(--red); }
.chamado-lista-item.em-atendimento { border-left: 3px solid var(--yellow); }

.chamado-lista-info { flex: 1; min-width: 0; }
.chamado-lista-protocolo { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.chamado-lista-endereco  { font-size: 0.73rem; color: var(--text-2); truncate; }

.chamado-lista-empty {
  font-size: 0.82rem; color: var(--text-3);
  text-align: center; padding: 16px 0; font-style: italic;
}

/* Map action bar (user info + nav inside map page) */
.map-topbar {
  position: fixed; top: 10px; right: 14px; z-index: 500;
  display: flex; align-items: center; gap: 10px;
  background: rgba(7,13,26,0.82);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  padding: 8px 14px; border-radius: 999px;
  box-shadow: var(--shadow);
}

.map-topbar-user { font-size: 0.82rem; color: var(--text-2); }
.map-topbar a { font-size: 0.82rem; font-weight: 600; color: var(--red); }
.map-topbar a:hover { text-decoration: underline; }

/* Popup customization */
.leaflet-popup-content-wrapper {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
}
.leaflet-popup-content { margin: 14px 16px !important; min-width: 160px; }
.leaflet-popup-tip { background: var(--surface) !important; }
.leaflet-popup-close-button { color: var(--text-2) !important; top: 8px !important; right: 8px !important; }

.popup-title { font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; }
.popup-row { font-size: 0.8rem; color: var(--text-2); margin-bottom: 3px; }
.popup-row strong { color: var(--text); }
.popup-divider { border: none; border-top: 1px solid var(--border); margin: 10px 0; }

.popup-btn {
  display: block; width: 100%; text-align: center;
  padding: 8px 12px; border-radius: var(--r-sm);
  font-size: 0.8rem; font-weight: 600; border: none;
  cursor: pointer; transition: all var(--tr-fast);
  margin-top: 6px; text-decoration: none;
}
.popup-btn-primary { background: var(--red); color: #fff; }
.popup-btn-primary:hover { background: #dc2626; text-decoration: none; }
.popup-btn-secondary { background: var(--surface-3); color: var(--text); }
.popup-btn-secondary:hover { background: var(--surface-2); text-decoration: none; }

/* Status dot pill */
.status-update-pill {
  font-size: 0.72rem; color: var(--text-3);
  padding: 4px 8px;
  background: var(--surface-2); border-radius: 999px;
  border: 1px solid var(--border);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .sidebar-overlay.active { display: block; }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-auto { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .page-header-actions .btn { flex: 1; justify-content: center; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; justify-content: center; }
  .map-sidebar { width: 100%; max-height: 40dvh; border-right: none; border-bottom: 1px solid var(--border); }
  .map-layout { flex-direction: column; }
  .map-container { flex: 1; min-height: 0; }
  .cidadao-nav-link span { display: none; }
}

@media (max-width: 480px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .btn { width: 100%; justify-content: center; }
  .btn-xl { width: 100%; }
}

/* ============================================================
   CHART CONTAINER
   ============================================================ */
.chart-container {
  position: relative;
  width: 100%;
}
.chart-container canvas { width: 100% !important; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex; align-items: center; gap: 4px;
  justify-content: center; margin-top: 20px;
}
.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r-sm);
  font-size: 0.85rem; font-weight: 500;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); text-decoration: none;
  transition: all var(--tr-fast);
}
.page-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.page-link.active { background: var(--accent); color: #fff; border-color: var(--accent); }
