:root {
  --bg: #F8F9FA;
  --text: #333333;
  --accent: #4A90E2;
  --accent-soft: #E8F1FC;
  --mint: #50C878;
  --muted: #BDBDBD;
}

html, body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Filter chip */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 0.875rem;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  transition: all 0.15s ease;
  cursor: pointer;
}
.filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.filter-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(74, 144, 226, 0.25);
}
.filter-chip .chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.4rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.18);
  color: inherit;
}
.filter-chip.is-active .chip-count {
  background: rgba(255, 255, 255, 0.22);
}

/* Priority stars */
.prio-star {
  cursor: pointer;
  color: #cbd5e1;
  transition: color 0.15s ease, transform 0.15s ease;
  padding: 0.125rem;
  line-height: 0;
}
.prio-star:hover { transform: scale(1.15); }
.prio-star.is-on { color: #f6b93b; }
.prio-star:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Task card */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 0.95rem 1.1rem;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.7);
  border-radius: 14px;
  transition: all 0.2s ease;
}
.task-item:hover {
  border-color: rgba(74, 144, 226, 0.35);
  box-shadow: 0 4px 14px -8px rgba(15, 23, 42, 0.12);
}
.task-item.is-done {
  background: #fafbfc;
}
.task-item.is-done .task-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1.5px;
}
.task-item.is-done .task-meta {
  color: var(--muted);
}
.task-item.is-done .task-stars {
  opacity: 0.45;
}
.task-title, .task-meta {
  transition: color 0.3s ease, text-decoration-color 0.3s ease;
}

/* Custom checkbox */
.task-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1.8px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  margin-top: 1px;
}
.task-check:hover {
  border-color: var(--accent);
}
.task-check.is-checked {
  background: var(--mint);
  border-color: var(--mint);
}
.task-check svg {
  width: 14px;
  height: 14px;
  color: #fff;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.task-check.is-checked svg {
  opacity: 1;
  transform: scale(1);
}
.task-check:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Category badge */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 9999px;
  letter-spacing: -0.01em;
}
.cat-badge.cat-work { background: #E8F1FC; color: #2563eb; }
.cat-badge.cat-personal { background: #FEF3E2; color: #b45309; }
.cat-badge.cat-shopping { background: #ECFCEB; color: #15803d; }

/* Due badge urgency */
.due-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
}
.due-badge.is-soon { background: #FFF4E5; color: #c2410c; }
.due-badge.is-overdue { background: #FEE2E2; color: #b91c1c; }

/* Delete button */
.task-delete {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.task-delete:hover {
  color: #ef4444;
  background: #FEE2E2;
}
.task-delete:focus-visible {
  outline: 2px solid #ef4444;
  outline-offset: 2px;
}

/* Toast visible */
#toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -4px);
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* Pulse for incoming task */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.task-item.is-new {
  animation: slideIn 0.28s ease-out;
}

/* Calendar */
.cal-cell {
  position: relative;
  min-height: 56px;
  padding: 0.4rem 0.45rem 0.35rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  font-size: 0.78rem;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}
.cal-cell:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.cal-cell.is-outside {
  color: #cbd5e1;
  background: transparent;
  cursor: default;
}
.cal-cell.is-outside:hover {
  background: transparent;
  border-color: transparent;
}
.cal-cell.is-today {
  border-color: var(--accent);
  background: #fff;
}
.cal-cell.is-today .cal-daynum {
  color: var(--accent);
  font-weight: 700;
}
.cal-cell.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.cal-cell.is-selected .cal-daynum { color: #fff; }
.cal-cell.is-selected .cal-dots .dot { background: #fff !important; }
.cal-cell.is-selected:hover { background: #3a7ec8; }

.cal-daynum {
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1;
  margin-bottom: auto;
}
.cal-dots {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  margin-top: 4px;
  min-height: 5px;
}
.cal-dots .dot {
  width: 5px;
  height: 5px;
  border-radius: 9999px;
  background: var(--accent);
  opacity: 0.85;
}
.cal-dots .dot.cat-personal { background: #c4811a; }
.cal-dots .dot.cat-shopping { background: #15803d; }
.cal-dots .dot.cat-work { background: #2563eb; }
.cal-dots .dot.is-done { background: #cbd5e1; opacity: 0.7; }
.cal-count {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.625rem;
  font-weight: 600;
  color: #94a3b8;
}
.cal-cell.is-selected .cal-count { color: rgba(255,255,255,0.85); }
.cal-cell.is-today .cal-count { color: var(--accent); }

/* Color swatches */
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px #e2e8f0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.is-on { box-shadow: 0 0 0 2px var(--accent); }
.color-swatch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px rgba(74,144,226,0.25);
}
.color-swatch .check {
  width: 12px;
  height: 12px;
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.color-swatch.is-on .check { opacity: 1; }
/* Soft / light swatches show a dark check */
.color-swatch[data-light="1"] .check { color: #334155; }

/* Task item clickable for edit */
.task-item .task-title {
  cursor: pointer;
}
.task-item .task-title:hover {
  text-decoration: underline;
  text-decoration-color: #cbd5e1;
  text-underline-offset: 3px;
}
.task-edit {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.task-edit:hover {
  color: var(--accent);
  background: var(--accent-soft);
}
.task-edit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Modal */
#editModal:not(.hidden) {
  display: flex;
  animation: modalFade 0.18s ease-out;
}
@keyframes modalFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (max-width: 480px) {
  .cal-cell { min-height: 44px; padding: 0.3rem 0.35rem 0.3rem; }
  .cal-daynum { font-size: 0.72rem; }
}
