:root {
  --primary: #419B8B;
  --primary-dark: #305E55;
  --primary-light: #5BBFAE;
  --contrast: #274039;
  --bg: #f5f7fa;
  --bg-card: #fff;
  --text: #333;
  --text-light: #666;
  --border: #e0e0e0;
  --danger: #e74c3c;
  --warning: #f39c12;
  --success: #27ae60;
  --info: #3498db;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.screen { display: none; }
.screen.active { display: block; }
.view { display: none; padding: 20px; max-width: 1200px; margin: 0 auto; }
.view.active { display: block; }

/* AUTH */
.auth-container {
  max-width: 380px;
  margin: 80px auto;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 30px;
  text-align: center;
}
.auth-logo { font-size: 48px; margin-bottom: 10px; }
.auth-container h1 { color: var(--primary-dark); margin-bottom: 5px; }
.auth-subtitle { color: var(--text-light); margin-bottom: 25px; font-size: 14px; }

.tabs { display: flex; gap: 0; margin-bottom: 20px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.tab {
  flex: 1; padding: 10px; border: none; background: var(--bg);
  cursor: pointer; font-weight: 600; color: var(--text-light); transition: all 0.2s;
}
.tab.active { background: var(--primary); color: white; }

#auth-form input {
  width: 100%; padding: 12px; border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 12px; font-size: 15px;
  outline: none; transition: border 0.2s;
}
#auth-form input:focus { border-color: var(--primary); }

.btn {
  padding: 10px 20px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); cursor: pointer; font-size: 14px; font-weight: 600;
  transition: all 0.2s;
}
.btn:hover { background: var(--border); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #c0392b; }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px 14px; font-size: 18px; }
.error { color: var(--danger); margin-top: 10px; font-size: 13px; min-height: 20px; }

/* NAVBAR */
.navbar {
  display: flex; align-items: center; padding: 12px 20px;
  background: var(--primary-dark); color: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  position: sticky; top: 0; z-index: 100;
}
.nav-brand { font-size: 20px; font-weight: 700; margin-right: 30px; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  padding: 8px 16px; border: none; background: transparent;
  color: rgba(255,255,255,0.7); cursor: pointer; border-radius: 6px;
  font-size: 14px; font-weight: 500; transition: all 0.2s;
}
.nav-link:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-link.active { background: rgba(255,255,255,0.2); color: white; }
.nav-user { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.nav-hamburger { display: none; background: none; border: none; color: white; font-size: 24px; cursor: pointer; }

/* VIEW HEADER */
.view-header {
  display: flex; align-items: center; gap: 15px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.view-header h2 { flex: 1; color: var(--primary-dark); }
.date-range { display: flex; gap: 8px; align-items: center; }

/* CALENDAR */
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; background: var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.cal-header {
  background: var(--primary-dark); color: white;
  padding: 10px; text-align: center; font-weight: 600; font-size: 13px;
}
.cal-day {
  background: var(--bg-card); min-height: 90px; padding: 6px;
  cursor: pointer; transition: background 0.15s; position: relative;
}
.cal-day:hover { background: #e8f5f1; }
.cal-day.other-month { opacity: 0.35; }
.cal-day.today { background: #e0f2ee; box-shadow: inset 0 0 0 2px var(--primary); }
.cal-day-num { font-weight: 600; font-size: 13px; color: var(--contrast); }
.cal-day-dots { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; }
.cal-dot {
  width: 6px; height: 6px; border-radius: 50%;
}
.cal-day-note { position: absolute; top: 4px; right: 6px; font-size: 12px; }

/* ACTIVITIES LIST */
.filters-bar {
  display: flex; gap: 8px; margin-bottom: 20px;
  flex-wrap: wrap; align-items: center;
}
.filters-bar input, .filters-bar select {
  padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; outline: none;
}
.filters-bar input:focus, .filters-bar select:focus { border-color: var(--primary); }

.activity-card {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 20px;
  margin-bottom: 10px; display: flex; align-items: center;
  gap: 15px; cursor: pointer; transition: transform 0.1s;
  border-left: 4px solid var(--primary);
}
.activity-card:hover { transform: translateX(4px); }
.activity-card.status-completed { border-left-color: var(--success); opacity: 0.75; }
.activity-card.status-cancelled { border-left-color: var(--danger); opacity: 0.5; }
.activity-card.status-in_progress { border-left-color: var(--warning); }

.act-icon { font-size: 24px; }
.act-info { flex: 1; }
.act-title { font-weight: 600; font-size: 15px; }
.act-meta { color: var(--text-light); font-size: 13px; margin-top: 3px; }
.act-badge {
  padding: 4px 10px; border-radius: 20px; font-size: 11px;
  font-weight: 600; text-transform: uppercase; white-space: nowrap;
}
.badge-pending { background: #fff3cd; color: #856404; }
.badge-in_progress { background: #cce5ff; color: #004085; }
.badge-completed { background: #d4edda; color: #155724; }
.badge-cancelled { background: #f8d7da; color: #721c24; }

.priority-dot {
  width: 10px; height: 10px; border-radius: 50; flex-shrink: 0;
}

.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-light);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 10px; }

/* STATS */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px; margin-bottom: 25px;
}
.stat-card {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; text-align: center;
}
.stat-number { font-size: 36px; font-weight: 700; color: var(--primary-dark); }
.stat-label { color: var(--text-light); font-size: 13px; margin-top: 5px; }

.charts-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}
.chart-container {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}

/* EXPORT */
.export-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.export-card {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 30px; text-align: center;
}
.export-card h3 { margin-bottom: 10px; color: var(--primary-dark); }
.export-card p { color: var(--text-light); font-size: 14px; margin-bottom: 20px; }
.export-dates { display: flex; gap: 10px; justify-content: center; margin-bottom: 20px; }
.export-dates input { padding: 8px; border: 1px solid var(--border); border-radius: 8px; }

/* MODALS */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-card); border-radius: var(--radius);
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 25px 15px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { color: var(--primary-dark); }
.btn-close {
  background: none; border: none; font-size: 24px; cursor: pointer;
  color: var(--text-light); padding: 0 5px;
}
.btn-close:hover { color: var(--danger); }

#activity-form, #note-modal-overlay .modal { padding: 20px 25px 25px; }
.form-row { margin-bottom: 15px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; color: var(--text-light); }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 10px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--primary); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-actions {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 15px; border-top: 1px solid var(--border); margin-top: 15px;
}
.form-actions div { display: flex; gap: 8px; }

/* MOOD */
.mood-selector { margin-bottom: 15px; }
.mood-selector p { font-weight: 600; color: var(--text-light); margin-bottom: 8px; }
.mood-options { display: flex; gap: 8px; }
.mood-btn {
  font-size: 28px; padding: 8px; border: 2px solid transparent;
  border-radius: 10px; cursor: pointer; background: var(--bg);
  transition: all 0.2s;
}
.mood-btn:hover { transform: scale(1.15); }
.mood-btn.selected { border-color: var(--primary); background: #e0f2ee; transform: scale(1.15); }

#note-content {
  width: 100%; padding: 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; resize: vertical; outline: none;
}
#note-content:focus { border-color: var(--primary); }

/* RESPONSIVE */
@media (max-width: 768px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: 52px; left: 0; right: 0; background: var(--primary-dark); padding: 10px; z-index: 99; }
  .nav-links.show { display: flex; }
  .nav-hamburger { display: block; margin-left: auto; }
  .nav-user span { display: none; }
  .cal-day { min-height: 60px; padding: 3px; }
  .cal-day-num { font-size: 11px; }
  .cal-dot { width: 4px; height: 4px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .filters-bar { flex-direction: column; }
  .filters-bar input, .filters-bar select { width: 100%; }
}
