/* 待办页 — Goal 13 扩展，参考 Stitch 07 */
.todo-page .todo-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 1024px) {
  .todo-page .todo-layout {
    grid-template-columns: minmax(0, 1fr) 360px;
  }
}

.todo-card {
  border: 1px solid var(--ws-outline-variant, #c3c6d7);
  border-radius: 14px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  margin-bottom: 12px;
}

.todo-card--overdue {
  border-color: rgba(186, 26, 26, 0.45);
  box-shadow: 0 0 0 1px rgba(186, 26, 26, 0.08);
}

.todo-card--done {
  opacity: 0.72;
}

.todo-card__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.todo-card__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.todo-card__meta {
  font-size: 13px;
  color: var(--ws-variant, #434655);
  line-height: 1.55;
}

.todo-card__meta-row {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin-top: 4px;
}

.todo-card__meta-row .material-symbols-outlined {
  font-size: 18px;
  color: var(--ws-outline, #737686);
  flex-shrink: 0;
}

.todo-card__meta-row > :last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.todo-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ws-variant, #434655);
  margin-bottom: 6px;
}

.todo-form input,
.todo-form textarea,
.todo-form select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--ws-outline-variant, #c3c6d7);
  font-size: 14px;
  font-family: inherit;
}

.todo-form textarea {
  min-height: 80px;
  resize: vertical;
}

.todo-form .todo-form-row {
  margin-bottom: 14px;
}

.todo-form__submit {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: var(--ws-primary, #004ac6);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.todo-form__submit:hover {
  filter: brightness(1.05);
}

.todo-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--ws-on-surface, #1a1b20);
  box-shadow: 0 20px 56px rgba(20, 22, 30, 0.24);
}

.todo-dialog::backdrop {
  background: rgba(20, 22, 30, 0.48);
}

.todo-dialog__surface {
  max-height: min(760px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.todo-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--ws-outline-variant, #c3c6d7);
}

.todo-dialog__header h2 {
  min-width: 0;
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.todo-dialog__close {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.todo-dialog__close:hover,
.todo-dialog__close:focus-visible {
  background: var(--ws-surface-variant, #e3e2ec);
}

.todo-dialog__body {
  min-height: 80px;
  padding: 18px 20px 20px;
  overflow: auto;
  overflow-wrap: anywhere;
}

.todo-dialog__loading,
.todo-dialog__empty {
  margin: 18px 0;
  color: var(--ws-variant, #434655);
  text-align: center;
}

.todo-dialog__error {
  margin: 12px 0;
  padding: 10px 12px;
  border-left: 3px solid #ba1a1a;
  background: #ffdad6;
  color: #410002;
  overflow-wrap: anywhere;
}

.todo-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.todo-timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.todo-timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 18px;
}

.todo-timeline__item:not(:last-child)::before {
  content: '';
  position: absolute;
  top: 12px;
  bottom: 0;
  left: 6px;
  width: 2px;
  background: var(--ws-outline-variant, #c3c6d7);
}

.todo-timeline__marker {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--ws-primary, #004ac6);
  box-shadow: 0 0 0 1px var(--ws-primary, #004ac6);
  z-index: 1;
}

.todo-timeline__content,
.todo-timeline__heading {
  min-width: 0;
}

.todo-timeline__heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.todo-timeline__heading strong,
.todo-timeline__heading time,
.todo-timeline__content p {
  overflow-wrap: anywhere;
}

.todo-timeline__heading time {
  flex-shrink: 0;
  color: var(--ws-outline, #737686);
  font-size: 12px;
}

.todo-timeline__content p {
  margin: 4px 0 0;
  color: var(--ws-variant, #434655);
  font-size: 13px;
}

.todo-timeline__note {
  white-space: pre-wrap;
}

@media (max-width: 520px) {
  .todo-dialog__header,
  .todo-dialog__body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .todo-dialog__actions {
    flex-direction: column-reverse;
  }

  .todo-dialog__actions .ws-btn {
    width: 100%;
  }

  .todo-timeline__heading {
    flex-direction: column;
    gap: 2px;
  }
}
