/* Alegria Kids QR - Styles */
/* Cores da identidade Alegria Kids */
:root {
  /* Cores principais */
  --color-primary: #E53935;
  --color-primary-light: #FF6F60;
  --color-primary-dark: #C62828;
  --color-secondary: #FF6FA3;
  --color-accent: #FFD93D;
  
  /* Backgrounds */
  --bg-dark: #111318;
  --bg-card: #1C1F26;
  --bg-input: #252930;
  --bg-hover: #2A2E36;
  
  /* Texto */
  --text-primary: #F8F8FA;
  --text-secondary: #D0D2D8;
  --text-muted: #8B8E96;
  
  /* Status */
  --color-success: #2ECC71;
  --color-error: #E74C3C;
  --color-warning: #F1C40F;
  --color-info: #3498DB;
  
  /* Outros */
  --border-radius: 12px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset e Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.pending-list {
  margin-top: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-content {
  text-align: center;
  color: white;
}

.loading-logo {
  font-size: 80px;
  margin-bottom: 16px;
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 24px auto 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Screens */
.screen {
  min-height: 100vh;
  padding: 24px;
  opacity: 1;
  transition: opacity 0.15s ease-in-out;
}

.screen.hidden {
  opacity: 0 !important;
  pointer-events: none;
  position: absolute;
  visibility: hidden;
  display: none !important;
}

/* Login Screen */
.login-container {
  max-width: 400px;
  margin: 0 auto;
  padding-top: 10vh;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  animation: bounce 2s ease-in-out infinite;
}

.logo svg {
  width: 100%;
  height: 100%;
}

.loading-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  animation: pulse 1.5s ease-in-out infinite;
}

.loading-logo svg {
  width: 100%;
  height: 100%;
}

.login-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 15px;
}

.login-footer {
  text-align: center;
  margin-top: 32px;
  padding: 20px 16px;
  background: linear-gradient(135deg, rgba(229, 57, 53, 0.05), rgba(255, 111, 163, 0.05));
  border-radius: 12px;
  border: 1px solid rgba(229, 57, 53, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.footer-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary, #B8BBC2);
  margin: 0;
}

.footer-icon {
  width: 16px;
  height: 16px;
  color: var(--color-primary, #E53935);
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  10% { transform: scale(1.1); }
  20% { transform: scale(1); }
}

.footer-link {
  color: var(--color-primary, #E53935);
  text-decoration: none;
  font-weight: 700;
  transition: all 0.3s ease;
  position: relative;
  padding: 0 2px;
}

.footer-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary, #E53935), var(--color-secondary, #FF6FA3));
  transition: width 0.3s ease;
}

.footer-link:hover {
  color: var(--color-secondary, #FF6FA3);
  transform: translateY(-1px);
}

.footer-link:hover::after {
  width: 100%;
}

/* Forms */
.form {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

/* Alinhamento e espaçamento dos links auxiliares do login */
.login-alt { text-align: center; margin-top: 12px; }
.login-alt .btn { min-width: 0; }

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 15px;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--bg-hover);
  box-shadow: 0 0 0 4px rgba(229, 57, 53, 0.1);
}

.form-group input:disabled,
.form-group textarea:disabled,
.form-group select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-group textarea {
  resize: vertical;
  font-family: inherit;
}

/* Campo de dias personalizados */
#custom-days-group {
  background: var(--bg-input);
  border-radius: 8px;
  padding: 16px;
  border-left: 4px solid var(--color-primary);
  animation: slideDown 0.3s ease-out;
}

#custom-days-group label {
  color: var(--text-primary);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Buttons */
.btn {
  padding: 14px 24px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.btn:active:not(:disabled):not(.loading) {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

.btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: white;
  box-shadow: 0 4px 12px rgba(229, 57, 53, 0.4);
}

.btn-primary:hover:not(:disabled):not(.loading) {
  box-shadow: 0 6px 16px rgba(229, 57, 53, 0.5);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 2px solid var(--color-primary);
}

.btn-secondary:hover {
  background: var(--color-primary);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-danger {
  background: transparent;
  color: #e53e3e;
  border: 1px solid #e53e3e;
}

.btn-danger:hover {
  background: #e53e3e;
  color: white;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

/* Header */
.app-header {
  /* Header global minimalista e transparente no desktop */
  background: transparent;
  border-bottom: 0;
  padding: 8px 16px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

/* Consistência visual dos ícones SVG em desktop */
.header-nav svg,
.nav-link-icon svg,
.btn-icon,
.brand-icon {
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.btn-icon { width: 20px; height: 20px; }
.brand-icon { width: 24px; height: 24px; }

.header-content {
  /* estica até as bordas para colocar o hambúrguer no canto direito */
  max-width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  flex: 1;
  min-width: 0;
}

.org-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.org-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: var(--color-primary);
  flex-shrink: 0;
}

.header-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

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

.nav-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--color-primary);
}

.btn-link {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
}

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

.user-info {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Tabs */
.tabs {
  background: var(--bg-card);
  padding: 12px 24px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--bg-hover);
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 20px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--color-primary);
  color: white;
}

/* Content */
.app-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* O header é fixo e transparente; não precisamos expandi-lo via margens */
#main-screen { padding-top: 0; }
#main-screen .app-header { margin: 0; border-radius: 0; }
@media (max-width: 768px) { #main-screen .app-header { margin: 0; } }

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease-in-out;
}

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

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

/* Offset sutil abaixo do header (desktop): primeiro card de cada aba */
.app-content .tab-content .card:first-child {
  margin-top: 12px;
}

.card h2, .card h3 {
  margin-bottom: 20px;
  font-size: 22px;
  font-weight: 700;
}

/* QR Display */
.qr-display {
  text-align: center;
  padding: 24px;
  background: white;
  border-radius: var(--border-radius);
  margin: 20px 0;
}

.qr-display.transparent {
  background: transparent;
}

.qr-caption {
  margin-top: 12px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.qr-code-text {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  word-break: break-all;
  letter-spacing: 0.5px;
}

/* 🔐 Blockchain Proof Badge */
.blockchain-badge {
  margin-top: 1rem;
  padding: 0.75rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  animation: fadeInUp 0.3s ease-out;
}

.blockchain-badge.blockchain-loading {
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
  opacity: 0.8;
}

.blockchain-badge.blockchain-pending {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.blockchain-badge.blockchain-error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.blockchain-verified {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.blockchain-icon {
  font-size: 1.2rem;
  animation: pulse 2s infinite;
}

.blockchain-text {
  flex: 1;
}

.blockchain-verify-link {
  margin-left: auto;
  color: white;
  text-decoration: underline;
  font-size: 0.9rem;
  transition: opacity 0.2s;
}

.blockchain-verify-link:hover {
  opacity: 0.8;
}

.blockchain-info {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  opacity: 0.9;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

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

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.form-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.no-margin {
  margin: 0 !important;
}

.qr-display canvas {
  max-width: 100%;
  height: auto;
}

.qr-info {
  background: var(--bg-input);
  border-radius: 8px;
  padding: 16px;
  margin: 20px 0;
}

.qr-info p {
  margin-bottom: 8px;
  font-size: 14px;
}

.code-text {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--color-accent);
  word-break: break-all;
}

/* Scanner */
#qr-reader {
  border-radius: var(--border-radius);
  overflow: hidden;
  margin-bottom: 16px;
}

/* Divider */
.divider {
  text-align: center;
  margin: 24px 0;
  color: var(--text-muted);
  position: relative;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--bg-hover);
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

/* Filters */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

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

.filter-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* QR List */
.qr-list {
  display: grid;
  gap: 12px;
}

.qr-item {
  background: var(--bg-input);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
  border-left: 4px solid transparent;
}

.qr-item:hover {
  background: var(--bg-hover);
}

.qr-item.used {
  border-left-color: var(--color-success);
}

.qr-item.unused {
  border-left-color: var(--color-warning);
}

.qr-item-info {
  flex: 1;
}

.qr-item-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.qr-item-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.qr-item-status {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.qr-item-status.used {
  background: rgba(46, 204, 113, 0.2);
  color: var(--color-success);
}

.qr-item-status.unused {
  background: rgba(241, 196, 15, 0.2);
  color: var(--color-warning);
}

.qr-item-status.purchased {
  background: rgba(52, 152, 219, 0.2);
  color: var(--color-info);
}

/* Messages */
.error-message {
  background: rgba(231, 76, 60, 0.2);
  border: 2px solid var(--color-error);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 16px;
  color: var(--color-error);
  font-size: 14px;
}

.success-message {
  background: rgba(46, 204, 113, 0.2);
  border: 2px solid var(--color-success);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 16px;
  color: var(--color-success);
  font-size: 14px;
}

.result-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-top: 20px;
  text-align: center;
  border: 3px solid;
  animation: slideUp 0.3s ease-out;
}

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

.result-card.success {
  border-color: var(--color-success);
  background: rgba(46, 204, 113, 0.1);
}

.result-card.error {
  border-color: var(--color-error);
  background: rgba(231, 76, 60, 0.1);
}

.result-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: currentColor;
}

.result-icon svg {
  width: 100%;
  height: 100%;
}

.result-card h3 {
  font-size: 24px;
  margin-bottom: 12px;
}

.result-card p {
  font-size: 15px;
  color: var(--text-secondary);
}

/* Utilities */
.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

/* Badges (versão desktop) */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9999px;
  line-height: 1.6;
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.12);
}
.badge.info { background: rgba(52, 152, 219, 0.18); color: var(--color-info); border-color: rgba(52,152,219,0.35); }
.badge.success { background: rgba(46, 204, 113, 0.18); color: var(--color-success); border-color: rgba(46,204,113,0.35); }
.badge.warning { background: rgba(241, 196, 15, 0.18); color: var(--color-warning); border-color: rgba(241,196,15,0.35); }
.badge.error { background: rgba(231, 76, 60, 0.18); color: var(--color-error); border-color: rgba(231,76,60,0.35); }
.badge.muted { background: rgba(255,255,255,0.06); color: var(--text-secondary); border-color: rgba(255,255,255,0.1); }

/* Subtítulo sutil */
.subtitle-small {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -4px;
}

.mt-4 {
  margin-top: 24px;
}

/* Helper note text */
.helper-note {
  font-size: 0.9rem;
  margin-top: -8px;
}

/* Inline styles → classes */
.hidden {
  display: none !important;
}

.full-width {
  width: 100% !important;
}

/* Offset de âncora em desktop (compensa cabeçalho fixo) */
.anchor-offset { scroll-margin-top: 96px; }

/* Responsive */
@media (max-width: 768px) {
  .screen {
    padding: 16px;
  }

  /* Alinhar com o mobile: menos espaço abaixo do header e cartões mais largos */
  .app-content {
    padding: calc(var(--header-height, 56px) + 4px) 12px calc(var(--bottom-nav-height, 56px) + 16px);
    max-width: 100%;
  }

  /* Reduzir offset do primeiro card apenas no mobile */
  .app-content .tab-content .card:first-child { margin-top: 4px; }

  .card {
    padding: 20px;
  }

  .header-content {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .user-info {
    width: 100%;
    justify-content: space-between;
  }

  .tabs {
    padding: 8px 16px;
  }

  .login-container {
    padding-top: 5vh;
  }
}

/* Print styles */
@media print {
  body {
    background: white;
  }

  .app-header,
  .tabs,
  .btn {
    display: none;
  }

  .qr-display {
    break-inside: avoid;
  }
}

/* ===================== */
/* Organizations & Health Tables */
/* ===================== */

.data-table,
.info-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  background: var(--bg-card);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.data-table th,
.data-table td,
.info-table th,
.info-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table thead,
.info-table thead {
  background: var(--bg-input);
}

.data-table th,
.info-table th {
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.data-table tbody tr:hover,
.info-table tbody tr:hover {
  background: var(--bg-hover);
}

.data-table tbody tr:last-child td,
.info-table tbody tr:last-child td {
  border-bottom: none;
}

.info-table td:first-child {
  font-weight: 500;
  color: var(--text-secondary);
  width: 40%;
}

.info-table td:last-child {
  color: var(--text-primary);
}

code {
  background: var(--bg-input);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
  color: var(--color-accent);
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: rgba(46, 204, 113, 0.15);
  color: var(--color-success);
}

.badge-error {
  background: rgba(231, 76, 60, 0.15);
  color: var(--color-error);
}

.badge-warning {
  background: rgba(241, 196, 15, 0.15);
  color: var(--color-warning);
}

/* Success/Error messages */
.success-message,
p.success {
  color: var(--color-success);
  padding: 12px;
  background: rgba(46, 204, 113, 0.1);
  border-radius: var(--border-radius);
  border-left: 3px solid var(--color-success);
}

.error-message,
p.error {
  color: var(--color-error);
  padding: 12px;
  background: rgba(231, 76, 60, 0.1);
  border-radius: var(--border-radius);
  border-left: 3px solid var(--color-error);
}

.text-sm {
  font-size: 0.875rem;
}

/* Usage Warning Banner */
.usage-banner {
  background: linear-gradient(135deg, #F1C40F 0%, #F39C12 100%);
  color: #000;
  padding: 16px 24px;
  margin: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.usage-banner-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.usage-banner-icon {
  font-size: 28px;
  line-height: 1;
}

.usage-banner-text {
  flex: 1;
  min-width: 200px;
  font-size: 14px;
  line-height: 1.4;
}

.usage-banner-text strong {
  font-weight: 700;
}

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

.usage-banner .btn {
  font-size: 13px;
  padding: 8px 16px;
  height: auto;
  min-height: 32px;
}

.usage-banner .btn-primary {
  background: #000;
  color: #fff;
  border: none;
}

.usage-banner .btn-primary:hover {
  background: #333;
}

.usage-banner .btn-ghost {
  color: #000;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.usage-banner .btn-ghost:hover {
  background: rgba(0, 0, 0, 0.1);
}

@media (max-width: 640px) {
  .usage-banner-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .usage-banner-actions {
    width: 100%;
    flex-direction: column;
  }
  
  .usage-banner-actions .btn {
    width: 100%;
  }
}

/* Responsive tables */
@media (max-width: 768px) {
  .data-table,
  .info-table {
    font-size: 0.875rem;
  }
  
  .data-table th,
  .data-table td,
  .info-table th,
  .info-table td {
    padding: 8px 12px;
  }
  
  .data-table th,
  .info-table th {
    font-size: 0.7rem;
  }
}

/* Dashboard Hero Section */
.dashboard-hero {
  /* Camadas sutis para profundidade: radial + gradiente + padrão suave */
  background-image:
    radial-gradient(800px 400px at 0% -10%, rgba(229,57,53,0.18), rgba(0,0,0,0) 60%),
    linear-gradient(135deg, rgba(229, 57, 53, 0.10) 0%, rgba(255, 111, 163, 0.10) 100%),
    repeating-linear-gradient(45deg, rgba(229,57,53,0.04) 0, rgba(229,57,53,0.04) 2px, rgba(0,0,0,0) 2px, rgba(0,0,0,0) 8px);
  border: 1px solid rgba(229, 57, 53, 0.20);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 24px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
}

.dashboard-hero-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.dashboard-title-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dashboard-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(229, 57, 53, 0.3);
}

.dashboard-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.dashboard-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 4px 0 0 0;
  font-weight: 500;
}

.dashboard-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.last-updated {
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid rgba(229,57,53,0.18);
  border-radius: 999px;
  background: rgba(0,0,0,0.2);
}

.filters-right .btn.btn-sm {
  padding: 6px 10px;
  height: 32px;
  font-size: 12px;
}

.dashboard-filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filters-left { 
  display: flex; 
  gap: 16px; 
  align-items: flex-end; 
  flex-wrap: nowrap;
}

.filters-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Inline label para organização */
.filter-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  align-self: flex-end;
  margin-left: 8px;
}

.filter-label-inline {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  height: 36px;
  display: inline-flex;
  align-items: center;
}

.select-modern.select-compact {
  padding: 6px 10px;
  height: 36px;
  min-width: 160px;
}

/* Compactação específica dos filtros do dashboard */
.dashboard-filters .filters {
  gap: 6px;
  margin-bottom: 0;
}

.dashboard-filters .filters .filter-btn {
  padding: 6px 12px;
  font-size: 12px;
  height: 32px;
  border-radius: 8px;
}

/* Forçar tema escuro no seletor e nas opções (Edge/Chrome/Firefox) */
.select-modern {
  color-scheme: dark;
}
.select-modern option,
.select-modern optgroup {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.select-modern {
  background: var(--bg-card);
  border: 1px solid rgba(229, 57, 53, 0.2);
  border-radius: 8px;
  padding: 8px 16px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  min-width: 200px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.select-modern:hover {
  border-color: var(--color-primary);
  background: rgba(229, 57, 53, 0.05);
}

.select-modern:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.1);
}

@media (max-width: 768px) {
  .dashboard-hero {
    padding: 20px;
  }
  
  .dashboard-title {
    font-size: 24px;
  }
  
  .dashboard-icon {
    width: 48px;
    height: 48px;
  }
  
  .dashboard-filters {
    width: 100%;
    flex-direction: column;
    gap: 12px;
  }
  
  .filter-group {
    width: 100%;
  }
  
  .select-modern {
    width: 100%;
  }
}

/* Regras extras para mobile estreito */
@media (max-width: 640px) {
  .dashboard-filters {
    gap: 10px;
  }
  .filters-left {
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
  }
  .filter-inline {
    width: 100%;
    margin-left: 0;
  }
  .select-modern.select-compact {
    width: 100%;
    min-width: 0;
  }
  .filters-right {
    width: 100%;
    justify-content: space-between;
  }
}

/* Admin Stats Dashboard */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

.stat-card.full-width {
  grid-column: 1 / -1;
  text-align: left;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* Tonalidade por cartão das primeiras métricas */
.stats-grid .stat-card:nth-child(1) {
  background: linear-gradient(180deg, rgba(52,152,219,0.10), rgba(0,0,0,0.04));
  border-color: rgba(52,152,219,0.30);
}
.stats-grid .stat-card:nth-child(1) .stat-value { color: var(--color-info); }

.stats-grid .stat-card:nth-child(2) {
  background: linear-gradient(180deg, rgba(46,204,113,0.10), rgba(0,0,0,0.04));
  border-color: rgba(46,204,113,0.30);
}
.stats-grid .stat-card:nth-child(2) .stat-value { color: var(--color-success); }

.stats-grid .stat-card:nth-child(3) {
  background: linear-gradient(180deg, rgba(229,57,53,0.10), rgba(0,0,0,0.04));
  border-color: rgba(229,57,53,0.30);
}
.stats-grid .stat-card:nth-child(3) .stat-value { color: var(--color-primary); }

.stats-grid .stat-card:nth-child(4) {
  background: linear-gradient(180deg, rgba(241,196,15,0.12), rgba(0,0,0,0.04));
  border-color: rgba(241,196,15,0.30);
}
.stats-grid .stat-card:nth-child(4) .stat-value { color: var(--color-warning); }

.plan-distribution {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.data-table.compact {
  font-size: 0.9rem;
}

.data-table.compact td,
.data-table.compact th {
  padding: 8px 12px;
}

/* Charts (Dashboard) */
.charts-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 20px;
}

.chart-card.full-width { grid-column: 1 / -1; }

.chart-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.chart-controls { display: flex; align-items: center; gap: 8px; }

.select-sm {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}

.table-wrapper { overflow-x: auto; margin-top: 12px; }

.chart-card canvas { max-width: 100%; height: auto; }
.chart-card.full-width canvas { max-height: 280px; }

/* Bulk Actions Bar */
.bulk-action-bar {
  background: var(--bg-card);
  border: 2px solid var(--color-primary);
  border-radius: var(--border-radius);
  padding: 14px 16px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: var(--shadow);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bulk-action-bar .bulk-count {
  color: var(--color-primary);
  font-size: 1.1rem;
}

.bulk-action-bar span {
  flex: 1;
}

.bulk-action-bar button {
  margin: 0;
}

/* Checkboxes */
.bulk-checkbox,
.bulk-checkbox-org {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-primary);
  margin-right: 10px;
  vertical-align: middle;
}

.bulk-checkbox:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Status badges for subscriptions */
.badge.success {
  background: var(--color-success);
  color: white;
}

.badge.error {
  background: var(--color-error);
  color: white;
}

.badge.warning {
  background: var(--color-warning);
  color: #333;
}

/* ================================================
   ONBOARDING & CONVERSION IMPROVEMENTS
   ================================================ */

/* Modal de Planos (Pricing Modal) */
.modal-pricing .modal-content {
  max-width: 1200px;
  width: 95%;
}

.pricing-grid {
  display: grid;
  align-items: flex-start;
  justify-content: space-between;
  margin-top: 20px;
}
  flex-wrap: wrap;

.pricing-card {
  background: var(--bg-card);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 16px;
  transition: var(--transition);
.chart-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; }
}

.pricing-card.popular {
  border-color: var(--color-primary);
  box-shadow: 0 8px 24px rgba(229, 57, 53, 0.3);
  transform: scale(1.05);
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.plan-badge {
  position: absolute;
  top: -12px;
  right: 20px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(229, 57, 53, 0.4);
}

.plan-current {
  background: var(--color-success);
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 12px;
  display: inline-block;
}

.plan-header h3 {
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.plan-price {
  font-size: 36px;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 20px;
}

.plan-period {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-secondary);
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  min-height: 150px;
}

.plan-features li {
  padding: 8px 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.plan-features li:before {
  content: "✓";
  color: var(--color-success);
  font-weight: 700;
  margin-right: 8px;
}

/* Upgrade Modal */
.upgrade-modal {
  text-align: center;
  padding: 20px;
}

.upgrade-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.upgrade-modal h3 {
  font-size: 24px;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.upgrade-modal p {
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.6;
}

.upgrade-benefits {
  background: var(--bg-input);
  border-radius: var(--border-radius);
  padding: 20px;
  margin: 20px 0;
  text-align: left;
}

.upgrade-benefits h4 {
  margin-bottom: 12px;
  color: var(--color-accent);
}

.upgrade-benefits ul {
  list-style: none;
  padding: 0;
}

.upgrade-benefits li {
  padding: 6px 0;
  color: var(--text-secondary);
}

.plan-comparison-mini {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.plan-comparison-mini .plan-card {
  background: var(--bg-input);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  padding: 20px;
  position: relative;
}

.plan-comparison-mini .plan-card.highlighted {
  border-color: var(--color-primary);
  background: linear-gradient(135deg, rgba(229, 57, 53, 0.1), rgba(198, 40, 40, 0.1));
}

.badge-popular {
  background: var(--color-primary);
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 12px;
  display: inline-block;
}

.plan-comparison-mini .plan-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.plan-comparison-mini .plan-price {
  font-size: 28px;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 16px;
}

.plan-comparison-mini .plan-price span {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
}

.plan-comparison-mini ul {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  font-size: 13px;
}

.plan-comparison-mini ul li {
  padding: 4px 0;
  color: var(--text-secondary);
}

/* Promo Banner (Welcome Coupon) */
.promo-banner {
  background: linear-gradient(135deg, #FFD93D, #FFC107);
  color: #333;
  padding: 12px 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  animation: slideDown 0.5s ease;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@keyframes slideUp {
  from { transform: translateY(0); }
  to { transform: translateY(-100%); }
}

.promo-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.promo-icon {
  font-size: 32px;
}

.promo-text {
  flex: 1;
  min-width: 200px;
  font-size: 14px;
  line-height: 1.4;
}

.promo-text code {
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 16px;
}

.promo-timer {
  font-weight: 600;
  color: #D32F2F;
}

.promo-banner .btn-icon {
  background: transparent;
  border: none;
  color: #333;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.promo-banner .btn-icon:hover {
  color: #D32F2F;
}

/* Usage Dashboard Card */
.usage-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-input));
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.usage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.usage-header h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: 18px;
}

.usage-progress {
  margin-bottom: 16px;
}

.progress-bar-wrapper {
  background: var(--bg-input);
  border-radius: 10px;
  height: 24px;
  overflow: hidden;
  margin-bottom: 8px;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-success), var(--color-primary));
  border-radius: 10px;
  transition: width 0.5s ease, background 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
  color: white;
  font-weight: 600;
  font-size: 12px;
}

.progress-bar[style*="80%"],
.progress-bar[style*="90%"],
.progress-bar[style*="100%"] {
  background: linear-gradient(90deg, var(--color-warning), var(--color-error));
}

.usage-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.usage-percent {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 16px;
}

.usage-message {
  padding: 12px;
  background: var(--bg-input);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.usage-message.warning {
  background: rgba(241, 196, 15, 0.1);
  border-left: 4px solid var(--color-warning);
  color: var(--color-warning);
}

.usage-message.danger {
  background: rgba(231, 76, 60, 0.1);
  border-left: 4px solid var(--color-error);
  color: var(--color-error);
}

.usage-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.3s ease-out;
  pointer-events: all;
  border-left: 4px solid var(--color-info);
  min-width: 300px;
  position: relative;
}

.toast.success {
  border-left-color: var(--color-success);
}

.toast.error {
  border-left-color: var(--color-error);
}

.toast.warning {
  border-left-color: var(--color-warning);
}

.toast.info {
  border-left-color: var(--color-info);
}

.toast-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.toast-icon svg {
  width: 100%;
  height: 100%;
}

.toast.success .toast-icon {
  color: var(--color-success);
}

.toast.error .toast-icon {
  color: var(--color-error);
}

.toast.warning .toast-icon {
  color: var(--color-warning);
}

.toast.info .toast-icon {
  color: var(--color-info);
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.toast-message {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  word-wrap: break-word;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  border-radius: 4px;
}

.toast-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.toast-close svg {
  width: 16px;
  height: 16px;
}

.toast.removing {
  animation: slideOutRight 0.3s ease-out forwards;
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .toast-container {
    top: auto;
    bottom: 24px;
    right: 16px;
    left: 16px;
    max-width: none;
  }

  .toast {
    min-width: 0;
  }

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

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

/* Responsive */
@media (max-width: 768px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }
  
  .pricing-card.popular {
    transform: none;
  }
  
  .plan-comparison-mini {
    grid-template-columns: 1fr;
  }
  
  .promo-content {
    flex-direction: column;
    text-align: center;
  }
  
  .promo-banner {
    padding: 16px;
  }
}
