.task-modal-card:not(.installer-completion-card) {
  width: min(1040px, calc(100vw - 24px));
  max-width: 1040px;
}

.task-modal-card:not(.installer-completion-card) .task-modal-head {
  gap: 16px;
}

.task-modal-card:not(.installer-completion-card) .task-modal-head h2 {
  display: flex;
  min-width: 0;
  align-items: baseline;
  margin: 0;
  overflow: hidden;
  font-size: 17px;
  white-space: nowrap;
}

.task-modal-card .task-modal-id {
  flex: none;
  margin-right: 8px;
  color: rgb(var(--muted-fg));
  font-weight: 600;
}

.task-modal-card .task-modal-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-card-body {
  min-height: 0;
  overflow: auto;
}

.task-card-tabs {
  position: sticky;
  z-index: 4;
  top: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid rgb(var(--border));
  border-radius: 13px;
  background: rgb(var(--surface-2));
}

.task-card-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgb(var(--muted-fg));
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.task-card-tabs button.is-active {
  background: rgb(var(--surface));
  color: rgb(var(--primary));
  box-shadow: 0 1px 4px rgb(15 23 42 / 0.09);
}

.task-card-panels,
.task-card-panel {
  min-width: 0;
}

.task-card-panel {
  display: none;
}

.task-card-panel.is-active {
  display: block;
}

.task-card-main.is-active {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card-main > .field,
.task-card-overview .field {
  min-width: 0;
  margin: 0;
  gap: 0;
}

.task-card-panel > .task-section {
  margin: 0;
}

.task-card-panel .task-activity-list,
.task-card-panel .task-children-box {
  max-height: min(62vh, 680px);
  overflow-y: auto;
}

.task-card-overview {
  display: grid;
  grid-template-columns: 44px repeat(3, minmax(0, 1fr));
  gap: 0;
  align-items: center;
  padding: 4px;
  border: 1px solid rgb(var(--border));
  border-radius: 12px;
  background: rgb(var(--surface-2));
}

.task-card-overview .task-card-status-field,
.task-card-overview .task-card-start-date-field,
.task-card-overview .task-card-end-date-field {
  border-left: 1px solid rgb(var(--border));
}

.task-modal-card .task-card-overview input,
.task-modal-card .task-card-overview select {
  min-width: 0;
  min-height: 42px;
  height: 42px;
  border: 0 !important;
  border-radius: 0 !important;
  background-color: transparent !important;
  box-shadow: none !important;
}

.task-card-parameter-basics {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.task-card-section,
.task-card-summary-section {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid rgb(var(--border));
  border-radius: 14px;
  background: rgb(var(--surface));
}

.task-card-section .field {
  margin: 0;
}

.task-card-section-title {
  margin-bottom: 10px;
  color: rgb(var(--foreground));
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}

.task-card-project-field select,
.task-card-title-field input {
  min-height: 48px;
  font-size: 16px;
}

.task-card-title-field input {
  font-weight: 600;
}

.task-card-description-section textarea,
.task-card-description-section .task-description-view {
  min-height: 112px;
}

.task-card-parameters-shell {
  background: rgb(var(--surface-2) / 0.46);
}

.task-card-responsibles,
.task-card-type-parameters {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgb(var(--border));
}

.task-card-responsibles .task-card-section-title {
  margin-bottom: 8px;
}

.task-priority-control {
  position: relative;
  width: max-content;
}

.task-priority-native {
  display: none !important;
}

.task-priority-toggle {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: background-color 140ms ease;
}

.task-priority-toggle:hover,
.task-priority-toggle[aria-expanded="true"] {
  background: rgb(var(--muted));
}

.task-priority-toggle:disabled {
  cursor: default;
  opacity: 0.7;
}

.task-priority-dot {
  display: block;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
}

.task-card-priority-field[data-task-priority="low"] .task-priority-toggle > .task-priority-dot,
.priority-dot-low { background: #38bdf8; }
.task-card-priority-field[data-task-priority="normal"] .task-priority-toggle > .task-priority-dot,
.priority-dot-normal { background: #16a34a; }
.task-card-priority-field[data-task-priority="high"] .task-priority-toggle > .task-priority-dot,
.priority-dot-high { background: #facc15; }
.task-card-priority-field[data-task-priority="immediate"] .task-priority-toggle > .task-priority-dot,
.task-card-priority-field[data-task-priority="urgent"] .task-priority-toggle > .task-priority-dot,
.task-card-priority-field[data-task-priority="critical"] .task-priority-toggle > .task-priority-dot,
.priority-dot-immediate,
.priority-dot-urgent,
.priority-dot-critical { background: #ef4444; }

.task-priority-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: 170px;
  padding: 4px;
  border: 1px solid rgb(var(--border));
  border-radius: 12px;
  background: rgb(var(--surface));
  box-shadow: 0 12px 30px rgb(15 23 42 / 0.16);
}

.task-priority-menu[hidden] {
  display: none;
}

.task-priority-menu button {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 7px 10px;
  color: rgb(var(--foreground));
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.task-priority-menu button:hover,
.task-priority-menu button.is-active {
  background: rgb(var(--muted));
}

.task-file-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  opacity: 0 !important;
  white-space: nowrap !important;
}

.task-activity-error {
  flex-basis: 100%;
  border-radius: 9px;
  background: rgb(var(--danger) / 0.1);
  padding: 8px 10px;
  color: rgb(var(--danger));
  font-size: 12px;
  line-height: 1.4;
}

.task-activity-error[hidden] {
  display: none;
}

.task-card-action-zone {
  display: flex;
  justify-content: center;
  padding: 2px 0;
}

.task-card-action-zone .task-lifecycle-action {
  width: min(100%, 420px);
  min-height: 48px;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
}

.task-card-main .task-meta-grid {
  margin-top: 4px;
}

.task-card-result-report {
  border-color: rgb(var(--primary) / 0.28);
  background: rgb(var(--primary) / 0.035);
}

.task-card-report-text {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgb(var(--surface-2));
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.task-card-report-text + .task-card-report-text {
  margin-top: 6px;
}

.task-card-photo-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.task-card-photo-links .task-file-link {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .task-modal-card:not(.installer-completion-card) {
    width: 100vw;
    max-width: none;
    min-height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .task-modal-card:not(.installer-completion-card) .task-modal-head {
    align-items: center;
    padding: 10px 12px;
  }

  .task-modal-card:not(.installer-completion-card) .task-modal-head h2 {
    font-size: 14px;
  }

  .task-modal-card .task-modal-top-actions {
    flex: none;
  }

  .task-modal-card:not(.installer-completion-card) .task-card-body {
    padding: calc(118px + env(safe-area-inset-top, 0px)) 12px calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .task-card-tabs {
    position: fixed;
    z-index: 29;
    top: calc(62px + env(safe-area-inset-top, 0px));
    right: 12px;
    left: 12px;
    margin: 0;
  }

  .task-card-main.is-active {
    gap: 8px;
  }

  .task-card-overview {
    grid-template-columns: 44px repeat(2, minmax(0, 1fr));
    gap: 0;
  }

  .task-card-start-date-field {
    display: none;
  }

  .task-card-panel .task-activity-list,
  .task-card-panel .task-children-box {
    max-height: none;
  }

  .task-card-section {
    padding: 13px;
  }

  .task-card-panel .task-activity-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .task-card-panel .task-file-btn,
  .task-card-panel .task-activity-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .task-card-panel .task-files-chosen,
  .task-card-panel .task-activity-error,
  .task-card-panel .task-activity-send {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .task-modal-card .task-modal-title {
    display: none;
  }

  .task-modal-card .task-modal-id {
    margin-right: 6px;
  }

  .task-modal-card:not(.installer-completion-card) .task-modal-head .btn {
    min-height: 36px;
    padding-inline: 10px;
  }

  .task-modal-card .task-reminder-toggle {
    width: 36px;
    padding-inline: 0;
    overflow: hidden;
    font-size: 0;
  }

  .task-modal-card .task-reminder-toggle::before {
    content: "🔔";
    font-size: 15px;
  }

  .task-card-tabs button {
    min-height: 36px;
    padding-inline: 4px;
    font-size: 12px;
  }

  .task-card-overview input,
  .task-card-overview select {
    min-width: 0;
    padding-right: 5px;
    padding-left: 8px;
    font-size: 11px;
  }

  .task-card-overview .task-priority-toggle {
    width: 36px;
    height: 36px;
  }

  .task-card-parameter-basics {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-card-overview {
    grid-template-columns: 44px repeat(2, minmax(0, 1fr));
    gap: 0;
  }
}

/* Unified task list — the same information architecture for every position. */
.tasks-root {
  --project-accent-0: #0f7c82;
  --project-accent-1: #2563eb;
  --project-accent-2: #7c3aed;
  --project-accent-3: #d97706;
  --project-accent-4: #16a34a;
  --project-accent-5: #db2777;
}

.tasks-context-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  border: 1px solid rgb(var(--primary) / .2);
  border-radius: 12px;
  background: rgb(var(--primary) / .06);
  padding: 10px 14px;
  color: rgb(var(--muted-fg));
  font-size: 12px;
}

.tasks-context-banner strong {
  min-width: 0;
  overflow: hidden;
  color: rgb(var(--foreground));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tasks-project-groups {
  display: grid;
  gap: 14px;
}

.tasks-project-group {
  overflow: hidden;
  border: 1px solid rgb(var(--border));
  border-radius: 16px;
  background: rgb(var(--surface));
  box-shadow: 0 8px 28px rgb(15 23 42 / .05);
}

.tasks-project-group-head {
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  border-bottom: 1px solid rgb(var(--border));
  padding: 9px 14px;
}

.tasks-project-group-head h2 {
  overflow: hidden;
  margin: 0;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tasks-project-group-head > span:last-child {
  border-radius: 999px;
  background: rgb(var(--muted));
  padding: 3px 8px;
  color: rgb(var(--muted-fg));
  font-size: 11px;
  font-weight: 700;
}

.tasks-project-accent {
  align-self: stretch;
  border-radius: 999px;
  background: var(--project-accent, rgb(var(--primary)));
}

.tasks-project-list,
.task-project-children {
  display: flex;
  flex-direction: column;
}

.task-project-node + .task-project-node {
  border-top: 1px solid rgb(var(--border));
}

.task-project-node.is-child {
  margin-left: min(calc(var(--task-depth) * 18px), 72px);
  border-left: 2px solid color-mix(in srgb, var(--project-accent, rgb(var(--primary))) 42%, transparent);
}

.task-project-children {
  border-top: 1px solid rgb(var(--border));
  background: rgb(var(--surface-2) / .45);
}

.task-list-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 10px 12px 10px 16px;
  background: rgb(var(--surface));
}

.task-list-card::before {
  position: absolute;
  inset: 15px auto 15px 7px;
  width: 3px;
  border-radius: 999px;
  background: #16a34a;
  content: "";
}

.task-list-card.priority-section-immediate::before,
.task-list-card.priority-section-critical::before { background: #ef4444; }
.task-list-card.priority-section-high::before { background: #eab308; }
.task-list-card.priority-section-low::before { background: #38bdf8; }

.task-list-main {
  display: grid;
  min-width: 0;
  gap: 4px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.task-list-title {
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-list-description {
  overflow: hidden;
  color: rgb(var(--muted-fg));
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-list-meta {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px 10px;
  color: rgb(var(--muted-fg));
  font-size: 11px;
}

.task-list-status,
.task-list-priority {
  border-radius: 999px;
  background: rgb(var(--muted));
  padding: 2px 7px;
  color: rgb(var(--foreground));
}

.task-list-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.task-list-action {
  min-width: 94px;
  justify-content: center;
}

.task-list-open,
.task-list-card .task-children-toggle {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid rgb(var(--border));
  border-radius: 11px;
  background: rgb(var(--surface));
  color: rgb(var(--foreground));
  font-size: 22px;
  cursor: pointer;
}

.task-list-card .task-children-toggle b {
  color: rgb(var(--primary));
  font-size: 11px;
}

.task-list-waiting {
  max-width: 150px;
  color: rgb(var(--primary));
  font-size: 11px;
  line-height: 1.25;
}

.task-list-card > .task-acceptance-bar,
.task-list-card > .task-acceptance-inline {
  grid-column: 1 / -1;
}

.task-modal-card.is-readonly .task-card-main input:disabled,
.task-modal-card.is-readonly .task-card-main select:disabled,
.task-modal-card.is-readonly .task-card-main textarea:disabled,
.task-modal-card.is-readonly .task-responsible-trigger:disabled {
  border-color: transparent;
  background: rgb(var(--surface-2));
  color: rgb(var(--foreground));
  opacity: 1;
  -webkit-text-fill-color: rgb(var(--foreground));
}

.task-description-editor { min-height: 120px; padding: 12px; border: 1px solid var(--border, #ddd); border-radius: 12px; font-size: 16px; }
.task-description-editor:focus { outline: 2px solid #00757b; outline-offset: 2px; }
.task-description-editor img, .task-description-view img { max-width: 100%; height: auto; }
.task-description-actions { display: flex; gap: 8px; margin-top: 8px; }
.task-description-gallery,
#taskDescriptionFiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.task-description-gallery:empty,
#taskDescriptionFiles:empty { display: none; }
.task-description-image-card {
  display: flex;
  min-width: 0;
  min-height: 120px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgb(var(--border));
  border-radius: 12px;
  background: rgb(var(--surface-2));
}
.task-description-image-card img,
.task-description-photo { display: block; width: 100%; max-width: 100%; max-height: 320px; object-fit: contain; }
.task-description-file { min-width: 0; overflow-wrap: anywhere; }
.task-description-file-link { display: block; margin-top: 6px; font-size: 13px; }
#taskDescriptionPending .task-description-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
#taskDescriptionPending .task-description-photo { width: auto; max-height: 120px; border-radius: 10px; }
.task-description-editor, .task-description-view {
  min-height: 74px;
  border-radius: 10px;
  background: rgb(var(--surface-2));
  padding: 12px;
  color: rgb(var(--foreground));
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

@media (max-width: 760px) {
  .task-description-gallery,
  #taskDescriptionFiles { grid-template-columns: minmax(0, 1fr); }
  .task-description-image-card { min-height: 160px; }
  .task-description-image-card img,
  .task-description-photo { max-height: min(52vh, 420px); }
  .tasks-project-groups { gap: 10px; }
  .tasks-project-group { border-radius: 14px; box-shadow: none; }
  .tasks-project-group-head { min-height: 44px; padding: 8px 10px; }
  .tasks-project-group-head h2 { font-size: 13px; }
  .task-list-card { min-height: 68px; padding: 9px 8px 9px 14px; }
  .task-list-title { font-size: 14px; }
  .task-list-description { display: none; }
  .task-list-meta { gap: 4px 7px; }
  .task-list-meta > span:nth-child(n+4) { display: none; }
  .task-list-action { min-width: 78px; height: 38px; padding: 0 10px; }
  .task-list-open { display: none; }
  .task-list-card .task-children-toggle { width: 38px; }
  .task-project-node.is-child { margin-left: min(calc(var(--task-depth) * 10px), 40px); }
  .task-modal-card .task-lifecycle-action {
    position: fixed;
    z-index: 35;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    left: 10px;
    width: auto;
    min-height: 46px;
    justify-content: center;
    box-shadow: 0 12px 30px rgb(15 23 42 / .2);
  }
  .task-modal-card:has(.task-lifecycle-action) .task-modal-body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}
