* {
  box-sizing: border-box;
}

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #315efb;
  --primary-dark: #2449d8;
  --success: #15803d;
  --warning: #b45309;
  --danger: #c62828;
  --shadow: 0 12px 32px rgba(25, 38, 70, 0.08);
  --radius: 18px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(49, 94, 251, 0.10), transparent 30%),
    var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 28px;
}

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

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: var(--primary);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.08;
}

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

.today-card {
  flex: 0 0 auto;
  min-width: 150px;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(255,255,255,.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.today-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.today-card strong {
  font-size: 16px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 20px rgba(25, 38, 70, .04);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 27px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 18px;
}

.panel-header,
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.panel h2 {
  margin-bottom: 5px;
  font-size: 20px;
}

.panel p {
  color: var(--muted);
  margin-bottom: 0;
  font-size: 14px;
}

.task-form {
  display: grid;
  grid-template-columns: 1.4fr .8fr .7fr .8fr;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-wide {
  grid-column: span 2;
}

.field label {
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.search,
.filters select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--text);
  outline: none;
  transition: .2s ease;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus,
.search:focus,
.filters select:focus {
  border-color: rgba(49,94,251,.65);
  box-shadow: 0 0 0 4px rgba(49,94,251,.10);
  background: #fff;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  grid-column: span 2;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 17px;
  font-weight: 800;
}

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

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

.btn-ghost {
  background: #eef1f6;
  color: #39445a;
}

.hidden {
  display: none !important;
}

.toolbar {
  align-items: end;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(130px, .8fr) minmax(130px, .8fr);
  gap: 9px;
  width: min(580px, 100%);
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #fff;
  transition: .18s ease;
}

.task-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(25, 38, 70, .06);
}

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

.task-card.is-done .task-title {
  text-decoration: line-through;
  color: #8a93a3;
}

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

.task-topline {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.task-title {
  margin-bottom: 8px;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.task-note {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

.task-note:empty {
  display: none;
}

.badges {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

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

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

.priority-low {
  color: #027a48;
  background: #d1fadf;
}

.status-todo {
  color: #344054;
  background: #f2f4f7;
}

.status-doing {
  color: #175cd3;
  background: #e7f0ff;
}

.status-done {
  color: #067647;
  background: #dcfae6;
}

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

.task-date.overdue {
  color: var(--danger);
  font-weight: 800;
}

.task-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-btn {
  border: 1px solid var(--border);
  color: #344054;
  background: #fff;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 700;
}

.icon-btn:hover {
  background: #f5f7fa;
}

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

.empty-state {
  text-align: center;
  padding: 50px 18px 34px;
  color: var(--muted);
}

.empty-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: #eef2ff;
  color: var(--primary);
  font-size: 24px;
  font-weight: 900;
}

.empty-state h3 {
  color: var(--text);
  margin-bottom: 7px;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 0 10px;
}

@media (max-width: 860px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .field-wide,
  .form-actions {
    grid-column: span 2;
  }

  .toolbar {
    display: block;
  }

  .filters {
    margin-top: 16px;
    width: 100%;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 24px;
  }

  .hero {
    align-items: stretch;
    flex-direction: column;
  }

  .today-card {
    width: 100%;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .panel {
    padding: 17px;
  }

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

  .field-wide,
  .form-actions {
    grid-column: span 1;
  }

  .filters {
    grid-template-columns: 1fr;
  }

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

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

  .badges {
    justify-content: flex-start;
  }

  .task-actions {
    justify-content: flex-start;
  }
}
