/* KARMA WORK · mobile list/detail refinements */
@media (max-width: 700px) {
  /* Projects: readable cards with status/type editable directly. */
  .projects-controls,
  .tasks-controls {
    margin-bottom: 16px !important;
  }

  .project-search,
  .task-search,
  .search {
    width: 100%;
    min-height: 48px;
  }

  .project-search input,
  .task-search input,
  .search input {
    width: 100% !important;
    min-width: 0 !important;
    font-size: 16px !important;
  }

  .project-filter-row,
  .task-filter-row {
    min-width: 0;
  }

  .filter-group {
    min-width: 0;
  }

  .filter-group + .filter-group {
    margin-top: 13px;
  }

  .filter-title {
    display: block;
    margin-bottom: 7px;
  }

  .projects-controls .tabs,
  .task-scope-tabs {
    width: calc(100vw - 28px);
    max-width: 100%;
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .projects-controls .tabs::-webkit-scrollbar,
  .task-scope-tabs::-webkit-scrollbar {
    display: none;
  }

  .projects-controls .tabs button,
  .task-scope-tabs button {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 9px 12px !important;
    scroll-snap-align: start;
  }

  .full-table {
    padding: 0 !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  .full-table > .table-labels {
    display: none !important;
  }

  .full-table > .project-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(118px, 42%) !important;
    grid-template-areas:
      "name status"
      "name type"
      "date date" !important;
    gap: 8px 12px !important;
    min-height: 0 !important;
    padding: 13px 0 !important;
    border-bottom: 1px solid var(--border) !important;
  }

  .full-table > .project-row:first-of-type {
    border-top: 1px solid var(--border) !important;
  }

  .full-table .project-name {
    grid-area: name;
    min-width: 0;
    align-self: start;
    padding-top: 3px;
  }

  .full-table .project-name strong {
    font-size: 13px !important;
    line-height: 1.25;
  }

  .full-table .project-name small {
    margin-top: 4px;
    font-size: 9px !important;
    line-height: 1.3;
  }

  .full-table .project-name .mobile-progress {
    display: block !important;
    margin-top: 7px;
    color: #9ba79a;
  }

  .full-table .project-statuses {
    grid-area: status;
  }

  .full-table .project-type {
    grid-area: type;
  }

  .full-table .project-row > .date {
    grid-area: date;
    min-height: 28px;
    justify-self: start;
    display: flex !important;
    align-items: center;
    gap: 5px;
    font-size: 10px !important;
  }

  .full-table .project-row > .date .icon {
    display: block !important;
    width: 13px !important;
  }

  .full-table .project-row > .progress,
  .full-table .project-row > .icon-button {
    display: none !important;
  }

  .inline-project-select {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 42px !important;
    padding: 7px 27px 7px 9px !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    text-overflow: ellipsis;
  }

  /* Task filters: two compact columns rather than a tall desktop stack. */
  .tasks-controls .task-controls {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    width: 100%;
  }

  .tasks-controls .task-controls label {
    width: 100% !important;
    min-width: 0 !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
    gap: 6px !important;
  }

  .tasks-controls .task-controls select,
  .tasks-controls .task-controls input {
    width: 100% !important;
    max-width: none !important;
    min-height: 44px !important;
    font-size: 16px !important;
  }

  .tasks-controls .task-controls .text-link {
    grid-column: 1 / -1;
    justify-self: start;
    min-height: 40px;
    padding: 8px 0;
  }

  .task-scope-tabs {
    margin-top: 12px;
  }

  .task-list {
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
  }

  .task-list-head {
    display: none !important;
  }

  .task-list .task-row {
    padding: 9px 0 !important;
    border-bottom: 1px solid var(--border);
  }

  .task-list .checkbox,
  .task-list .today-task-toggle {
    min-width: 42px !important;
    min-height: 42px !important;
  }

  .task-list .task-title {
    min-width: 0;
  }

  .task-list .task-title strong {
    font-size: 12px !important;
    line-height: 1.3;
  }

  .task-list .task-title small {
    margin-top: 4px;
    line-height: 1.25;
  }

  .list-foot {
    margin-bottom: 0;
    padding: 8px 0;
  }

  /* Project detail status remains comfortable to edit on iOS. */
  .project-meta .status-select,
  .project-meta select {
    width: 100%;
    min-height: 44px;
    font-size: 16px !important;
  }

  .journal textarea {
    min-height: 108px;
    font-size: 16px !important;
  }

  .journal form .button {
    min-height: 44px;
  }
}

@media (max-width: 390px) {
  .full-table > .project-row {
    grid-template-columns: minmax(0, 1fr) minmax(112px, 44%) !important;
    gap-column: 9px !important;
  }

  .tasks-controls .task-controls {
    grid-template-columns: 1fr !important;
  }
}
