body { background: #f3f4f6; }

/* NAV OVERRIDES */
.nav-right { display: flex; align-items: center; gap: 1rem; }

.user-info { font-size: .85rem; color: var(--text-muted); }

.btn-logout {
  background: none;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: .85rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-muted);
  transition: border-color .15s, color .15s;
}

.btn-logout:hover { border-color: #e53935; color: #e53935; }

.btn-home { color: var(--text-muted); text-decoration: none; font-size: .85rem; }
.btn-home:hover { color: var(--green); }

/* AUTH LOADING */
#authLoading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  flex-direction: column;
  gap: 1rem;
  color: var(--text-muted);
}

/* CONTENT */
#mainContent { display: none; }

.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

/* PAGE HEADER */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.page-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.page-header p { font-size: .9rem; color: var(--text-muted); margin-top: 2px; }

.btn-refresh {
  background: var(--white);
  border: 1.5px solid var(--green-border);
  border-radius: 7px;
  padding: 8px 16px;
  font-size: .85rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--green);
  font-weight: 600;
  transition: background .15s;
}

.btn-refresh:hover { background: var(--green-bg); }

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

.stat-card {
  background: var(--white);
  border: 1px solid var(--green-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--green);
  line-height: 1;
  margin-bottom: .25rem;
}

.stat-card .label { font-size: .85rem; color: var(--text-muted); }

/* FILTERS */
.filters {
  background: var(--white);
  border: 1px solid var(--green-border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
  box-shadow: var(--shadow);
}

.filter-group { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 160px; }
.filter-group label { font-size: .82rem; color: var(--text-muted); font-weight: 600; }

.filters input, .filters select {
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: .88rem;
  font-family: inherit;
  color: var(--text);
  background: #f9fafb;
  transition: border-color .15s;
  width: 100%;
}

.filters input:focus, .filters select:focus {
  outline: none;
  border-color: var(--green);
}

/* TABLE */
.table-wrap {
  background: var(--white);
  border: 1px solid var(--green-border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  font-size: .85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

thead th {
  background: #f9fafb;
  padding: 10px 14px;
  text-align: left;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid #e5e7eb;
}

tbody tr {
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background .1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--green-bg); }

tbody td { padding: 12px 14px; vertical-align: top; color: var(--text); }

.td-nome { font-weight: 600; }

.td-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
  display: block;
  color: var(--text-muted);
  font-size: .85rem;
}

.empresa-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 700;
}

.empresa-badge.ecovalor { background: #e8f5e9; color: #1b5e20; }
.empresa-badge.esgnow { background: #e3f2fd; color: #0d47a1; }

.date-cell { color: var(--text-muted); font-size: .82rem; white-space: nowrap; }

/* EMPTY / LOADING */
.empty-state, .loading-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 2.5rem; margin-bottom: .75rem; }

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal {
  background: var(--white);
  border-radius: 14px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  background: #fff;
  border-radius: 14px 14px 0 0;
}

.modal-header h2 { font-size: 1.1rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .1s;
}

.modal-close:hover { background: #f0f0f0; }

.modal-body { padding: 1.5rem; }

.modal-meta {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  align-items: center;
}

.meta-item { font-size: .82rem; color: var(--text-muted); }
.meta-item strong { color: var(--text); }

.modal-section { margin-bottom: 1.25rem; }

.modal-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: .5rem;
}

.field-letter-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  font-size: .65rem;
  font-weight: 700;
}

.modal-section p {
  font-size: .93rem;
  color: var(--text);
  line-height: 1.6;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: .75rem 1rem;
}
