/* ── Reset & Custom Properties ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:        #4f46e5;
  --primary-h:      #4338ca;
  --primary-light:  #eef2ff;
  --bg:             #f1f5f9;
  --card:           #ffffff;
  --sidebar:        #1e293b;
  --sidebar-item:   #334155;
  --sidebar-text:   #94a3b8;
  --sidebar-active: #ffffff;
  --border:         #e2e8f0;
  --text:           #1e293b;
  --text-2:         #475569;
  --text-muted:     #94a3b8;
  --danger:         #ef4444;
  --danger-light:   #fee2e2;
  --success:        #22c55e;
  --success-light:  #dcfce7;
  --warning:        #f59e0b;
  --warning-light:  #fef3c7;
  --info:           #3b82f6;
  --info-light:     #dbeafe;
  --radius:         10px;
  --radius-sm:      6px;
  --topbar-h:       45px;
  --shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:      0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:      0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --sidebar-w:      240px;
  --transition:     0.15s ease;
}

html {
  overflow-x: hidden;
}

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

/* ── App Shell ───────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid #334155;
}

.sidebar-brand h1 {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.3px;
}

.sidebar-brand span {
  font-size: 11px;
  color: var(--sidebar-text);
  display: block;
  margin-top: 2px;
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #475569;
  padding: 8px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-size: 13.5px;
  font-weight: 500;
  user-select: none;
}

.nav-item:hover { background: #334155; color: #cbd5e1; }
.nav-item.active { background: var(--primary); color: var(--sidebar-active); }

.nav-item .icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 15px;
}

.sidebar-user {
  padding: 12px 16px;
  border-top: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-sm { width: 24px; height: 24px; font-size: 10px; }

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info .name { color: #f1f5f9; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info .role { color: var(--sidebar-text); font-size: 11px; }

.btn-logout {
  background: none;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  transition: color var(--transition);
}
.btn-logout:hover { color: var(--danger); }

/* ── Main Content ────────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

.topbar {
  background: var(--sidebar);
  border-bottom: none;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar h2 { font-size: 17px; font-weight: 700; color: #f1f5f9; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content-area { padding: 24px 28px; flex: 1; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--transition), opacity var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: #d1d5db; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-ghost    { background: none; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); }
.btn-new-topbar { display: none; }
body.hide-fab .fab { display: none; }
.topbar .btn-ghost { color: #94a3b8; border-color: #334155; }
.topbar .btn-ghost:hover:not(:disabled) { background: #334155; color: #f1f5f9; }
.btn-sm       { padding: 4px 10px; font-size: 12.5px; }
.btn-icon     { padding: 7px; width: 34px; height: 34px; justify-content: center; }

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-pad { padding: 20px; }

/* ── Task Cards ──────────────────────────────────────────────────────────────── */
.task-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition), background var(--transition);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.task-card:hover { box-shadow: var(--shadow-md); border-color: #c7d2fe; }

.task-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-card-title.done { text-decoration: line-through; color: var(--text-muted); }

.task-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11.5px;
}

.task-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

/* ── Task Checkbox ───────────────────────────────────────────────────────────── */
.task-check {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  flex-shrink: 0;
}
.task-check:hover { border-color: var(--success); }
.task-card.confirming {
  background: rgba(34, 197, 94, 0.06);
  overflow: hidden;
}
.task-card.confirming::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--success);
  border-radius: 0 0 var(--radius) var(--radius);
  animation: card-countdown 2.5s linear forwards;
}
@keyframes card-countdown {
  from { width: 100%; }
  to   { width: 0%; }
}
.task-check.checked {
  background: var(--success);
  border-color: var(--success);
}
.task-check.checked::after {
  content: '✓';
  font-size: 12px;
  color: #fff;
  line-height: 1;
}

/* ── Priority Icon ───────────────────────────────────────────────────────────── */
.priority-icon {
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}

/* ── Status Badge ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-open     { background: var(--bg); color: var(--text-2); border: 1px solid var(--border); }
.badge-progress { background: var(--info-light); color: #1d4ed8; }
.badge-done     { background: var(--success-light); color: #15803d; }
.badge-archived { background: #f8fafc; color: var(--text-muted); }
.badge-overdue  { background: var(--danger-light); color: #b91c1c; }
.badge-primary  { background: var(--primary-light); color: var(--primary); }

/* ── Energy Badge ────────────────────────────────────────────────────────────── */
.energy {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 2px;
}

/* ── Capacity Bar ────────────────────────────────────────────────────────────── */
.capacity-bar-wrap {
  background: var(--bg);
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
  width: 100%;
}

.capacity-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--primary);
  transition: width 0.4s ease;
}

.capacity-bar-fill.overload { background: var(--danger); }
.capacity-bar-fill.warn { background: var(--warning); }

/* ── Today Screen ────────────────────────────────────────────────────────────── */
.capacity-card {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 160px;
}

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

.focus-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Inbox ───────────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filter-btn {
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}
.filter-btn.active, .filter-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.task-list { display: flex; flex-direction: column; gap: 8px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; color: var(--text-2); margin-bottom: 6px; }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  transition: border-color var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 80px; }

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

/* ── Modal ───────────────────────────────────────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}

#modal-overlay.hidden { display: none; }

#modal-box {
  background: var(--card);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92svh;
  box-shadow: var(--shadow-lg);
  position: relative;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.modal-title { font-size: 15px; font-weight: 700; color: var(--text); flex: 1; text-align: center; }

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color var(--transition);
  min-width: 32px;
}
.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 20px 16px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
.modal-footer { padding: 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; }

/* ── Task form — title input ─────────────────────────────────────────────────── */
.task-title-input {
  width: 100%;
  border: none;
  font-size: 18px;
  font-weight: 700;
  padding: 0 0 16px;
  background: transparent;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.task-title-input:focus { outline: none; }
.task-title-input::placeholder { color: var(--text-muted); font-weight: 400; }

/* ── Task form — field rows ──────────────────────────────────────────────────── */
.task-fields {
  margin: 4px 0 16px;
}
.task-field-row {
  display: flex;
  align-items: center;
  min-height: 44px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.task-field-row:last-child { border-bottom: none; }
.task-field-label {
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 100px;
}
.task-field-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  padding: 4px 0 !important;
  font-size: 14px;
  color: var(--text);
  text-align: right;
  box-shadow: none !important;
  min-width: 0;
}
.task-field-input:focus { outline: none; }
input[type="date"].task-field-input { color: var(--text); }

/* ── Task form — description textarea ───────────────────────────────────────── */
.task-desc-input {
  width: 100%;
  border: none;
  border-top: 1px solid var(--border);
  padding: 12px 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  min-height: 80px;
}
.task-desc-input:focus { outline: none; }
.task-desc-input::placeholder { color: var(--text-muted); }

@media (min-width: 640px) {
  #modal-overlay {
    align-items: center;
    padding: 32px 16px;
    overflow-y: auto;
  }
  #modal-box {
    border-radius: 14px;
    max-height: 90vh;
  }
  .modal-body { padding: 24px; }
  .modal-header { padding: 20px 24px 16px; }
}

/* ── Sections within modal ───────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title { font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .5px; }

/* ── Subtasks ────────────────────────────────────────────────────────────────── */
.subtask-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.subtask-item:last-child { border-bottom: none; }

.subtask-check {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

.subtask-title { flex: 1; font-size: 13.5px; }
.subtask-title.done { text-decoration: line-through; color: var(--text-muted); }

.subtask-est { font-size: 12px; color: var(--text-muted); }

/* ── Comments ────────────────────────────────────────────────────────────────── */
.comment-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.comment-item:last-child { border-bottom: none; }

.comment-body { flex: 1; }
.comment-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.comment-meta strong { color: var(--text-2); }
.comment-content { font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }

.comment-input-row { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.comment-input-row textarea { min-height: 48px; }

/* ── Dependencies ────────────────────────────────────────────────────────────── */
.dep-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.dep-item:last-child { border-bottom: none; }
.dep-item .dep-title { flex: 1; font-size: 13.5px; }

/* ── Projects ────────────────────────────────────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.project-card {
  padding: 18px 20px;
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.project-card:hover { box-shadow: var(--shadow-md); border-color: #c7d2fe; }

.project-card h3 { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.project-card p { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; min-height: 20px; }

.project-progress { margin-top: 12px; }

.project-stats { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }

/* ── Admin ───────────────────────────────────────────────────────────────────── */
.users-table { width: 100%; border-collapse: collapse; }
.users-table th, .users-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.users-table th { font-weight: 600; color: var(--text-2); background: var(--bg); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.users-table tr:last-child td { border-bottom: none; }
.users-table tr:hover td { background: #f8fafc; }

/* ── Login ───────────────────────────────────────────────────────────────────── */
.login-screen {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.login-box {
  background: var(--card);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 24px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }
.login-logo p { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.login-step { display: flex; flex-direction: column; gap: 14px; }

.pin-hint {
  background: var(--primary-light);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pin-inputs {
  display: flex;
  gap: 6px;
  justify-content: center;
  width: 100%;
}

.pin-digit {
  flex: 1;
  min-width: 0;
  max-width: 48px;
  aspect-ratio: 5 / 6;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  color: var(--primary);
  transition: border-color var(--transition);
  padding: 0;
}
.pin-digit:focus { border-color: var(--primary); }

/* ── Setup screen ────────────────────────────────────────────────────────────── */
.setup-screen { width: 100%; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); }

/* ── Toast ───────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
}

.toast {
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  box-shadow: var(--shadow-md);
  animation: slideIn .2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
}
.toast.success { background: #15803d; }
.toast.error   { background: #b91c1c; }

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

/* ── Settings ────────────────────────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.window-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.window-row:last-child { border-bottom: none; }
.weekday-name { width: 80px; font-size: 13px; font-weight: 600; color: var(--text-2); }

/* ── Utilities ───────────────────────────────────────────────────────────────── */
.hidden   { display: none !important; }
.flex     { display: flex; }
.gap-8    { gap: 8px; }
.gap-12   { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-4     { margin-top: 4px; }
.mt-8     { margin-top: 8px; }
.mt-16    { margin-top: 16px; }
.mt-24    { margin-top: 24px; }
.mb-16    { margin-bottom: 16px; }
.text-sm  { font-size: 12.5px; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.font-bold { font-weight: 700; }
.w-full   { width: 100%; }
.overflow-hidden { overflow: hidden; }
.text-ellipsis { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }

/* ── List nav items ──────────────────────────────────────────────────────────── */
.list-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.list-label { flex: 1; }

.list-count {
  font-size: 11px;
  background: rgba(255,255,255,.1);
  color: var(--sidebar-text);
  border-radius: 99px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

.nav-item.active .list-count { background: rgba(255,255,255,.25); color: #fff; }

.btn-nav-action {
  background: none;
  border: none;
  color: #475569;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color var(--transition);
}
.btn-nav-action:hover { color: var(--sidebar-text); }

/* ── List badge in task cards ────────────────────────────────────────────────── */
.list-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── List view header ────────────────────────────────────────────────────────── */
.list-header-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

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

/* ── Color picker ────────────────────────────────────────────────────────────── */
.color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

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

/* ── Loader ──────────────────────────────────────────────────────────────────── */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .main { margin-left: 200px; }
  .content-area { padding: 16px; }

  .form-row { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .today-header { grid-template-columns: 1fr; }
}

/* ── Hamburger (desktop: hidden) ─────────────────────────────────────────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  margin-right: 4px;
  border-radius: 6px;
  line-height: 1;
  flex-shrink: 0;
}
.hamburger:hover { background: var(--bg-2); }
.hamburger.nav-back {
  display: block;
  color: #f1f5f9;
  font-size: 22px;
  font-weight: 300;
}

/* ── Sidebar overlay (mobile backdrop) ───────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 299;
}
.sidebar-overlay.active { display: block; }

/* ── Mobile layout ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Hamburger nur als ← sichtbar, normales ☰ übernimmt die Bottom Nav */
  .hamburger:not(.nav-back) { display: none; }
  .hamburger.nav-back       { display: block; }

  /* Neue-Aufgabe-Buttons in Topbar ausblenden — Bottom Nav übernimmt (s. globale Regel) */

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .22s ease;
    z-index: 300;
  }
  .sidebar.open { transform: translateX(0); }

  .main { margin-left: 0; }

  .topbar { padding: 0 12px; }

  .form-row { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .today-header { flex-direction: column; }
}

details[open] .grp-chevron { transform: rotate(90deg); }
details summary::-webkit-details-marker { display: none; }

/* ── Task Groups ─────────────────────────────────────────────────────────────── */
.task-group {
  margin-bottom: 20px;
  border-radius: var(--radius);
  border-left: 3px solid var(--gc, #94a3b8);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.task-group-header {
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 6px 7px 14px;
  cursor: pointer;
  user-select: none;
}

.tg-chevron {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform .2s;
  flex-shrink: 0;
}
.task-group.tg-collapsed .tg-chevron { transform: rotate(-90deg); }

.tg-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--text-2);
  flex: 1;
}
.tg-count { font-weight: 400; color: var(--text-muted); margin-left: 4px; }
.tg-time  { font-size: 11px; color: var(--text-muted); }

.task-group-body {
  background: var(--card);
}
.task-group.tg-collapsed .task-group-body { display: none; }

/* Cards inside groups: borderless, no radius, dividers only */
.task-group-body .task-card {
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  margin-bottom: 0;
}
.task-group-body .task-card:last-child { border-bottom: none; }
.task-group-body .task-card:hover { box-shadow: none; background: #fafbff; }

/* ── Floating Action Button ──────────────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79,70,229,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: transform .15s ease, box-shadow .15s ease;
}
.fab:hover  { transform: scale(1.1);  box-shadow: 0 6px 20px rgba(79,70,229,.55); }
.fab:active { transform: scale(0.93); }

/* ── Bottom Navigation ───────────────────────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 62px;
  background: var(--sidebar);
  border-top: none;
  align-items: center;
  justify-content: space-around;
  z-index: 250;
  box-shadow: 0 -2px 12px rgba(0,0,0,.25);
  padding: 0 4px;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--sidebar-text);
  padding: 8px 0;
  transition: color .15s;
}
.bottom-nav-item.active { color: #fff; }
.bottom-nav-item:active  { opacity: .7; }
.bottom-nav-icon  { font-size: 20px; line-height: 1; }
.bottom-nav-label { font-size: 10px; font-weight: 500; }

.bottom-nav-add {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(79,70,229,.45);
  flex-shrink: 0;
  margin-bottom: 10px; /* leicht angehoben */
  transition: transform .15s ease;
}
.bottom-nav-add:active { transform: scale(0.93); }

@media (max-width: 768px) {
  .bottom-nav { display: flex; }
  .content-area { padding-bottom: 80px; }
  .fab { display: none; }
}
