/* ============================================================
   TRANSPOBRAS - Sistema de Transparência de Obras Públicas
   Aesthetic: Civic Bold — Navy + Amber, strong geometric
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;0,900;1,300;1,400&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --navy-950: #040d21;
  --navy-900: #0a1628;
  --navy-800: #0f2147;
  --navy-700: #163266;
  --navy-600: #1d4285;
  --navy-500: #1d5cad;
  --navy-400: #3b7fce;
  --navy-300: #6baae0;
  --navy-200: #a8cef0;
  --navy-100: #dbeafe;

  --amber-600: #d97706;
  --amber-500: #f59e0b;
  --amber-400: #fbbf24;
  --amber-300: #fcd34d;
  --amber-100: #fef3c7;

  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50:  #f8fafc;

  --green-600: #16a34a;
  --green-100: #dcfce7;
  --red-600:   #dc2626;
  --red-100:   #fee2e2;
  --orange-600:#ea580c;
  --orange-100:#ffedd5;
  --purple-600:#7c3aed;
  --purple-100:#ede9fe;

  --font-display: 'Roboto', sans-serif;
  --font-body:    'Roboto', sans-serif;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  32px;

  --shadow-sm:  0 1px 3px rgba(4,13,33,.08), 0 1px 2px rgba(4,13,33,.06);
  --shadow-md:  0 4px 16px rgba(4,13,33,.12), 0 2px 6px rgba(4,13,33,.08);
  --shadow-lg:  0 12px 40px rgba(4,13,33,.18), 0 4px 12px rgba(4,13,33,.10);
  --shadow-xl:  0 24px 64px rgba(4,13,33,.22);

  --transition: 200ms cubic-bezier(.4,0,.2,1);
}

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

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

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--slate-900);
  background: var(--slate-50);
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: inherit; text-decoration: none; }

/* ── Typography ─────────────────────────────────────────────── */
.font-display { font-family: var(--font-display); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--navy-900);
}

/* ── Public Layout ──────────────────────────────────────────── */
.topbar {
  background: var(--navy-900);
  color: #fff;
  padding: 8px 0;
  font-size: 12px;
  border-bottom: 2px solid var(--amber-500);
}
.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar a { color: var(--amber-400); transition: color var(--transition); }
.topbar a:hover { color: var(--amber-300); }

.navbar {
  background: var(--navy-800);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
}
.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 24px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.nav-brand-icon {
  width: 48px;
  height: 48px;
  background: transparent;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.35));
}
.nav-brand-text h1 {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.5px;
  line-height: 1;
}
.nav-brand-text span {
  font-size: 11px;
  color: var(--navy-300);
  font-weight: 400;
  font-family: var(--font-body);
  letter-spacing: .5px;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.nav-links a {
  color: var(--navy-200);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.nav-links a.active { background: var(--amber-500); color: var(--navy-900); font-weight: 600; }

.nav-cta {
  background: var(--amber-500);
  color: var(--navy-900) !important;
  font-weight: 700 !important;
  padding: 10px 20px !important;
  border-radius: var(--radius-sm) !important;
  transition: background var(--transition) !important;
}
.nav-cta:hover { background: var(--amber-400) !important; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  background: none;
  border: none;
  color: #fff;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all var(--transition);
}

/* ── Hero / Stats ───────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 60%, var(--navy-600) 100%);
  padding: 64px 24px 56px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-inner {
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
}
.hero-title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
  line-height: 1.1;
}
.hero-title span { color: var(--amber-400); }
.hero-subtitle {
  color: var(--navy-200);
  font-size: 16px;
  max-width: 600px;
  margin-bottom: 40px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  max-width: 900px;
}
.stat-card {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  backdrop-filter: blur(8px);
  transition: all var(--transition);
}
.stat-card:hover {
  background: rgba(255,255,255,.13);
  transform: translateY(-2px);
}
.stat-card-num {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: var(--amber-400);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card-label {
  font-size: 12px;
  color: var(--navy-200);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── Filters Bar ────────────────────────────────────────────── */
.filters-bar {
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
  padding: 16px 24px;
  position: sticky;
  top: 72px;
  z-index: 900;
  box-shadow: var(--shadow-sm);
}
.filters-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-search {
  flex: 1;
  min-width: 220px;
  position: relative;
}
.filter-search input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--slate-50);
  transition: border-color var(--transition);
}
.filter-search input:focus {
  outline: none;
  border-color: var(--navy-500);
  background: #fff;
}
.filter-search i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-500);
  font-size: 14px;
}
.filter-select {
  padding: 10px 14px;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--slate-50);
  color: var(--slate-700);
  cursor: pointer;
  transition: border-color var(--transition);
}
.filter-select:focus { outline: none; border-color: var(--navy-500); }

.view-toggle {
  display: flex;
  background: var(--slate-100);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.view-btn {
  padding: 7px 12px;
  border: none;
  background: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--slate-500);
  transition: all var(--transition);
  font-size: 15px;
}
.view-btn.active { background: #fff; color: var(--navy-700); box-shadow: var(--shadow-sm); }

/* ── Map ────────────────────────────────────────────────────── */
.map-section {
  padding: 0;
  position: relative;
}
#mapa-obras {
  width: 100%;
  height: 520px;
  z-index: 1;
}
.map-legend {
  position: absolute;
  bottom: 32px;
  right: 32px;
  background: #fff;
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 500;
  min-width: 180px;
}
.map-legend h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--slate-500);
  margin-bottom: 10px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--slate-700);
  margin-bottom: 6px;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Content Area ───────────────────────────────────────────── */
.content-area {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.section-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--navy-900);
}
.section-count {
  font-size: 14px;
  color: var(--slate-500);
  font-weight: 400;
  margin-left: 8px;
}

/* ── Cards Grid ─────────────────────────────────────────────── */
.obras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.obra-card {
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  transition: all var(--transition);
  cursor: pointer;
}
.obra-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: var(--navy-200);
}

.card-header {
  height: 8px;
}
.card-body { padding: 24px; }

.card-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.badge-status-planejada     { background: #e0f2fe; color: #0369a1; }
.badge-status-licitacao     { background: #fef3c7; color: #92400e; }
.badge-status-em_andamento  { background: #d1fae5; color: #065f46; }
.badge-status-paralisada    { background: #fee2e2; color: #991b1b; }
.badge-status-concluida     { background: #dcfce7; color: #14532d; }
.badge-status-cancelada     { background: #f3f4f6; color: #374151; }

.badge-prio-urgente { background: #fee2e2; color: #991b1b; }
.badge-prio-alta    { background: #ffedd5; color: #9a3412; }
.badge-prio-media   { background: #fef9c3; color: #854d0e; }
.badge-prio-baixa   { background: #f0fdf4; color: #166534; }

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy-900);
  margin-bottom: 8px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.card-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--slate-500);
}
.card-meta-item i { width: 16px; color: var(--navy-400); font-size: 12px; }

.progress-section { margin-bottom: 16px; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--slate-500);
  margin-bottom: 6px;
}
.progress-bar {
  height: 6px;
  background: var(--slate-200);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

.card-footer {
  padding: 14px 24px;
  background: var(--slate-50);
  border-top: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-valor {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--navy-800);
}
.card-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-500);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color var(--transition);
}
.card-link:hover { color: var(--navy-700); }

/* ── Table View ─────────────────────────────────────────────── */
.table-container {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--navy-900);
  color: #fff;
  padding: 14px 16px;
  text-align: left;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}
thead th:first-child { border-radius: 0; }
tbody tr {
  border-bottom: 1px solid var(--slate-100);
  transition: background var(--transition);
}
tbody tr:hover { background: var(--slate-50); }
tbody tr:last-child { border-bottom: none; }
tbody td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--slate-700);
  vertical-align: middle;
}
.td-title { font-weight: 600; color: var(--navy-900); max-width: 260px; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4,13,33,.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(.98);
  transition: all var(--transition);
  box-shadow: var(--shadow-xl);
}
.modal-overlay.open .modal { transform: none; }

.modal-header {
  padding: 28px 32px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.modal-close {
  background: var(--slate-100);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--slate-500);
  flex-shrink: 0;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--slate-200); color: var(--slate-900); }
.modal-body { padding: 20px 32px 32px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}
.detail-item label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--slate-500);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}
.detail-item span {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy-900);
}
.detail-full { grid-column: 1 / -1; }

/* ── Admin Layout ───────────────────────────────────────────── */
.admin-body {
  display: flex;
  min-height: 100vh;
  background: var(--slate-100);
}

.sidebar {
  width: 260px;
  background: var(--navy-950);
  min-height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 1001;
  transition: transform var(--transition);
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo-icon {
  width: 42px;
  height: 42px;
  background: transparent;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.4));
}
.sidebar-logo-text h2 {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}
.sidebar-logo-text p {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  margin-top: 2px;
}

.sidebar-nav { padding: 16px 12px; flex: 1; }
.sidebar-section {
  margin-bottom: 24px;
}
.sidebar-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.3);
  font-weight: 600;
  padding: 0 8px;
  margin-bottom: 6px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.6);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
  position: relative;
}
.sidebar-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-link.active {
  background: var(--navy-700);
  color: #fff;
}
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--amber-500);
  border-radius: 0 2px 2px 0;
}
.sidebar-link i { width: 18px; text-align: center; font-size: 14px; }
.sidebar-badge {
  margin-left: auto;
  background: var(--amber-500);
  color: var(--navy-900);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
}

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  background: var(--navy-700);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--amber-400);
  font-size: 14px;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-info strong {
  display: block;
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-info span {
  font-size: 11px;
  color: rgba(255,255,255,.4);
}

/* ── Admin Main ─────────────────────────────────────────────── */
.admin-main {
  margin-left: 260px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 999;
}
.admin-topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.admin-page-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--navy-900);
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--slate-500);
  margin-top: 2px;
}
.breadcrumb a { color: var(--navy-500); }
.breadcrumb a:hover { text-decoration: underline; }

.menu-toggle {
  display: none;
  background: none;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  color: var(--slate-700);
  font-size: 16px;
}

.admin-content { padding: 32px; flex: 1; }

/* ── Dashboard KPI Cards ────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.kpi-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.kpi-info { flex: 1; }
.kpi-num {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  color: var(--navy-900);
  line-height: 1;
  margin-bottom: 4px;
}
.kpi-label { font-size: 13px; color: var(--slate-500); font-weight: 500; }
.kpi-trend {
  font-size: 12px;
  margin-top: 6px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.trend-up   { color: var(--green-600); }
.trend-down { color: var(--red-600); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary   { background: var(--navy-800); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }

.btn-success   { background: var(--green-600); color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-amber     { background: var(--amber-500); color: var(--navy-900); }
.btn-amber:hover { background: var(--amber-400); }

.btn-danger    { background: var(--red-600); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-ghost     { background: transparent; color: var(--slate-700); border: 1.5px solid var(--slate-200); }
.btn-ghost:hover { background: var(--slate-50); border-color: var(--slate-300); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-icon { padding: 9px; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  overflow: hidden;
}
.form-section {
  padding: 28px 32px;
  border-bottom: 1px solid var(--slate-100);
}
.form-section:last-child { border-bottom: none; }
.form-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy-900);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.form-section-title i { color: var(--amber-500); font-size: 16px; }
.form-section-desc {
  font-size: 13px;
  color: var(--slate-500);
  margin-bottom: 20px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
}
label.form-label .req { color: var(--red-600); margin-left: 3px; }

.form-control {
  padding: 10px 14px;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--slate-900);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--navy-500);
  box-shadow: 0 0 0 3px rgba(29,92,173,.12);
}
.form-control.error { border-color: var(--red-600); }
.form-hint { font-size: 12px; color: var(--slate-500); }
.form-error { font-size: 12px; color: var(--red-600); font-weight: 500; }

textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

.range-wrapper { display: flex; align-items: center; gap: 12px; }
input[type="range"] { flex: 1; }
.range-val {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--navy-800);
  width: 44px;
  text-align: right;
}

.form-actions {
  padding: 24px 32px;
  background: var(--slate-50);
  border-top: 1px solid var(--slate-200);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}
.alert i { margin-top: 1px; font-size: 16px; flex-shrink: 0; }
.alert-success { background: var(--green-100); color: #14532d; border: 1px solid #bbf7d0; }
.alert-danger   { background: var(--red-100);   color: #7f1d1d; border: 1px solid #fecaca; }
.alert-warning  { background: var(--amber-100); color: #78350f; border: 1px solid #fde68a; }
.alert-info     { background: var(--navy-100);  color: var(--navy-800); border: 1px solid var(--navy-200); }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  margin-top: 32px;
  flex-wrap: wrap;
}
.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
  background: #fff;
  border: 1.5px solid var(--slate-200);
  color: var(--slate-700);
}
.page-link:hover   { border-color: var(--navy-400); color: var(--navy-700); }
.page-link.active  { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.page-link.disabled{ opacity: .5; pointer-events: none; }

/* ── Login ──────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-800) 50%, var(--navy-700) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(245,158,11,.12) 0%, transparent 60%);
  top: -100px;
  right: -100px;
  border-radius: 50%;
}
.login-card {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  padding: 48px 40px;
  box-shadow: var(--shadow-xl);
  position: relative;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}
.login-logo-icon {
  width: 56px;
  height: 56px;
  background: transparent;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.2));
}
.login-logo-text h1 { font-size: 24px; font-weight: 800; color: var(--navy-900); }
.login-logo-text p  { font-size: 13px; color: var(--slate-500); }

.input-group {
  position: relative;
  margin-bottom: 16px;
}
.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 6px;
}
.input-group input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color var(--transition);
}
.input-group input:focus { outline: none; border-color: var(--navy-500); }
.input-group-icon {
  position: absolute;
  left: 14px;
  bottom: 13px;
  color: var(--slate-400);
  font-size: 16px;
}
.input-toggle {
  position: absolute;
  right: 14px;
  bottom: 13px;
  background: none;
  border: none;
  color: var(--slate-400);
  cursor: pointer;
  font-size: 15px;
  padding: 0;
}

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  background: var(--navy-950);
  color: rgba(255,255,255,.6);
  padding: 48px 24px 24px;
  margin-top: auto;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 24px;
}
.footer-brand h3 { color: #fff; margin-bottom: 8px; }
.footer-col h4 { color: rgba(255,255,255,.8); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 16px; }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-size: 14px; transition: color var(--transition); }
.footer-links a:hover { color: var(--amber-400); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Utilities ──────────────────────────────────────────────── */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }

/* ── Leaflet Custom ─────────────────────────────────────────── */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  border: none !important;
  padding: 0 !important;
  overflow: hidden;
}
.leaflet-popup-content { margin: 0 !important; }
.popup-body {
  padding: 16px 20px;
  min-width: 220px;
}
.popup-status {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 6px;
}
.popup-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; color: var(--navy-900); }
.popup-local { font-size: 12px; color: var(--slate-500); margin-bottom: 10px; }
.popup-progress { margin-bottom: 8px; }
.popup-link {
  display: block;
  text-align: center;
  padding: 8px;
  background: var(--navy-800);
  color: #fff !important;
  font-size: 13px;
  font-weight: 600;
}
.popup-link:hover { background: var(--navy-700); }

.marker-custom {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 3px 12px rgba(0,0,0,.3);
  border: 2px solid rgba(255,255,255,.8);
}
.marker-custom i {
  transform: rotate(45deg);
  font-size: 14px;
  color: #fff;
}

/* ── Print ──────────────────────────────────────────────────── */
@media print {
  .sidebar, .admin-topbar, .nav-links, .filters-bar, .btn { display: none !important; }
  .admin-main { margin-left: 0 !important; }
  .admin-content { padding: 0 !important; }
  body { background: #fff; }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .admin-main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4,13,33,.5);
    z-index: 1000;
    display: none;
  }
  .sidebar-overlay.show { display: block; }
}
@media (max-width: 768px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: 72px; left: 0; right: 0; background: var(--navy-800); padding: 16px; gap: 4px; }
  .nav-links.open { display: flex; }
  .hamburger { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .obras-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .admin-content { padding: 20px 16px; }
  .form-section { padding: 20px; }
  .form-actions { padding: 16px 20px; }
  #mapa-obras { height: 380px; }
  .map-legend { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .modal-overlay { padding: 12px; }
  .modal { max-height: 95vh; border-radius: 16px; }
  .modal-header { padding: 18px 16px 0; }
  .modal-body { padding: 16px 16px 24px; }
  #obra-tabs-nav { padding: 0 16px; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding: 40px 16px; }
  .login-card { padding: 32px 24px; }
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.animate-in { animation: fadeInUp .4s ease forwards; }
.loading-spin { animation: spin 1s linear infinite; }

.skeleton {
  background: linear-gradient(90deg, var(--slate-200) 25%, var(--slate-100) 50%, var(--slate-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Botão ir ao topo ──────────────────────────────────────── */
#btnTopo {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--navy-800);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .25s, visibility .25s, transform .25s, background .15s;
}
#btnTopo.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#btnTopo:hover { background: var(--navy-600); }
@media (max-width: 640px) {
  #btnTopo { bottom: 20px; right: 20px; width: 42px; height: 42px; font-size: 14px; }
}

/* ══════════════════════════════════════════════════════════════
   TEMA ESCURO — Portal Público
   ══════════════════════════════════════════════════════════════ */

html[data-theme="dark"] {
  --slate-50:  #0d1117;
  --slate-100: #161b27;
  --slate-200: #2d3748;
  --slate-300: #4a5568;
  --slate-400: #94a3b8;
  --slate-500: #94a3b8;
  --slate-700: #e2e8f0;
  --slate-900: #f8fafc;
}

html[data-theme="dark"] body {
  background: #0d1117;
  color: #e2e8f0;
}

/* Cards de obra */
html[data-theme="dark"] .card {
  background: #161b27;
  border-color: #2d3748;
}

html[data-theme="dark"] .card-body {
  background: #161b27;
}

html[data-theme="dark"] .card-title a {
  color: #e2e8f0;
}

html[data-theme="dark"] .card-meta,
html[data-theme="dark"] .card-location {
  color: #94a3b8;
}

html[data-theme="dark"] .card-value-label {
  color: #64748b;
}

html[data-theme="dark"] .card-value-num {
  color: #f1f5f9;
}

/* Filtros */
html[data-theme="dark"] .filters-bar {
  background: #161b27;
  border-color: #2d3748;
}

html[data-theme="dark"] .filter-select,
html[data-theme="dark"] .filter-input,
html[data-theme="dark"] .search-input {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

/* KPIs */
html[data-theme="dark"] .kpi-card {
  background: #161b27;
  border-color: #2d3748;
}

html[data-theme="dark"] .kpi-num {
  color: #f1f5f9;
}

html[data-theme="dark"] .kpi-label {
  color: #94a3b8;
}

/* Seção de obras */
html[data-theme="dark"] .obras-section,
html[data-theme="dark"] .content-area {
  background: #0d1117;
}

/* View btn */
html[data-theme="dark"] .view-btn {
  background: #1e293b;
  color: #94a3b8;
  border-color: #334155;
}
html[data-theme="dark"] .view-btn.active {
  background: #2d3748;
  color: #f1f5f9;
}

/* Paginação */
html[data-theme="dark"] .pagination a,
html[data-theme="dark"] .pagination span {
  background: #161b27;
  border-color: #2d3748;
  color: #94a3b8;
}
html[data-theme="dark"] .pagination a:hover {
  background: #1e293b;
}

/* Badges */
html[data-theme="dark"] .badge-status-planejada    { background: #0c2340; color: #60a5fa; }
html[data-theme="dark"] .badge-status-em_andamento { background: #052e16; color: #4ade80; }
html[data-theme="dark"] .badge-status-concluida    { background: #052e16; color: #86efac; }
html[data-theme="dark"] .badge-status-paralisada   { background: #450a0a; color: #f87171; }
html[data-theme="dark"] .badge-status-cancelada    { background: #1a1a2e; color: #94a3b8; }
html[data-theme="dark"] .badge-status-licitacao    { background: #2d1b00; color: #fbbf24; }

/* Botão toggle tema no portal */
.theme-toggle-public {
  width: 36px; height: 36px;
  border: 1.5px solid rgba(255,255,255,.2);
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.8);
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .2s;
  flex-shrink: 0;
}
.theme-toggle-public:hover {
  background: rgba(255,255,255,.16);
  color: #fff;
}
