#taskModal .modal-card {
  width: min(720px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
#taskModal [hidden] {
  display: none !important;
}
.task-features {
  display: grid;
  gap: 15px;
}
.task-features fieldset {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-subtle);
}
.task-repeat-section {
  display: grid;
  gap: 10px;
}
.task-features .helper-text {
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.task-features small {
  font-size: 11px;
  color: var(--muted);
}
.task-weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 18px;
}
.task-weekdays label {
  position: relative;
  cursor: pointer;
}
.task-weekdays input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.task-weekdays span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  min-width: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  font-size: 11px;
}
.task-weekdays input:checked + span {
  background: var(--text);
  color: var(--panel);
  border-color: var(--text);
}
.task-weekdays input:focus-visible + span {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}
.task-feature-section {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.task-feature-section summary {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.task-feature-section summary::before {
  content: "+";
  font-weight: 400;
  font-size: 16px;
}
.task-feature-section[open] summary::before {
  content: "−";
}
.task-feature-section summary > span {
  margin-left: auto;
  padding: 2px 8px;
  background: var(--surface-muted);
  border-radius: 20px;
  font-size: 11px;
}
.task-feature-section[open] summary {
  margin-bottom: 15px;
}
.task-document-options {
  max-height: 220px;
  overflow: auto;
  margin: 12px 0;
}
.task-document-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
}
.task-document-option label {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
}
.task-document-option label span {
  overflow-wrap: anywhere;
}
.task-document-option input {
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: var(--text);
}
.task-document-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.task-record {
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.task-record time {
  font-size: 10px;
  color: var(--muted);
}
.task-record p {
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 8px 0;
}
.task-record-list {
  max-height: 260px;
  overflow: auto;
}
.task-feature-error {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--text);
  padding: 12px;
  font-size: 12px;
  line-height: 1.6;
}
.planner-sync-notice {
  margin: 0 0 16px;
  padding: 13px 16px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  line-height: 1.6;
}
.planner-sync-notice[hidden] {
  display: none;
}
.planner-sync-notice span {
  flex: 1;
  min-width: 170px;
}
.docs-related {
  padding: 13px 22px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  font-size: 11px;
  max-height: 145px;
  overflow: auto;
}
.docs-related > strong {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}
.docs-related button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin: 0 7px 7px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
  color: var(--text);
  font: 11px system-ui;
  cursor: pointer;
}
.docs-related button:hover {
  background: var(--surface-hover);
}
@media (max-width: 600px) {
  #taskModal {
    padding: 8px;
  }
  #taskModal .modal-card {
    max-height: calc(100dvh - 16px);
    padding: 18px;
  }
  #taskModal .form-grid {
    grid-template-columns: 1fr;
  }
  #taskModal .modal-actions {
    flex-wrap: wrap;
  }
  .task-weekdays {
    gap: 4px;
  }
  .task-weekdays span {
    min-width: 34px;
    padding: 8px 5px;
  }
  .docs-related {
    padding: 10px 13px;
  }
}
#taskModal input[type="number"],
#taskModal input[type="datetime-local"],
#taskModal input[type="search"] {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  box-sizing: border-box;
}
#taskModal .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 16px;
  padding: 12px 0 0;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
#taskModal :disabled {
  cursor: default;
}
