:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --border: #e8e6e0;
  --text: #1a1916;
  --text-muted: #888680;
  --accent: #5b6af5;
  --accent-light: #eef0ff;
  --danger: #e05c5c;
  --success: #3daa6e;
  --warning: #f5a623;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --font: 'Inter', sans-serif;
  --font-display: 'Sora', sans-serif;
  --transition: 0.18s ease;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── LOGO ─────────────────────────────────────── */
.logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}
.logo.small { font-size: 1.2rem; }
.logo-k {
  color: var(--accent);
}

/* ─── SCREENS ───────────────────────────────────── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }

/* ─── LOGIN ─────────────────────────────────────── */
#login-screen {
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-container {
  text-align: center;
  padding: 2rem;
  max-width: 340px;
  width: 100%;
}
.login-sub {
  color: var(--text-muted);
  margin: 0.5rem 0 2rem;
  font-size: 0.95rem;
}
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-google:hover { background: var(--bg); }
.login-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

/* ─── APP LAYOUT ────────────────────────────────── */
#app-screen {
  flex-direction: row;
  width: 100%;
}

/* ─── SIDEBAR ───────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar.hidden { transform: translateX(-100%); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
  width: 100%;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--accent-light); color: var(--accent); }
.nav-icon { font-size: 1rem; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
#user-name { font-size: 0.85rem; font-weight: 500; }

.btn-logout {
  background: none;
  border: none;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0;
}
.btn-logout:hover { color: var(--danger); }

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

/* ─── TOPBAR ────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.view-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  flex: 1;
}
.topbar-actions { display: flex; gap: 8px; }

/* ─── VIEWS ─────────────────────────────────────── */
.view-container { flex: 1; padding: 1.5rem; }
.view { display: none; }
.view.active { display: block; }

/* ─── DASHBOARD ─────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.card-header h2 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.agenda-connect { text-align: center; padding: 1rem 0; }
.agenda-connect p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1rem; }

/* ─── LISTES ────────────────────────────────────── */
.lists-toolbar {
  margin-bottom: 1rem;
}
.lists-container-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.list-category {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.list-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.list-category-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
}
.cat-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.list-category-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity var(--transition);
}
.list-category:hover .list-category-actions { opacity: 1; }
.list-items { padding: 0.5rem 0; }
.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 1.25rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background var(--transition);
}
.list-item:hover { background: var(--bg); }
.list-item.done { text-decoration: line-through; color: var(--text-muted); }
.item-check {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  transition: all var(--transition);
}
.list-item.done .item-check {
  background: var(--success);
  border-color: var(--success);
}
.list-add-item {
  padding: 8px 1.25rem;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  border-top: 1px solid var(--border);
  transition: all var(--transition);
}
.list-add-item:hover { color: var(--accent); background: var(--accent-light); }

/* ─── TÂCHES ────────────────────────────────────── */
.tasks-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.task-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 14px 1.25rem;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: box-shadow var(--transition);
}
.task-item:hover { box-shadow: var(--shadow); }
.task-check {
  width: 20px; height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  transition: all var(--transition);
}
.task-item.done .task-check {
  background: var(--success);
  border-color: var(--success);
}
.task-item.done .task-name {
  text-decoration: line-through;
  color: var(--text-muted);
}
.task-body { flex: 1; }
.task-name { font-weight: 500; font-size: 0.9rem; margin-bottom: 4px; }
.task-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.task-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.badge-urgent { background: #fee2e2; color: #b91c1c; }
.badge-normal { background: var(--accent-light); color: var(--accent); }
.badge-someday { background: #f3f4f6; color: #6b7280; }
.badge-recurring { background: #d1fae5; color: #065f46; }
.badge-date { background: #fef3c7; color: #92400e; }

/* ─── AGENDA ────────────────────────────────────── */
.agenda-connect-full {
  text-align: center;
  padding: 3rem 1rem;
  max-width: 400px;
  margin: 0 auto;
}
.agenda-connect-full p { color: var(--text-muted); margin-bottom: 1.5rem; }
.connect-note {
  font-size: 0.8rem;
  margin-top: 1rem;
  color: var(--warning);
}
.agenda-day {
  margin-bottom: 1.5rem;
}
.agenda-day-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.agenda-event {
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  margin-bottom: 6px;
}
.agenda-event-title { font-weight: 500; font-size: 0.9rem; }
.agenda-event-time { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* ─── BOUTONS ───────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--transition);
}
.btn-primary:hover { opacity: 0.88; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-secondary:hover { background: var(--bg); }

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  cursor: pointer;
  transition: color var(--transition);
}
.btn-ghost:hover { color: var(--text); }

.btn-icon {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background var(--transition);
}
.btn-icon:hover { background: var(--bg); color: var(--text); }

.btn-refresh {
  background: transparent;
  border: none;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
}
.btn-refresh:hover { color: var(--accent); }

.btn-danger {
  background: transparent;
  border: none;
  font-size: 0.8rem;
  color: var(--danger);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.btn-danger:hover { background: #fee2e2; }

/* ─── MODALS ────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}
.modal h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 1rem;
}
.modal-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 1rem;
}
.modal-input:focus { outline: none; border-color: var(--accent); }
.modal-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}
.modal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1rem;
}
.modal-row label { font-size: 0.85rem; color: var(--text-muted); min-width: 80px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 1rem;
}

.color-picker {
  display: flex;
  gap: 10px;
  margin-bottom: 1rem;
}
.color-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition);
}
.color-dot[data-selected="true"] { border-color: var(--text); }

/* ─── TOAST ─────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.88rem;
  z-index: 300;
  transition: transform 0.25s ease;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ─── UTILS ─────────────────────────────────────── */
.empty-state {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 1.5rem 0;
}

/* ─── RESPONSIVE ────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
  }
  #btn-close-sidebar { display: flex; }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
@media (min-width: 769px) {
  #btn-open-sidebar { display: none; }
  #btn-close-sidebar { display: none; }
}

/* ─── VOICE ──────────────────────────────────────── */
.btn-voice {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  width: 38px; height: 38px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-voice:hover { border-color: var(--accent); background: var(--accent-light); }
.btn-voice.listening {
  background: #fee2e2;
  border-color: var(--danger);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 92, 92, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(224, 92, 92, 0); }
}

.voice-panel {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  min-width: 260px;
  text-align: center;
  box-shadow: var(--shadow-md);
  z-index: 150;
  display: none;
}
.voice-panel.active { display: block; }
.voice-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.voice-transcript {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  min-height: 20px;
}
