/* Lists: the bar with tabs and the view switch, the group headings, the rows (docs/VIEW-DESIGN.md §4, mock 2).
   Markup: views/list.js. Every rule of these parts lives here and nowhere else. */

/* ---- the bar: tabs and the view switch (in the top line on a computer, under the title on a phone) */
.subbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border-soft); }
.subbar-tabs { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.subbar-tabs::-webkit-scrollbar { display: none; }
.subbar-tabs > * { flex: none; }
.tab { height: 28px; padding: 0 11px; border: 0; border-radius: var(--r-full); background: transparent; display: inline-flex; align-items: center; color: var(--text-3); font-weight: 450; white-space: nowrap; flex: none; cursor: pointer; }
.tab .n { margin-left: 5px; color: var(--text-4); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; }
.tab.on { background: var(--hover); color: var(--text); font-weight: 500; }
@media (hover: hover) { .tab:not(.on):hover { background: var(--hover); } }
.vswitch { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-full); background: var(--hover); flex: none; }
.vbtn { width: 34px; height: 28px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: var(--r-full); background: transparent; color: var(--text-3); cursor: pointer; }
.vbtn svg, .vbtn .i { width: 16px; height: 16px; }
.vbtn.on { background: var(--elev); color: var(--text); box-shadow: 0 0 0 1px var(--border-soft); }
#topslot { flex: 1; min-width: 0; display: flex; }
#topslot:empty { display: none; }
#topslot:not(:empty) + .spacer { display: none; }
#topslot .subbar { flex: 1; min-width: 0; padding: 0 0 0 10px; border: 0; }
@media (max-width: 860px) {
  .subbar-tabs.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
  .subbar-tabs.fade-l { -webkit-mask-image: linear-gradient(to right, transparent, #000 32px); mask-image: linear-gradient(to right, transparent, #000 32px); }
  .subbar-tabs.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
}

/* ---- a group heading: 36 px on the quiet ground, chevron, icon, name, count, «+» */
.group-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 9px; height: 36px; margin: 8px 8px 2px; padding: 0 4px 0 12px; border-radius: var(--r-sm); background: var(--elev2); white-space: nowrap; font-size: var(--fs-body); }
.group-head > span:first-child { display: inline-flex; align-items: center; gap: 9px; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
.group-head .muted { color: var(--text-4); font-weight: 450; font-variant-numeric: tabular-nums; }
.group-head .round-btn { width: 28px; height: 28px; padding: 0; border-radius: var(--r-full); }
.group-head.foldable { cursor: pointer; -webkit-user-select: none; user-select: none; }
.group-head .gchev { display: inline-flex; color: var(--text-4); transition: transform var(--t-fast) var(--ease); }
.group-head .gchev svg, .group-head .gchev .i { width: 12px; height: 12px; }
.group-head.folded .gchev { transform: rotate(-90deg); }
.group-head.minor { position: static; z-index: auto; height: 32px; background: transparent; color: var(--text-3); font-size: var(--fs-caption); }
.group-head.minor > span:first-child { font-weight: 500; }
.group-head.minor.link { cursor: pointer; color: var(--text-2); }
.group-head.sec-head > .sec-count { display: inline; white-space: nowrap; font-variant-numeric: tabular-nums; }
.group-rows[hidden] { display: none; }
@media (max-width: 860px) {
  .group-head { margin: 8px 4px 2px; }
  .group-head .chip:not(.ball-us) { display: none; }
}

/* ---- a row: priority · number · status · title · who it concerns · context · chips · counter · executor · sum · date · type */
.row { display: flex; align-items: center; gap: 9px; min-height: 40px; margin: 0 8px; padding: 0 12px; border-radius: var(--r-sm); cursor: pointer; min-width: 0; }
@media (hover: hover) { .row:not(.static):hover { background: var(--hover); } }
.row:not(.static):active { background: var(--active); }
.row.static { cursor: default; }
.row.selected { background: var(--active); }
.row > .pre { display: inline-flex; align-items: center; flex: none; width: 16px; color: var(--text-3); }
.row > .pre > span { display: flex; }
.row > .pre .i, .row > .lead > .i { display: block; width: 16px; height: 16px; }
.row .ident { width: 44px; flex: none; color: var(--text-4); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; }
.row > .lead { display: inline-flex; align-items: center; gap: 9px; flex: none; }
.row .lead .ai { margin-right: 2px; }
.row .lead.weight { gap: 6px; width: 104px; color: var(--text-3); font-size: var(--fs-caption); white-space: nowrap; }
/* a critical point: the bars in the accent colour (mock 2, «Чек-листы») */
.row .lead.weight > .lvl-red { color: var(--accent); }
.row .lead.weight > .i { flex: none; width: 14px; height: 14px; }
.row .title { display: flex; align-items: center; gap: 10px; flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; font-size: var(--fs-body); }
.row .tt { flex: 0 1 auto; min-width: 80px; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.row .title .sub { display: flex; align-items: center; gap: 10px; flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text-4); }
.row .sub .chip.person { flex: 0 1 auto; height: auto; max-width: 220px; padding: 0; gap: 5px; border: 0; background: transparent; color: var(--text-2); font-size: inherit; font-weight: 450; }
.row .sub .chip.person > .avatar { width: 18px; height: 18px; font-size: 8.5px; }
.row .sub .chip.person > svg, .row .sub .chip.person > .i { width: 14px; height: 14px; flex: none; color: var(--icon); }
.row.closed-row .tt { color: var(--text-3); }
.row.empty-row { min-height: 36px; padding-top: 8px; padding-bottom: 8px; }
.row.empty-row .title, .row.empty-row .tt { white-space: normal; font-weight: 450; }
.row.older { opacity: .65; }
.row.disabled { opacity: .5; }
.row.need-outcome .sub { color: var(--orange); }
.row-btns { display: flex; justify-content: flex-end; gap: 6px; }
.row [data-tip] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.list-end { height: 1px; }

/* the right side: small plates, then the columns that line up down the list */
.row .meta { display: flex; align-items: center; gap: 12px; flex: 0 1 auto; min-width: 0; overflow: hidden; color: var(--text-3); font-size: var(--fs-caption); }
.row .meta > * { flex: none; }
.row .meta .chip { height: 24px; padding: 0 9px; font-size: var(--fs-caption); }
.row .meta .chip.ic svg, .row .meta .chip.ic .i { width: 14px; height: 14px; }
.row .meta .chip:has(> .avatar:first-child) { padding-left: 0; }
.row .meta .chip.person { padding-left: 2px; }
.row .meta .chip.person > .avatar { width: 18px; height: 18px; font-size: 8.5px; }
.row .meta .chip.fit-ic { font-size: 0; gap: 0; padding: 0 5px; }
.row .meta .chip.fit-ic > .avatar:first-child { margin: 0; }
.row .meta .chip.fit-ic:has(> .avatar:first-child), .row .meta .chip.ic:has(> .avatar:first-child) { padding: 0; }
.row .meta .fit-hide { display: none !important; }
.row .meta .btn { height: 26px; }
.row .meta .col { display: inline-flex; align-items: center; justify-content: flex-end; flex: none; }
.row .meta .c-count { min-width: 34px; }
.row .meta .c-count .chip { height: auto; padding: 0; gap: 3px; background: transparent; color: var(--text-4); font-variant-numeric: tabular-nums; }
.row .meta .c-exec { min-width: 22px; justify-content: center; }
.list:not(:has(.c-exec > *)) .c-exec, .list:not(:has(.c-count > *)) .c-count { display: none; }
.row .amount { flex: none; font-weight: 550; font-size: var(--fs-body); font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.row .amount.in { color: var(--green); }
.row .date { display: inline-flex; align-items: center; gap: 12px; flex: none; white-space: nowrap; color: var(--text-4); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; }
.row .date > .d { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 46px; }
.row.wide-date .date > .d { min-width: 110px; }
.row .date svg, .row .date .i { width: 13px; height: 13px; margin: 0; flex: none; }
.row .date.overdue, .row .date.soon { color: var(--accent-text); }
.row .date.overdue > .d, .row .date.soon > .d { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.row .date.strong { font-weight: 600; color: var(--text); }
.row .date > .tail { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 22px; color: var(--icon); }
.row .tail-ic { display: inline-flex; align-items: center; }
.row .tail-ic svg, .row .tail-ic .i { width: 16px; height: 16px; }

/* parts opened under their parent: one step to the right per level; a swiped row keeps its ground */
.row.indent-1 { padding-left: 34px; } .row.indent-2 { padding-left: 56px; } .row.indent-3 { padding-left: 78px; }
@media (pointer: coarse) { .row[data-id] { position: relative; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } }
.row.swiping, .row.swipe-anim, .row:has(> .swipe-act) { position: relative; z-index: 1; background: var(--base); }
.row.swipe-anim { transition: transform .18s var(--ease); }

/* ---- a phone (mock 2): two lines — the title with the executor and the date on the right, then who / where under the title */
@media (max-width: 860px) {
  .row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "lead tt meta date" "lead sub sub sub"; align-items: center; column-gap: 10px; row-gap: 3px; min-height: 0; margin: 0 4px; padding: 9px 12px; }
  .row:has(> .pre) { grid-template-columns: auto auto minmax(0, 1fr) auto auto; grid-template-areas: "pre lead tt meta date" "pre lead sub sub sub"; column-gap: 8px; }
  .row > .pre { grid-area: pre; align-self: start; margin-top: 2px; }
  .row > .ident { display: none; }
  .row > :not(.pre):not(.ident):not(.title):not(.meta):not(.date):not(.swipe-act) { grid-area: lead; align-self: start; margin-top: 2px; }
  .row > .title { display: contents; }
  .row > .title > .tt { grid-area: tt; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; }
  .row > .title > .sub { grid-area: sub; display: flex; min-width: 0; font-size: var(--fs-caption); white-space: nowrap; }
  .row > .title > .sub:empty { display: none; }
  .row > .title .sub .chip.person { flex: none; max-width: 60%; }
  .row > .meta { grid-area: meta; gap: 6px; }
  .row > .meta:empty, .row .meta .col:empty, .row .date > .tail:empty { display: none; }
  .row > .meta .amount { margin-left: auto; }
  .row > .date { grid-area: date; gap: 8px; }
  .row .date > .d, .row.wide-date .date > .d, .row .meta .col { min-width: 0; }
  .row .meta .chip { height: 22px; padding: 0 7px; }
  .row .meta .chip.ic { font-size: 0; gap: 0; padding: 0 5px; }
  .row .meta .chip.round { width: 22px; padding: 0; }
  .row .meta .chip.keep > .avatar:first-child { width: 20px; height: 20px; font-size: 9px; }
  .row.empty-row .tt { white-space: normal; }
  .row.indent-1 { padding-left: 34px; } .row.indent-2 { padding-left: 56px; } .row.indent-3 { padding-left: 78px; }
  .row.dir-row { padding-left: 16px; }
}

/* the pill of the tab (mock 2 .lfilter): a phone only, right after the title; the row of tabs is hidden there */
.lfilter { display: none; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; height: 30px; padding: 0 12px 0 10px; border: 0; border-radius: var(--r-full); background: var(--hover); color: var(--text); font: inherit; font-size: var(--fs-body); font-weight: 500; cursor: pointer; }
.lfilter svg, .lfilter .i { flex: none; width: 16px; height: 16px; color: var(--icon); }
.lfilter .lf-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lfilter:active { background: var(--press); }
@media (max-width: 860px) {
  .subbar .lfilter { display: inline-flex; }
  .subbar .subbar-tabs { display: none; }
  #topslot .subbar { padding-left: 8px; justify-content: space-between; }
}
