/* ==========================================================
   ARTRO - DESIGN SYSTEM & STYLESHEET
   Clean, modern, high-contrast, mathematically spaced UI
   ========================================================== */

:root {
  /* Dynamic Custom Accent Color */
  --cor-accent: #603DDC;

  /* Color Palette - Light Mode */
  --bg-app: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #FFFFFF;
  --bg-surface-subtle: #F1F5F9;
  --bg-hover: #F8FAFC;
  
  --border-subtle: #E2E8F0;
  --border-normal: #CBD5E1;
  --border-focus: var(--cor-accent);

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;

  --brand: var(--cor-accent);
  --brand-hover: var(--cor-accent);
  --brand-light: rgba(96, 61, 220, 0.12);
  --brand-light-border: rgba(96, 61, 220, 0.25);
  --brand-glow: rgba(96, 61, 220, 0.2);

  --success: #10B981;
  --success-light: rgba(16, 185, 129, 0.10);
  --info: #3B82F6;
  --info-light: rgba(59, 130, 246, 0.10);
  --warning: #F59E0B;
  --warning-light: rgba(245, 158, 11, 0.10);
  --danger: #EF4444;
  --danger-light: rgba(239, 68, 68, 0.10);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.06);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;
}

/* Dark Mode Theme Variables */
body.dark-theme {
  --cor-accent: #7C5CFC;

  --bg-app: #0B0F19;
  --bg-surface: #121A2D;
  --bg-surface-elevated: #18223B;
  --bg-surface-subtle: #1E293B;
  --bg-hover: #1A243D;

  --border-subtle: #1E293B;
  --border-normal: #2B3A55;
  --border-focus: var(--cor-accent);

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --brand: var(--cor-accent);
  --brand-hover: var(--cor-accent);
  --brand-light: rgba(124, 92, 252, 0.16);
  --brand-light-border: rgba(124, 92, 252, 0.3);
  --brand-glow: rgba(124, 92, 252, 0.25);

  --success-light: rgba(16, 185, 129, 0.16);
  --info-light: rgba(59, 130, 246, 0.16);
  --warning-light: rgba(245, 158, 11, 0.16);
  --danger-light: rgba(239, 68, 68, 0.16);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.35);
}

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

html, body {
  height: 100%;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Typography Hierarchy */
h1, h2, h3, h4, .font-display {
  font-family: 'Poppins', sans-serif;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* App Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* ==========================================================
   SIDEBAR
   ========================================================== */
.sidebar {
  width: 280px;
  height: 100vh;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 32px 20px;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 90;
  overflow-y: auto;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  margin-bottom: 28px;
  padding: 0 4px;
  width: 100%;
  box-sizing: border-box;
}

.sidebar-logo-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
}

/* Tamanho e proporção do logotipo da Sidebar */
.sidebar-logo img {
  width: 100%; /* Ocupa toda a largura horizontal útil dos botões da sidebar */
  max-width: 100%;
  height: auto;
  max-height: 90px; /* Ajuste aqui a altura máxima desejada (ex: 60px, 75px, 90px) */
  object-fit: contain;
  object-position: center;
  display: block;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Alternância da logo por tema */
body.dark-theme .logo-light {
  display: none !important;
}

body.dark-theme .logo-dark {
  display: block !important;
}

body:not(.dark-theme) .logo-light {
  display: block !important;
}

body:not(.dark-theme) .logo-dark {
  display: none !important;
}

.btn-close-sidebar {
  display: none;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  z-index: 2;
}

.btn-close-sidebar:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
}

.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Automatic logo toggling according to theme */
.logo-light { display: block; }
.logo-dark { display: none; }
body.dark-theme .logo-light { display: none; }
body.dark-theme .logo-dark { display: block; }

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

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  border: 1px solid transparent;
}

.sidebar-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  flex-shrink: 0;
}

.sidebar-item:hover {
  background-color: var(--bg-surface-subtle);
  color: var(--text-primary);
}

.sidebar-item.active {
  background-color: var(--brand-light);
  color: var(--brand);
  border-color: var(--brand-light-border);
}

.btn-atalho {
  background: transparent;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  padding: 11px 16px;
  margin: 18px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.btn-atalho:hover {
  background-color: var(--bg-surface-subtle);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.btn-sessao {
  background-color: var(--brand);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--brand-glow);
  transition: all 0.2s ease;
}

.btn-sessao:hover {
  background-color: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--brand-glow);
}

/* Settings Popover */
.settings-popup {
  position: absolute;
  bottom: 80px;
  left: 0;
  right: 0;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}

.settings-popup.open {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.settings-popup-item:hover {
  background-color: var(--bg-surface-subtle);
  color: var(--brand);
}

/* ==========================================================
   MAIN CONTENT AREA
   ========================================================== */
.main-content {
  flex: 1;
  margin-left: 280px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

/* Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px 48px 24px 48px;
  width: 100%;
}

.header__left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-mobile-menu {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-normal);
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn-mobile-menu:hover {
  background: var(--bg-surface-subtle);
  color: var(--brand);
}

.btn-mobile-menu svg {
  width: 20px;
  height: 20px;
}

.header__welcome h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 4px;
}

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

.header__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Streak Badge */
.streak-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: var(--warning-light);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 9999px;
  color: var(--warning);
  font-size: 14px;
  font-weight: 700;
}

/* Theme Toggle Button */
.btn-theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-normal);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-theme-toggle:hover {
  background-color: var(--bg-surface-subtle);
  color: var(--brand);
  border-color: var(--brand);
}

.btn-premium {
  background-color: transparent;
  border: 1px solid var(--brand);
  color: var(--brand);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-premium:hover {
  background-color: var(--brand-light);
}

.user-profile-trigger {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border-normal);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.user-profile-trigger:hover {
  transform: scale(1.05);
}

.user-profile-trigger img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Active Running Timer Floating Pill */
.active-timer-bar {
  display: none;
  background: var(--brand-light);
  border: 1px solid var(--brand-light-border);
  padding: 10px 24px;
  border-radius: var(--radius-md);
  margin: 0 48px 20px 48px;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.25s ease;
}

.active-timer-bar.visible {
  display: flex;
}

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

.timer-dot {
  width: 10px;
  height: 10px;
  background: var(--brand);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

.timer-digits {
  font-family: 'Poppins', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--brand);
}

/* Views Management */
.view-container {
  display: none;
  animation: fadeIn 0.2s ease-out;
  padding-bottom: 60px;
}

.view-container.active {
  display: block;
}

/* ==========================================================
   VIEW 1: DASHBOARD
   ========================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 0 48px 32px 48px;
}

.metric-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
  transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-card__icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-green { background-color: var(--success-light); color: var(--success); }
.icon-blue  { background-color: var(--info-light); color: var(--info); }
.icon-orange{ background-color: var(--warning-light); color: var(--warning); }
.icon-purple{ background-color: var(--brand-light); color: var(--brand); }

.metric-card__info {
  display: flex;
  flex-direction: column;
}

.metric-card__title {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 2px;
}

.metric-card__value {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.value-number {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.value-unit {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.metric-card__trend {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 4px;
}

.trend-green  { color: var(--success); }
.trend-blue   { color: var(--info); }
.trend-orange { color: var(--warning); }
.trend-purple { color: var(--brand); }
.trend-text   { color: var(--text-muted); font-weight: 500; }

/* Dashboard Columns Grid */
.dashboard-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 28px;
  padding: 0 48px 48px 48px;
  align-items: start;
}

.content-main {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.content-side {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.panel-box {
  background-color: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.panel-box h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

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

.chart-header h3 {
  margin-bottom: 0;
}

.chart-select {
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  outline: none;
}

.chart-legend {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.legend-color.purple { background-color: var(--brand); }
.legend-color.gray   { background-color: var(--text-muted); }

.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
}

/* Upcoming Subjects Box */
.upcoming-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.upcoming-header h3 {
  margin-bottom: 0;
}

.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upcoming-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  transition: all 0.15s ease;
}

.upcoming-item:hover {
  border-color: var(--border-normal);
}

.upcoming-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.upcoming-icon-badge {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--brand-light);
  color: var(--brand);
}

.upcoming-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.upcoming-meta {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.btn-start-session {
  background-color: transparent;
  border: 1.5px solid var(--brand);
  color: var(--brand);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-start-session:hover {
  background-color: var(--brand);
  color: #FFFFFF;
}

/* Most Studied Subjects List */
.subjects-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

.subject-item {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}

.subject-item:last-child {
  border-bottom: none;
}

.subject-rank {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-secondary);
  width: 24px;
}

.subject-color-bar {
  width: 4px;
  height: 28px;
  border-radius: 4px;
  background-color: var(--brand);
  flex-shrink: 0;
}

.subject-name-col {
  flex: 1;
}

.subject-name-col strong {
  display: block;
  font-size: 15px;
  color: var(--text-primary);
}

.subject-name-col span {
  font-size: 12px;
  color: var(--text-muted);
}

.subject-hours {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: right;
}

.subject-hours span {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 16px;
}

.btn-view-all {
  width: 100%;
  background-color: transparent;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  padding: 12px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-view-all:hover {
  background-color: var(--bg-surface-subtle);
  color: var(--text-primary);
}

/* Goals Widget in Dashboard Side */
.goals-card-item {
  margin-bottom: 18px;
}

.goals-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.goals-progress-track {
  width: 100%;
  height: 8px;
  background-color: var(--bg-surface-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.goals-progress-fill {
  height: 100%;
  background-color: var(--brand);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.goals-progress-fill.green {
  background-color: var(--success);
}

/* ==========================================================
   VIEW 2: SESSIONS & TIMER
   ========================================================== */
.view-content-wrapper {
  padding: 0 48px;
}

.timer-dashboard-card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 36px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer-mode-selector {
  display: flex;
  background: var(--bg-surface-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
  margin-bottom: 24px;
}

.timer-mode-btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.timer-mode-btn.active {
  background: var(--bg-surface);
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.timer-clock-display {
  font-family: 'Poppins', monospace;
  font-size: 72px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  letter-spacing: -2px;
}

.timer-subject-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.custom-select {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-normal);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 500;
  outline: none;
  min-width: 220px;
}

.timer-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-timer-main {
  background-color: var(--brand);
  color: #FFFFFF;
  border: none;
  border-radius: 9999px;
  padding: 14px 36px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px var(--brand-glow);
  transition: all 0.2s ease;
}

.btn-timer-main:hover {
  background-color: var(--brand-hover);
  transform: scale(1.02);
}

.btn-timer-secondary {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-normal);
  color: var(--text-secondary);
  border-radius: 9999px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

/* Sessions History Table & List */
.section-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header-bar h2 {
  font-size: 22px;
  font-weight: 700;
}

.table-card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: var(--bg-surface-subtle);
  padding: 16px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}

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

.data-table tr:hover td {
  background-color: var(--bg-hover);
}

.badge-accuracy {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-accuracy.high {
  background: var(--success-light);
  color: var(--success);
}

.badge-accuracy.mid {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-accuracy.low {
  background: var(--danger-light);
  color: var(--danger);
}

/* ==========================================================
   VIEW 3: SUBJECTS (MATÉRIAS)
   ========================================================== */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.subject-card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.subject-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background-color: var(--card-color, var(--brand));
}

.subject-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-normal);
}

.subject-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.subject-card-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.subject-meta-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
  text-align: center;
}

.meta-stat-item small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.meta-stat-item strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ==========================================================
   VIEW 4: SCHEDULE & WEEKLY PLANNER
   ========================================================== */
.schedule-grid-days {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.day-column-card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  min-height: 280px;
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.day-header h4 {
  font-size: 16px;
  font-weight: 700;
}

.task-list-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.task-item-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: all 0.15s ease;
}

.task-item-card.completed {
  opacity: 0.55;
  background: transparent;
}

.task-item-card.completed .task-desc {
  text-decoration: line-through;
}

.task-checkbox {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
}

.task-details {
  flex: 1;
}

.task-subject-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 2px;
}

.task-desc {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
}

.task-time-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================
   VIEW 5: STUDY CYCLE & GOALS
   ========================================================== */
.cycle-banner {
  background: linear-gradient(135deg, var(--brand) 0%, #431CC8 100%);
  color: #FFFFFF;
  border-radius: var(--radius-xl);
  padding: 36px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px var(--brand-glow);
}

.cycle-banner-text h2 {
  color: #FFFFFF;
  font-size: 26px;
  margin-bottom: 6px;
}

.cycle-banner-text p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 15px;
}

.btn-cycle-advance {
  background: #FFFFFF;
  color: var(--brand);
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.btn-cycle-advance:hover {
  transform: translateY(-2px);
  background: #F8FAFC;
}

.cycle-items-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 36px;
}

.cycle-block-item {
  background: var(--bg-surface);
  border: 2px solid var(--border-normal);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.2s ease;
}

.cycle-block-item.current {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
  background: var(--brand-light);
}

.cycle-block-order {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.cycle-block-item.current .cycle-block-order {
  color: var(--brand);
}

.cycle-block-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.cycle-block-duration {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ==========================================================
   VIEW 6: SPACED REPETITION (REVISÃO ESPAÇADA)
   ========================================================== */
.reviews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.review-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.review-subject-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--brand-light);
  color: var(--brand);
  margin-bottom: 12px;
}

.review-content-box {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 20px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.review-action-ratings {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.btn-rate {
  border: none;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.btn-rate.forgot { background: var(--danger-light); color: var(--danger); }
.btn-rate.hard   { background: var(--warning-light); color: var(--warning); }
.btn-rate.medium { background: var(--info-light); color: var(--info); }
.btn-rate.easy   { background: var(--success-light); color: var(--success); }

.btn-rate:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
}

/* ==========================================================
   MODALS & DRAWERS
   ========================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

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

.modal-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalScale 0.2s ease-out;
}

.modal-container.large {
  max-width: 720px;
}

.modal-header {
  padding: 24px 28px 18px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 700;
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.btn-close-modal:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px 28px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 28px 24px 28px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-textarea, .form-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--border-focus);
}

/* Color Swatches for Subject Modal */
.color-palette-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.swatch-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  padding: 0;
}

.swatch-btn:hover {
  transform: scale(1.15);
}

.swatch-btn.active {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--brand);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.btn-primary {
  background: var(--brand);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--brand-glow);
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-normal);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

/* Drawer */
.customization-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  background: var(--bg-surface-elevated);
  border-left: 1px solid var(--border-normal);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  padding: 32px 28px;
}

.customization-drawer.open {
  transform: translateX(0);
}

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

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  pointer-events: auto;
  animation: slideLeft 0.2s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }

/* ==========================================================
   PROFILE MODAL & AVATAR CUSTOMIZATION
   ========================================================== */
.profile-modal-box {
  max-width: 480px;
}

.profile-header-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--brand-light);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar-edit-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.profile-avatar-wrapper {
  position: relative;
  width: 86px;
  height: 86px;
  flex-shrink: 0;
}

.profile-avatar-wrapper img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg-surface);
  box-shadow: var(--shadow-md);
  background-color: var(--bg-surface);
}

.profile-avatar-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-surface);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.profile-avatar-badge:hover {
  transform: scale(1.1);
  background: var(--brand-hover);
}

.profile-avatar-badge svg {
  width: 14px;
  height: 14px;
}

.profile-avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.btn-upload-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  background: var(--bg-surface);
}

.btn-upload-photo svg {
  width: 15px;
  height: 15px;
}

.btn-remove-photo {
  background: transparent;
  border: none;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  transition: opacity 0.15s ease;
}

.btn-remove-photo svg {
  width: 14px;
  height: 14px;
}

.btn-remove-photo:hover {
  opacity: 0.8;
}

.avatar-presets-wrapper {
  margin-bottom: 20px;
}

.section-sub-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 8px;
}

.avatar-presets-list {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.avatar-preset-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
}

.avatar-preset-btn:hover {
  transform: scale(1.08);
}

.avatar-preset-btn.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-light-border);
}

.avatar-preset-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ==========================================================
   MOBILE BOTTOM NAVIGATION BAR
   ========================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(62px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-normal);
  z-index: 990;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  justify-content: space-around;
  align-items: center;
  padding-left: 4px;
  padding-right: 4px;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  height: 100%;
  transition: color 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item svg {
  width: 20px;
  height: 20px;
}

.mobile-nav-item.active {
  color: var(--brand);
}

/* Table Card Responsiveness */
.table-card {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

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

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

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* ==========================================================
   RESPONSIVE BREAKPOINTS (PERFECT SMARTPHONE & TABLET FIT)
   ========================================================== */
@media (max-width: 1024px) {
  .dashboard-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 0 28px 24px 28px;
  }

  .dashboard-content, .view-content-wrapper {
    padding-left: 28px;
    padding-right: 28px;
  }
}

@media (max-width: 768px) {
  /* Prevent any horizontal drag or page-level overflow */
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .app-layout {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* Sidebar becomes off-canvas slide-in drawer on mobile */
  .sidebar {
    width: 280px;
    max-width: 82vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1100;
    transform: translateX(-100%);
    box-shadow: none;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s ease;
  }
  
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 16px 0 40px rgba(0, 0, 0, 0.45);
  }

  .btn-close-sidebar {
    display: flex;
  }

  .btn-mobile-menu {
    display: flex;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  /* Main content full width, accounting for bottom nav & safe areas */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box;
  }

  /* Main Header Responsive Adjustments */
  .main-header {
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
  }

  .header__left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }

  .btn-mobile-menu {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
  }

  .btn-mobile-menu svg {
    width: 18px;
    height: 18px;
  }

  .header__welcome {
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }

  .header__welcome h1 {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    line-height: 1.25 !important;
  }

  .header__welcome p {
    display: block !important;
    font-size: 11px !important;
    color: var(--text-secondary) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin-top: 1px !important;
  }

  .header__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }

  .btn-cloud-account {
    padding: 6px 8px;
    font-size: 12px;
  }

  .btn-cloud-account span {
    display: none !important;
  }

  .streak-pill {
    padding: 5px 8px;
    font-size: 12px;
    gap: 4px;
    border-radius: 999px;
  }

  .streak-pill svg {
    width: 14px;
    height: 14px;
  }

  .btn-theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .btn-theme-toggle svg {
    width: 16px;
    height: 16px;
  }

  .btn-premium {
    padding: 6px 8px;
    font-size: 12px;
    border-radius: var(--radius-sm);
  }

  .btn-premium .premium-label {
    display: none !important;
  }

  .user-profile-trigger {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  /* Active Running Timer Bar on Mobile */
  .active-timer-bar {
    margin: 8px 14px 14px 14px;
    padding: 10px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    box-sizing: border-box;
  }

  .active-timer-bar > div:first-child {
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  .active-timer-bar > div:last-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .active-timer-bar button {
    flex: 1;
    min-width: 100px;
    text-align: center;
    justify-content: center;
  }

  /* View Containers & Global Wrappers */
  .view-container {
    padding-bottom: 20px;
  }

  .stats-grid, 
  .dashboard-content, 
  .view-content-wrapper {
    padding-left: 14px !important;
    padding-right: 14px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* ==========================================================
     METRIC CARDS (FITTED & NON-OVERFLOWING FOR MOBILE)
     ========================================================== */
  .stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    padding-bottom: 16px !important;
  }

  .metric-card {
    padding: 14px 12px !important;
    gap: 12px !important;
    border-radius: var(--radius-md) !important;
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
  }

  .metric-card__icon {
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .metric-card__icon svg {
    width: 20px !important;
    height: 20px !important;
  }

  .metric-card__info {
    min-width: 0 !important;
    flex: 1 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .metric-card__title {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    white-space: normal !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.25 !important;
    margin-bottom: 2px !important;
  }

  .metric-card__value {
    gap: 4px !important;
    align-items: baseline !important;
    display: flex !important;
    flex-wrap: wrap !important;
  }

  .value-number {
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    line-height: 1.15 !important;
  }

  .value-unit {
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
  }

  .metric-card__trend {
    font-size: 0.75rem !important;
    margin-top: 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.2 !important;
  }

  .trend-text {
    display: inline !important;
    color: var(--text-muted) !important;
    font-size: 0.7rem !important;
  }

  /* ==========================================================
     DASHBOARD CONTENT & PANELS
     ========================================================== */
  .dashboard-content {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding-bottom: 24px !important;
  }

  .content-main, .content-side {
    gap: 16px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .panel-box {
    padding: 16px 14px !important;
    border-radius: var(--radius-lg) !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .panel-box h3 {
    font-size: 16px !important;
    margin-bottom: 14px !important;
  }

  .chart-header {
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  .chart-header h3 {
    font-size: 15px !important;
  }

  .chart-select {
    padding: 4px 8px !important;
    font-size: 12px !important;
  }

  .chart-legend {
    gap: 12px !important;
    margin-bottom: 12px !important;
    font-size: 12px !important;
    flex-wrap: wrap !important;
  }

  .chart-container {
    height: 190px !important;
    width: 100% !important;
  }

  /* Upcoming items list */
  .upcoming-header {
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  .upcoming-header h3 {
    font-size: 15px !important;
  }

  .upcoming-item {
    padding: 10px 10px !important;
    gap: 10px !important;
    border-radius: var(--radius-sm) !important;
  }

  .upcoming-left {
    min-width: 0 !important;
    flex: 1 !important;
    gap: 10px !important;
  }

  .upcoming-icon-badge {
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }

  .upcoming-icon-badge svg {
    width: 16px !important;
    height: 16px !important;
  }

  .upcoming-name {
    font-size: 13px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .upcoming-meta {
    font-size: 11px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .btn-start-session {
    padding: 6px 10px !important;
    font-size: 12px !important;
    flex-shrink: 0 !important;
  }

  /* Most Studied Subjects */
  .subject-item {
    padding: 10px 0 !important;
    gap: 10px !important;
  }

  .subject-rank {
    font-size: 13px !important;
    width: 20px !important;
  }

  .subject-name-col strong {
    font-size: 14px !important;
  }

  .subject-name-col span {
    font-size: 11px !important;
  }

  .subject-hours span {
    font-size: 14px !important;
  }

  .btn-view-all {
    padding: 10px !important;
    font-size: 13px !important;
  }

  /* Goals Widget */
  .goals-card-item {
    margin-bottom: 14px !important;
  }

  .goals-label {
    font-size: 12px !important;
    margin-bottom: 4px !important;
  }

  /* ==========================================================
     VIEW 2: SESSIONS & TIMER
     ========================================================== */
  .timer-dashboard-card {
    padding: 20px 14px !important;
    border-radius: var(--radius-lg) !important;
    margin-bottom: 24px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .timer-mode-selector {
    width: 100% !important;
    display: flex !important;
    gap: 4px !important;
    margin-bottom: 16px !important;
    box-sizing: border-box !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .timer-mode-btn {
    flex: 1 !important;
    min-width: 0 !important;
    padding: 8px 4px !important;
    font-size: 11px !important;
    white-space: nowrap !important;
    text-align: center !important;
  }

  .timer-clock-display {
    font-size: clamp(38px, 13vw, 56px) !important;
    letter-spacing: -1px !important;
    margin-bottom: 16px !important;
  }

  .timer-subject-picker {
    flex-direction: column !important;
    width: 100% !important;
    align-items: stretch !important;
    gap: 6px !important;
    margin-bottom: 18px !important;
  }

  .custom-select {
    width: 100% !important;
    min-width: 0 !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
  }

  .timer-controls {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 10px !important;
  }

  .btn-timer-main, .btn-timer-secondary, #btnSaveSessionNow {
    width: 100% !important;
    justify-content: center !important;
    padding: 12px 18px !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
  }

  .section-header-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    margin-bottom: 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .section-header-bar h2 {
    font-size: 18px !important;
  }

  .section-header-bar .btn-primary {
    width: 100% !important;
    justify-content: center !important;
    font-size: 13px !important;
    padding: 10px 14px !important;
  }

  /* Sessions & Generic Tables Responsive Scrolling Inside Card */
  .table-card {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: var(--radius-lg) !important;
    box-sizing: border-box !important;
    position: relative;
    border: 1px solid var(--border-subtle) !important;
  }

  .data-table {
    min-width: 600px !important;
    width: 100% !important;
  }

  .data-table th, .data-table td {
    padding: 10px 12px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
  }

  /* ==========================================================
     VIEW 3: SUBJECTS (MATÉRIAS)
     ========================================================== */
  .subjects-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .subject-card {
    padding: 16px 14px !important;
    border-radius: var(--radius-lg) !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .subject-card-header h3 {
    font-size: 17px !important;
  }

  .subject-meta-stats {
    padding: 10px 8px !important;
    gap: 6px !important;
    margin-bottom: 14px !important;
  }

  .meta-stat-item small {
    font-size: 10px !important;
  }

  .meta-stat-item strong {
    font-size: 14px !important;
  }

  /* ==========================================================
     VIEW 4: SCHEDULE & PLANNER
     ========================================================== */
  .schedule-grid-days {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .day-column-card {
    min-height: unset !important;
    padding: 16px 14px !important;
    border-radius: var(--radius-lg) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background: var(--bg-surface) !important;
  }

  .day-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding-bottom: 10px !important;
    margin-bottom: 12px !important;
    border-bottom: 1px solid var(--border-subtle) !important;
  }

  .day-header h4 {
    font-size: 16px !important;
    font-weight: 700 !important;
  }

  .day-header .btn-add-day-task {
    padding: 6px 12px !important;
    font-size: 12px !important;
    border-radius: var(--radius-sm) !important;
  }

  .task-item-card {
    padding: 12px 10px !important;
    gap: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: flex-start !important;
  }

  .task-details {
    min-width: 0 !important;
    flex: 1 !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
  }

  .task-desc {
    font-size: 13px !important;
    line-height: 1.35 !important;
    margin-top: 2px !important;
    margin-bottom: 4px !important;
  }

  .task-time-meta {
    font-size: 11px !important;
  }

  /* ==========================================================
     VIEW 5: STUDY CYCLE & GOALS
     ========================================================== */
  .cycle-banner {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 16px !important;
    padding: 22px 16px !important;
    border-radius: var(--radius-lg) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .cycle-banner-text h2 {
    font-size: 20px !important;
    line-height: 1.3 !important;
    margin-bottom: 4px !important;
  }

  .cycle-banner-text p {
    font-size: 13px !important;
    opacity: 0.9 !important;
  }

  .cycle-banner > div:last-child {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 10px !important;
  }

  .btn-cycle-advance, .cycle-banner button {
    width: 100% !important;
    justify-content: center !important;
    padding: 12px 18px !important;
    font-size: 14px !important;
    text-align: center !important;
  }

  .cycle-items-flow {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    margin-bottom: 24px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  @media (min-width: 480px) and (max-width: 768px) {
    .cycle-items-flow {
      grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
      gap: 12px !important;
    }
  }

  .cycle-block-item {
    min-width: 0 !important;
    padding: 14px 12px !important;
    border-radius: var(--radius-md) !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }

  .cycle-block-order {
    font-size: 11px !important;
  }

  .cycle-block-name {
    font-size: 14px !important;
    font-weight: 600 !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  .cycle-block-duration {
    font-size: 12px !important;
  }

  /* Weekly Goals Form on Mobile */
  #formUpdateGoals .form-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
  }

  #formUpdateGoals button {
    width: 100% !important;
    justify-content: center !important;
    padding: 12px !important;
  }

  /* ==========================================================
     VIEW 6: SPACED REPETITION (FLASHCARDS)
     ========================================================== */
  .reviews-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .review-card {
    padding: 16px 14px !important;
    border-radius: var(--radius-lg) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .review-content-box {
    font-size: 14px !important;
    margin-bottom: 14px !important;
  }

  .review-action-ratings {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 5px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .btn-rate {
    padding: 8px 2px !important;
    font-size: 11px !important;
    white-space: nowrap !important;
    text-align: center !important;
  }

  /* ==========================================================
     MODALS & DRAWERS (MOBILE COMPACT & USABLE)
     ========================================================== */
  .modal-overlay {
    padding: 10px !important;
    align-items: center !important;
  }

  .modal-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    border-radius: var(--radius-lg) !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
  }

  .modal-header {
    padding: 16px 16px 12px 16px !important;
  }

  .modal-header h3 {
    font-size: 17px !important;
  }

  .modal-body {
    padding: 14px 16px !important;
    max-height: 65vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .modal-footer {
    padding: 12px 16px 16px 16px !important;
    flex-direction: column-reverse !important;
    gap: 8px !important;
  }

  .modal-footer button {
    width: 100% !important;
    justify-content: center !important;
    padding: 12px !important;
    font-size: 14px !important;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* 16px font-size prevents mobile Safari/Chrome from zooming on inputs */
  .form-input, .form-textarea, .form-select {
    font-size: 16px !important;
    padding: 10px 12px !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }

  .form-group label {
    font-size: 12px !important;
  }

  /* Profile Edit Card on Mobile */
  .profile-avatar-edit-card {
    flex-direction: column !important;
    text-align: center !important;
    padding: 14px !important;
    gap: 12px !important;
  }

  .profile-avatar-actions {
    width: 100% !important;
    align-items: center !important;
  }

  .btn-upload-photo {
    width: 100% !important;
    padding: 10px !important;
  }

  /* Customization Drawer on Mobile */
  .customization-drawer {
    width: 100% !important;
    max-width: 100vw !important;
    padding: 24px 18px !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 380px) {
  /* Ultra-compact tweaks for narrow phones (<= 380px) */
  .stats-grid, 
  .dashboard-content, 
  .view-content-wrapper,
  .main-header {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .stats-grid {
    gap: 8px !important;
  }

  .metric-card {
    padding: 10px 8px !important;
    gap: 6px !important;
  }

  .metric-card__icon {
    width: 32px !important;
    height: 32px !important;
  }

  .metric-card__icon svg {
    width: 16px !important;
    height: 16px !important;
  }

  .value-number {
    font-size: 1.15rem !important;
  }

  .value-unit {
    font-size: 0.75rem !important;
  }

  .cycle-items-flow {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================
   CLOUD SYNC & AUTHENTICATION STYLING
   ========================================================== */
.btn-cloud-account {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-normal);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-cloud-account:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--bg-surface-subtle);
}

.btn-cloud-account.connected {
  border-color: rgba(16, 185, 129, 0.4);
  color: #10B981;
  background: rgba(16, 185, 129, 0.08);
}

.btn-cloud-account.connected:hover {
  background: rgba(16, 185, 129, 0.15);
}

.btn-google-auth {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.btn-google-auth:hover {
  background: var(--bg-surface-subtle);
  border-color: var(--border-focus);
}

.auth-tab.active {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}


