/* The personal day list (/today, today/index): a flat list of rows in
   the list view's card language — check, id, title with the project and
   archive underneath, labels, column dropdown, assignee, ⋮. Archive-
   independent page: no sidebar, no resource header. */
@layer components {
  .today-page {
    max-width: 62rem;
    margin: 0 auto;
    padding: 0.5rem 0 3rem;
  }

  .today-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    margin-bottom: 1rem;
  }

  .today-title {
    margin: 0;
    font-size: 1.6rem;
    color: var(--ink);
  }

  .today-date {
    margin: 0.15rem 0 0;
    color: var(--muted);
  }

  /* "3 von 7 erledigt" with a gold bar — replaced with every row answer. */
  .today-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--muted);
    font-size: 0.95rem;
    min-height: 1.5rem;
  }

  .today-progress-bar {
    display: block;
    width: 12rem;
    max-width: 40vw;
    height: 0.5rem;
    border-radius: 999px;
    background: var(--gold);
    overflow: hidden;
  }

  .today-progress-fill {
    display: block;
    height: 100%;
    background: var(--gold-bright);
    transition: width 0.3s ease;
  }

  /* Progress and the "Erledigte ausblenden" switch, right of the title. */
  .today-tools {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
  }

  .today-hide-done {
    height: auto;
  }

  .today-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
  }

  .today-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 2.2rem 0.6rem 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--surface-border);
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.08);
  }

  /* Drag & drop (today_controller): the dragged row leaves a faint ghost
     in the list, the lifted copy (touch fallback) casts a shadow. */
  .today-row-ghost {
    opacity: 0.4;
  }

  .today-row-chosen {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  }

  /* The handle: six dots at the row's start. A mouse may drag the whole
     row, so it is only a hint there; touch drags by it alone —
     touch-action: none keeps the page from scrolling under the finger. */
  .today-row-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.1rem;
    margin-left: -0.35rem;
    color: var(--muted-3);
    --icon-size: 1.1rem;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }

  .today-row:hover .today-row-handle {
    color: var(--muted);
  }

  @media (pointer: coarse) {
    /* A finger needs more than the icon: the handle spans the row's height. */
    .today-row-handle {
      align-self: stretch;
      width: 1.5rem;
      color: var(--muted-2);
    }
  }

  /* "Erledigte ausblenden" — the controller's value hides the done rows;
     once nothing is left to see, the note below the list says so. */
  .today-page[data-today-hide-done-value="true"] .today-row.is-done {
    display: none;
  }

  .today-all-done {
    display: none;
    margin: 0;
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--surface-border);
    border-radius: 12px;
    background: var(--cream-soft);
  }

  .today-page[data-today-hide-done-value="true"] .today-list:not(:has(.today-row:not(.is-done))) + .today-all-done {
    display: block;
  }

  /* The check: a square that fills green once the task sits in a done
     column. Follows the column, never a state of its own. */
  .today-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    border-radius: 7px;
    border: 1.5px solid var(--muted-3);
    color: transparent;
    background: var(--surface);
    --icon-size: 1rem;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  }

  .today-check:hover {
    border-color: #3f7d52;
    color: #3f7d52;
  }

  .today-row.is-done .today-check {
    background: #3f7d52;
    border-color: #3f7d52;
    color: #fff;
  }

  .today-row-id {
    flex-shrink: 0;
    min-width: 2.4rem;
  }

  .today-row-main {
    flex: 1 1 12rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
  }

  .today-row-title {
    color: var(--ink);
    font-weight: 500;
    text-decoration: none;
    overflow-wrap: anywhere;
  }

  .today-row-title:hover {
    color: var(--wine);
  }

  .today-row.is-done .today-row-title {
    text-decoration: line-through;
    color: var(--muted-2);
  }

  .today-row-crumb {
    font-size: 0.8rem;
    color: var(--muted);
  }

  .today-row-project {
    color: var(--muted);
    font-weight: 500;
    text-decoration: none;
  }

  .today-row-project:hover {
    color: var(--wine);
  }

  .today-row-since {
    color: var(--muted-3);
  }

  .today-row-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    flex-shrink: 0;
  }

  .today-row .kanban-card-assignee {
    margin-left: 0;
  }

  .today-row-menu {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
  }

  .today-hint {
    margin: 1.25rem 0 0;
    color: var(--muted-2);
    font-size: 0.85rem;
  }

  .today-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    border: 1px dashed var(--surface-border);
    border-radius: 12px;
    background: var(--cream-soft);
  }

  .today-empty-title {
    margin: 0 0 0.4rem;
    font-weight: 600;
    color: var(--ink);
  }

  .today-empty-body {
    margin: 0 auto;
    max-width: 34rem;
    color: var(--muted);
  }

  @media (max-width: 640px) {
    .today-row {
      flex-wrap: wrap;
      row-gap: 0.4rem;
    }

    .today-row-id {
      display: none;
    }

    .today-tools {
      align-items: flex-start;
    }

    /* Handle, check and title share the first line; the chips wrap under
       the title (indented past handle and check) as one group. */
    .today-row-chips {
      flex-basis: 100%;
      justify-content: flex-start;
      padding-left: 3.45rem;
    }

    @media (pointer: coarse) {
      .today-row-chips {
        padding-left: 3.85rem;
      }
    }
  }
}
