/* ==========================================
   GeoAmbiental — Sistema de Consultoria Ambiental
   CSS Principal
   ========================================== */

:root {
  --primary:       #1e7d4b;
  --primary-dark:  #155c36;
  --primary-light: #e8f5ee;
  --secondary:     #2c6e49;
  --accent:        #40c074;
  --accent-light:  #d4f4e3;

  --warning:       #f59e0b;
  --warning-light: #fef3c7;
  --danger:        #ef4444;
  --danger-light:  #fee2e2;
  --info:          #3b82f6;
  --info-light:    #dbeafe;
  --success:       #22c55e;
  --success-light: #dcfce7;

  --bg:            #f0f4f1;
  --bg-card:       #ffffff;
  --border:        #d1ddd6;
  --border-light:  #e8f0ea;

  --text:          #1a2e22;
  --text-muted:    #6b7c70;
  --text-light:    #9ab0a0;

  --sidebar-w:     260px;
  --sidebar-bg:    #0d2d1a;
  --sidebar-text:  #a8c4b4;
  --sidebar-active:#1e7d4b;

  --radius:        10px;
  --radius-lg:     16px;
  --shadow:        0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.12);

  --font:          'Inter', system-ui, sans-serif;
  --transition:    .2s ease;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==========================================
   SCROLLBAR
   ========================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition), width var(--transition);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: #fff;
  flex-shrink: 0;
}

.brand-text { flex: 1; overflow: hidden; }
.brand-name { display: block; color: #fff; font-weight: 700; font-size: .95rem; white-space: nowrap; }
.brand-sub  { display: block; color: var(--sidebar-text); font-size: .72rem; white-space: nowrap; }

.sidebar-toggle {
  background: none; border: none; color: var(--sidebar-text);
  font-size: 1.1rem; cursor: pointer; padding: 4px;
  transition: color var(--transition);
  display: none;
}
.sidebar-toggle:hover { color: #fff; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav-section-label {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #4a7060;
  padding: 14px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
  white-space: nowrap;
}

.nav-item i { width: 18px; text-align: center; font-size: .95rem; }

.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(30,125,75,.4);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.footer-info {
  display: flex; align-items: center; gap: 8px;
  color: #4a7060; font-size: .78rem;
}

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

/* ==========================================
   TOPBAR
   ========================================== */
.topbar {
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 var(--border-light);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.mobile-toggle {
  background: none; border: none;
  font-size: 1.1rem; color: var(--text-muted);
  cursor: pointer; display: none;
}

.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: .875rem; color: var(--text-muted); font-weight: 500;
}
.breadcrumb i { color: var(--primary); }

.topbar-right { display: flex; align-items: center; gap: 14px; }

.topbar-alert {
  position: relative;
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid #fcd34d;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: .8rem;
  font-weight: 600;
  display: flex; align-items: center; gap: 5px;
  cursor: pointer;
  animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
  0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,.3); }
  50%      { box-shadow: 0 0 0 6px rgba(245,158,11,0); }
}

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  font-size: .875rem; font-weight: 500; color: var(--text);
}
.user-avatar {
  width: 34px; height: 34px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: .9rem;
}

/* ==========================================
   PAGE CONTAINER
   ========================================== */
.page-container { padding: 28px; flex: 1; }

.page { display: none; }
.page.active { display: block; animation: fadeIn .25s ease; }

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

.page-header {
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.page-header h1 i { color: var(--primary); font-size: 1.3rem; }
.page-header p { color: var(--text-muted); font-size: .9rem; margin-top: 4px; }

/* ==========================================
   STATS GRID
   ========================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border: 1px solid var(--border-light);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.stat-sub   { font-size: .76rem; color: var(--text-light); margin-top: 4px; }

.stat-green  .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-green  .stat-value { color: var(--primary); }
.stat-blue   .stat-icon { background: var(--info-light); color: var(--info); }
.stat-blue   .stat-value { color: var(--info); }
.stat-orange .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-orange .stat-value { color: var(--warning); }
.stat-red    .stat-icon { background: var(--danger-light); color: var(--danger); }
.stat-red    .stat-value { color: var(--danger); }
.stat-teal   .stat-icon { background: #e0f2fe; color: #0891b2; }
.stat-teal   .stat-value { color: #0891b2; }

/* ==========================================
   DASHBOARD GRID
   ========================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.dash-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.dash-card-header h3 {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.dash-card-header h3 i { color: var(--primary); }

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

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 14px;
  flex: 1; min-width: 200px;
}
.search-box i { color: var(--text-muted); font-size: .9rem; }
.search-box input {
  border: none; outline: none;
  background: transparent;
  padding: 10px 0;
  font-size: .875rem;
  color: var(--text);
  width: 100%;
  font-family: var(--font);
}

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

.filter-select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 9px 12px;
  font-size: .85rem;
  color: var(--text);
  outline: none;
  cursor: pointer;
  font-family: var(--font);
}
.filter-select:focus { border-color: var(--primary); }
.filter-select.w-full { width: 100%; }

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: none;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(30,125,75,.35); }

.btn-secondary { background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); }
.btn-secondary:hover { background: var(--border-light); }

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

.btn-outline   { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }

.btn-sm   { padding: 6px 12px; font-size: .8rem; }
.btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; border-radius: 8px; }

/* ==========================================
   TABLE
   ========================================== */
.table-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  overflow: hidden;
  overflow-x: auto;
}

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

.data-table thead tr {
  background: var(--bg);
  border-bottom: 2px solid var(--border-light);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: .8rem;
  letter-spacing: .03em;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--primary-light); }

.data-table td {
  padding: 12px 16px;
  color: var(--text);
  vertical-align: middle;
}

.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 16px !important;
  font-size: .9rem;
}

.table-actions { display: flex; gap: 6px; }

/* ==========================================
   BADGES
   ========================================== */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.4;
}

.badge-success  { background: var(--success-light); color: #166534; }
.badge-warning  { background: var(--warning-light); color: #92400e; }
.badge-danger   { background: var(--danger-light);  color: #991b1b; }
.badge-info     { background: var(--info-light);    color: #1e40af; }
.badge-muted    { background: var(--bg);            color: var(--text-muted); border: 1px solid var(--border); }
.badge-primary  { background: var(--primary-light); color: var(--primary-dark); }

/* Status badges */
.status-vigente     { background: var(--success-light); color: #166534; }
.status-vencida     { background: var(--danger-light);  color: #991b1b; }
.status-renovacao   { background: var(--warning-light); color: #92400e; }
.status-suspensa    { background: var(--info-light);    color: #1e40af; }
.status-analise     { background: #f3e8ff;              color: #6b21a8; }
.status-cancelada   { background: var(--bg);            color: var(--text-muted); }
.status-ativo       { background: var(--success-light); color: #166534; }
.status-inativo     { background: var(--bg);            color: var(--text-muted); }
.status-prospecto   { background: var(--info-light);    color: #1e40af; }
.status-pendente    { background: var(--warning-light); color: #92400e; }
.status-andamento   { background: var(--info-light);    color: #1e40af; }
.status-cumprida    { background: var(--success-light); color: #166534; }
.status-atrasada    { background: var(--danger-light);  color: #991b1b; }

/* Priority badges */
.priority-alta   { background: var(--danger-light);  color: #991b1b; }
.priority-media  { background: var(--warning-light); color: #92400e; }
.priority-baixa  { background: var(--success-light); color: #166534; }

/* ==========================================
   DIAS RESTANTES INDICATOR
   ========================================== */
.days-indicator {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .8rem; font-weight: 600;
  padding: 3px 8px; border-radius: 6px;
}
.days-ok      { background: var(--success-light); color: #166534; }
.days-warning { background: var(--warning-light); color: #92400e; }
.days-danger  { background: var(--danger-light);  color: #991b1b; }
.days-expired { background: #f1f5f9; color: #64748b; }

/* ==========================================
   LIST ITEMS (Dashboard)
   ========================================== */
.list-items { display: flex; flex-direction: column; gap: 10px; }

.list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
  transition: all var(--transition);
}
.list-item:hover { background: var(--primary-light); }
.list-item.item-warning { border-color: var(--warning); }
.list-item.item-danger  { border-color: var(--danger); }

.list-item-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
}
.list-item-icon.green  { background: var(--primary-light); color: var(--primary); }
.list-item-icon.orange { background: var(--warning-light); color: var(--warning); }
.list-item-icon.red    { background: var(--danger-light);  color: var(--danger); }

.list-item-info { flex: 1; min-width: 0; }
.list-item-title { font-size: .875rem; font-weight: 600; color: var(--text); }
.list-item-sub   { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }

.list-item-badge { flex-shrink: 0; }

.empty-list {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: .875rem;
}
.empty-list i { display: block; font-size: 1.5rem; margin-bottom: 6px; opacity: .4; }

/* ==========================================
   PAGINATION
   ========================================== */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.page-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: .875rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  font-family: var(--font);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ==========================================
   MODALS
   ========================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; animation: fadeIn .2s ease; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-sm { max-width: 440px; }
.modal-lg { max-width: 780px; }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  flex-shrink: 0;
}
.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex; align-items: center; gap: 10px;
  color: var(--text);
}
.modal-header h2 i { color: var(--primary); }
.modal-close {
  background: none; border: none;
  font-size: 1.1rem; color: var(--text-muted);
  cursor: pointer; padding: 4px;
  border-radius: 6px;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: var(--bg);
}

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

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--text-muted); }

.form-col-2 { grid-column: span 2; }
.form-col-full { grid-column: 1 / -1; }

.form-group input,
.form-group select,
.form-group textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: .875rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: var(--font);
  background: var(--bg-card);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,125,75,.12);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* ==========================================
   CHECKLIST EDITOR
   ========================================== */
.checklist-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.checklist-items-list { padding: 8px; max-height: 280px; overflow-y: auto; }

.checklist-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  transition: background var(--transition);
}
.checklist-item-row:hover { background: var(--bg); }
.checklist-item-row.done .item-label { text-decoration: line-through; color: var(--text-muted); }

.checklist-item-row input[type="checkbox"] {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.item-label { flex: 1; font-size: .875rem; }

.item-del-btn {
  background: none; border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .85rem;
  transition: all var(--transition);
}
.item-del-btn:hover { color: var(--danger); background: var(--danger-light); }

.add-item-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border-light);
  background: var(--bg);
}
.add-item-row input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: .875rem;
  outline: none;
  font-family: var(--font);
}
.add-item-row input:focus { border-color: var(--primary); }

/* ==========================================
   CHECKLIST CARDS
   ========================================== */
.checklists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.checklist-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all var(--transition);
}
.checklist-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); }

.cc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cc-title { font-size: .95rem; font-weight: 700; color: var(--text); }
.cc-category { font-size: .75rem; color: var(--text-muted); margin-top: 3px; }

.cc-progress { margin-bottom: 12px; }
.cc-progress-label {
  display: flex; justify-content: space-between;
  font-size: .78rem; color: var(--text-muted); margin-bottom: 5px;
}
.progress-bar-bg {
  height: 6px; border-radius: 10px;
  background: var(--border);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 10px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .4s ease;
}

.cc-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  font-size: .8rem; color: var(--text-muted);
}

.cc-actions { display: flex; gap: 6px; }

/* ==========================================
   MODELOS CARDS
   ========================================== */
.modelos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.modelo-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: all var(--transition);
}
.modelo-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.mc-header { margin-bottom: 10px; }
.mc-icon-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.mc-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.mc-title { font-size: .95rem; font-weight: 700; color: var(--text); }
.mc-category { font-size: .78rem; color: var(--text-muted); }
.mc-desc { font-size: .83rem; color: var(--text-muted); margin-bottom: 10px; min-height: 36px; }

.mc-tags {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-bottom: 12px;
}
.mc-tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: .72rem;
  color: var(--text-muted);
}

.mc-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}
.mc-version { font-size: .78rem; color: var(--text-light); }
.mc-actions { display: flex; gap: 6px; }

/* ==========================================
   PRAZOS PAGE
   ========================================== */
.prazos-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: start;
}

.prazos-filters {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  position: sticky; top: 80px;
}

.filter-group { margin-bottom: 18px; }
.filter-group:last-child { margin-bottom: 0; }
.filter-group label { font-size: .8rem; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 8px; }

.filter-chips { display: flex; flex-direction: column; gap: 5px; }

.chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
  font-family: var(--font);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.prazos-list {
  display: flex; flex-direction: column; gap: 10px;
}

.prazo-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all var(--transition);
  border-left: 4px solid var(--primary);
}
.prazo-item:hover { box-shadow: var(--shadow-lg); }
.prazo-item.urgente { border-color: var(--danger); }
.prazo-item.alerta  { border-color: var(--warning); }

.prazo-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.prazo-icon.green  { background: var(--primary-light); color: var(--primary); }
.prazo-icon.orange { background: var(--warning-light); color: var(--warning); }
.prazo-icon.red    { background: var(--danger-light);  color: var(--danger); }

.prazo-info { flex: 1; min-width: 0; }
.prazo-title { font-weight: 600; font-size: .9rem; color: var(--text); }
.prazo-sub { font-size: .8rem; color: var(--text-muted); margin-top: 3px; }
.prazo-meta { font-size: .78rem; color: var(--text-light); margin-top: 4px; }

.prazo-date { flex-shrink: 0; text-align: right; }
.prazo-days { font-size: 1.3rem; font-weight: 800; line-height: 1; }
.prazo-days.red    { color: var(--danger); }
.prazo-days.orange { color: var(--warning); }
.prazo-days.green  { color: var(--primary); }
.prazo-date-label  { font-size: .72rem; color: var(--text-muted); }

/* ==========================================
   TEMPLATE HINT
   ========================================== */
.template-hint {
  background: var(--info-light);
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: .8rem;
  color: #1e40af;
  margin-bottom: 8px;
}
.template-hint code {
  background: #dbeafe;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
}

/* ==========================================
   MODAL VER CHECKLIST
   ========================================== */
.view-checklist-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.view-progress-text { font-size: .9rem; color: var(--text-muted); }

.view-checklist-items { display: flex; flex-direction: column; gap: 6px; }

.view-item-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}
.view-item-row:hover { background: var(--primary-light); border-color: var(--primary); }
.view-item-row.done { background: var(--success-light); border-color: #bbf7d0; }
.view-item-row.done .view-item-label { text-decoration: line-through; color: #166534; }
.view-item-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.view-item-label { flex: 1; font-size: .875rem; }

/* ==========================================
   MODELO PREVIEW
   ========================================== */
.modelo-preview-content {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 20px;
  font-size: .875rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
  color: var(--text);
  font-family: 'Courier New', monospace;
  border: 1px solid var(--border);
}
.modelo-meta { margin-bottom: 16px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ==========================================
   TOAST
   ========================================== */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  display: flex; align-items: center; gap: 10px;
  min-width: 280px; max-width: 380px;
  font-size: .875rem;
  pointer-events: all;
  animation: slideInRight .3s ease;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%); }
}

.toast.exit { animation: slideOutRight .3s ease forwards; }
.toast-success { border-color: var(--success); }
.toast-warning { border-color: var(--warning); }
.toast-error   { border-color: var(--danger); }
.toast i       { font-size: 1.1rem; flex-shrink: 0; }
.toast-success i { color: var(--success); }
.toast-warning i { color: var(--warning); }
.toast-error   i { color: var(--danger); }

/* ==========================================
   EMPTY STATE
   ========================================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 3rem; opacity: .25; display: block; margin-bottom: 12px; }
.empty-state p { font-size: .95rem; }

/* ==========================================
   MOBILE OVERLAY
   ========================================== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}
.sidebar-backdrop.open { display: block; }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .prazos-layout { grid-template-columns: 1fr; }
  .prazos-filters { position: static; }
  .filter-chips { flex-direction: row; flex-wrap: wrap; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .mobile-toggle { display: block; }
  .topbar-user span { display: none; }
  .page-container { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-col-2 { grid-column: span 1; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-actions { flex-wrap: wrap; }
  .data-table td, .data-table th { padding: 10px 12px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .checklists-grid, .modelos-grid { grid-template-columns: 1fr; }
}

/* ==========================================
   HELPER CLASSES
   ========================================== */
.text-primary { color: var(--primary); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 700; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
