/* Aufgaben verwenden bewusst die bestehenden Stammdaten-Grundklassen
   aus adressen.css. Hier stehen nur aufgabenspezifische Ergänzungen. */

#tasksRoot.tasks-page.address-page {
  height: 100%;
  min-height: 0;
}

.task-page-heading {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 14px 7px 14px;
  box-sizing: border-box;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
}

.task-page-heading-bar {
  flex: 0 0 4px;
  width: 4px;
  height: 24px;
  border-radius: 2px;
  background: var(--color-accent, #F28C18);
}

.task-page-heading-title {
  color: var(--color-primary, #063f6c);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

@media (max-width: 1400px) {
  .task-page-heading {
    padding-left: 58px;
  }
}

.task-searchbar {
  z-index: 31;
}

.task-filter-button.is-active {
  border-color: var(--color-primary);
  background: #eef5fb;
  color: var(--color-primary);
  font-weight: 700;
}

.task-results .task-row.is-overdue {
  border-left: 3px solid #c84b4b;
}

.task-results .task-row.is-overdue .task-row-meta {
  color: #b42318;
  font-weight: 700;
}

.task-results .task-row.is-completed .address-row-main {
  color: #52677c;
}

.task-results .task-row.is-completed .task-row-meta {
  color: #5f7865;
}

.task-list-empty {
  padding: 28px 14px;
  color: #64748b;
  font-size: 13px;
  text-align: center;
}

.task-page-error {
  padding-top: 14px;
  color: #991b1b;
}

.task-edit-dialog {
  width: min(680px, calc(100vw - 40px));
}

.task-detail-dialog {
  width: min(760px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
}

.task-edit-grid {
  align-items: start;
}

.task-reference-line {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 12px;
}

.task-reference-hint {
  flex: 1 1 auto;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.task-reference-hint > .material-icons {
  flex: 0 0 auto;
  color: var(--color-primary);
  font-size: 18px;
}

.task-reference-hint > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-reference-hint b {
  color: #475569;
  font-size: 12px;
}

.task-reference-hint span:last-child {
  overflow: hidden;
  color: #0f172a;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-reference-open {
  flex: 0 0 auto;
  align-self: center;
}

.task-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  background: #fff;
  color: #64748b;
  font-size: 11px;
}

.task-meta-line b {
  color: #334155;
  font-weight: 600;
}

.task-completion-note {
  padding: 9px 10px;
  border: 1px solid #d9e2ef;
  border-radius: 3px;
  background: #fff;
  color: #26384a;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.task-attachments {
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  background: #fff;
}

.task-attachment-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 8px 10px;
  border-bottom: 1px solid #edf2f7;
}

.task-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
}

.task-attachment-list {
  padding: 0 10px;
}

.task-attachment-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 0;
  border-top: 1px solid #edf2f7;
}

.task-attachment-row:first-child {
  border-top: 0;
}

.task-attachment-file {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-primary);
  font-family: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.task-attachment-file .material-icons {
  flex: 0 0 auto;
  font-size: 18px;
}

.task-attachment-file span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-attachment-actions {
  flex: 0 0 auto;
}

.task-attachment-action {
  min-width: 0;
  height: 28px;
  font-size: 12px;
}

.task-empty-note {
  padding: 10px;
  color: #64748b;
  font-size: 12px;
}

.task-detail-footer {
  align-items: center;
}

.task-footer-spacer {
  flex: 1 1 auto;
}

.task-context-button {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.task-context-button .material-icons {
  font-size: 17px;
}

.task-list-open-count {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 34px;
  height: 26px;
  margin: 0 7px;
  padding: 0 5px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #063f6c;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.task-list-open-count .material-icons {
  font-size: 17px;
}

.task-list-open-count:hover,
.task-list-open-count:focus-visible {
  background: #eaf1f8;
}

.task-context-count {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #c62828;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.task-context-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 15px 0;
  border-bottom: 1px solid #e2e8f0;
}

.task-context-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.task-context-tab.is-active {
  border-bottom-color: var(--color-primary, #063f6c);
  color: var(--color-primary, #063f6c);
  font-weight: 700;
}

.task-context-tab span {
  display: inline-flex;
  min-width: 19px;
  height: 19px;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border-radius: 10px;
  background: #eef2f7;
  color: inherit;
  font-size: 11px;
}

.task-context-tab:focus-visible {
  outline: 2px solid var(--color-primary, #063f6c);
  outline-offset: -2px;
}

.task-context-list {
  max-height: min(60vh, 520px);
  overflow-y: auto;
  padding: 0;
}

.task-context-item {
  width: 100%;
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 12px 15px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.task-context-item:hover,
.task-context-item:focus-visible {
  background: #f5f8fc;
}

.task-context-item > .material-icons {
  flex: 0 0 auto;
  color: #718096;
  font-size: 18px;
}

.task-context-item.is-overdue > .material-icons:first-child,
.task-context-item.is-overdue small {
  color: #b42318;
}

.task-context-item-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-context-item-body strong {
  color: #253247;
  font-size: 13px;
  font-weight: 600;
}

.task-context-item-body small {
  color: #64748b;
  font-size: 11px;
}

.task-context-dialog .address-edit-footer .material-icons {
  font-size: 17px;
  vertical-align: middle;
}

.banking-transaction-side .task-context-button {
  width: 30px;
  min-width: 30px;
  padding: 0;
}

.banking-transaction-side .task-context-button > span:nth-child(2),
.banking-transaction-side .task-context-count {
  display: none;
}

.task-menu-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #f59e0b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.dashboard-tasks-card {
  grid-column: span 1;
}

.dashboard-task-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 10px;
  background: #eef5fb;
  color: var(--color-primary);
  font-size: 11px;
}

.dashboard-task-list,
.dashboard-task-feedback-list {
  display: flex;
  flex-direction: column;
}

.dashboard-task-row,
.dashboard-task-feedback {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 0;
  border-top: 1px solid #edf0f3;
  background: #fff;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.dashboard-task-row:hover,
.dashboard-task-feedback:hover {
  background: #f8fafc;
}

.dashboard-task-row > span:nth-child(2),
.dashboard-task-feedback > span:nth-child(2) {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dashboard-task-row strong,
.dashboard-task-feedback strong {
  color: #253247;
  font-size: 13px;
}

.dashboard-task-row small,
.dashboard-task-feedback small {
  overflow: hidden;
  color: #7c8798;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-task-row.is-overdue > span:first-child,
.dashboard-task-row.is-overdue small {
  color: #b42318;
}

.dashboard-task-feedback {
  background: #fffbeb;
}

.dashboard-task-feedback > span:first-child {
  color: #d98b00;
}

.dashboard-task-empty {
  padding: 14px 12px;
}

@media (max-width: 720px) {
  .task-edit-dialog,
  .task-detail-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .task-reference-line {
    align-items: stretch;
    flex-direction: column;
  }

  .task-reference-open {
    width: 100%;
  }

  .task-detail-footer {
    flex-direction: column-reverse;
  }

  .task-footer-spacer {
    display: none;
  }

  .task-detail-footer .address-edit-button {
    width: 100%;
  }

  .task-attachment-row {
    align-items: stretch;
    flex-direction: column;
  }

  .task-attachment-actions,
  .task-attachment-action {
    width: 100%;
  }

  .task-context-button > span:nth-child(2) {
    display: none;
  }
}

/* Aufgabenindikator ist eine zusaetzliche Grid-Spalte. Ohne diese
   explizite Zuordnung faellt der Oeffnen-Pfeil in die naechste Zeile. */
#adressen-results .address-row:has(> .task-list-open-count) {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}
#adressen-results .address-row:has(> .task-list-open-count) > .address-row-content { grid-column: 1; }
#adressen-results .address-row:has(> .task-list-open-count) > .address-row-pills { grid-column: 2; }
#adressen-results .address-row:has(> .task-list-open-count) > .task-list-open-count { grid-column: 3; }
#adressen-results .address-row:has(> .task-list-open-count) > .address-row-arrow { grid-column: 4; }

#projekte-results .address-row:has(> .task-list-open-count) {
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
}
#projekte-results .address-row:has(> .task-list-open-count) > .address-row-content { grid-column: 1; }
#projekte-results .address-row:has(> .task-list-open-count) > .address-row-meta { grid-column: 2; }
#projekte-results .address-row:has(> .task-list-open-count) > .project-archive-button { grid-column: 3; }
#projekte-results .address-row:has(> .task-list-open-count) > .task-list-open-count { grid-column: 4; }
#projekte-results .address-row:has(> .task-list-open-count) > .address-row-arrow { grid-column: 5; }

@media (max-width: 760px) {
  #adressen-results .address-row:has(> .task-list-open-count) {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  #adressen-results .address-row:has(> .task-list-open-count) > .address-row-arrow { grid-column: 3; }
  #adressen-results .address-row:has(> .task-list-open-count) > .task-list-open-count { grid-column: 2; }
  #projekte-results .address-row:has(> .task-list-open-count) {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
  }
  #projekte-results .address-row:has(> .task-list-open-count) > .project-archive-button { grid-column: 2; }
  #projekte-results .address-row:has(> .task-list-open-count) > .task-list-open-count { grid-column: 3; }
  #projekte-results .address-row:has(> .task-list-open-count) > .address-row-arrow { grid-column: 4; }
}
