:root{
  --bg: #f6f8fc;
  --card: rgba(255,255,255,.86);
  --card-solid: #ffffff;
  --text: #142033;
  --muted: #6b7a90;
  --line: #e6ebf2;
  --primary: #4f7cff;
  --primary-2: #3e68ea;
  --danger: #ef5a67;
  --success: #10b981;
  --shadow: 0 18px 50px rgba(32, 53, 98, .12);
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(79,124,255,.12), transparent 32%),
    radial-gradient(circle at top right, rgba(16,185,129,.10), transparent 30%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button, input, textarea {
  font: inherit;
}

.hidden { display: none !important; }

.app-shell {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.hero h1 {
  margin: 10px 0 8px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 60ch;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(79,124,255,.12);
  color: var(--primary-2);
  font-size: 13px;
  font-weight: 700;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.panel {
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.task-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-bottom: 16px;
}

.task-form input,
.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card-solid);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

.task-form input:focus,
.field input:focus,
.field textarea:focus {
  border-color: rgba(79,124,255,.75);
  box-shadow: 0 0 0 4px rgba(79,124,255,.14);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip,
.btn,
.icon-btn {
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease, background .15s ease, border-color .15s ease;
}

.chip:hover,
.btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.chip {
  padding: 10px 14px;
  background: #eef3ff;
  color: #3d5fd0;
}

.chip.active {
  background: var(--primary);
  color: #fff;
}

.btn {
  padding: 12px 16px;
  background: #eef3ff;
  color: var(--text);
  font-weight: 700;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 10px 24px rgba(79,124,255,.22);
}

.stats {
  color: var(--muted);
  font-size: 14px;
}

.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.task-item {
  background: rgba(255,255,255,.88);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.task-left {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
  flex: 1;
}

.task-check {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--success);
  flex: 0 0 auto;
}

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

.task-title {
  font-size: 16px;
  line-height: 1.5;
  word-break: break-word;
}

.task-item.done .task-title {
  color: #7a8699;
  text-decoration: line-through;
}

.task-meta {
  margin-top: 6px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.task-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.action-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 9px 12px;
  border-radius: 12px;
  cursor: pointer;
}

.action-btn.danger {
  color: var(--danger);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 26px 10px 10px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 34, .42);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 99;
}

.modal-card {
  width: min(640px, 100%);
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.6);
  padding: 18px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  background: #f2f5fb;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}

.field textarea {
  resize: vertical;
  min-height: 180px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(20,32,51,.95);
  color: #fff;
  padding: 12px 16px;
  border-radius: 999px;
  box-shadow: 0 18px 42px rgba(0,0,0,.18);
  z-index: 120;
  max-width: min(92vw, 520px);
}

@media (max-width: 760px) {
  .hero {
    flex-direction: column;
    align-items: stretch;
  }

  .task-form {
    grid-template-columns: 1fr;
  }

  .task-item {
    flex-direction: column;
  }

  .task-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

.search-input,
.category-select{
  border:1px solid var(--line);
  background:#fff;
  border-radius:14px;
  padding:12px 14px;
  outline:none;
}

.search-input{
  min-width:220px;
}

.category-tag{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  background:#eef3ff;
  color:#4f7cff;
  font-size:12px;
  margin-top:6px;
}

@media (max-width:760px){
  .search-input,
  .category-select{
    width:100%;
  }
}