/* Todo: the board from the data root, its horizon tabs and cards, the
   Later fold, and Instructions and Scans in the gear's panel. */
@layer views {
  /* Todo's Scans, below Instructions and Sources in the gear's panel, under
     a heading of theirs. Curation is a switch row and the scans a card of
     the grouped list (components.css), each scan its name, schedule, and
     last run. */
  .todo-scans { margin: 24px 0; }
  .todo-scans > .instructions-heading + .todo-curation { margin-top: 16px; }
  .todo-curation-state,
  .todo-curation-reason,
  .todo-schedules-note {
    margin: 6px var(--row-inset) 0;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
  }
  .todo-curation-reason { color: var(--red); }
  .todo-schedules { margin-top: 12px; }
  .todo-schedule {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 2px 12px;
    padding: 12px var(--row-inset);
    font-size: 14px;
  }
  .todo-schedule-name { font-weight: 500; }
  .todo-schedule-text,
  .todo-schedule-run {
    min-width: 0;
    color: var(--muted);
    overflow-wrap: anywhere;
  }
  .todo-schedule-run { text-align: right; }

  /* Todo: the board from the data root, its horizon tabs under the page
     heading (the Feed's tabs), Refresh at the tabs row's right end, and its
     sections in the Feed's centered column. */
  .todo-board {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }
  /* The row holds the tablist; the row keeps the border so the tablist can
     stay the shared .pane-tabs (components.css). */
  .todo-tabs-row {
    display: flex;
    flex: none;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--line);
  }
  .todo-tabs-row .todo-tabs {
    flex: 1;
    min-width: 0;
    border-bottom: none;
  }
  .todo-page {
    flex: 1;
    min-height: 0;
    padding: var(--page-top) var(--page-x) 96px;
    overflow: auto;
  }
  .todo-page > * {
    width: 100%;
    max-width: var(--column);
    margin-left: auto;
    margin-right: auto;
  }
  .todo-tab-drop {
    border-bottom-color: var(--green);
    color: var(--green);
  }
  .todo-heading {
    margin: 32px 0 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1.4;
    text-transform: uppercase;
  }
  .todo-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .todo-card {
    position: relative;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 14px 8px 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
  }
  /* The add form uses the routine cadence select and the card's date
     field, alongside its actions, wrapping into rows on a phone. */
  .todo-add-actions { flex-wrap: wrap; }
  .todo-add-field { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
  .todo-add-field .form-input { width: auto; min-width: 0; }
  .todo-dismiss-confirm { grid-column: 1 / -1; margin-top: 4px; }
  .todo-card[draggable="true"] { cursor: grab; }
  .todo-card-dragging { opacity: 0.35; }
  .todo-card-done { opacity: 0.55; }
  :root[data-theme="dark"] .todo-card-done { opacity: 0.8; }
  .todo-check {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    padding: 0;
    border: 1.5px solid var(--faint);
    border-radius: 50%;
    background: none;
    color: var(--on-accent);
    cursor: pointer;
  }
  .todo-check svg { opacity: 0; }
  .todo-check:hover { border-color: var(--green); }
  .todo-check[aria-pressed="true"] { border-color: var(--green); background: var(--green); }
  .todo-check[aria-pressed="true"] svg { opacity: 1; }
  .todo-card-body { min-width: 0; }
  .todo-card-body:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }
  .todo-title {
    display: block;
    margin: 0;
    color: var(--ink);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
    overflow-wrap: anywhere;
  }
  a.todo-title:hover { text-decoration: underline; text-decoration-color: var(--faint); }
  .todo-title[data-editable] { cursor: text; }
  .todo-card-done .todo-title { text-decoration: line-through; }
  .todo-meta {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
  }
  .todo-source-icon { flex: none; color: var(--faint); }
  .todo-meta .todo-source-icon { display: inline-block; margin-right: 6px; vertical-align: -2px; }
  .todo-note {
    margin: 8px 0 0;
    padding-left: 10px;
    border-left: 2px solid var(--rule);
    color: var(--ink-soft);
    font-size: 13px;
    font-style: italic;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
  .todo-note-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  /* A cut note is the toggle that opens it, as the Feed's takeaway line:
     plain text with a chevron at its end that flips once it is open. */
  button.todo-note {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    appearance: none;
    background: none;
    font: inherit;
    font-size: 13px;
    font-style: italic;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
  }
  button.todo-note .todo-note-text { flex: 1 1 auto; min-width: 0; }
  button.todo-note:hover, button.todo-note:focus-visible, button.todo-note[aria-expanded="true"] { color: var(--ink); }
  .todo-note-icon { flex: none; align-self: flex-start; margin-top: calc((1.5em - 16px) / 2); transition: transform 120ms ease; transform: rotate(-90deg); }
  .todo-note-toggle[aria-expanded="true"] .todo-note-icon { transform: rotate(0deg); }
  .todo-note-open .todo-note-text { display: block; -webkit-line-clamp: unset; overflow: visible; }
  .todo-edit,
  .todo-note-edit,
  .todo-due-edit {
    display: block;
    width: 100%;
    border: 1px solid var(--green);
    border-radius: 6px;
    background: var(--bg);
    color: var(--ink);
    font: inherit;
  }
  .todo-edit { margin: -3px 0; padding: 2px 6px; font-size: 16px; font-weight: 500; line-height: 1.4; }
  .todo-note-edit { min-height: 54px; margin-top: 8px; padding: 6px 8px; font-size: 13px; line-height: 1.5; resize: vertical; }
  .todo-due-edit { width: auto; margin-top: 8px; padding: 4px 8px; font-size: var(--field-font); line-height: 1.4; }
  .todo-edit:focus,
  .todo-note-edit:focus,
  .todo-due-edit:focus { outline: none; }
  .todo-card-done .row-more { visibility: hidden; }
  .todo-card:hover .row-more,
  .todo-card:focus-within .row-more { opacity: 1; }
  .todo-empty-row { list-style: none; }
  .todo-empty { margin: 0; padding: 10px 2px; color: var(--muted); }
  .todo-drawer-count { margin-left: 8px; color: var(--faint); font-weight: 400; letter-spacing: 0; }
  .todo-later > .todo-list { margin-top: 10px; }
  /* On the Later tab the list is the lead, with no fold around it. */
  .todo-later.todo-later-flat { margin-top: 0; padding-top: 0; border-top: 0; }
  .todo-later.todo-later-flat > summary { display: none; }
  .todo-later.todo-later-flat > .todo-list { margin-top: 0; }
  .todo-later.todo-later-flat + .drawer { margin-top: 32px; }
  .todo-row-dismissed .drawer-row-title,
  .todo-row-done .drawer-row-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
  /* A done row's check, the card's pressed check at the source icon's size. */
  .todo-row-check {
    display: grid;
    flex: none;
    place-items: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--green);
    color: var(--on-accent);
  }
  .todo-row-check svg { width: 9px; height: 9px; }
  .todo-candidate { align-items: flex-start; }
  .todo-candidate .todo-source-icon { margin-top: 4px; }
  .todo-candidate-group {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
  }
  .todo-candidate-text { flex: 1; min-width: 0; }
  .todo-candidate-title {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  .todo-candidate-meta {
    margin-top: 2px;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .todo-candidate .todo-edit { font-size: 14px; font-weight: 400; }
  .todo-verdict { flex: none; padding-top: 2px; color: var(--muted); font-size: 12px; white-space: nowrap; }

  /* Todo's and the brief's instructions forms. In the views
     layer, since chat.css's phone .composer padding would beat it from
     the components layer. */
  .composer.instructions-composer {
    margin: 16px 0 0;
    padding: 0;
    border-top: 0;
  }

  @media (max-width: 719.98px) {
    .todo-schedule {
      grid-template-columns: minmax(0, 1fr) auto;
      grid-template-areas:
        "name run"
        "text text";
    }
    .todo-schedule-name { grid-area: name; }
    .todo-schedule-run { grid-area: run; }
    .todo-schedule-text { grid-area: text; }
    .todo-card { padding-left: 12px; gap: 10px; }
    /* A row menu keeps inside a phone's width. */
    .row-menu { right: 0; max-width: calc(100vw - 32px); }
  }
}
