/* 智能任务管理 · 样式
   风格：浅底 + 白卡片 + 蓝色强调色，整体简洁、留白充足 */

:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #18212f;
  --text-soft: #4a5568;
  --muted: #79869a;
  --line: #e7ebf1;
  --line-strong: #d8dee9;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eef4ff;
  --done: #16a34a;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 12px 28px -14px rgba(16, 24, 40, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -220px, #e5edff 0%, rgba(229, 237, 255, 0) 70%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC",
    "Hiragino Sans GB", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------- 布局 ---------------------------- */

.app {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 44px 20px 72px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(140deg, #3b82f6, #2563eb 60%, #1d4ed8);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 8px 18px -8px rgba(37, 99, 235, 0.7);
}

h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.storage-chip {
  flex: none;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f2f5f9;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.storage-chip.is-demo {
  background: #fff8ec;
  border-color: #f6e3bd;
  color: #9a6a12;
}

/* ---------------------------- 添加任务 ---------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm), var(--shadow-md);
}

.add-card {
  padding: 16px;
}

.add-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input,
.select {
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 14px;
}

.input::placeholder {
  color: #a4afbe;
}

.input:hover,
.select:hover {
  border-color: #c8d1de;
}

.input:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.13);
}

.select-wrap {
  position: relative;
  flex: none;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 34px 0 13px;
  width: 118px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2379869a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 11px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    transform 0.06s ease, opacity 0.15s ease;
}

.btn.primary {
  flex: none;
  height: 44px;
  padding: 0 20px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 16px -10px rgba(37, 99, 235, 0.85);
}

.btn.primary:hover {
  background: var(--accent-dark);
}

.btn.primary:active {
  transform: translateY(1px);
}

.btn.primary:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  transform: none;
}

.form-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--danger);
  min-height: 0;
}

.form-hint:empty {
  display: none;
}

.form-hint:not(:empty) {
  margin-top: 10px;
}

/* ---------------------------- 工具栏 ---------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 22px 0 8px;
}

.filters {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.filter:hover {
  background: #f5f7fa;
}

.filter.is-active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
}

.filter .count {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.filter.is-active .count {
  color: var(--accent);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.dot-high {
  background: #f04438;
}

.dot-medium {
  background: #f79009;
}

.dot-low {
  background: #98a2b3;
}

.progress {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress-bar {
  height: 3px;
  border-radius: 999px;
  background: #e8ecf3;
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #16a34a);
  transition: width 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------------------------- 任务列表 ---------------------------- */

.alert {
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid #f7d3cf;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.6;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.18s ease, background 0.18s ease;
  animation: task-in 0.22s ease both;
}

@keyframes task-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.task:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 20px -16px rgba(16, 24, 40, 0.4);
}

.task.is-done {
  background: #fbfcfd;
}

.task.is-busy {
  opacity: 0.6;
  pointer-events: none;
}

.task-toggle {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1.6px solid #cdd5e1;
  border-radius: 50%;
  background: #fff;
  color: transparent;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.task-toggle:hover {
  border-color: var(--done);
  color: rgba(22, 163, 74, 0.45);
}

.task.is-done .task-toggle {
  background: var(--done);
  border-color: var(--done);
  color: #fff;
}

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

.task-title {
  font-size: 14.8px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.45;
  word-break: break-word;
  transition: color 0.15s ease;
}

.task.is-done .task-title {
  color: #9aa5b6;
  text-decoration: line-through;
  text-decoration-thickness: 1.4px;
  text-decoration-color: #b6c0cf;
}

.task-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.pill-high {
  background: #fee4e2;
  color: #b42318;
}

.pill-medium {
  background: #fef0c7;
  color: #b54708;
}

.pill-low {
  background: #f2f4f7;
  color: #475467;
}

.task.is-done .pill {
  opacity: 0.72;
}

.task-time {
  font-size: 11.5px;
  color: var(--muted);
}

.task-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ghost {
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ghost:hover {
  background: #f4f6fa;
  color: var(--text);
}

.ghost.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------------------------- 空状态 / 提示 ---------------------------- */

.empty {
  margin-top: 4px;
  padding: 44px 20px;
  text-align: center;
  border: 1.5px dashed #dfe4ec;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
}

.empty-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  color: #c1cad8;
}

.empty-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-soft);
}

.empty-text {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.skeleton {
  height: 62px;
  border-radius: 14px;
  background: linear-gradient(90deg, #eff2f7 25%, #f7f9fc 37%, #eff2f7 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 8px);
  padding: 10px 16px;
  border-radius: 10px;
  background: #18212f;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 14px 30px -14px rgba(16, 24, 40, 0.6);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  max-width: min(88vw, 460px);
  text-align: center;
  z-index: 20;
}

.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-error {
  background: #b42318;
}

/* ---------------------------- 自适应 ---------------------------- */

@media (max-width: 620px) {
  .app {
    padding: 28px 14px 56px;
  }

  .app-header {
    margin-bottom: 18px;
  }

  h1 {
    font-size: 19px;
  }

  .add-form {
    flex-wrap: wrap;
  }

  .input {
    flex: 1 1 100%;
  }

  .select-wrap {
    flex: 1 1 auto;
  }

  .select {
    width: 100%;
  }

  .btn.primary {
    flex: 1 1 auto;
    padding: 0 16px;
  }

  .task {
    padding: 12px 13px;
    gap: 10px;
  }

  .task-actions {
    gap: 2px;
  }

  .ghost {
    padding: 6px 8px;
  }
}

@media (max-width: 400px) {
  .task-actions .ghost.toggle-label {
    display: none;
  }
}

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