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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ========== DARK MODE ========== */
body.dark {
  background: #09090b;
  color: #e4e4e7;
}

/* --- Surfaces --- */
.card-surface {
  border: 1px solid #e4e4e7;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dark .card-surface {
  border-color: #27272a;
  background: #18181b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.header-bar {
  border-color: rgba(228,228,231,0.8);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.dark .header-bar {
  border-color: rgba(39,39,42,0.8);
  background: rgba(9,9,11,0.9);
}

.quick-add-bar {
  border: 1px dashed #d4d4d8;
  background: rgba(255,255,255,0.6);
  transition: border-color 0.15s, background 0.15s;
}
.quick-add-bar:focus-within {
  border-color: #a1a1aa;
  background: #fff;
}
.dark .quick-add-bar {
  border-color: #3f3f46;
  background: rgba(24,24,27,0.6);
}
.dark .quick-add-bar:focus-within {
  border-color: #52525b;
  background: #18181b;
}

.desc-input {
  border-color: #f4f4f5;
  background: rgba(250,250,250,0.6);
}
.dark .desc-input {
  border-color: #27272a;
  background: rgba(24,24,27,0.6);
}

/* ========== INPUTS ========== */
.input-field {
  height: 34px;
  border-radius: 8px;
  border: 1px solid #e4e4e7;
  background: #fff;
  padding: 0 10px;
  font-size: 13px;
  color: #18181b;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-field::placeholder { color: #a1a1aa; }
.input-field:focus {
  border-color: #a1a1aa;
  box-shadow: 0 0 0 3px rgba(161,161,170,0.1);
}
.dark .input-field {
  border-color: #3f3f46;
  background: #27272a;
  color: #e4e4e7;
}
.dark .input-field::placeholder { color: #52525b; }
.dark .input-field:focus {
  border-color: #52525b;
  box-shadow: 0 0 0 3px rgba(82,82,91,0.2);
}

select.input-field {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

/* ========== BUTTONS ========== */
.btn-primary {
  height: 34px;
  padding: 0 16px;
  border-radius: 8px;
  border: none;
  background: #18181b;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-primary:hover { background: #27272a; }
.btn-primary:active { transform: scale(0.97); }
.dark .btn-primary { background: #e4e4e7; color: #18181b; }
.dark .btn-primary:hover { background: #d4d4d8; }

.btn-ghost {
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: #71717a;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-ghost:hover { background: #f4f4f5; color: #18181b; }
.dark .btn-ghost:hover { background: #27272a; color: #e4e4e7; }
.btn-ghost--danger:hover { background: #fef2f2; color: #ef4444; }
.dark .btn-ghost--danger:hover { background: rgba(239,68,68,0.1); color: #f87171; }

/* ========== SECTION ACTION BUTTONS ========== */
.section-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #e4e4e7;
  background: #fafafa;
  color: #71717a;
  cursor: pointer;
  transition: all 0.15s;
}
.section-action-btn:hover {
  background: #f4f4f5;
  border-color: #a1a1aa;
  color: #18181b;
}
.section-action-btn--danger:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #ef4444;
}
.dark .section-action-btn {
  border-color: #3f3f46;
  background: #27272a;
  color: #71717a;
}
.dark .section-action-btn:hover {
  background: #3f3f46;
  border-color: #52525b;
  color: #e4e4e7;
}
.dark .section-action-btn--danger:hover {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.3);
  color: #f87171;
}

/* ========== TASK ACTION BUTTONS ========== */
.task-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: #a1a1aa;
  cursor: pointer;
  transition: all 0.15s;
  opacity: 0;
}
.group:hover .task-action-btn { opacity: 1; }
.task-action-btn:hover {
  background: #f4f4f5;
  border-color: #d4d4d8;
  color: #18181b;
}
.task-action-btn--danger:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #ef4444;
}
.dark .task-action-btn { color: #52525b; }
.dark .task-action-btn:hover {
  background: #27272a;
  border-color: #3f3f46;
  color: #e4e4e7;
}
.dark .task-action-btn--danger:hover {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.3);
  color: #f87171;
}

/* Task hover selects */
.task-hover-control {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  color: #a1a1aa;
  opacity: 0;
  transition: opacity 0.15s;
}
.group:hover .task-hover-control { opacity: 1; }
.task-hover-control:focus { opacity: 1; }
.dark .task-hover-control { color: #71717a; }

/* ========== FILTER CHIPS ========== */
.filter-chip {
  height: 30px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid #e4e4e7;
  background: #fff;
  color: #71717a;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.filter-chip:hover { border-color: #a1a1aa; color: #18181b; }
.filter-chip--active { background: #18181b; border-color: #18181b; color: #fff; }
.filter-chip--active:hover { background: #27272a; border-color: #27272a; color: #fff; }
.dark .filter-chip { border-color: #3f3f46; background: #18181b; color: #71717a; }
.dark .filter-chip:hover { border-color: #52525b; color: #e4e4e7; }
.dark .filter-chip--active { background: #e4e4e7; border-color: #e4e4e7; color: #18181b; }
.dark .filter-chip--active:hover { background: #d4d4d8; border-color: #d4d4d8; }

/* ========== SAVE INDICATOR ========== */
.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
}
.save-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.save-indicator--saved { color: #22c55e; }
.save-indicator--saving { color: #eab308; }
.save-indicator--saving .save-dot { animation: pulse-dot 1s ease infinite; }
.save-indicator--error { color: #ef4444; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ========== STAT PILL ========== */
.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid #e4e4e7;
  background: #fafafa;
}
.dark .stat-pill { border-color: #27272a; background: #1c1c1e; }
.stat-pill__value { font-size: 15px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.stat-pill__label { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #a1a1aa; margin-top: 2px; }

/* ========== PROGRESS BAR ========== */
.progress-bar-fill {
  background: linear-gradient(90deg, #18181b 0%, #3b82f6 50%, #22c55e 100%);
  background-size: 200% 100%;
  animation: progress-shine 3s ease infinite;
}
.dark .progress-bar-fill {
  background: linear-gradient(90deg, #e4e4e7 0%, #60a5fa 50%, #4ade80 100%);
  background-size: 200% 100%;
}
@keyframes progress-shine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ========== SECTION CARD ========== */
.section-card { transition: box-shadow 0.2s; }
.section-card__body { overflow: hidden; transition: max-height 0.3s cubic-bezier(0.4,0,0.2,1); }
.section-card--collapsed .section-card__body { max-height: 0 !important; }
.section-card--collapsed .section-card__chevron { transform: rotate(-90deg); }
.section-card__header:hover { background: #fafaf9; }
.dark .section-card__header:hover { background: #1c1c1e; }
.section-card__completion { font-variant-numeric: tabular-nums; }

/* ========== TASK CHECKBOX ========== */
.task-checkbox { border-radius: 5px; transition: all 0.15s; }
.task-checkbox--done { background: #18181b; border-color: #18181b; }
.dark .task-checkbox--done { background: #e4e4e7; border-color: #e4e4e7; }
.task-checkbox--done .task-check-icon { display: block; }
.dark .task-checkbox--done .task-check-icon { color: #18181b; }
.task-checkbox--progress { border-color: #3b82f6; background: rgba(59,130,246,0.08); }
.task-checkbox--progress::after { content: ''; width: 6px; height: 6px; border-radius: 2px; background: #3b82f6; }
.task-checkbox--todo { border-color: #d4d4d8; }
.dark .task-checkbox--todo { border-color: #52525b; }
.task-checkbox--todo:hover { border-color: #a1a1aa; background: #fafafa; }
.dark .task-checkbox--todo:hover { border-color: #71717a; background: #27272a; }

/* ========== STATUS BADGE ========== */
.status-badge { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.status-badge--todo { color: #a16207; background: #fef9c3; }
.status-badge--progress { color: #1d4ed8; background: #dbeafe; }
.status-badge--done { color: #166534; background: #dcfce7; }
.dark .status-badge--todo { color: #fbbf24; background: rgba(251,191,36,0.12); }
.dark .status-badge--progress { color: #60a5fa; background: rgba(96,165,250,0.12); }
.dark .status-badge--done { color: #4ade80; background: rgba(74,222,128,0.12); }

/* ========== TASK DONE ========== */
.task-item--done .task-text { text-decoration: line-through; color: #a1a1aa; }
.dark .task-item--done .task-text { color: #52525b; }

/* ========== TASK HOVER ========== */
.task-item:hover { background: rgba(250,250,249,0.8); }
.dark .task-item:hover { background: rgba(28,28,30,0.5); }

/* ========== EMPTY STATES ========== */
.empty-state { padding: 40px 24px; text-align: center; font-size: 13px; color: #a1a1aa; border: 1px dashed #e4e4e7; border-radius: 12px; background: #fff; }
.dark .empty-state { border-color: #3f3f46; background: #18181b; color: #52525b; }

/* ========== COLOR CLASSES ========== */
.color-bar-slate { background: #94a3b8; }
.color-bar-blue { background: #3b82f6; }
.color-bar-amber { background: #f59e0b; }
.color-bar-green { background: #22c55e; }
.color-bar-violet { background: #8b5cf6; }
.color-bar-rose { background: #f43f5e; }
.color-bar-orange { background: #f97316; }
.color-bar-cyan { background: #06b6d4; }
.color-bar-indigo { background: #6366f1; }

.progress-slate { background: #94a3b8; }
.progress-blue { background: #3b82f6; }
.progress-amber { background: #f59e0b; }
.progress-green { background: #22c55e; }
.progress-violet { background: #8b5cf6; }
.progress-rose { background: #f43f5e; }
.progress-orange { background: #f97316; }
.progress-cyan { background: #06b6d4; }
.progress-indigo { background: #6366f1; }

.circle-slate { stroke: #94a3b8; }
.circle-blue { stroke: #3b82f6; }
.circle-amber { stroke: #f59e0b; }
.circle-green { stroke: #22c55e; }
.circle-violet { stroke: #8b5cf6; }
.circle-rose { stroke: #f43f5e; }
.circle-orange { stroke: #f97316; }
.circle-cyan { stroke: #06b6d4; }
.circle-indigo { stroke: #6366f1; }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a1a1aa; }
.dark ::-webkit-scrollbar-thumb { background: #3f3f46; }
.dark ::-webkit-scrollbar-thumb:hover { background: #52525b; }

/* ========== FOCUS ========== */
:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }
input:focus-visible, select:focus-visible { outline: none; }

/* ========== PRIORITY INDICATOR ========== */
.priority-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.priority-dot--high { background: #ef4444; box-shadow: 0 0 4px rgba(239,68,68,0.4); }
.priority-dot--medium { background: #f59e0b; }
.priority-dot--low { background: #94a3b8; }

.priority-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
}
.priority-badge--high { color: #dc2626; background: #fef2f2; }
.priority-badge--medium { color: #d97706; background: #fffbeb; }
.priority-badge--low { color: #64748b; background: #f8fafc; }
.dark .priority-badge--high { color: #f87171; background: rgba(239,68,68,0.1); }
.dark .priority-badge--medium { color: #fbbf24; background: rgba(245,158,11,0.1); }
.dark .priority-badge--low { color: #94a3b8; background: rgba(148,163,184,0.08); }

/* High priority task left border accent */
.task-item--high { border-left: 2px solid #ef4444; }
.task-item--medium { border-left: 2px solid transparent; }
.task-item--low { border-left: 2px solid transparent; }

/* ========== ANIMATIONS ========== */
.task-item { transition: background 0.15s, opacity 0.2s; }
.section-card { animation: slideIn 0.2s ease; }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== MOBILE TOUCH TARGETS ========== */
@media (max-width: 639px) {
  .task-action-btn { opacity: 0.6; width: 28px; height: 28px; }
  .task-action-btn svg { width: 14px; height: 14px; }
  .section-action-btn { width: 32px; height: 32px; }
  .task-item { padding-top: 10px; padding-bottom: 10px; }
  .stat-pill { min-width: 48px; padding: 4px 8px; }
  .stat-pill__value { font-size: 14px; }
  .filter-chip { height: 34px; padding: 0 14px; }
}
