/* pandabu V2.0.4 RC16.279b
   TASKS MOBILE LISTVIEW FIX
   Base: RC16.279a STARTUP_HOTFIX
   Scope: Aufgaben > Listenansicht on mobile only.
   No API, mutation, sync, shopping, inventory or emergency logic changes. */

@media (max-width: 899px) {
  /* Keep task lists and their cards inside the available page width. */
  .card-list:not(.tile-grid) > .task-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .card-list:not(.tile-grid) > .task-card > .card-row {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
  }

  /* The text column must be allowed to shrink. This prevents the title/meta
     from pushing the completion button outside the card. */
  .card-list:not(.tile-grid) > .task-card .card-main {
    flex: 1 1 0 !important;
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  /* Long task names stay readable without widening the card. */
  .card-list:not(.tile-grid) > .task-card .card-title {
    min-width: 0 !important;
    max-width: 100% !important;
    white-space: normal !important;
    overflow: hidden !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
  }

  .card-list:not(.tile-grid) > .task-card .meta {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .card-list:not(.tile-grid) > .task-card .meta > span {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* Fixed controls remain completely visible inside the task card. */
  .card-list:not(.tile-grid) > .task-card .content-icon,
  .card-list:not(.tile-grid) > .task-card .drag-handle,
  .card-list:not(.tile-grid) > .task-card .task-attachment-badge,
  .card-list:not(.tile-grid) > .task-card .task-attachment-actions,
  .card-list:not(.tile-grid) > .task-card .check-btn {
    flex-shrink: 0 !important;
  }

  .card-list:not(.tile-grid) > .task-card .check-btn {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    margin-left: 0 !important;
  }
}
