:root {
    --primary: #4f46e5;
    --secondary: #10b981;
    --border: #e5e7eb;
    --bg-light: #f9fafb;
    --text: #1f2937;
    --accent: #a78bfa;
    --card-bg: #fff;
    --sidebar-bg: #fff;
    --table-header-bg: #4f46e5;
    --table-header-text: #fff;
  }
  
  .theme-dark-red {
    --primary: #ef4444;
    --secondary: #f87171;
    --border: #4b5563;
    --bg-light: #111827;
    --text: #d1d5db;
    --accent: #f87171;
    --card-bg: #1f2937;
    --sidebar-bg: #1f2937;
    --table-header-bg: #ef4444;
    --table-header-text: #fff;
  }
  
  body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text);
    display: flex;
    min-height: 100vh;
  }
  
  .sidebar {
    width: 180px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    height: 100vh;
    padding: 16px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  
  @media (max-width: 768px) {
    .sidebar {
      width: 160px;
      transform: translateX(-100%);
      transition: transform 0.3s ease;
    }
    .sidebar.active {
      transform: translateX(0);
    }
  }
  
  @media (max-width: 480px) {
    .sidebar {
      width: 140px;
    }
  }
  
  .back-btn {
    background: var(--primary);
    color: var(--table-header-text);
    border: none;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: clamp(0.9rem, 3vw, 1rem);
  }
  
  .back-btn:hover {
    background: var(--accent);
  }
  
  .logo {
    font-size: clamp(1.2rem, 4vw, 1.3rem);
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
  }
  
  .nav {
    list-style: none;
    padding: 0;
  }
  
  .nav li {
    padding: 12px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: clamp(0.9rem, 3vw, 1rem);
  }
  
  .nav li:hover {
    background-color: var(--border);
  }
  
  .nav li.active {
    background-color: var(--primary);
    color: var(--table-header-text);
  }
  
  .user {
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .main {
    flex: 1;
    padding: clamp(20px, 5vw, 40px);
    margin-left: 180px;
  }
  
  @media (max-width: 768px) {
    .main {
      margin-left: 0;
    }
  }
  
  .menu-toggle {
    display: none;
    background: var(--primary);
    color: var(--table-header-text);
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1100;
  }
  
  @media (max-width: 768px) {
    .menu-toggle {
      display: block;
    }
  }
  
  .section {
    display: none;
  }
  
  .section.active {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }
  
  header h1 {
    margin: 0;
    font-size: clamp(1.8rem, 6vw, 2rem);
    color: var(--primary);
  }
  
  header p {
    color: var(--text);
    opacity: 0.8;
    font-size: clamp(1rem, 3.5vw, 1.1rem);
  }
  
  .filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
  }
  
  .filters button {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text);
    font-size: clamp(0.9rem, 3vw, 1rem);
  }
  
  .filters button:hover {
    background-color: var(--border);
  }
  
  .filters button.active {
    background-color: var(--primary);
    color: var(--table-header-text);
    border: none;
  }
  
  .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  @media (min-width: 1024px) {
    .dashboard-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  
  .card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  
  .card canvas {
    flex: 1;
    max-height: 250px;
  }
  
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: clamp(1rem, 3.5vw, 1.1rem);
    color: var(--primary);
  }
  
  .card-header a {
    color: var(--secondary);
    text-decoration: none;
    font-size: clamp(0.9rem, 3vw, 1rem);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .card-header a:hover {
    text-decoration: underline;
  }
  
  .events-table {
    margin-top: 24px;
  }
  
  table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    font-size: clamp(0.9rem, 3vw, 1rem);
  }
  
  th, td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
  }
  
  th {
    background-color: var(--table-header-bg);
    color: var(--table-header-text);
  }
  
  .action-btn {
    background: var(--secondary);
    color: var(--table-header-text);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: clamp(0.9rem, 3vw, 1rem);
  }
  
  .action-btn:hover {
    background: #059669;
  }
  
  .calendar-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }
  
  .calendar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
  }
  
  .calendar-header button {
    background: var(--primary);
    color: var(--table-header-text);
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
  }
  
  .calendar-header button:hover {
    background: var(--accent);
  }
  
  .calendar-header h2 {
    margin: 0;
    font-size: clamp(1.3rem, 4.5vw, 1.5rem);
    color: var(--primary);
  }
  
  .calendar-search input {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: min(100%, 400px);
    font-size: clamp(0.9rem, 3vw, 1rem);
    background: var(--card-bg);
    color: var(--text);
  }
  
  .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
  }
  
  .calendar-day-header {
    font-weight: 700;
    text-align: center;
    padding: 12px;
    color: var(--primary);
    font-size: clamp(0.9rem, 3vw, 1rem);
  }
  
  .calendar-day {
    padding: 12px;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
    font-size: clamp(0.9rem, 3vw, 1rem);
  }
  
  .calendar-day:hover {
    background-color: var(--border);
  }
  
  .calendar-day.has-event {
    color: #fff;
    font-weight: 700;
  }
  
  .calendar-day.selected {
    background-color: var(--primary) !important;
    color: var(--table-header-text);
  }
  
  .calendar-events {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
  }
  
  .calendar-events h3 {
    margin: 0 0 16px;
    font-size: clamp(1.1rem, 4vw, 1.2rem);
    color: var(--primary);
  }
  
  #event-list {
    list-style: none;
    padding: 0;
  }
  
  #event-list li {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: clamp(0.9rem, 3vw, 1rem);
  }
  
  #event-list li:hover {
    background-color: var(--border);
  }
  
  #event-list li:last-child {
    border-bottom: none;
  }
  
  .modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
  }
  
  .modal-content {
    background: var(--card-bg);
    color: var(--text);
    padding: 24px;
    border-radius: 12px;
    width: min(90%, 600px);
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  
  .modal-content h2 {
    font-size: clamp(1.3rem, 4.5vw, 1.5rem);
    margin: 0;
  }
  
  .modal-content p {
    font-size: clamp(1rem, 3.5vw, 1.1rem);
    margin: 0;
  }
  
  .modal-close {
    position: absolute;
    top: 16px;
    right: 24px;
    font-size: clamp(1.3rem, 4.5vw, 1.5rem);
    cursor: pointer;
    color: var(--primary);
  }
  
  .modal-close:hover {
    color: var(--secondary);
  }
  
  .chart-modal-content {
    width: min(90%, 1000px);
    max-height: 90vh;
    overflow-y: auto;
  }
  
  .chart-modal-content canvas {
    width: 100% !important;
    height: 450px !important;
  }
  
  #chart-modal-details {
    margin-top: 24px;
  }
  
  #chart-modal-details h3 {
    font-size: clamp(1.1rem, 4vw, 1.2rem);
    color: var(--primary);
    margin: 0 0 16px;
  }
  
  #chart-modal-details ul {
    list-style: none;
    padding: 0;
  }
  
  #chart-modal-details li {
    font-size: clamp(0.9rem, 3vw, 1rem);
    margin: 8px 0;
  }
  
  /* Estilos para a seção Análises */
  .analytics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  @media (min-width: 1024px) {
    .analytics-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  
  .analytics-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-height: 350px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  
  .analytics-card canvas {
    flex: 1;
    max-height: 300px;
  }
  
  .analytics-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: clamp(1rem, 3.5vw, 1.1rem);
    color: var(--primary);
  }
  
  .analytics-card-header a {
    color: var(--secondary);
    text-decoration: none;
    font-size: clamp(0.9rem, 3vw, 1rem);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .analytics-card-header a:hover {
    text-decoration: underline;
  }
  
  /* Estilos para a tabela de clientes */
  .clients-table {
    margin-top: 24px;
  }
  
  .clients-table table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    font-size: clamp(0.9rem, 3vw, 1rem);
  }
  
  .clients-table th,
  .clients-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
  }
  
  .clients-table th {
    background-color: var(--table-header-bg);
    color: var(--table-header-text);
  }
  
  .clients-table td a {
    color: var(--primary);
    text-decoration: none;
  }
  
  .clients-table td a:hover {
    text-decoration: underline;
  }
  
  /* Estilos para o gráfico de top clientes */
  .top-clients-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-height: 350px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  
  .top-clients-card canvas {
    flex: 1;
    max-height: 300px;
  }
  
  /* Estilos para a distribuição por dispositivo */
  .device-distribution-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-height: 350px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  
  .device-distribution-card canvas {
    flex: 1;
    max-height: 300px;
  }
  
  /* Ajustes responsivos para as novas seções */
  @media (max-width: 768px) {
    .analytics-grid {
      grid-template-columns: 1fr;
    }
  
    .clients-table {
      overflow-x: auto;
    }
  
    .clients-table table {
      min-width: 800px;
    }
  
    .analytics-card,
    .top-clients-card,
    .device-distribution-card {
      min-height: 300px;
    }
  
    .analytics-card canvas,
    .top-clients-card canvas,
    .device-distribution-card canvas {
      max-height: 250px;
    }
  }
  
  @media (max-width: 480px) {
    .analytics-card,
    .top-clients-card,
    .device-distribution-card {
      min-height: 250px;
    }
  
    .analytics-card canvas,
    .top-clients-card canvas,
    .device-distribution-card canvas {
      max-height: 200px;
    }
  
    .clients-table th,
    .clients-table td {
      padding: 12px;
      font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    }
  }