/* Desktop ergonomics. Keep every rule inside this breakpoint: the mobile
   layout, zoom preferences and shared interaction handlers stay unchanged. */
@media (min-width: 1024px) {
  body {
    --desktop-control-size: 40px;
  }

  /* Pixel floors keep controls usable even with the XS/S zoom preferences. */
  :root body button {
    min-width: var(--desktop-control-size);
    min-height: var(--desktop-control-size);
    cursor: pointer;
    font-size: max(12px, 0.875rem) !important;
  }

  body :is(button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid var(--accent-task-hover) !important;
    outline-offset: 3px;
  }

  body button:disabled {
    cursor: not-allowed;
  }

  #app-viewport {
    padding: 24px clamp(24px, 2.5vw, 48px) 112px;
    scrollbar-gutter: stable;
  }

  #app-viewport > [id^="view-"] {
    max-width: 1680px;
    margin-inline: auto;
  }

  #app-viewport > #view-timeboxing-app .timebox-slot-time {
    width: 16rem;
  }

  #app-viewport > #view-timeboxing-app .timebox-slot-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  /* Leave invisible date-picker overlays, hidden controls and ranges alone. */
  body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]), select):not(.sr-only):not(.absolute) {
    min-height: var(--desktop-control-size);
  }

  body :is(input[type="checkbox"], input[type="radio"]):not(.hidden):not(.sr-only):not(.task-checkbox) {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    accent-color: var(--accent-task-hover);
    cursor: pointer;
  }

  /* A real, enlarged native hit target works with mouse and Space, while
     retaining the existing stopPropagation and persistence behavior. */
  body input.task-checkbox {
    width: var(--desktop-control-size);
    height: var(--desktop-control-size);
    min-width: var(--desktop-control-size);
    min-height: var(--desktop-control-size);
    margin: 0;
    align-self: flex-start;
    accent-color: var(--accent-task-hover);
  }

  #board-container :has(> .task-card) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 16px;
    align-items: stretch;
  }

  #board-container .task-card {
    margin: 0;
    min-width: 0;
    padding: 16px;
    gap: 12px;
  }

  .task-card .card-title {
    font-size: max(14px, 1rem);
    line-height: 1.5;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 3;
  }

  .task-card :is(.badge-priority, .badge-status) {
    font-size: max(11px, 0.75rem);
    line-height: 1.4;
  }

  .task-footer-bar {
    gap: 10px;
    margin-top: auto;
    padding-top: 12px;
  }

  .task-footer-bar > :last-child {
    gap: 8px;
  }

  body .card-today-btn {
    padding-inline: 12px;
  }

  body .card-delete-direct-btn {
    justify-content: center;
    border: 1px solid var(--border-medium);
    border-radius: 10px;
    color: var(--text-secondary);
  }

  .card-delete-direct-btn svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
  }

  body .card-delete-direct-btn:hover {
    background: #fff1f2;
    border-color: #fda4af;
    color: #be123c;
  }

  /* Keep the target under the pointer rather than lifting/scaling its card. */
  .task-card:hover,
  .task-card:active,
  .habit-card:hover,
  .habit-card:active {
    transform: none;
  }

  .task-card:focus-within {
    border-color: var(--accent-task);
    box-shadow: 0 0 0 2px var(--accent-task-soft);
  }

  #category-filter-chips,
  #completed-category-filter-chips {
    flex-wrap: wrap;
    overflow: visible;
    gap: 10px;
  }

  #habits-daily-container label[for="habit-picker-hidden"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--desktop-control-size);
    min-height: var(--desktop-control-size);
    border-radius: 10px;
  }

  #modal-habit-edit label:has(> input[type="checkbox"]) > span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--desktop-control-size);
  }

  .modal-overlay input[type="color"] {
    min-width: var(--desktop-control-size);
    min-height: var(--desktop-control-size);
  }

  :is(#app-viewport, .modal-overlay) a[href][class*="flex"] {
    min-width: var(--desktop-control-size);
    min-height: var(--desktop-control-size);
  }

  /* Desktop dock: visible labels beside their icons and comfortable spacing. */
  #bottom-nav {
    min-height: 72px;
    height: 72px;
    gap: 8px;
  }

  #bottom-nav .bottom-nav-item {
    min-width: 104px;
    min-height: 44px;
    flex-direction: row;
    gap: 8px;
    padding: 10px 16px;
  }

  #bottom-nav .bottom-nav-item span {
    font-size: max(13px, 0.875rem) !important;
  }

  #bottom-nav .bottom-nav-item.active::before {
    inset: 0;
    width: auto;
    height: auto;
    border-radius: 12px;
  }

  #bottom-nav .bottom-nav-item.active svg {
    transform: none;
  }

  /* Room for the enlarged controls without clipping long modal contents. */
  .modal-overlay > div {
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    scrollbar-gutter: stable;
  }

  .modal-overlay :is(button, select) {
    line-height: 1.4;
  }

  :is(#task-notion-modal, #modal-habit-edit, #modal-finance-edit-expense) > div {
    max-width: 640px;
  }
}
