/* =============================================
   RESET E BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #F4F6FA;
  color: #2D3436;
  min-height: 100vh;
}

/* =============================================
   NAVBAR
   ============================================= */
.navbar {
  background: linear-gradient(90deg, #1a5276 0%, #2980b9 100%);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  height: 56px;
  box-shadow: 0 2px 8px rgba(26, 82, 118, 0.2);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 2rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  min-width: 200px;
}

.nav-logo { font-size: 1.3rem; }
.nav-title { color: #fff; font-weight: 700; font-size: 0.95rem; white-space: nowrap; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex: 1;
}

.nav-link {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.nav-link:hover { background: rgba(255,255,255,0.15); color: #fff; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.nav-user-name { color: #fff; font-size: 0.85rem; font-weight: 600; }
.nav-user-perfil { color: rgba(255,255,255,0.65); font-size: 0.75rem; }

.nav-logout {
  color: rgba(255,255,255,0.7) !important;
  font-size: 0.82rem !important;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 0.25rem 0.6rem !important;
}

.nav-logout:hover { background: rgba(255,255,255,0.15); color: #fff !important; }

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* =============================================
   PAGE HEADER
   ============================================= */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2D3436;
}

.text-muted { color: #636E72; font-size: 0.85rem; margin-top: 0.2rem; }

/* =============================================
   STAT CARDS
   ============================================= */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: transparent;
  display: grid;
  place-items: center;
  font-size: 2rem;
  flex-shrink: 0;
}

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: #2D3436; }
.stat-label { font-size: 0.82rem; color: #636E72; }

/* =============================================
   PANEL
   ============================================= */
.panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
}

.panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #ECEEF3;
}

.panel-header h2 { font-size: 1.1rem; font-weight: 700; }

.panel-body {
  padding: 1.25rem;
  font-size: 0.92rem;
  line-height: 1.55;
}

/* =============================================
   FLASH MESSAGES
   ============================================= */
.flash-container {
  max-width: 1200px;
  margin: 0.75rem auto 0;
  padding: 0 1.5rem;
  display: grid;
  gap: 0.4rem;
}

.flash {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.flash-success { background: #D4EDDA; color: #155724; border: 1px solid #C3E6CB; }
.flash-danger  { background: #F8D7DA; color: #721C24; border: 1px solid #F5C6CB; }
.flash-warning { background: #FFF3CD; color: #856404; border: 1px solid #FFEEBA; }
.flash-info    { background: #D1ECF1; color: #0C5460; border: 1px solid #BEE5EB; }

.flash-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
}

.flash-close:hover { opacity: 1; }

/* =============================================
   LOGIN PAGE
   ============================================= */
body.page-login {
  background:
    radial-gradient(900px 380px at 10% 8%, rgba(255,255,255,0.12), transparent 60%),
    radial-gradient(820px 320px at 90% 92%, rgba(255,255,255,0.08), transparent 60%),
    linear-gradient(135deg, #1a5276 0%, #2471a3 48%, #2980b9 100%);
}

.auth-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.login-shell { width: 100%; max-width: 440px; position: relative; }

.login-glow {
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle at top, rgba(255,255,255,0.3), transparent 55%);
  filter: blur(16px);
  z-index: 0;
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: 20px;
  padding: 2rem 1.5rem 1.5rem;
  box-shadow: 0 24px 55px rgba(20, 50, 80, 0.3);
  backdrop-filter: blur(6px);
}

.login-brand { text-align: center; margin-bottom: 1.2rem; }

.login-brand-line {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
}

.login-brand-icon { font-size: 1.1rem; }
.login-brand-name { font-size: 1rem; font-weight: 800; color: #1a5276; }

.login-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: #2D3436;
}

.login-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: #636E72;
}

.login-alert {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.login-alert-danger { background: #FFEBEE; color: #B71C1C; border: 1px solid #EF9A9A; }

.login-form { margin-top: 1rem; }

.login-group { margin-bottom: 1rem; }

.login-label {
  display: block;
  font-size: 0.83rem;
  font-weight: 700;
  color: #2D3436;
  margin-bottom: 0.35rem;
}

.login-input-wrap { position: relative; }

.login-input {
  width: 100%;
  border: 1.5px solid #D9DCE3;
  border-radius: 10px;
  padding: 0.72rem 0.88rem;
  font-size: 0.92rem;
  color: #2D3436;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.login-input:focus {
  outline: none;
  border-color: #2980b9;
  box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.14);
}

.login-has-toggle { padding-right: 2.5rem; }

.login-toggle {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #7A7F88;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  font-size: 0.95rem;
}

.login-toggle:hover { background: #EBF5FB; color: #1a5276; }

.login-submit {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 0.78rem;
  font-size: 0.96rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #1a5276, #2980b9);
  box-shadow: 0 8px 18px rgba(26, 82, 118, 0.3);
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
  margin-top: 0.5rem;
}

.login-submit:hover { opacity: 0.92; transform: translateY(-1px); }

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary { background: #1a5276; color: #fff; }
.btn-danger  { background: #E74C3C; color: #fff; }
.btn-success { background: #27AE60; color: #fff; }
.btn-warning { background: #F39C12; color: #fff; }
.btn-outline { background: transparent; border: 2px solid #1a5276; color: #1a5276; }
.btn-outline:hover { background: #1a5276; color: #fff; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.82rem; }

/* =============================================
   TABLE
   ============================================= */
.table-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #636E72;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #F8F9FA;
  border-bottom: 2px solid #ECEEF3;
}

.table td {
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  border-bottom: 1px solid #F0F1F5;
}

.table tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-admin  { background: #E8F8F5; color: #1a5276; }
.badge-operador { background: #EBF5FB; color: #2471a3; }
.badge-active { background: #D4EDDA; color: #155724; }
.badge-inactive { background: #F8D7DA; color: #721C24; }
.badge-warning { background: #FFF3CD; color: #856404; }

/* =============================================
   FORM
   ============================================= */
.form-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 1.5rem;
  max-width: 600px;
}

.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #2D3436;
  margin-bottom: 0.3rem;
}

.form-control {
  width: 100%;
  border: 1.5px solid #D9DCE3;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  color: #2D3436;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: #2980b9;
  box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.12);
}

.form-hint { font-size: 0.78rem; color: #858C97; margin-top: 0.25rem; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; gap: 1rem; }
  .nav-links { display: none; }
  .main-content { padding: 1.25rem 1rem; }
  .cards-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .cards-grid { grid-template-columns: 1fr; }
  .login-card { padding: 1.5rem 1rem 1rem; border-radius: 16px; }
}

/* =============================================
   5-COLUMN CARDS GRID
   ============================================= */
.cards-grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

@media (max-width: 1024px) {
  .cards-grid-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .cards-grid-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .cards-grid-5 { grid-template-columns: 1fr; }
}

/* =============================================
   DASHBOARD GRID (2 columns)
   ============================================= */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* =============================================
   FUNNEL
   ============================================= */
.funnel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.funnel-step {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.funnel-bar-wrap {
  flex: 1;
  height: 28px;
  background: #F0F1F5;
  border-radius: 6px;
  overflow: hidden;
}

.funnel-bar {
  height: 100%;
  background: linear-gradient(90deg, #1a5276, #2980b9);
  border-radius: 6px;
  min-width: 4px;
  transition: width 0.6s ease;
}

.funnel-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 200px;
}

.funnel-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #2D3436;
  min-width: 110px;
}

.funnel-value {
  font-size: 0.95rem;
  font-weight: 800;
  color: #1a5276;
}

.funnel-pct {
  font-size: 0.78rem;
  color: #636E72;
}

/* =============================================
   KPI LIST (operational)
   ============================================= */
.kpi-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.kpi-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #F0F1F5;
}

.kpi-item:last-child { border-bottom: none; }

.kpi-label {
  font-size: 0.85rem;
  color: #636E72;
}

.kpi-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: #2D3436;
}

/* =============================================
   CHART BARS (simple bar chart)
   ============================================= */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 160px;
  padding-top: 10px;
  overflow-x: auto;
}

.chart-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 24px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  max-width: 36px;
  background: linear-gradient(180deg, #2980b9, #1a5276);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.chart-bar-val {
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  position: absolute;
  top: 2px;
  white-space: nowrap;
}

.chart-bar-label {
  font-size: 0.65rem;
  color: #636E72;
  margin-top: 4px;
  white-space: nowrap;
}

/* =============================================
   FILTERS BAR
   ============================================= */
.filters-bar {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.filters-form {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #636E72;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-control-sm {
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  min-width: 140px;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* =============================================
   PAGINATION
   ============================================= */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 0.75rem;
}

.pagination-info {
  font-size: 0.85rem;
  color: #636E72;
}

/* =============================================
   MONO TEXT
   ============================================= */
.mono-text {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.8rem;
  color: #636E72;
  background: #F4F6FA;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}

/* =============================================
   NAV ACTIVE STATE
   ============================================= */
.nav-link.active {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* =============================================
   USER ACTION BUTTONS
   ============================================= */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

select.form-control {
  appearance: auto;
}
