/* ============================================================
   AprovaOS — Design System
   ============================================================ */

:root {
  --color-primary: #6C63FF;
  --color-secondary: #FF6584;
  --color-accent: #43D9AD;

  /* Light theme */
  --bg: #F8F9FF;
  --bg-card: #FFFFFF;
  --bg-sidebar: #1E1B4B;
  --sidebar-text: rgba(255,255,255,0.75);
  --sidebar-active: rgba(255,255,255,0.15);
  --text: #1a1a2e;
  --text-muted: #64748b;
  --border: #E2E8F0;
  --input-bg: #F8FAFC;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.10);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 240px;
}

[data-theme="dark"] {
  --bg: #0F0E1A;
  --bg-card: #1A1828;
  --bg-sidebar: #120F1E;
  --sidebar-text: rgba(255,255,255,0.7);
  --sidebar-active: rgba(255,255,255,0.1);
  --text: #E2E8F0;
  --text-muted: #94A3B8;
  --border: #2D2B3D;
  --input-bg: #211F30;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-icon {
  width: 36px; height: 36px;
  background: var(--color-primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 16px;
}
.logo-text { font-weight: 800; font-size: 18px; color: white; letter-spacing: -0.5px; }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.15s;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.nav-item:hover { background: var(--sidebar-active); color: white; }
.nav-item.active { background: var(--color-primary); color: white; box-shadow: 0 4px 12px rgba(108,99,255,0.3); }
.nav-logout:hover { background: rgba(239,68,68,0.2); color: #fca5a5; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-toggle { background: none; border: none; color: var(--sidebar-text); cursor: pointer; font-size: 16px; }
#sidebarClose { display: none; }

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

#sidebarOpen { display: none; color: var(--text); }

.topbar-title { font-weight: 700; font-size: 16px; flex: 1; }

.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
}

/* ============================================================
   AUTH LAYOUT
   ============================================================ */
.auth-layout { min-height: 100vh; }
.auth-container {
  display: grid;
  grid-template-columns: 480px 1fr;
  min-height: 100vh;
}

.auth-card {
  background: var(--bg-card);
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
}

.auth-brand { text-align: center; margin-bottom: 8px; }
.auth-logo {
  width: 64px; height: 64px;
  background: var(--color-primary);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px; color: white;
  box-shadow: 0 8px 24px rgba(108,99,255,0.35);
}
.auth-brand h1 { font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.auth-brand p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

.auth-illustration {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: white;
  position: relative;
  overflow: hidden;
}
.auth-illustration::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  top: -100px; right: -100px;
}
.auth-illustration h2 { font-size: 32px; font-weight: 800; line-height: 1.2; margin-bottom: 12px; z-index: 1; }
.auth-illustration h2 span { color: rgba(255,255,255,0.8); }
.auth-illustration p { font-size: 16px; opacity: 0.9; z-index: 1; }

.auth-floating { position: absolute; top: 20%; width: 100%; padding: 0 32px; z-index: 1; }
.float-card {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  width: fit-content;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid rgba(255,255,255,0.2);
}
.float-1 { margin-left: 40px; }
.float-2 { margin-left: 10px; }
.float-3 { margin-left: 60px; }

.auth-stats { z-index: 1; width: 100%; margin-bottom: 32px; }
.stat-item {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 500;
}
.stat-num { font-size: 24px; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 13px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.auth-link { text-align: center; color: var(--text-muted); font-size: 13px; }
.auth-link a { color: var(--color-primary); font-weight: 600; text-decoration: none; }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-header h3 i { color: var(--color-primary); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(108,99,255,0.3);
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--input-bg); color: var(--text); }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn-google {
  background: var(--bg-card);
  color: var(--text);
  border: 1.5px solid var(--border);
  font-weight: 600;
  justify-content: center;
  gap: 10px;
}
.btn-google:hover { background: var(--input-bg); transform: translateY(-1px); }

.btn-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
}
.btn-icon:hover { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.btn-icon.btn-danger:hover { background: #ef4444; border-color: #ef4444; color: white; }
.btn-icon.sm { width: 26px; height: 26px; font-size: 11px; }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.12);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.form-check input { width: auto; }
.form-check-inline { flex-direction: row; align-items: center; padding-top: 24px; }

.input-icon { position: relative; }
.input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.input-icon input { padding-left: 36px; }
.input-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted); cursor: pointer;
}

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.badge-neutral { background: var(--input-bg); color: var(--text-muted); }
.badge-danger { background: #fee2e2; color: #ef4444; }
[data-theme="dark"] .badge-danger { background: rgba(239,68,68,0.2); }

/* Alerts */
.flash-messages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  position: relative;
}
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid #10b981; }
.alert-danger { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid #f59e0b; }
.alert-info { background: #dbeafe; color: #1e40af; border-left: 4px solid #3b82f6; }
[data-theme="dark"] .alert-success { background: rgba(16,185,129,0.15); color: #34d399; }
[data-theme="dark"] .alert-danger { background: rgba(239,68,68,0.15); color: #fca5a5; }
[data-theme="dark"] .alert-warning { background: rgba(245,158,11,0.15); color: #fcd34d; }
[data-theme="dark"] .alert-info { background: rgba(59,130,246,0.15); color: #93c5fd; }
.alert-close { margin-left: auto; background: none; border: none; cursor: pointer; opacity: 0.6; }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.2s ease;
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* User Menu */
.user-menu { position: relative; }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-weight: 700;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  padding: 8px;
  display: none;
  z-index: 300;
}
.user-dropdown.open { display: block; animation: slideUp 0.15s ease; }
.user-info { padding: 8px 8px 12px; }
.user-info strong { display: block; font-size: 14px; }
.user-info small { color: var(--text-muted); font-size: 12px; }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.user-dropdown a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  transition: background 0.15s;
}
.user-dropdown a:hover { background: var(--input-bg); }
.user-dropdown a.text-danger { color: #ef4444; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #1e293b;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  z-index: 999;
  animation: slideUp 0.2s ease;
  box-shadow: var(--shadow-md);
}

/* ============================================================
   WELCOME BANNER (pós-onboarding)
   ============================================================ */
.welcome-banner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: white;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(108,99,255,0.25);
  animation: slideDown 0.4s ease;
}
@keyframes slideDown {
  from { opacity:0; transform:translateY(-12px); }
  to   { opacity:1; transform:translateY(0); }
}
.wb-icon { font-size: 32px; flex-shrink: 0; }
.wb-content { flex: 1; }
.wb-content strong { font-size: 15px; font-weight: 700; display: block; margin-bottom: 4px; }
.wb-content p { font-size: 13px; opacity: 0.92; margin: 0; line-height: 1.5; }
.wb-close {
  background: rgba(255,255,255,0.2); border: none; color: white;
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0;
  transition: background 0.15s;
}
.wb-close:hover { background: rgba(255,255,255,0.35); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px,1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-progress { width: 100%; height: 4px; background: var(--border); border-radius: 2px; margin-top: 8px; }
.progress-bar { height: 100%; background: #f59e0b; border-radius: 2px; transition: width 0.5s; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Task items (dashboard + tasks page) */
.task-list { padding: 8px 0; }
.task-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.task-item:last-child { border-bottom: none; }
.task-item:hover { background: var(--input-bg); }
.task-check {
  width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  color: transparent;
}
.task-check.checked { background: var(--color-primary); border-color: var(--color-primary); color: white; }
.task-check i { font-size: 10px; }
.task-content { flex: 1; }
.task-title { font-size: 14px; font-weight: 500; }
.task-title.done { text-decoration: line-through; color: var(--text-muted); }
.task-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.task-date { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.task-date.overdue { color: #ef4444; }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; }
.priority-dot.priority-high { background: #ef4444; }
.priority-dot.priority-medium { background: #f59e0b; }
.priority-dot.priority-low { background: #22c55e; }

/* Timeline (Routine on Dashboard) */
.routine-timeline { padding: 8px 20px; }
.timeline-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; position: relative; }
.timeline-item:not(:last-child)::after {
  content: ''; position: absolute; left: 50px; top: 32px; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-time { width: 40px; font-size: 12px; font-weight: 700; color: var(--text-muted); text-align: right; flex-shrink: 0; padding-top: 2px; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.timeline-content { flex: 1; }
.timeline-title { font-weight: 600; font-size: 14px; display: block; }
.timeline-duration { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; margin-top: 2px; }

/* Events (Dashboard) */
.event-list { padding: 8px 0; }
.event-item { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.event-item:last-child { border-bottom: none; }
.event-color { width: 4px; height: 36px; border-radius: 2px; flex-shrink: 0; }
.event-content { display: flex; flex-direction: column; }
.event-title { font-weight: 600; font-size: 13px; }
.event-date { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; margin-top: 2px; }

/* Quick Actions */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px 20px; }
.quick-action {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s;
}
.quick-action i { font-size: 20px; color: var(--color-primary); }
.quick-action:hover { border-color: var(--color-primary); background: rgba(108,99,255,0.06); transform: translateY(-2px); }

/* Empty States */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 24px; text-align: center; color: var(--text-muted);
}
.empty-state i { font-size: 28px; opacity: 0.4; }
.empty-state p { font-size: 13px; }
.empty-state.large { padding: 48px; }
.empty-state.large i { font-size: 48px; }
.empty-state.large h3 { font-size: 18px; font-weight: 700; color: var(--text); }

/* ============================================================
   TASKS PAGE
   ============================================================ */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.toolbar-filters { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.filter-pill {
  padding: 5px 14px;
  border-radius: 100px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}
.filter-pill.active { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.filter-select {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.task-list-full { }
.task-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.task-row:last-child { border-bottom: none; }
.task-row:hover { background: var(--input-bg); }
.task-row.task-done .task-title-full { text-decoration: line-through; color: var(--text-muted); }
.task-main { flex: 1; }
.task-title-full { font-weight: 600; font-size: 14px; display: block; }
.task-desc { font-size: 12px; color: var(--text-muted); display: block; margin-top: 2px; }
.task-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.task-actions { display: flex; gap: 6px; }
.badge-priority-high { background: #fee2e2; color: #ef4444; }
.badge-priority-medium { background: #fef3c7; color: #b45309; }
.badge-priority-low { background: #d1fae5; color: #065f46; }
[data-theme="dark"] .badge-priority-high { background: rgba(239,68,68,0.2); }
[data-theme="dark"] .badge-priority-medium { background: rgba(245,158,11,0.2); }
[data-theme="dark"] .badge-priority-low { background: rgba(16,185,129,0.2); }

/* ============================================================
   CALENDAR PAGE
   ============================================================ */
.calendar-card { padding: 16px; }
.fc { --fc-border-color: var(--border); --fc-button-bg-color: var(--color-primary); --fc-button-border-color: var(--color-primary); --fc-button-hover-bg-color: var(--color-primary); --fc-today-bg-color: rgba(108,99,255,0.08); --fc-page-bg-color: transparent; color: var(--text); }
.fc .fc-col-header-cell { background: var(--input-bg); }
.fc .fc-daygrid-day-number, .fc .fc-col-header-cell-cushion { color: var(--text); text-decoration: none; }
.fc .fc-button { font-size: 13px; font-weight: 600; border-radius: var(--radius-sm) !important; }
.fc .fc-toolbar-title { font-size: 18px; font-weight: 700; }

/* ============================================================
   ROUTINE PAGE
   ============================================================ */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}
.day-column { min-width: 0; }
.day-header {
  padding: 8px 12px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-weight: 700;
  font-size: 13px;
  display: flex; flex-direction: column;
}
.day-count { font-size: 11px; font-weight: 400; opacity: 0.8; }
.day-slots { background: var(--bg-card); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); min-height: 80px; }
.day-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: 12px; }
.routine-slot {
  padding: 10px 12px;
  border-left: 3px solid var(--color-primary);
  margin: 8px;
  background: var(--input-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.slot-inactive { opacity: 0.5; }
.slot-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.slot-time { font-size: 11px; font-weight: 700; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.slot-actions { display: flex; gap: 4px; }
.slot-title { font-size: 13px; font-weight: 600; }
.slot-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11px; color: var(--text-muted); }

/* ============================================================
   SUBJECTS PAGE
   ============================================================ */
.subjects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 16px; }
.subject-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--subject-color, var(--color-primary));
  position: relative;
}
.subject-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.subject-info { flex: 1; min-width: 0; }
.subject-info h4 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.subject-stats { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.mini-progress { height: 4px; background: var(--border); border-radius: 2px; margin-top: 6px; }
.mini-bar { height: 100%; border-radius: 2px; transition: width 0.5s; }
.subject-actions { display: flex; flex-direction: column; gap: 4px; }

/* Icon Grid */
.icon-grid { display: grid; grid-template-columns: repeat(8,1fr); gap: 6px; margin-top: 8px; }
.icon-option {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--input-bg);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  transition: all 0.15s;
}
.icon-option:hover, .icon-option.selected { border-color: var(--color-primary); color: var(--color-primary); background: rgba(108,99,255,0.1); }

/* ============================================================
   CHATBOT PAGE
   ============================================================ */
.page-chatbot { height: calc(100vh - 108px); display: flex; flex-direction: row; }
.chat-container {
  flex: 1; display: flex; flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.chat-avatar {
  width: 40px; height: 40px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px;
}
.chat-status { font-size: 11px; color: var(--color-accent); display: flex; align-items: center; gap: 4px; }
.chat-status i { font-size: 8px; }
.ms-auto { margin-left: auto; }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
  scroll-behavior: smooth;
}
.chat-welcome { text-align: center; padding: 32px 16px; }
.welcome-icon { font-size: 48px; color: var(--color-primary); margin-bottom: 12px; }
.chat-welcome h3 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.chat-welcome p { color: var(--text-muted); margin-bottom: 20px; }
.quick-questions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.quick-q {
  padding: 6px 14px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.quick-q:hover { border-color: var(--color-primary); color: var(--color-primary); }

.chat-msg { display: flex; align-items: flex-end; gap: 10px; }
.chat-msg-user { flex-direction: row-reverse; }
.msg-avatar {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  overflow: hidden;
}
.msg-avatar.user-av { background: var(--color-secondary); font-weight: 700; font-size: 13px; }
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-bubble { max-width: 70%; }
.chat-msg-assistant .msg-bubble {
  background: var(--input-bg);
  border-radius: 4px 16px 16px 16px;
}
.chat-msg-user .msg-bubble {
  background: var(--color-primary);
  color: white;
  border-radius: 16px 4px 16px 16px;
}
.msg-content { padding: 10px 14px; font-size: 14px; line-height: 1.7; word-break: break-word; }
.msg-time { display: block; font-size: 10px; opacity: 0.6; padding: 0 14px 6px; }

.chat-input-area {
  display: block;
  padding: .7rem 1rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  background: var(--input-bg);
  color: var(--text);
  max-height: 120px;
  line-height: 1.5;
}
.chat-input:focus { outline: none; border-color: var(--color-primary); }
.chat-send { height: 42px; border-radius: 12px; flex-shrink: 0; }

.typing-dots { display: flex; gap: 4px; padding: 10px 14px; }
.typing-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted);
  animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-grid .card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.profile-avatar-section { display: flex; align-items: center; gap: 14px; }
.profile-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white; font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.theme-mode-toggle {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
}
.toggle-switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: white;
  left: 3px; top: 3px;
  transition: 0.2s;
}
input:checked + .toggle-slider { background: var(--color-primary); }
input:checked + .toggle-slider::before { transform: translateX(20px); }

.preset-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.preset-card {
  padding: 14px 10px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  color: white;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  transition: all 0.15s;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.preset-card:hover { transform: scale(1.04); box-shadow: 0 4px 16px rgba(0,0,0,0.2); }

.color-pickers { display: flex; flex-direction: column; gap: 12px; }
.color-pick-item { display: flex; flex-direction: column; gap: 6px; }
.color-pick-item label { font-size: 13px; font-weight: 600; }
.color-pick-row { display: flex; align-items: center; gap: 10px; }
.color-pick-row input[type="color"] {
  width: 40px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  cursor: pointer; padding: 2px;
  background: var(--input-bg);
}
.color-pick-row span { font-size: 13px; font-weight: 600; color: var(--text-muted); font-family: monospace; }

.theme-preview { border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.preview-label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 10px; }
.preview-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.preview-primary, .preview-secondary, .preview-accent { flex: 1; }
.preview-elements { display: flex; align-items: center; gap: 10px; }

/* Utility */
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.text-muted { color: var(--text-muted); font-size: 13px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .week-grid { grid-template-columns: repeat(4,1fr); }
}
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .auth-container { grid-template-columns: 1fr; }
  .auth-illustration { display: none; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.2); }
  #sidebarOpen { display: block; }
  #sidebarClose { display: block; }
  .main-wrapper { margin-left: 0; }
  .content { padding: 16px; }
  .week-grid { grid-template-columns: repeat(2,1fr); }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .msg-bubble { max-width: 85%; }
}
@media (max-width: 480px) {
  .week-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 32px 24px; }
}
