/* =============================================
   PLANNER — Main Stylesheet
   ============================================= */

:root {
  --primary: #4f8ef7;
  --primary-dark: #3a7ae0;
  --primary-light: #e8f0fe;
  --success: #43a047;
  --success-light: #e8f5e9;
  --warning: #fb8c00;
  --warning-light: #fff3e0;
  --danger: #e53935;
  --danger-light: #fce4ec;
  --info: #1e88e5;
  --info-light: #e3f2fd;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --bg: #f5f7fb;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --sidebar-width: 240px;
  --topbar-height: 64px;
  --bottom-nav-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.10);
  --transition: all 0.2s ease;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
}

/* =============================================
   LAYOUT
   ============================================= */

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform 0.3s ease;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.logo i { font-size: 22px; }

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 14.5px;
  transition: var(--transition);
}

.nav-item:hover { background: var(--bg); color: var(--primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary); }
.nav-item i { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-light);
}

.btn-ai-generate {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-ai-generate:hover { opacity: 0.9; transform: translateY(-1px); }

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 150;
}

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

/* =============================================
   TOPBAR
   ============================================= */

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

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.page-title {
  flex: 1;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-add-task {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

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

/* =============================================
   CONTENT
   ============================================= */

.content {
  flex: 1;
  padding: 28px 28px 100px;
}

.view { display: none; }
.view.active { display: block; }

/* =============================================
   BUTTONS
   ============================================= */

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  background: var(--primary); color: white;
  border: none; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px;
  cursor: pointer; transition: var(--transition);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  background: transparent; color: var(--text-secondary);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-weight: 500; font-size: 14px;
  cursor: pointer; transition: var(--transition);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.btn-danger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  background: var(--danger); color: white;
  border: none; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px;
  cursor: pointer; transition: var(--transition);
}
.btn-danger:hover { background: #c62828; }

.btn-small {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none; border-radius: var(--radius-xs);
  font-size: 12px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
}
.btn-small:hover { opacity: 0.85; }
.btn-small.btn-outline {
  background: transparent; color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-small.btn-outline:hover { background: var(--primary-light); }

.btn-full { width: 100%; justify-content: center; }

.btn-gcal {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: white; color: #555;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: var(--transition);
}
.btn-gcal:hover { border-color: #4285F4; color: #4285F4; }

/* =============================================
   DASHBOARD
   ============================================= */

.dashboard-grid { display: flex; flex-direction: column; gap: 24px; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.stat-number {
  display: block;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.progress-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 10px;
}

.progress-bar-wrap {
  height: 10px;
  background: var(--border-light);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #764ba2);
  border-radius: 99px;
  transition: width 0.5s ease;
  width: 0%;
}

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

.dash-col {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}

.dash-col h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}
.dash-col h3 i { color: var(--primary); }

.task-list-mini { display: flex; flex-direction: column; gap: 8px; }

.task-mini-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.task-mini-item:hover { background: var(--primary-light); }
.task-mini-item.overdue { border-left-color: var(--danger); }
.task-mini-item.done { opacity: 0.6; }

.task-mini-title {
  flex: 1;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-mini-date {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.task-mini-date.overdue { color: var(--danger); font-weight: 600; }

.group-summary-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}

.group-summary-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.group-summary-card h3 i { color: var(--primary); }

.group-summary-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }

.group-summary-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.group-color-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.group-summary-info { flex: 1; min-width: 0; }
.group-summary-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-summary-count { font-size: 12px; color: var(--text-secondary); }

.mini-progress-bar {
  margin-top: 6px;
  height: 4px;
  background: var(--border-light);
  border-radius: 99px;
  overflow: hidden;
}
.mini-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* =============================================
   MY TASKS
   ============================================= */

.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}

.search-wrap {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  transition: var(--transition);
}
.search-wrap:focus-within { border-color: var(--primary); }
.search-wrap i { color: var(--text-muted); font-size: 14px; }
.search-wrap input {
  border: none; outline: none; background: none;
  flex: 1; font-size: 14px; color: var(--text-primary);
}

.filters { display: flex; gap: 10px; flex-wrap: wrap; }

.filters select {
  padding: 9px 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.filters select:focus { border-color: var(--primary); }

/* Task Groups */
.task-group-section { margin-bottom: 28px; }

.task-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 4px;
}

.task-group-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 10px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  color: white;
}

.task-group-count {
  background: rgba(0,0,0,0.15);
  border-radius: 99px;
  padding: 1px 7px;
  font-size: 12px;
}

.tasks-list { display: flex; flex-direction: column; gap: 8px; }

/* Task Card */
.task-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: var(--transition);
  cursor: pointer;
  border-left: 3.5px solid transparent;
}
.task-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.task-card.overdue { border-left-color: var(--danger); background: #fffbfb; }
.task-card.done { opacity: 0.65; }

.task-checkbox {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  transition: var(--transition);
}
.task-checkbox.checked {
  background: var(--success);
  border-color: var(--success);
  color: white;
}
.task-checkbox.in-progress {
  border-color: var(--warning);
  background: var(--warning-light);
  color: var(--warning);
}
.task-checkbox i { font-size: 10px; }

.task-main { flex: 1; min-width: 0; }

.task-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.task-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.task-title.done { text-decoration: line-through; color: var(--text-muted); }

.task-label-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.task-deadline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}
.task-deadline.overdue { color: var(--danger); font-weight: 600; }
.task-deadline i { font-size: 11px; }

.task-notes-preview {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

.subtask-progress {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.task-status-badge {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
}
.status-not_started { background: var(--border-light); color: var(--text-muted); }
.status-in_progress { background: var(--warning-light); color: var(--warning); }
.status-done { background: var(--success-light); color: var(--success); }

/* Ungrouped */
.task-group-section.ungrouped .task-group-badge {
  background: var(--text-muted);
}

/* =============================================
   CALENDAR
   ============================================= */

.calendar-wrap {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}

.calendar-header h2 { font-size: 18px; font-weight: 700; }

.calendar-header button {
  background: none; border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  width: 34px; height: 34px;
  cursor: pointer; color: var(--text-secondary);
  font-size: 14px;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.calendar-header button:hover { border-color: var(--primary); color: var(--primary); }

.calendar-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
}
.calendar-grid-header span {
  text-align: center;
  padding: 10px 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-day {
  min-height: 100px;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 8px 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.cal-day:hover { background: var(--primary-light); }
.cal-day.other-month { background: var(--bg); }
.cal-day.today .cal-day-num {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}

.cal-day-num {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}

.cal-task-dot {
  display: block;
  font-size: 11.5px;
  padding: 2px 5px;
  border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.cal-task-dot:hover { opacity: 0.85; }
.cal-task-dot.overdue { outline: 2px solid var(--danger); }

/* =============================================
   GROUPS PAGE
   ============================================= */

.page-actions { margin-bottom: 20px; }

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.group-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  border-top: 4px solid var(--primary);
  transition: var(--transition);
}
.group-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.group-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.group-card-emoji { font-size: 26px; }

.group-card-name {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
}

.group-card-actions { display: flex; gap: 6px; }

.btn-icon {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-xs);
  border: none; background: none;
  cursor: pointer; color: var(--text-muted);
  font-size: 13px;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--bg); color: var(--primary); }
.btn-icon.danger:hover { color: var(--danger); }

.group-card-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.group-card-stats span { display: flex; align-items: center; gap: 5px; }

/* =============================================
   LABELS PAGE
   ============================================= */

.labels-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.label-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: var(--transition);
}
.label-item:hover { box-shadow: var(--shadow-md); }

.label-color-swatch {
  width: 18px; height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
}

.label-item-name {
  flex: 1;
  font-size: 14.5px;
  font-weight: 600;
}

.label-item-count {
  font-size: 13px;
  color: var(--text-secondary);
}

/* =============================================
   MODALS
   ============================================= */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 500;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalSlideIn 0.2s ease;
  margin: auto;
}
.modal.modal-sm { max-width: 420px; }

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-header h2 {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  transition: var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text-primary); }

.modal-body { padding: 20px 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-footer-right { display: flex; gap: 10px; margin-left: auto; }

/* =============================================
   FORMS
   ============================================= */

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

.form-group label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.required { color: var(--danger); }
.optional { color: var(--text-muted); font-weight: 400; }

.form-group input[type="text"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  background: var(--bg-card);
  outline: none;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.form-group textarea { resize: vertical; }

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

/* Color Picker */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.preset-colors { display: flex; gap: 7px; flex-wrap: wrap; }

.color-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: var(--transition);
}
.color-dot:hover, .color-dot.selected { border-color: var(--text-primary); transform: scale(1.1); }

input[type="color"] {
  width: 36px; height: 36px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  padding: 2px;
  background: none;
}

/* Label Picker */
.label-picker { display: flex; gap: 7px; flex-wrap: wrap; }

.label-pick-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  opacity: 0.55;
}
.label-pick-chip.selected { opacity: 1; border-color: rgba(0,0,0,0.25); }

/* =============================================
   SUBTASKS
   ============================================= */

.subtasks-section {
  margin-top: 4px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  overflow: hidden;
}

.subtasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
}

.subtasks-header label {
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
}

.subtasks-actions { display: flex; gap: 7px; }

#subtasks-list { padding: 8px; display: flex; flex-direction: column; gap: 6px; }

.subtask-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: var(--radius-xs);
}

.subtask-check {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
  background: white;
}
.subtask-check.checked { background: var(--success); border-color: var(--success); color: white; }
.subtask-check i { font-size: 9px; }

.subtask-text {
  flex: 1;
  font-size: 13.5px;
  border: none; background: none;
  outline: none;
  color: var(--text-primary);
}
.subtask-text.done { text-decoration: line-through; color: var(--text-muted); }

.subtask-del {
  background: none; border: none;
  color: var(--text-muted); font-size: 13px;
  cursor: pointer; padding: 2px 4px;
  border-radius: 4px;
  transition: var(--transition);
}
.subtask-del:hover { color: var(--danger); background: var(--danger-light); }

/* AI Suggestions */
.ai-suggestions-panel {
  border-top: 1px dashed var(--border);
  padding: 10px;
}

.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: #764ba2;
  margin-bottom: 8px;
  gap: 8px;
}

.ai-suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: linear-gradient(135deg, rgba(102,126,234,0.07) 0%, rgba(118,75,162,0.07) 100%);
  margin-bottom: 5px;
  border: 1px solid rgba(102,126,234,0.15);
}

.ai-suggestion-text { flex: 1; font-size: 13.5px; }

.ai-suggestion-btns { display: flex; gap: 5px; }

.btn-approve {
  background: var(--success-light); color: var(--success);
  border: 1px solid var(--success); border-radius: 4px;
  padding: 3px 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
}
.btn-approve:hover { background: var(--success); color: white; }

.btn-reject {
  background: var(--danger-light); color: var(--danger);
  border: 1px solid var(--danger); border-radius: 4px;
  padding: 3px 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
}
.btn-reject:hover { background: var(--danger); color: white; }

/* AI Generate List */
.ai-gen-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--bg);
  margin-bottom: 6px;
  border: 1px solid var(--border-light);
}

.ai-gen-item input[type="checkbox"] {
  width: 16px; height: 16px; margin-top: 2px;
  flex-shrink: 0; cursor: pointer; accent-color: var(--primary);
}

.ai-gen-item-text { flex: 1; }
.ai-gen-item-title { font-size: 14px; font-weight: 600; }
.ai-gen-item-note { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.ai-loading {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* =============================================
   EMPTY STATE
   ============================================= */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 15px; }

/* =============================================
   TOAST
   ============================================= */

.toast-container {
  position: fixed;
  bottom: 80px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--text-primary);
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s ease;
  max-width: 320px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* =============================================
   BOTTOM NAV (mobile)
   ============================================= */

.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 200;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  transition: var(--transition);
  flex: 1;
}
.bottom-nav-item i { font-size: 18px; }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item:hover { color: var(--primary); }

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-md);
  }
  .sidebar-close { display: block; }
  .overlay.open { display: block; }

  .main-wrapper { margin-left: 0; }
  .menu-toggle { display: block; }
  .btn-add-task span { display: none; }

  .content { padding: 20px 16px 90px; }

  .bottom-nav { display: flex; }
  .toast-container { bottom: 80px; }

  .dashboard-columns { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }

  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { border-radius: var(--radius) var(--radius) 0 0; max-width: 100%; }
  .modal.modal-sm { max-width: 100%; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-number { font-size: 22px; }
  .filter-bar { flex-direction: column; }
  .filters { width: 100%; }
  .filters select { flex: 1; }
  .group-summary-list { grid-template-columns: 1fr 1fr; }
}

.subtask-inline-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-light);
}

.subtask-inline-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.subtask-inline-item i {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.subtask-inline-item.done {
  text-decoration: line-through;
  color: var(--text-muted);
}

.subtask-inline-item.done i {
  color: var(--success);
}

/* =============================================
   NOTIFICATION BADGE
   ============================================= */

.notif-badge {
  display: inline-block;
  background: var(--danger);
  color: white;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  margin-left: 6px;
}
