.task-flow {
  display: grid;
  gap: 14px;
}

body.task-modal-open {
  overflow: hidden;
}

.task-summary-card {
  border: 1px solid var(--portal-border);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--portal-shadow-soft);
  padding: 16px;
  display: grid;
  gap: 14px;
}

.task-summary-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
}

.task-summary-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--church-primary) 14%, #fff);
  color: var(--church-primary);
  border: 1px solid color-mix(in srgb, var(--church-primary) 32%, #dbeafe);
  display: grid;
  place-items: center;
}

.task-summary-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.task-summary-copy h1,
.task-summary-copy h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--portal-text);
}

.task-summary-kicker {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--portal-muted);
}

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

.task-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  border: 1px solid var(--portal-border);
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  padding: 0 10px;
  white-space: nowrap;
}

.task-pill.priority-high,
.task-pill.priority-urgent {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.task-pill.priority-normal {
  border-color: rgba(59, 130, 246, 0.28);
  background: rgba(59, 130, 246, 0.11);
  color: #1d4ed8;
}

.task-pill.priority-low {
  border-color: rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.task-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.task-meta-item {
  border: 1px solid var(--portal-border);
  border-radius: 14px;
  background: #f8fafc;
  padding: 10px 12px;
}

.task-meta-item span {
  display: block;
  font-size: 12px;
  color: var(--portal-muted);
}

.task-meta-item strong {
  display: block;
  margin-top: 5px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--portal-text);
}

.task-description {
  border: 1px solid var(--portal-border);
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px;
}

.task-description strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.task-description p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #334155;
}

.task-action-card {
  border: 1px solid var(--portal-border);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--portal-shadow-soft);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.task-action-card h3 {
  margin: 0;
  font-size: 17px;
  color: var(--portal-text);
}

.task-action-copy {
  margin: 0;
  font-size: 13px;
  color: var(--portal-muted);
}

.task-action-grid {
  display: grid;
  gap: 9px;
}

.task-action-grid.task-action-grid-split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-action-grid .portal-btn {
  justify-content: center;
  width: 100%;
}

.task-action-grid .portal-btn-danger {
  border-color: rgba(239, 68, 68, 0.4);
  color: #dc2626;
  background: rgba(239, 68, 68, 0.06);
}

.task-context-card,
.task-timeline-card {
  border: 1px solid var(--portal-border);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--portal-shadow-soft);
  padding: 14px;
}

.task-context-card h3,
.task-timeline-card h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.task-context-grid {
  display: grid;
  gap: 10px;
}

.task-context-item {
  border: 1px solid var(--portal-border);
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px 12px;
  display: grid;
  gap: 6px;
}

.task-context-item strong {
  font-size: 14px;
  color: var(--portal-text);
}

.task-context-item p,
.task-context-item small {
  margin: 0;
  color: #475569;
  line-height: 1.45;
}

.task-context-item small {
  font-size: 12px;
}

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

.task-timeline-item {
  position: relative;
  border: 1px solid var(--portal-border);
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.task-timeline-item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 13px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--church-primary);
}

.task-timeline-item h4 {
  margin: 0;
  font-size: 14px;
  color: var(--portal-text);
}

.task-timeline-item p,
.task-timeline-item small {
  margin: 0;
  color: #475569;
  line-height: 1.45;
}

.task-timeline-item small {
  font-size: 12px;
}

.task-cta-sticky {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(100%, 900px);
  padding: 0 14px;
  z-index: 96;
  pointer-events: none;
}

.task-cta-sticky .task-cta-inner {
  border: 1px solid var(--portal-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 28px rgba(15, 23, 42, 0.12);
  padding: 9px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  pointer-events: auto;
}

.task-cta-sticky .portal-btn {
  width: 100%;
  justify-content: center;
}

.task-modal {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: none;
}

.task-modal.is-open {
  display: block;
}

.task-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 23, 0.56);
}

.task-modal-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(100% - 24px, 520px);
  max-height: min(88vh, 760px);
  overflow: auto;
  border: 1px solid var(--portal-border);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 60px rgba(2, 8, 23, 0.32);
}

.task-modal-head {
  padding: 14px 14px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--portal-border);
}

.task-modal-head h4 {
  margin: 0;
  font-size: 18px;
}

.task-modal-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--portal-muted);
}

.task-modal-close {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--portal-border);
  background: #fff;
  color: #475569;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.task-modal-body {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.task-modal-body .portal-form {
  margin: 0;
  display: grid;
  gap: 10px;
}

.task-modal-footer {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--portal-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.task-inline-note {
  margin: 0;
  font-size: 12px;
  color: var(--portal-muted);
}

.task-reveal-card {
  border: 1px solid var(--portal-border);
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.task-reveal-card h4 {
  margin: 0;
  font-size: 15px;
}

.task-reveal-card p,
.task-reveal-card small {
  margin: 0;
  color: #475569;
  line-height: 1.45;
}

.task-upload-link {
  color: var(--church-primary);
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 760px) {
  .task-meta-grid {
    grid-template-columns: 1fr;
  }

  .task-summary-head {
    grid-template-columns: auto 1fr;
  }

  .task-summary-badges {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

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

  .task-modal-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: 100%;
    max-height: 84vh;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
  }

  .task-cta-sticky {
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
}

@media (min-width: 761px) {
  .task-cta-sticky {
    display: none;
  }
}

@media (min-width: 980px) {
  .task-cta-sticky {
    width: min(100%, 980px);
  }
}

html[data-theme="dark"] .task-summary-card,
html[data-theme="dark"] .task-action-card,
html[data-theme="dark"] .task-context-card,
html[data-theme="dark"] .task-timeline-card,
html[data-theme="dark"] .task-modal-panel,
html[data-theme="dark"] .task-cta-sticky .task-cta-inner {
  background: #111827;
  border-color: #334155;
  color: #e2e8f0;
}

html[data-theme="dark"] .task-meta-item,
html[data-theme="dark"] .task-description,
html[data-theme="dark"] .task-context-item,
html[data-theme="dark"] .task-timeline-item,
html[data-theme="dark"] .task-reveal-card {
  background: #0f172a;
  border-color: #334155;
}

html[data-theme="dark"] .task-meta-item strong,
html[data-theme="dark"] .task-context-item strong,
html[data-theme="dark"] .task-summary-copy h1,
html[data-theme="dark"] .task-summary-copy h2,
html[data-theme="dark"] .task-timeline-item h4,
html[data-theme="dark"] .task-reveal-card h4 {
  color: #e2e8f0;
}

html[data-theme="dark"] .task-description p,
html[data-theme="dark"] .task-context-item p,
html[data-theme="dark"] .task-context-item small,
html[data-theme="dark"] .task-timeline-item p,
html[data-theme="dark"] .task-timeline-item small,
html[data-theme="dark"] .task-reveal-card p,
html[data-theme="dark"] .task-reveal-card small,
html[data-theme="dark"] .task-inline-note,
html[data-theme="dark"] .task-summary-kicker,
html[data-theme="dark"] .task-meta-item span {
  color: #94a3b8;
}

html[data-theme="dark"] .task-pill {
  background: #1f2937;
  border-color: #334155;
  color: #cbd5e1;
}

html[data-theme="dark"] .task-modal-head,
html[data-theme="dark"] .task-modal-footer {
  border-color: #334155;
}

html[data-theme="dark"] .task-modal-close {
  background: #1f2937;
  border-color: #334155;
  color: #cbd5e1;
}
