/* ==========================================================================
   CDL PELOTAS - SISTEMA DE CARTÃO DE DESCONTO DIGITAL & IA COPILOT
   Design System Oficial - Cores CDL, Efeitos Glassmorphism & PWA Mobile First
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700;800;900&display=swap');

:root {
  /* Paleta Oficial CDL Pelotas */
  --cdl-navy-dark: #070d18;
  --cdl-navy-bg: #0b1526;
  --cdl-card-bg: #0f1e36;
  --cdl-card-border: rgba(255, 255, 255, 0.08);
  --cdl-card-hover: #142847;

  --cdl-primary: #103560;
  --cdl-primary-light: #184c8a;
  --cdl-accent: #0284c7;
  --cdl-accent-cyan: #00c0f3;
  --cdl-accent-glow: rgba(0, 192, 243, 0.35);

  --cdl-success: #10b981;
  --cdl-success-glow: rgba(16, 185, 129, 0.3);
  --cdl-warning: #f59e0b;
  --cdl-danger: #ef4444;

  /* IA Futuristic Accent */
  --ai-purple: #8b5cf6;
  --ai-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --ai-glow: rgba(139, 92, 246, 0.4);

  /* Tipografia & Espaçamentos */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(2, 132, 199, 0.25);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   TELA DE LOGIN MULTIPERFIL (MASTER, EMPRESA/ESTABELECIMENTO, ASSOCIADO)
   ========================================================================== */
.login-screen-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 10;
}

.login-card-container {
  background: rgba(15, 30, 54, 0.92);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.7), 0 0 35px rgba(2, 132, 199, 0.2);
  border-radius: 26px;
  width: 100%;
  max-width: 520px;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.4s ease-out;
}

.login-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.login-logo-img {
  height: 58px;
  background: #ffffff;
  padding: 6px 14px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.login-header h2 {
  font-family: var(--font-heading);
  font-size: 1.55rem;
  font-weight: 800;
  color: #ffffff;
}

.login-header p {
  font-size: 0.86rem;
  color: #94a3b8;
}

/* Seletor de Perfil no Login */
.login-tabs-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--cdl-card-border);
  gap: 4px;
}

.login-tab-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 10px 8px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.login-tab-btn.active {
  background: var(--cdl-accent);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #cbd5e1;
}

.form-input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--cdl-card-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: #ffffff;
  font-size: 0.92rem;
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--cdl-accent-cyan);
  box-shadow: 0 0 15px rgba(0, 192, 243, 0.25);
  background: rgba(255, 255, 255, 0.07);
}

.btn-submit-login {
  background: linear-gradient(135deg, #0284c7 0%, #103560 100%);
  border: 1px solid rgba(0, 192, 243, 0.4);
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  padding: 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  margin-top: 6px;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.3);
}

.btn-submit-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(2, 132, 199, 0.5);
  background: linear-gradient(135deg, #0ea5e9 0%, #184c8a 100%);
}

.demo-quick-access {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--cdl-card-border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.demo-quick-access span {
  font-size: 0.78rem;
  color: #94a3b8;
}

.demo-buttons-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.btn-quick-demo {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #e2e8f0;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.btn-quick-demo:hover {
  background: var(--cdl-accent);
  color: #ffffff;
}

/* Abas Internas da Empresa/Estabelecimento */
.subtabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--cdl-card-border);
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.subtab-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  white-space: nowrap;
}

.subtab-btn.active {
  background: var(--cdl-primary);
  color: #ffffff;
  border: 1px solid var(--cdl-accent);
}

.btn-logout {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  background: #ef4444;
  color: #ffffff;
}

/* Reset Geral */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--cdl-navy-dark);
  color: #f1f5f9;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(16, 53, 96, 0.35) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(2, 132, 199, 0.2) 0%, transparent 45%);
  background-attachment: fixed;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--cdl-navy-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--cdl-primary-light);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--cdl-accent);
}

/* ==========================================================================
   BARRA DE INSTALAÇÃO PWA & AVISO DE AUTO-UPDATE
   ========================================================================== */
.pwa-banner {
  background: linear-gradient(90deg, #0e2a4d, #144075);
  border-bottom: 1px solid rgba(0, 192, 243, 0.3);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 9999;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  animation: slideDown 0.4s ease-out;
}

.pwa-banner.hidden {
  display: none !important;
}

.pwa-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

.pwa-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #fff;
  padding: 2px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

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

.btn-install {
  background: var(--cdl-accent-cyan);
  color: #051429;
  border: none;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}

.btn-install:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 15px var(--cdl-accent-glow);
  background: #38bdf8;
}

.btn-dismiss {
  background: transparent;
  color: #94a3b8;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
}

/* Toast de Atualização Automática */
.toast-update {
  position: fixed;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 30, 54, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--cdl-success);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 15px var(--cdl-success-glow);
  z-index: 10000;
  animation: bounceIn 0.5s ease-out;
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
.app-container {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 70px);
  position: relative;
}

/* Sidebar para Desktop / Tablet */
.app-sidebar {
  width: 250px;
  background: rgba(11, 21, 38, 0.85);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--cdl-card-border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  flex-shrink: 0;
  transition: var(--transition);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--cdl-card-border);
  margin-bottom: 24px;
}

.brand-logo-img {
  height: 44px;
  object-fit: contain;
  background: #ffffff;
  padding: 4px 8px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.brand-text h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
  line-height: 1.2;
}

.brand-text p {
  font-size: 0.72rem;
  color: var(--cdl-accent-cyan);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: #94a3b8;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  cursor: pointer;
  transition: var(--transition);
}

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

.nav-item.active {
  background: linear-gradient(90deg, rgba(2, 132, 199, 0.22) 0%, rgba(16, 53, 96, 0.4) 100%);
  color: #ffffff;
  border-left: 3px solid var(--cdl-accent-cyan);
  font-weight: 600;
}

.nav-item .icon {
  font-size: 1.2rem;
  width: 22px;
  text-align: center;
}

/* Área de Conteúdo Principal */
.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 32px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Header Superior */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.header-title-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.current-date {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 500;
  text-transform: capitalize;
}

.page-main-title {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-ai-assistant {
  background: var(--ai-gradient);
  border: none;
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 18px var(--ai-glow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-ai-assistant:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px var(--ai-glow);
}

.btn-ai-assistant .badge-pulse {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: #38bdf8;
  border-radius: 50%;
  animation: pulseDot 1.5s infinite;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--cdl-card-bg);
  border: 1px solid var(--cdl-card-border);
  padding: 6px 14px 6px 6px;
  border-radius: var(--radius-full);
}

.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cdl-accent), var(--cdl-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: #ffffff;
}

.user-role-label {
  font-size: 0.72rem;
  color: var(--cdl-accent-cyan);
  font-weight: 500;
}

/* ==========================================================================
   CARDS DE ESTATÍSTICA (KPIs)
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--cdl-card-bg);
  border: 1px solid var(--cdl-card-border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(2, 132, 199, 0.4);
  box-shadow: 0 12px 35px -10px rgba(0, 0, 0, 0.6), var(--shadow-glow);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(2, 132, 199, 0.12);
  color: var(--cdl-accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.stat-badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.stat-badge.positive {
  background: rgba(16, 185, 129, 0.15);
  color: var(--cdl-success);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -1px;
}

.stat-label {
  font-size: 0.88rem;
  color: #94a3b8;
  font-weight: 500;
}

.stat-subtext {
  font-size: 0.74rem;
  color: #64748b;
}

/* ==========================================================================
   PAINEL EM BENTO GRID (GRÁFICOS & LISTAS)
   ========================================================================== */
.bento-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.bento-card {
  background: var(--cdl-card-bg);
  border: 1px solid var(--cdl-card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-title-row h3 {
  font-family: var(--font-heading);
  font-size: 1.18rem;
  font-weight: 700;
  color: #ffffff;
}

.live-badge {
  background: rgba(16, 185, 129, 0.18);
  color: var(--cdl-success);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 5px;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--cdl-success);
  border-radius: 50%;
  animation: pulseDot 1.2s infinite;
}

/* Barras de Crescimento */
.chart-bars-container {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 190px;
  padding-top: 20px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}

.bar-pill {
  width: 100%;
  max-width: 32px;
  background: linear-gradient(180deg, #38bdf8 0%, #103560 100%);
  border-radius: 6px 6px 2px 2px;
  transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  cursor: pointer;
}

.bar-pill:hover {
  background: linear-gradient(180deg, #67e8f9 0%, #0284c7 100%);
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.5);
}

.bar-label {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
}

/* Ranking de Empresas por Uso */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ranking-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ranking-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
  font-weight: 600;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  border-radius: 4px;
  transition: width 0.8s ease-in-out;
}

/* ==========================================================================
   ATIVIDADE RECENTE & TABELAS
   ========================================================================== */
.activity-card {
  background: var(--cdl-card-bg);
  border: 1px solid var(--cdl-card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 90px;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.03);
  transition: var(--transition);
}

.activity-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(2, 132, 199, 0.2);
}

.activity-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.activity-dot {
  width: 8px;
  height: 8px;
  background: var(--cdl-accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--cdl-accent-glow);
}

.activity-text {
  font-size: 0.88rem;
  color: #e2e8f0;
}

.activity-text strong {
  color: #ffffff;
}

.activity-text .highlight-discount {
  color: #fbbf24;
  font-weight: 700;
}

.activity-time-tag {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: #94a3b8;
}

.badge-valid {
  background: rgba(16, 185, 129, 0.14);
  color: var(--cdl-success);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   APP DO ASSOCIADO - CARTÃO DIGITAL DE DESCONTO NO CELULAR
   ========================================================================== */
.member-mobile-view {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 90px;
}

/* Cartão Holográfico CDL Pelotas */
.card-virtual-wrapper {
  perspective: 1000px;
}

.cdl-digital-card {
  width: 100%;
  height: 250px;
  border-radius: 22px;
  background: linear-gradient(135deg, #091b34 0%, #103560 50%, #04659b 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 24px;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7), 0 0 30px rgba(2, 132, 199, 0.25);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.4s ease;
}

.cdl-digital-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
  pointer-events: none;
}

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-logo {
  height: 38px;
  background: #fff;
  padding: 3px 6px;
  border-radius: 6px;
}

.card-chip {
  width: 38px;
  height: 28px;
  background: linear-gradient(135deg, #eab308, #ca8a04);
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.4);
  position: relative;
}

.card-chip::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(0,0,0,0.3);
  border-radius: 2px;
}

.card-center-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.member-card-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--cdl-accent-cyan);
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.member-card-info h4 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
}

.member-card-info p {
  font-size: 0.82rem;
  color: #93c5fd;
  font-weight: 500;
}

.card-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.card-reg-num {
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  letter-spacing: 2px;
  color: #ffffff;
  font-weight: 700;
}

.card-expiry {
  font-size: 0.74rem;
  color: #cbd5e1;
  text-align: right;
}

.card-expiry span {
  display: block;
  font-weight: 700;
  color: #ffffff;
}

/* Botão de Exibição do QR Code */
.btn-qr-display {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: 1px solid rgba(0, 192, 243, 0.4);
  color: #ffffff;
  padding: 16px;
  border-radius: var(--radius-lg);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  box-shadow: 0 8px 24px -5px rgba(2, 132, 199, 0.4);
  transition: var(--transition);
}

.btn-qr-display:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -5px rgba(2, 132, 199, 0.6);
}

.btn-qr-display .qr-badge {
  background: #ffffff;
  color: #0369a1;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

/* Modal do QR Code Dinâmico */
.qr-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10000;
  animation: fadeIn 0.3s ease-out;
}

.qr-modal-backdrop.hidden {
  display: none !important;
}

.qr-modal-card {
  background: #0d1e38;
  border: 1px solid var(--cdl-accent);
  border-radius: 24px;
  padding: 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 35px var(--cdl-accent-glow);
  position: relative;
}

.qr-modal-card h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: #ffffff;
  margin-bottom: 6px;
}

.qr-modal-card p {
  font-size: 0.82rem;
  color: #94a3b8;
  margin-bottom: 18px;
}

.qr-box-inner {
  background: #ffffff;
  padding: 18px;
  border-radius: 18px;
  display: inline-block;
  margin-bottom: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.qr-code-img {
  width: 200px;
  height: 200px;
  display: block;
}

.token-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--cdl-accent-cyan);
  font-weight: 600;
  margin-bottom: 18px;
}

.btn-close-modal {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-close-modal:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   LISTA DOS 16 CONVÊNIOS & ESTABELECIMENTOS
   ========================================================================== */
.convenios-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-convenios {
  display: flex;
  gap: 10px;
  position: relative;
}

.search-input {
  width: 100%;
  background: var(--cdl-card-bg);
  border: 1px solid var(--cdl-card-border);
  padding: 12px 16px 12px 42px;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--cdl-accent);
  box-shadow: 0 0 15px rgba(2, 132, 199, 0.25);
}

.search-icon-pos {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 1.1rem;
}

.category-tags {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.cat-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--cdl-card-border);
  color: #94a3b8;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

.cat-pill.active, .cat-pill:hover {
  background: var(--cdl-primary);
  color: #ffffff;
  border-color: var(--cdl-accent);
}

.establishments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.est-card {
  background: var(--cdl-card-bg);
  border: 1px solid var(--cdl-card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: var(--transition);
}

.est-card:hover {
  transform: translateY(-3px);
  border-color: rgba(2, 132, 199, 0.3);
}

.est-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.est-name-col h4 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  color: #ffffff;
  font-weight: 700;
}

.est-cat {
  font-size: 0.76rem;
  color: var(--cdl-accent-cyan);
  font-weight: 600;
}

.discount-badge-highlight {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #051429;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.est-address {
  font-size: 0.78rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   PAINEL DO ESTABELECIMENTO / LOJISTA - SCANNER DE QR CODE
   ========================================================================== */
.scanner-box {
  background: #0d1e38;
  border: 2px dashed var(--cdl-accent);
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.scanner-camera-viewport {
  width: 240px;
  height: 240px;
  background: #000;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--cdl-accent-cyan);
}

.laser-scanner-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #00c0f3;
  box-shadow: 0 0 15px #00c0f3, 0 0 25px #00c0f3;
  animation: scanLaser 2s infinite ease-in-out;
}

.btn-trigger-scan {
  background: var(--cdl-accent);
  color: #ffffff;
  font-weight: 700;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 0.95rem;
  transition: var(--transition);
}

.btn-trigger-scan:hover {
  background: #0284c7;
  box-shadow: 0 0 20px var(--cdl-accent-glow);
}

/* ==========================================================================
   MODAL DA IA COPILOTO CDL (GERÊNCIA & AVISOS INTELIGENTES)
   ========================================================================== */
.ai-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10001;
  animation: fadeIn 0.3s ease;
}

.ai-modal-backdrop.hidden {
  display: none !important;
}

.ai-modal-window {
  background: #0c1a30;
  border: 1px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9), 0 0 35px var(--ai-glow);
  border-radius: 24px;
  width: 100%;
  max-width: 650px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-window-header {
  background: linear-gradient(90deg, #122847 0%, #1e1b4b 100%);
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-sparkle-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--ai-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 0 15px var(--ai-glow);
}

.ai-window-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
}

.ai-alerts-box {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius-md);
  padding: 16px;
}

.ai-alerts-box h4 {
  font-size: 0.88rem;
  color: #c084fc;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-alert-pill {
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  margin-bottom: 8px;
  border-left: 3px solid var(--cdl-accent-cyan);
}

.ai-alert-pill.warn {
  border-left-color: #f59e0b;
}

.ai-chat-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 6px;
}

.ai-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.88rem;
  line-height: 1.45;
}

.ai-msg.user {
  flex-direction: row-reverse;
}

.ai-msg-bubble {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 16px;
  border-radius: 16px;
  max-width: 82%;
  color: #e2e8f0;
}

.ai-msg.user .ai-msg-bubble {
  background: var(--cdl-primary);
  border-color: var(--cdl-accent);
  color: #ffffff;
}

.ai-input-row {
  padding: 16px 20px;
  background: rgba(11, 21, 38, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: 10px;
}

.ai-text-field {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 16px;
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 0.9rem;
  outline: none;
}

.ai-text-field:focus {
  border-color: var(--ai-purple);
  box-shadow: 0 0 15px var(--ai-glow);
}

.btn-ai-send {
  background: var(--ai-gradient);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* ==========================================================================
   BARRA FLUTUANTE DE PAPÉIS NO RODAPÉ (IGUAL ÀS TELAS DE REFERÊNCIA)
   [Master] [Empresa] [Est.] [Func.]
   ========================================================================== */
.role-floating-switcher {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 30, 54, 0.88);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 5px;
  border-radius: var(--radius-full);
  display: flex;
  gap: 4px;
  z-index: 999;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.role-pill-btn {
  background: transparent;
  color: #94a3b8;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.role-pill-btn:hover {
  color: #ffffff;
}

.role-pill-btn.active {
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

/* ==========================================================================
   ANIMAÇÕES & RESPONSIVIDADE
   ========================================================================== */
@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@keyframes bounceIn {
  from { transform: translate(-50%, 40px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

@keyframes scanLaser {
  0% { top: 0%; }
  50% { top: 96%; }
  100% { top: 0%; }
}

/* Responsividade Mobile First */
@media (max-width: 900px) {
  .app-sidebar {
    display: none;
  }
  .app-content {
    padding: 16px;
  }
  .bento-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .role-floating-switcher {
    width: 92%;
    justify-content: space-between;
  }
  .role-pill-btn {
    padding: 7px 10px;
    font-size: 0.76rem;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .top-header {
    margin-bottom: 20px;
  }
  .page-main-title {
    font-size: 1.5rem;
  }
}

/* Indicador de Armazenamento Local / Modo Teste */
.btn-storage-indicator {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-storage-indicator:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: #34d399;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.btn-storage-indicator .storage-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

/* Scanner de QR Code do Estabelecimento */
.scanner-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--cdl-card-border);
  padding: 22px;
  border-radius: var(--radius-lg);
}

.scanner-camera-viewport {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 250px;
  background: #000000;
  border: 2px solid var(--cdl-accent);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 25px rgba(2, 132, 199, 0.25);
}

.scanner-camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.laser-scanner-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  background: #00c0f3;
  box-shadow: 0 0 12px #00c0f3, 0 0 22px #00c0f3;
  animation: scanLaser 2.2s infinite ease-in-out;
  pointer-events: none;
  z-index: 5;
}

.scanner-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid #00c0f3;
  pointer-events: none;
  z-index: 6;
}
.scanner-corner.tl { top: 10px; left: 10px; border-right: none; border-bottom: none; }
.scanner-corner.tr { top: 10px; right: 10px; border-left: none; border-bottom: none; }
.scanner-corner.bl { bottom: 10px; left: 10px; border-right: none; border-top: none; }
.scanner-corner.br { bottom: 10px; right: 10px; border-left: none; border-top: none; }

.btn-trigger-scan {
  background: linear-gradient(135deg, #0284c7, #00c0f3);
  color: #051429;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(0, 192, 243, 0.3);
}

.btn-trigger-scan:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0, 192, 243, 0.5);
}

.btn-scanner-camera {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--cdl-card-border);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-scanner-camera:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: #38bdf8;
}

.btn-scanner-camera.active-danger {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #fca5a5;
}

.scanner-camera-viewport.scan-success-flash {
  border-color: #10b981 !important;
  box-shadow: 0 0 35px #10b981, inset 0 0 20px rgba(16, 185, 129, 0.3) !important;
  transition: all 0.2s ease;
}

#qrCodeContainer {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#qrCodeContainer img,
#qrCodeContainer canvas {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}

.btn-scanner-file {
  background: rgba(255, 255, 255, 0.08);
  color: #93c5fd;
  border: 1px solid rgba(147, 197, 253, 0.3);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-scanner-file:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: #60a5fa;
  color: #fff;
}


