/* ============================================================
   TUPÃ - Design System 2026
   Paleta: Verde institucional + Azul escuro + Cinza neutro
   ============================================================ */

/* ---------- CSS Variables / Tokens ---------- */
:root {
  /* Brand */
  --primary:        #1a7a4a;
  --primary-dark:   #145e38;
  --primary-light:  #e8f5ee;
  --primary-mid:    #2ecc71;

  /* Accent */
  --accent:         #1565c0;
  --accent-dark:    #0d47a1;
  --accent-light:   #e3f0ff;

  /* Sidebar */
  --sidebar-bg:     #0f2027;
  --sidebar-hover:  rgba(255,255,255,0.08);
  --sidebar-active: rgba(26,122,74,0.85);
  --sidebar-text:   rgba(255,255,255,0.75);
  --sidebar-width:  240px;
  --sidebar-mini:   64px;

  /* Topbar */
  --topbar-bg:      #0f2027;
  --topbar-height:  60px;

  /* Surfaces */
  --body-bg:        #f0f2f5;
  --card-bg:        #ffffff;
  --card-border:    #e8ecf0;
  --border:         #dee2e6;

  /* Typography */
  --text-main:      #1a1f36;
  --text-secondary: #6b7280;
  --text-muted:     #9ca3af;
  --font:           'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

  /* Status */
  --success:        #16a34a;
  --success-light:  #dcfce7;
  --warning:        #d97706;
  --warning-light:  #fef3c7;
  --danger:         #dc2626;
  --danger-light:   #fee2e2;
  --info:           #0284c7;
  --info-light:     #e0f2fe;

  /* Spacing */
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:     0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);

  /* Transitions */
  --transition: all 0.2s ease;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 14px; }

body {
  font-family: var(--font);
  background: var(--body-bg);
  color: var(--text-main);
  line-height: 1.6;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: none; }

h1,h2,h3,h4,h5,h6 { font-weight: 600; line-height: 1.3; color: var(--text-main); }

/* ---------- Utilities ---------- */
.hide { display: none !important; }
.w-full { width: 100%; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ============================================================
   PRELOADER
   ============================================================ */
#preloader {
  position: fixed; inset: 0;
  background: #fff;
  z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  transition: opacity 0.4s;
}
#preloader img { width: 72px; margin-bottom: 16px; }
#preloader p {
  font-size: 22px; font-weight: 700; color: var(--primary);
  letter-spacing: 3px; font-family: monospace;
}
#preloader .loader-bar {
  width: 120px; height: 3px; background: #e5e7eb; border-radius: 99px; margin-top: 16px; overflow: hidden;
}
#preloader .loader-bar::after {
  content: '';
  display: block; height: 100%;
  background: var(--primary);
  animation: preload 1.2s ease-in-out infinite;
}
@keyframes preload {
  0%  { width: 0%; margin-left: 0; }
  50% { width: 70%; margin-left: 15%; }
  100%{ width: 0%; margin-left: 100%; }
}

/* ============================================================
   GLOBAL LOADING BAR (top)
   ============================================================ */
#global-loading {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px; z-index: 99998; display: none;
}
#global-loading.show { display: block; }
#global-loading .bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-mid));
  animation: loadbar 1.4s ease-in-out infinite;
}
@keyframes loadbar {
  0%   { width: 0%;   margin-left: 0; }
  50%  { width: 60%;  margin-left: 20%; }
  100% { width: 0%;   margin-left: 100%; }
}

/* ============================================================
   TOPBAR / HEADER
   ============================================================ */
#topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--topbar-bg);
  z-index: 1030;
  display: flex; align-items: center;
  padding: 0 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: white;
  min-width: var(--sidebar-width);
  padding-right: 20px;
}
.topbar-brand img { width: 28px; }
.topbar-brand .brand-name {
  font-size: 18px; font-weight: 700;
  letter-spacing: 2px; font-family: monospace;
  color: #fff;
}

.topbar-toggle {
  background: none; border: none; color: rgba(255,255,255,.7);
  font-size: 20px; cursor: pointer; padding: 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  margin-right: 8px;
}
.topbar-toggle:hover { background: rgba(255,255,255,.1); color: #fff; }

.topbar-spacer { flex: 1; }

.topbar-right {
  display: flex; align-items: center; gap: 4px;
}

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,.85);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}
.topbar-user .avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
}

.topbar-btn {
  background: none; border: none;
  color: rgba(255,255,255,.7);
  padding: 8px 14px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px;
  display: flex; align-items: center; gap: 6px;
  transition: var(--transition);
}
.topbar-btn:hover { background: rgba(255,255,255,.1); color: white; }

/* ============================================================
   SIDEBAR
   ============================================================ */
#sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  z-index: 1020;
  overflow-y: auto; overflow-x: hidden;
  transition: width 0.25s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 99px; }

body.sidebar-mini #sidebar { width: var(--sidebar-mini); }

.sidebar-section {
  padding: 20px 0 8px;
}
.sidebar-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: rgba(255,255,255,.3);
  padding: 0 20px 8px;
  white-space: nowrap; overflow: hidden;
  transition: var(--transition);
}
body.sidebar-mini .sidebar-section-label { opacity: 0; }

.sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  cursor: pointer;
  border-radius: 0;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  font-size: 13.5px;
  font-weight: 500;
}
.sidebar-item:hover {
  background: var(--sidebar-hover);
  color: white;
  text-decoration: none;
}
.sidebar-item.active {
  background: var(--sidebar-active);
  color: white;
}
.sidebar-item.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--primary-mid);
  border-radius: 0 2px 2px 0;
}
.sidebar-item i {
  font-size: 16px; min-width: 24px;
  text-align: center; flex-shrink: 0;
}
.sidebar-item .nav-text {
  transition: opacity 0.2s;
  white-space: nowrap;
}
body.sidebar-mini .sidebar-item .nav-text { opacity: 0; width: 0; overflow: hidden; }
body.sidebar-mini .sidebar-item { justify-content: center; padding: 12px; }

/* Tooltip for mini sidebar */
body.sidebar-mini .sidebar-item { position: relative; }
body.sidebar-mini .sidebar-item:hover::after {
  content: attr(data-tooltip);
  position: absolute; left: calc(var(--sidebar-mini) + 8px); top: 50%;
  transform: translateY(-50%);
  background: #1a1a2e; color: white;
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 13px; white-space: nowrap;
  z-index: 9999;
  box-shadow: var(--shadow);
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
#main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
  transition: margin-left 0.25s ease;
  padding: 0;
}
body.sidebar-mini #main-content { margin-left: var(--sidebar-mini); }

/* ============================================================
   BREADCRUMB
   ============================================================ */
.tupa-breadcrumb {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex; align-items: center; gap: 6px;
}
.tupa-breadcrumb a {
  color: var(--text-secondary); font-size: 13px;
}
.tupa-breadcrumb a:hover { color: var(--primary); }
.tupa-breadcrumb .sep { color: var(--text-muted); font-size: 12px; }
.tupa-breadcrumb .current {
  color: var(--text-main); font-size: 13px; font-weight: 600;
}

/* Page title bar */
.page-title-bar {
  padding: 20px 28px 0;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.page-title-bar h2 {
  font-size: 20px; font-weight: 700; margin: 0;
  color: var(--text-main);
}
.page-title-bar p { margin: 2px 0 0; font-size: 13px; color: var(--text-secondary); }

/* Content padding */
.content-area { padding: 20px 28px 40px; }

/* ============================================================
   CARDS
   ============================================================ */
.tupa-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.tupa-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.tupa-card-header h5 {
  margin: 0; font-size: 15px; font-weight: 600; color: var(--text-main);
  display: flex; align-items: center; gap: 8px;
}
.tupa-card-header h5 i { color: var(--primary); font-size: 16px; }
.tupa-card-body { padding: 20px; }
.tupa-card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: #fafafa;
  display: flex; align-items: center; gap: 10px;
}

/* ============================================================
   STAT CARDS (Dashboard)
   ============================================================ */
.stat-cards { display: grid; gap: 16px; }
.stat-cards-4 { grid-template-columns: repeat(4, 1fr); }
.stat-cards-3 { grid-template-columns: repeat(3, 1fr); }

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.green::before  { background: var(--primary); }
.stat-card.blue::before   { background: var(--accent); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.purple::before { background: #7c3aed; }
.stat-card.teal::before   { background: #0891b2; }
.stat-card.red::before    { background: var(--danger); }

.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 4px;
}
.stat-card.green .stat-icon  { background: var(--primary-light); color: var(--primary); }
.stat-card.blue .stat-icon   { background: var(--accent-light); color: var(--accent); }
.stat-card.orange .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-card.purple .stat-icon { background: #f3e8ff; color: #7c3aed; }
.stat-card.teal .stat-icon   { background: #e0f7fa; color: #0891b2; }
.stat-card.red .stat-icon    { background: var(--danger-light); color: var(--danger); }

.stat-card .stat-value {
  font-size: 28px; font-weight: 800; line-height: 1;
  color: var(--text-main);
}
.stat-card .stat-label {
  font-size: 12.5px; color: var(--text-secondary); font-weight: 500;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-tupa {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 13.5px; font-weight: 500;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  transition: var(--transition);
  line-height: 1;
  text-decoration: none;
}
.btn-tupa:focus { outline: none; box-shadow: 0 0 0 3px rgba(26,122,74,.25); }
.btn-tupa:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary-tupa {
  background: var(--primary); color: white;
}
.btn-primary-tupa:hover { background: var(--primary-dark); color: white; }

.btn-accent-tupa {
  background: var(--accent); color: white;
}
.btn-accent-tupa:hover { background: var(--accent-dark); color: white; }

.btn-danger-tupa {
  background: var(--danger); color: white;
}
.btn-danger-tupa:hover { background: #b91c1c; color: white; }

.btn-ghost-tupa {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost-tupa:hover { background: var(--body-bg); color: var(--text-main); border-color: #c1c9d2; }

.btn-icon {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
}
.btn-icon:focus { outline: none; }
.btn-icon-edit  { background: var(--info-light); color: var(--info); }
.btn-icon-edit:hover  { background: var(--info); color: white; }
.btn-icon-delete { background: var(--danger-light); color: var(--danger); }
.btn-icon-delete:hover { background: var(--danger); color: white; }
.btn-icon-view  { background: #f1f5f9; color: var(--text-secondary); }
.btn-icon-view:hover  { background: #e2e8f0; color: var(--text-main); }

.btn-new {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary); color: white;
  border: none; padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  text-decoration: none;
}
.btn-new:hover { background: var(--primary-dark); color: white; }
.btn-new i { font-size: 15px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-label-tupa {
  font-size: 12.5px; font-weight: 600;
  color: var(--text-secondary); letter-spacing: 0.3px;
  margin-bottom: 6px; display: block;
  text-transform: uppercase;
}
.form-label-tupa.error { color: var(--danger); }

.form-control-tupa {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font);
  background: #fff;
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  transition: var(--transition);
  appearance: none;
}
/* Chevron customizado para <select> nativo (sem Select2). */
select.form-control-tupa {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1L6 6L11 1' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}
.form-control-tupa:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,122,74,.12);
}
.form-control-tupa.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220,38,38,.1);
}
.form-control-tupa::placeholder { color: #9ca3af; }

.form-feedback {
  font-size: 12px; color: var(--danger);
  margin-top: 4px; display: flex; align-items: center; gap: 4px;
}

.form-section {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}
.form-section-header {
  padding: 12px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 700;
  color: var(--text-secondary); letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.form-section-header i { color: var(--primary); }
.form-section-body { padding: 20px; }
.form-row-grid {
  display: grid;
  gap: 18px 20px;
  /* Evita os campos ficarem absurdamente largos em monitores wide.
     Cada coluna fica com ~280-380px (faixa confortável de UX). */
  max-width: 1180px;
}
.form-row-grid.cols-1 { grid-template-columns: 1fr; max-width: 560px; }
.form-row-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); max-width: 880px; }
.form-row-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); max-width: 1180px; }

/* Select2 Custom */
.select2-container--default .select2-selection--single {
  height: 38px;
  border: 1.5px solid #d1d5db !important;
  border-radius: var(--radius-sm) !important;
  background: #fff !important;
  font-family: var(--font) !important;
  display: flex; align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 38px !important; color: var(--text-main) !important;
  padding-left: 12px !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 36px !important;
}
.select2-container--default .select2-selection--single:focus,
.select2-container--focus .select2-selection--single {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(26,122,74,.12) !important;
  outline: none !important;
}
.select2-dropdown {
  border: 1.5px solid #d1d5db !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow) !important;
  font-family: var(--font) !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: var(--primary) !important;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.tupa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.tupa-table thead th {
  background: #f8fafc;
  padding: 11px 16px;
  text-align: left;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tupa-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}
.tupa-table tbody tr:last-child { border-bottom: none; }
.tupa-table tbody tr:hover { background: #f8fafc; }
.tupa-table tbody td {
  padding: 11px 16px; color: var(--text-main);
  vertical-align: middle;
}
.tupa-table .td-actions {
  display: flex; gap: 4px; align-items: center;
}

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input {
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: var(--font);
  font-size: 13px;
  margin-left: 8px;
}
.dataTables_wrapper .dataTables_filter input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,122,74,.12);
}
.dataTables_wrapper .dataTables_length select {
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-family: var(--font);
  font-size: 13px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--radius-sm) !important;
  border: none !important;
  font-size: 13px !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary) !important;
  color: white !important;
  border: none !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--primary-light) !important;
  color: var(--primary) !important;
  border: none !important;
}
.dataTables_wrapper .dataTables_info {
  font-size: 12.5px; color: var(--text-secondary);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge-tupa {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600;
}
.badge-green  { background: var(--success-light); color: var(--success); }
.badge-blue   { background: var(--info-light); color: var(--info); }
.badge-orange { background: var(--warning-light); color: var(--warning); }
.badge-red    { background: var(--danger-light); color: var(--danger); }
.badge-gray   { background: #f1f5f9; color: var(--text-secondary); }
.badge-purple { background: #f3e8ff; color: #7c3aed; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  padding: 60px 20px; text-align: center;
}
.empty-state .empty-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  background: var(--body-bg); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: var(--text-muted);
}
.empty-state h6 { font-size: 15px; color: var(--text-secondary); margin: 0; }
.empty-state p  { font-size: 13px; color: var(--text-muted); margin: 6px 0 0; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-tupa .modal-content {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.modal-tupa .modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-tupa .modal-header.danger {
  background: var(--danger); color: white;
}
.modal-tupa .modal-title {
  font-size: 15px; font-weight: 700; margin: 0;
}
.modal-tupa .modal-body { padding: 20px 24px; }
.modal-tupa .modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  gap: 8px;
}
.modal-tupa .close { color: inherit; opacity: 0.8; }
.modal-tupa .close:hover { opacity: 1; }

/* ============================================================
   MAP AREA
   ============================================================ */
.map-wrapper {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #e8eef3;
}
.map-inner {
  width: 100%; height: 480px;
}
.map-panel {
  position: absolute; left: 16px; top: 16px;
  z-index: 500; min-width: 220px; max-width: 260px;
}
.map-panel .tupa-card { box-shadow: var(--shadow-lg); }
.map-panel .panel-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.map-panel .panel-row:last-child { border-bottom: none; padding-bottom: 0; }
.map-panel .panel-row .val {
  font-size: 16px; font-weight: 700; color: var(--text-main);
}
.map-panel .panel-row i { color: var(--primary); margin-right: 6px; width: 16px; }

/* ============================================================
   AÇÃO TAGS (has-many)
   ============================================================ */
.tag-list {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.tag-item {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-light);
  border: 1px solid rgba(26,122,74,.2);
  color: var(--primary-dark);
  padding: 4px 10px; border-radius: 99px;
  font-size: 12.5px; cursor: pointer;
  transition: var(--transition);
}
.tag-item:hover { background: var(--danger-light); border-color: rgba(220,38,38,.2); color: var(--danger); }
.tag-item i { font-size: 11px; }
.tag-empty {
  font-size: 13px; color: var(--text-muted);
  font-style: italic; padding: 8px 0;
}

/* ============================================================
   ANEXOS (gallery)
   ============================================================ */
.anexo-gallery {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 8px 0;
}
.anexo-thumb {
  width: 80px; height: 80px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  overflow: hidden; cursor: pointer;
  transition: var(--transition);
}
.anexo-thumb:hover { border-color: var(--primary); transform: scale(1.04); }
.anexo-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #0f2027 0%, #162b35 50%, #1a3a4a 100%);
}
.login-left {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.login-right {
  width: 460px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  background: rgba(255,255,255,.04);
  border-left: 1px solid rgba(255,255,255,.08);
}
.login-brand { text-align: center; }
.login-brand img { width: 80px; margin-bottom: 20px; filter: drop-shadow(0 4px 12px rgba(0,0,0,.3)); }
.login-brand h1 {
  font-size: 36px; font-weight: 800; letter-spacing: 6px;
  font-family: monospace;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 12px;
}
.login-brand .tagline {
  color: rgba(255,255,255,.5); font-size: 14px;
  max-width: 280px; line-height: 1.7;
}
.login-brand .system-name {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(26,122,74,.2);
  border: 1px solid rgba(26,122,74,.4);
  color: var(--primary-mid);
  padding: 6px 16px; border-radius: 99px;
  font-size: 12px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; margin-top: 20px;
}
.login-box {
  width: 100%; max-width: 380px;
}
.login-box-header {
  text-align: center; margin-bottom: 32px;
}
.login-box-header h2 {
  font-size: 22px; font-weight: 700; color: white;
  margin: 0 0 6px;
}
.login-box-header p { font-size: 13.5px; color: rgba(255,255,255,.5); margin: 0; }

.login-field { margin-bottom: 16px; }
.login-field label {
  display: block; font-size: 12px; font-weight: 600;
  color: rgba(255,255,255,.6); letter-spacing: 0.5px;
  text-transform: uppercase; margin-bottom: 8px;
}
.login-input-wrap { position: relative; }
.login-input-wrap .input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: rgba(255,255,255,.35); font-size: 15px;
}
.login-input-wrap input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: rgba(255,255,255,.08);
  border: 1.5px solid rgba(255,255,255,.12);
  border-radius: var(--radius-sm);
  color: white; font-family: var(--font); font-size: 14px;
  transition: var(--transition);
}
.login-input-wrap input::placeholder { color: rgba(255,255,255,.3); }
.login-input-wrap input:focus {
  outline: none;
  border-color: var(--primary-mid);
  background: rgba(255,255,255,.1);
  box-shadow: 0 0 0 3px rgba(46,204,113,.15);
}

.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  border: none; border-radius: var(--radius-sm);
  color: white; font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: var(--font);
  transition: var(--transition);
  margin-top: 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-login:hover { background: var(--primary-dark); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

.login-loading {
  height: 2px; background: rgba(255,255,255,.1);
  border-radius: 99px; overflow: hidden; margin: 12px 0;
}
.login-loading-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-mid), var(--accent));
  animation: loadbar 1.2s ease-in-out infinite;
}

/* ============================================================
   TOASTR Custom
   ============================================================ */
#toast-container > div {
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
  font-family: var(--font) !important;
  font-size: 13.5px !important;
  padding: 12px 18px 12px 50px !important;
}
#toast-container > .toast-success { background: var(--success) !important; }
#toast-container > .toast-error   { background: var(--danger) !important; }
#toast-container > .toast-warning { background: var(--warning) !important; }
#toast-container > .toast-info    { background: var(--accent) !important; }

/* ============================================================
   CHECKBOX / RADIO custom
   ============================================================ */
.check-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.check-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition);
  font-size: 13px;
}
.check-item:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}
.check-item input { accent-color: var(--primary); }

/* ============================================================
   PROGRESS LOADING (inline)
   ============================================================ */
.inline-loading {
  height: 3px; background: #e5e7eb;
  border-radius: 99px; overflow: hidden;
  margin: 8px 0;
}
.inline-loading-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-mid));
  animation: loadbar 1.2s ease-in-out infinite;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .stat-cards-4 { grid-template-columns: repeat(2, 1fr); }
  /* form-row-grid já é responsivo via auto-fit minmax — mas reforçamos
     o limite em telas médias pra não passar de 2 cols visualmente. */
  .form-row-grid.cols-3 { max-width: 100%; }
  .form-row-grid.cols-2 { max-width: 100%; }
}
@media (max-width: 768px) {
  :root {
    --sidebar-width: var(--sidebar-mini);
  }
  body:not(.sidebar-mini) #sidebar { width: var(--sidebar-width); }
  .login-left { display: none; }
  .login-right { width: 100%; border-left: none; }
  .stat-cards-4, .stat-cards-3 { grid-template-columns: 1fr 1fr; }
  .form-row-grid.cols-2,
  .form-row-grid.cols-3 { grid-template-columns: 1fr; }
  .content-area { padding: 16px; }
  .page-title-bar { padding: 16px 16px 0; }
  .tupa-breadcrumb { padding: 10px 16px; }
  .map-inner { height: 300px; }
  .map-panel { position: relative; left: 0; top: 0; max-width: 100%; margin-bottom: 12px; }
  .topbar-brand .brand-name { display: none; }
}
@media (max-width: 480px) {
  .stat-cards-4, .stat-cards-3 { grid-template-columns: 1fr; }
}

/* ============================================================
   MISC / OVERRIDES
   ============================================================ */
.cursor-pointer { cursor: pointer; }
.text-muted-tupa { color: var(--text-muted); }
.text-secondary-tupa { color: var(--text-secondary); }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* Page transitions */
.page-section { animation: fadeUp 0.2s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Leaflet overrides */
.leaflet-container { border-radius: 0; }
.leaflet-control-zoom a {
  border-radius: var(--radius-sm) !important;
  font-family: var(--font) !important;
}

/* ============================================================
   Toastr overrides — usa Font Awesome via ::before, ignora
   completamente o background-image do CSS do CDN (que estava
   gerando mosaico ilegível por CSP/repeat issues).
   ============================================================ */
#toast-container > div {
  opacity: 1 !important;
  background-image: none !important;  /* mata o ícone PNG que multiplicava */
  border-radius: var(--radius) !important;
  padding: 14px 18px 14px 52px !important;
  position: relative !important;
  box-shadow: var(--shadow-lg) !important;
  font-family: var(--font) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  min-width: 320px !important;
  max-width: 480px !important;
  margin-bottom: 8px !important;
  color: #fff !important;
}
#toast-container > div::before {
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", FontAwesome !important;
  font-weight: 900 !important;
  font-size: 20px !important;
  position: absolute !important;
  left: 18px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  color: #fff !important;
  line-height: 1 !important;
  width: 22px !important;
  height: 22px !important;
  text-align: center !important;
}
/* Reset agressivo — toastr CDN tem background-image PNG via classe
   específica (.toast-success, etc) que ganha do reset do <div>.
   Aplicar background: none em CADA variante elimina o mosaico. */
#toast-container > .toast-success,
#toast-container > .toast-error,
#toast-container > .toast-warning,
#toast-container > .toast-info {
  background-image: none !important;
  background: none !important;
}
#toast-container > .toast-success {
  background: var(--success, #16a34a) !important;
  background-color: var(--success, #16a34a) !important;
  background-image: none !important;
}
#toast-container > .toast-success::before { content: "\f00c" !important; } /* check */
#toast-container > .toast-error {
  background: var(--danger, #dc2626) !important;
  background-color: var(--danger, #dc2626) !important;
  background-image: none !important;
}
#toast-container > .toast-error::before { content: "\f06a" !important; } /* circle-exclamation */
#toast-container > .toast-warning {
  background: var(--warning, #d97706) !important;
  background-color: var(--warning, #d97706) !important;
  background-image: none !important;
}
#toast-container > .toast-warning::before { content: "\f071" !important; } /* triangle-exclamation */
#toast-container > .toast-info {
  background: var(--accent, #1565c0) !important;
  background-color: var(--accent, #1565c0) !important;
  background-image: none !important;
}
#toast-container > .toast-info::before { content: "\f05a" !important; } /* circle-info */
#toast-container .toast-title { font-weight: 700; margin-bottom: 2px; color: #fff; }
#toast-container .toast-message { line-height: 1.45; color: #fff; }
#toast-container .toast-close-button {
  color: rgba(255,255,255,.85) !important;
  text-shadow: none !important;
  font-weight: 400 !important;
  font-size: 18px !important;
  opacity: 0.7 !important;
}
#toast-container .toast-close-button:hover { opacity: 1 !important; }
#toast-container > div .toast-progress {
  background-color: rgba(255,255,255,.4) !important;
  height: 3px !important;
}
