.tasks-header { padding-top: 18px; padding-bottom: 18px; }
.tasks-tabs { height: 34px; }

.tasks-body {
  flex: 1; min-height: 0;
  overflow: auto;
  padding: 14px var(--pad-x) 32px;
  display: flex; flex-direction: column; gap: 14px;
}

.xsearch {
  display: inline-flex; align-items: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--bg-elev);
  width: 240px;
}
.xsearch-input {
  flex: 1; border: 0; background: transparent; outline: none;
  font-size: 13px;
}

.task-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  font-size: 13px;
}
.task-table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-3);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 14px;
  background: var(--bg-sunk);
  border-bottom: 1px solid var(--line);
}
.task-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.task-table tbody tr:last-child td { border-bottom: 0; }
.task-table tbody tr:hover { background: var(--bg-sunk); }
.task-link {
  color: var(--ink);
  font-weight: 500;
}
.task-link:hover { color: var(--accent-deep); }
.task-tags { display: flex; gap: 4px; margin-top: 4px; }

.task-placeholder, .task-empty {
  padding: 32px;
  text-align: center;
  color: var(--ink-4);
  background: var(--bg-elev);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
}
.task-error {
  padding: 16px;
  border: 1px solid var(--bad-soft);
  background: var(--bad-soft);
  color: var(--bad);
  border-radius: var(--r-md);
  font-size: 13px;
}

@media (max-width: 640px) {
  .task-table { font-size: 12.5px; }
  .th-due, .td-due, .th-author, .td-author, .th-type, .td-type { display: none; }
}

/* Task drawer — sidebar style matching workflow drawer (no scrim, page
   under remains usable, click-outside on .drawer-side closes it). The
   .drawer rule in kanban.css uses top:0/z:90 with shadow; this override
   re-anchors below the brandbar and removes the shadow weight. */
.task-drawer-root .drawer.drawer-side {
  position: fixed;
  top: 56px; right: 0; bottom: 0;
  width: 520px; max-width: calc(100vw - 88px);
  background: var(--bg-elev);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 22px rgba(0, 0, 0, .06);
  z-index: 60;
  display: flex; flex-direction: column;
  animation: drawer-in .18s ease-out;
  transition: width .18s ease-out;
}
.task-drawer-root .drawer.drawer-side.is-fullscreen {
  width: calc(100vw - 88px);
  max-width: none;
}
/* minmax(0, 1fr) overrides the default min-width:auto on the grid item so
   wide content (task table) is constrained to the squeezed column instead
   of forcing the track to grow past the drawer. */
body:has(.task-drawer-root .drawer-side) .app {
  grid-template-columns: 88px minmax(0, 1fr);
}
body:has(.task-drawer-root .drawer-side) main.view {
  padding-right: 540px;
}
body:has(.task-drawer-root .drawer-side.is-fullscreen) main.view {
  padding-right: calc(100vw - 88px);
}
@media (max-width: 1100px) {
  body:has(.task-drawer-root .drawer-side) main.view {
    padding-right: 0;
  }
}

/* ── Query bar (GitHub-style) ────────────────────────────────── */
.tasks-query-row {
  padding: 10px var(--pad-x) 0;
  display: flex; flex-direction: column; gap: 8px;
}
.query-bar {
  display: flex; align-items: center; gap: 8px;
}
.query-bar-input-wrap {
  position: relative;
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  background: var(--bg-elev);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.query-bar-input-wrap > svg { color: var(--ink-4); flex: none; }
.query-bar-input-wrap:focus-within {
  border-color: var(--ink-3);
  box-shadow: 0 0 0 3px var(--y-wash);
}
.query-bar-input {
  flex: 1; border: 0; background: transparent; outline: 0;
  font-family: var(--font-mono); font-size: 13px;
  color: var(--ink);
}
.query-bar-input::placeholder { color: var(--ink-4); font-family: var(--font-sans); }
.query-bar-clear {
  border: 0; background: var(--bg-sunk); color: var(--ink-3);
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
}
.query-bar-clear:hover { background: var(--line); color: var(--ink); }

.query-bar-filters { position: relative; }
.query-bar-saved { position: relative; }

/* Filtry popover (chip groups) */
.filter-pop {
  position: absolute;
  top: calc(100% + 6px); left: 0;
  width: 380px; max-height: 480px;
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: var(--sh-3);
  z-index: 50;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: pop-in .12s ease;
}
.filter-pop-group {
  padding: 8px 12px 4px;
  border-bottom: 1px solid var(--line);
}
.filter-pop-group:last-of-type { border-bottom: 0; }
.filter-pop-h {
  font-size: 10.5px; font-weight: 600;
  color: var(--ink-4);
  letter-spacing: .06em; text-transform: uppercase;
  margin-bottom: 6px;
}
.filter-chips {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding-bottom: 6px;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  background: var(--bg-elev);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.filter-chip:hover { background: var(--bg-sunk); border-color: var(--line-3); }
.filter-chip[data-on="true"] {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.filter-chip[data-on="true"] .dot { box-shadow: 0 0 0 1px rgba(255,255,255,.35); }
.filter-chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block;
}
.filter-pop-foot {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

/* Active count badge on the Filtry button */
.iconbtn-badge {
  background: var(--accent);
  color: var(--ink);
  font-size: 10px; font-weight: 700;
  padding: 0 5px;
  border-radius: 999px;
  min-width: 16px; height: 16px;
  display: inline-grid; place-items: center;
  letter-spacing: 0;
  border: 1px solid var(--accent-deep);
}

/* Query autocomplete — visually attached to the input itself so it reads
   as a combobox extension rather than a separate dropdown. */
.query-bar-input-wrap:has(.query-suggest-pop:not([style*="display: none"])) {
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
.query-suggest-pop {
  position: absolute;
  top: 100%; left: -1px; right: -1px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--ink-3);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,.08), 0 0 0 3px var(--y-wash);
  z-index: 60;
  padding: 4px;
  animation: pop-in .08s ease;
}
.query-suggest-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-2);
}
.query-suggest-item:hover,
.query-suggest-item[data-active="true"] {
  background: var(--bg-sunk);
  color: var(--ink);
}
.query-suggest-icon {
  width: 18px;
  font-family: var(--font-mono);
  color: var(--ink-4);
  text-align: center;
}
.query-suggest-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.query-suggest-label b { font-family: var(--font-mono); color: var(--accent-deep); font-weight: 600; }
.query-suggest-hint { font-size: 11px; color: var(--ink-4); flex: none; }
.query-suggest-label .qs-q { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); margin-left: 6px; }
.query-bar-saved-pop {
  position: absolute;
  top: calc(100% + 6px); right: 0;
  width: 380px; max-height: 460px;
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: var(--sh-3);
  z-index: 50;
  display: flex; flex-direction: column;
  animation: pop-in .12s ease;
}
.query-bar-saved-h {
  padding: 10px 14px 6px;
  font-size: 11px; font-weight: 600;
  color: var(--ink-4);
  letter-spacing: .06em; text-transform: uppercase;
}
.query-bar-saved-body {
  flex: 1; overflow-y: auto;
  padding: 4px;
}
.query-bar-saved-loading,
.query-bar-saved-empty {
  padding: 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-4);
}
.query-bar-saved-list {
  display: flex; flex-direction: column; gap: 2px;
}
.query-bar-saved-row {
  display: flex; align-items: stretch; gap: 4px;
  padding: 2px;
  border-radius: 8px;
}
.query-bar-saved-row:hover { background: var(--bg-sunk); }
.query-bar-saved-apply {
  flex: 1;
  display: flex; flex-direction: column; gap: 2px;
  padding: 7px 10px;
  border: 0; background: transparent;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
}
.query-bar-saved-label {
  font-size: 13px; font-weight: 500;
  color: var(--ink);
}
.query-bar-saved-q {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.query-bar-saved-del {
  border: 0; background: transparent;
  color: var(--ink-4);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.query-bar-saved-del:hover { background: var(--bad-soft); color: var(--bad); }

.query-bar-save-form {
  display: flex; gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  border-radius: 0 0 12px 12px;
}
.query-bar-save-form input[type="text"] {
  flex: 1;
  height: 30px; padding: 0 10px;
  border: 1px solid var(--line-2);
  background: var(--bg-elev);
  border-radius: 7px;
  font-size: 12.5px;
}

.query-bar-chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.query-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 4px 3px 8px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--ink-2);
}
.query-chip-key {
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 11px;
}
.query-chip-val { color: var(--ink); font-weight: 500; }
.query-chip-x {
  width: 16px; height: 16px;
  border: 0; background: transparent;
  color: var(--ink-4);
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px; line-height: 1;
  padding: 0;
}
.query-chip-x:hover { background: var(--line); color: var(--ink); }
.query-clear-all {
  border: 0; background: transparent;
  color: var(--ink-4);
  font-size: 11.5px;
  cursor: pointer;
  padding: 0 4px;
  text-decoration: underline;
}
.query-clear-all:hover { color: var(--ink); }

/* ── Iconbtn-pill (filter, view, saved-filters trigger) ─────── */
.iconbtn-pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  background: var(--bg-elev);
  color: var(--ink-2);
  border-radius: 8px;
  cursor: pointer;
  position: relative;
}
.iconbtn-pill:hover { background: var(--bg-sunk); color: var(--ink); }
.iconbtn-pill[data-active="true"] {
  background: var(--accent-wash);
  border-color: var(--accent-soft);
  color: var(--ink);
}

/* ── New CSS-grid table ─────────────────────────────────────── */
.tasks-table-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--sh-1);
  /* Horizontal scroll when the column grid is wider than the wrap
   * (resized columns, many visible cols, narrow viewport). Vertical
   * overflow stays hidden so the border-radius keeps clipping rows. */
  overflow-x: auto;
  overflow-y: hidden;
}
.tbl {
  display: grid;
}
.tbl-head { display: contents; }
.tbl-row  { display: contents; }
.tbl-row-cells { display: contents; }
.tbl-head .tbl-cell {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 12px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 4px;
}
.tbl-cell {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 6px;
  min-width: 0;
  font-size: 13px;
  white-space: nowrap;
  background: var(--bg-elev);
}
.tbl-row:hover .tbl-cell { background: var(--bg-sunk); }

.tbl-sort {
  border: 0; background: transparent; padding: 0;
  display: inline-flex; align-items: center; gap: 4px;
  color: inherit;
  font: inherit; letter-spacing: inherit; text-transform: inherit;
  cursor: pointer;
}
.tbl-sort:hover { color: var(--ink-2); }
.tbl-sort[data-sort="asc"],
.tbl-sort[data-sort="desc"] {
  color: var(--ink);
  background: var(--accent-wash);
  padding: 2px 6px;
  margin: -2px -6px;
  border-radius: 6px;
}
.tbl-sort-chev { display: inline-grid; place-items: center; line-height: 0; transition: transform .15s; }
.tbl-sort-chev-inactive { opacity: .35; color: var(--ink-4); }
.tbl-sort[data-sort="asc"]  .tbl-sort-chev { transform: rotate(180deg); color: var(--accent-deep); }
.tbl-sort[data-sort="desc"] .tbl-sort-chev { color: var(--accent-deep); }
.tbl-sort:hover .tbl-sort-chev-inactive { opacity: .65; }

.tbl-title { flex-direction: column; align-items: flex-start; gap: 2px; white-space: normal; }
.tbl-titleline {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; width: 100%;
}
.tbl-titletext {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink); font-weight: 500;
  letter-spacing: -.005em;
  min-width: 0;
}
.tbl-titletext-done {
  color: var(--ink-4); text-decoration: line-through;
}
.tbl-id {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-4);
  padding-left: 14px;
  white-space: nowrap;
}
.tbl-status-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: none;
}
.tbl-expand,
.tbl-expand-spacer {
  width: 18px; height: 18px;
  flex: none;
  display: inline-grid; place-items: center;
}
.tbl-expand {
  border: 0; background: transparent;
  color: var(--ink-4);
  border-radius: 4px;
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.tbl-expand:hover { background: var(--bg-sunk); color: var(--ink); }
.tbl-expand[data-open="true"] { transform: rotate(90deg); color: var(--ink); }
.ai-pill {
  width: 16px; height: 16px; border-radius: 4px;
  background: var(--y-wash);
  color: var(--ink);
  display: inline-grid; place-items: center;
  border: 1px solid var(--y-soft);
  flex: none;
}
.subtask-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  padding: 1px 6px;
  background: var(--bg-sunk);
  border-radius: 999px;
  letter-spacing: 0;
  text-transform: none;
  flex: none;
}

.tbl-tags { gap: 4px; flex-wrap: wrap; }
.tbl-due { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.tbl-due-sub { font-size: 11px; color: var(--ink-4); }
.due-warn { color: var(--warn) !important; }
.due-bad  { color: var(--bad) !important; font-weight: 600; }

.tbl-assignee {
  font-size: 12.5px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis;
}

.tbl-foot {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  font-size: 12px;
  color: var(--ink-3);
  position: sticky; bottom: 0;
  z-index: 1;
}
.tbl-foot-slot { display: inline-flex; align-items: center; }
.tbl-foot .grow { flex: 1; }

/* Column resize handle — thin draggable strip on the right edge of
 * each header cell. Sits flush with the column border; the hover
 * state widens it visually so the affordance is obvious. */
.tbl-head .tbl-cell { position: relative; }
.tbl-col-resizer {
  position: absolute;
  top: 6px; bottom: 6px;
  right: -3px;
  width: 7px;
  cursor: col-resize;
  z-index: 2;
  background: transparent;
  user-select: none;
}
.tbl-col-resizer::after {
  content: ""; display: block;
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 1px;
  background: transparent;
  transition: background .12s ease;
}
.tbl-col-resizer:hover::after,
.tbl-col-resizer.is-dragging::after {
  background: var(--accent);
  left: calc(50% - 1px); width: 3px;
}

/* Pagination — classic numbered pager rendered in the table foot. */
.data-table-pager {
  display: inline-flex; align-items: center; gap: 2px;
}
.data-table-pager-step,
.data-table-pager-page {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px;
  padding: 0 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer; text-decoration: none;
  user-select: none;
}
.data-table-pager-step:hover,
.data-table-pager-page:hover {
  background: var(--bg-sunk);
  color: var(--ink);
}
.data-table-pager-page.is-active {
  background: var(--accent);
  color: var(--bg);
  cursor: default;
}
.data-table-pager-step.is-disabled {
  color: var(--ink-4);
  cursor: not-allowed;
  pointer-events: none;
}
.data-table-pager-ellipsis {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 28px;
  color: var(--ink-4);
  font-size: 13px;
  user-select: none;
}
.tbl-foot-selnum { font-weight: 500; color: var(--ink); }
.tbl-foot-divider { width: 1px; height: 16px; background: var(--line-2); }
.tbl-foot-menu { position: relative; display: inline-block; }
.tbl-foot-pop {
  position: absolute;
  bottom: calc(100% + 4px); left: 0;
  min-width: 160px;
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  box-shadow: var(--sh-3);
  z-index: 60;
  padding: 4px;
  display: flex; flex-direction: column; gap: 1px;
  animation: pop-in .1s ease;
}
.tbl-foot-pop-item {
  display: block; width: 100%;
  text-align: left;
  border: 0; background: transparent;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12.5px; color: var(--ink-2);
  cursor: pointer;
}
.tbl-foot-pop-item:hover { background: var(--bg-sunk); color: var(--ink); }
.tbl-foot-selected .grow { flex: 1; }
.tbl-foot-selected .btn-danger {
  background: var(--bad-soft);
  border-color: var(--bad-soft);
  color: var(--bad);
}
.tbl-foot-selected .btn-danger:hover { background: var(--bad); color: white; border-color: var(--bad); }

/* DataTableColsPicker — column-visibility dropdown reused by every
 * surface that hosts the shared DataTable. The <details> element is
 * the disclosure container; we suppress the native marker and style
 * the summary as a pill button so it sits naturally next to a search
 * field or QueryBar. */
.data-table-cols { position: relative; }
.data-table-cols > summary { list-style: none; }
.data-table-cols > summary::-webkit-details-marker { display: none; }
.data-table-cols-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}
.data-table-cols-trigger:hover { color: var(--ink); }
.data-table-cols[open] .data-table-cols-trigger { background: var(--bg-sunk); }
.data-table-cols-count {
  font-size: 11px; color: var(--ink-3);
  padding-left: 4px;
  border-left: 1px solid var(--line-2);
  margin-left: 2px;
}
.data-table-cols-pop {
  position: absolute;
  top: calc(100% + 4px); right: 0;
  min-width: 200px;
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  box-shadow: var(--sh-3);
  z-index: 60;
  padding: 4px;
  animation: pop-in .1s ease;
}
.data-table-cols-list { list-style: none; margin: 0; padding: 0; }
.data-table-cols-item {
  margin: 0;
  display: flex; align-items: center;
  border-radius: 6px;
}
.data-table-cols-item.is-dragging {
  background: var(--bg-sunk);
  opacity: 0.6;
}
.data-table-cols-grip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 26px;
  margin-left: 2px;
  color: var(--ink-4);
  font-size: 10px;
  letter-spacing: -1px;
  cursor: grab; user-select: none;
}
.data-table-cols-grip:active { cursor: grabbing; }
.data-table-cols-item:hover .data-table-cols-grip { color: var(--ink-3); }
.data-table-cols-link {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  text-decoration: none;
}
.data-table-cols-link:hover { background: var(--bg-sunk); color: var(--ink); }
.data-table-cols-check {
  width: 14px; height: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  color: var(--ink-3);
  background: var(--bg);
}
.data-table-cols-check.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

/* Per-page picker — same disclosure shape as the cols picker, just
 * narrower and anchored from the right (pop opens upward from the
 * footer). */
.data-table-per-page { position: relative; display: inline-block; }
.data-table-per-page > summary { list-style: none; }
.data-table-per-page > summary::-webkit-details-marker { display: none; }
.data-table-per-page-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--ink-3);
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  cursor: pointer; user-select: none;
}
.data-table-per-page-trigger:hover { color: var(--ink); }
.data-table-per-page[open] .data-table-per-page-trigger { background: var(--bg-sunk); color: var(--ink); }
.data-table-per-page-current { color: var(--ink); font-weight: 500; }
.data-table-per-page-pop {
  position: absolute;
  bottom: calc(100% + 4px); right: 0;
  min-width: 80px;
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  box-shadow: var(--sh-3);
  z-index: 60;
  padding: 4px;
  animation: pop-in .1s ease;
}
.data-table-per-page-list { list-style: none; margin: 0; padding: 0; }
.data-table-per-page-item {
  display: block; padding: 5px 12px;
  text-align: right;
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer; text-decoration: none;
}
.data-table-per-page-item:hover { background: var(--bg-sunk); color: var(--ink); }
.data-table-per-page-item.is-on { color: var(--accent-deep); font-weight: 500; }

/* Saved-filter star + dropdown — mirrors the QueryBar's saved-filter
 * pop styling so the affordance feels identical across simple and
 * advanced filter modes. Sits to the right of the simple-filter form
 * via flex auto-margin. */
.data-table-saved { position: relative; display: inline-block; }
.data-table-saved-pop {
  position: absolute;
  top: calc(100% + 4px); right: 0;
  width: 280px;
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: var(--sh-3);
  z-index: 60;
  padding: 8px;
  animation: pop-in .1s ease;
}
.data-table-saved-h {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-4); padding: 2px 4px 8px;
}
.data-table-saved-body { min-height: 32px; }
.data-table-saved-loading {
  padding: 8px; font-size: 12px; color: var(--ink-4); text-align: center;
}
.data-table-saved-form {
  display: flex; gap: 6px;
  margin-top: 6px; padding-top: 8px;
  border-top: 1px solid var(--line);
}
.data-table-saved-form input[name="label"] {
  flex: 1; height: 30px;
  padding: 0 8px;
  font-size: 12.5px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--bg);
}
.data-table-saved-form input[name="label"]:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-wash);
}

/* Products header — same skeleton as .tasks-header: a flex row with
 * title on the left, grow spacer, then the filter toggle pill. */
.products-header { padding-top: 18px; padding-bottom: 18px; display: flex; align-items: center; gap: 12px; }
.products-tools-slot { display: inline-flex; align-items: center; }

/* Products body — owns its own scroll surface inside main.view's
 * overflow:hidden container. The table-wrap inside uses
 * `overflow:hidden` to clip its border-radius, which combined with
 * a flex-column parent would have constrained the wrap's height and
 * hidden the load-more sentinel. Keeping the body as a normal block
 * lets the wrap auto-size to its content, and the body's
 * `overflow:auto` scrolls the whole thing within main.view. */
.products-body {
  flex: 1; min-height: 0;
  overflow: auto;
  padding: 14px var(--pad-x) 32px;
}

/* Simple filter form — row of compact inputs/selects rendered when the
 * advanced QueryBar is gated off. Each control behaves like a small
 * pill matching the cols/per-page picker styling. */
.products-simple-filters {
  grid-column: 1; grid-row: 1;
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.products-simple-input {
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  min-width: 140px;
}
.products-simple-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

/* Collapsible query-bar row — CSS-grid so the input area (column 1)
 * and the trailing tools group (column 2: saved-filter star + cols
 * picker) sit on the same row, while the chips strip emitted by the
 * QueryBar molecule wraps to a second row spanning the full width.
 * The tools group lives in `.dt-toolbar-right` regardless of which
 * filter mode is active — keeps the star + cols visually anchored on
 * the right edge of the toolbar across pages. */
.products-query-row,
.tasks-query-row {
  padding: 10px var(--pad-x) 0;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 10px;
  row-gap: 8px;
}
.products-query-row > .query-bar,
.products-query-row > .products-simple-filters,
.tasks-query-row > .query-bar,
.tasks-query-row > .products-simple-filters {
  grid-column: 1; grid-row: 1;
}
.products-query-row > .dt-toolbar-right,
.tasks-query-row > .dt-toolbar-right {
  grid-column: 2; grid-row: 1;
  display: inline-flex; align-items: center; gap: 6px;
}
.products-query-row > .query-bar-chips,
.tasks-query-row > .query-bar-chips {
  grid-column: 1 / -1; grid-row: 2;
}

/* Load-more sentinel — sits at the end of the rows, the intersect
 * observer fires the GET when it scrolls into view. `grid-column:
 * 1 / -1` makes the block span every column of the parent .tbl grid;
 * `display: block` overrides the .tbl-row trick (display:contents)
 * so IntersectionObserver actually sees a positive-sized box. */
.products-loadmore {
  display: block;
  grid-column: 1 / -1;
  padding: 14px 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: 12px;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.products-loadmore-label::before {
  content: ""; display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid var(--ink-4);
  border-top-color: var(--ink-2);
  border-radius: 50%;
  margin-right: 8px;
  animation: spin .6s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Subtask rows */
.tbl-subrows { display: contents; }
.tbl-row-sub .tbl-cell {
  background: var(--bg-sunk);
  font-size: 12.5px;
}
.tbl-row-sub:hover .tbl-cell { background: color-mix(in srgb, var(--bg-sunk) 90%, var(--ink) 4%); }
.tbl-titleline-sub { padding-left: 22px; position: relative; }
.tbl-sub-curve {
  position: absolute;
  left: 8px; top: -8px;
  width: 10px; height: 14px;
  border-left: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
  border-bottom-left-radius: 6px;
}
.tbl-sub-empty {
  grid-column: 1 / -1;
  padding: 10px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-4);
  background: var(--bg-sunk);
}

/* Mini chip used inside sub rows */
.chip-mini {
  font-size: 10px;
  padding: 1px 6px;
  height: auto;
  display: inline-flex; align-items: center; gap: 3px;
  border-radius: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.chip-mini .dot {
  width: 6px; height: 6px; border-radius: 50%; display: inline-block;
}

/* Resolve CTA on a table row */
.resolve-btn-row {
  height: 24px; padding: 0 10px;
  font-size: 11.5px;
}

/* ── Create task form (drawer) ───────────────────────────────── */
.tdrawer-create-form {
  display: flex; flex-direction: column;
  gap: 14px;
  padding: 18px 24px 22px;
}
.tdrawer-field {
  display: flex; flex-direction: column;
  gap: 5px;
}
.tdrawer-field-row {
  display: flex; gap: 12px;
}
.tdrawer-field-half { flex: 1; }
.tdrawer-field-label {
  font-size: 11px; font-weight: 600;
  color: var(--ink-4);
  letter-spacing: .04em; text-transform: uppercase;
}
.tdrawer-input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  background: var(--bg-elev);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--ink);
  outline: 0;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.tdrawer-input:focus {
  border-color: var(--ink-3);
  box-shadow: 0 0 0 3px var(--y-wash);
}
.tdrawer-input-lg {
  height: 42px;
  font-size: 15px;
  font-weight: 500;
}
.tdrawer-textarea {
  min-height: 90px;
  padding: 10px 12px;
  height: auto;
  resize: vertical;
  line-height: 1.5;
}
select.tdrawer-input {
  cursor: pointer;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10"><polyline points="1.5,3.5 5,7 8.5,3.5" fill="none" stroke="%23737067" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 26px;
  -webkit-appearance: none; appearance: none;
}
.tdrawer-create-foot {
  display: flex; align-items: center; gap: 8px;
  padding-top: 6px;
  margin-top: 4px;
  border-top: 1px dashed var(--line);
}
.drawer-task-create .drawer-h .drawer-id {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.005em;
  color: var(--ink);
  background: transparent;
  padding: 0;
}

/* ── Drawer view — inline edit chips + metadata footer ───────── */
.tdrawer-edit-chip { position: relative; display: inline-block; }
.tdrawer-edit-chip .chip-edit {
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid transparent;
  transition: border-color .12s;
}
.tdrawer-edit-chip .chip-edit:hover { border-color: var(--line-3); }
.tdrawer-edit-chip .chip-edit > svg { opacity: .55; }
.tdrawer-edit-pop {
  position: absolute;
  top: calc(100% + 4px); left: 0;
  min-width: 160px;
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: var(--sh-3);
  z-index: 70;
  padding: 4px;
  display: flex; flex-direction: column; gap: 1px;
  animation: pop-in .1s ease;
}
.tdrawer-edit-item {
  display: flex; align-items: center; gap: 8px;
  border: 0; background: transparent;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
}
.tdrawer-edit-item:hover { background: var(--bg-sunk); color: var(--ink); }
.tdrawer-edit-dot {
  width: 7px; height: 7px;
  border-radius: 50%; flex: none;
}

.tdrawer-title-edit {
  outline: none;
  border-radius: 8px;
  padding: 4px 8px;
  margin: 0 -8px 0 -8px;
  transition: background .12s, box-shadow .12s;
  cursor: text;
}
.tdrawer-title-edit:hover { background: var(--bg-sunk); }
.tdrawer-title-edit:focus {
  background: var(--bg-elev);
  box-shadow: 0 0 0 2px var(--y-wash);
}

.tdrawer-desc-edit { margin-top: 10px; }
.tdrawer-desc-view {
  border-radius: 8px;
  padding: 6px 8px;
  margin: 0 -8px;
  cursor: text;
  transition: background .12s;
  min-height: 1.4em;
}
.tdrawer-desc-view:hover { background: var(--bg-sunk); }
.tdrawer-desc-empty { color: var(--ink-3); font-style: italic; }
.tdrawer-desc-ta { width: 100%; resize: vertical; min-height: 6em; }

.tdrawer-picker { position: relative; display: inline-block; }
.tdrawer-picker-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-3);
  cursor: pointer;
  max-width: 240px;
}
.tdrawer-picker-btn:hover { background: var(--bg-elev); }
.tdrawer-picker-btn > span:last-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tdrawer-picker-empty { font-style: italic; color: var(--ink-4); }
.tdrawer-picker-pop {
  position: absolute; top: 100%; left: 0; margin-top: 4px; z-index: 30;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px; min-width: 200px; max-height: 240px; overflow-y: auto;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
}
.tdrawer-picker-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; border-radius: 4px; cursor: pointer;
  font-size: 12.5px;
}
.tdrawer-picker-row:hover { background: var(--bg-sunk); }
.tdrawer-picker-row input { margin: 0; }

/* Autosave confirmation glow. Added by pulseSaved() in tasks.js for
   ~3s after a successful inline-edit PATCH. Targets any element — chip,
   button, contenteditable, textarea. */
.field-saved {
  box-shadow: 0 0 0 2px var(--accent-deep);
  transition: box-shadow .25s ease-out;
  border-radius: 8px;
}

.tdrawer-due-edit { position: relative; display: inline-block; }
.tdrawer-due-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-3);
  cursor: pointer;
  transition: border-color .12s;
}
.tdrawer-due-btn:hover { border-color: var(--line-3); color: var(--ink-2); }
.tdrawer-due-btn > svg { color: var(--ink-4); }
.tdrawer-due-empty { color: var(--ink-4); font-style: italic; }
.tdrawer-due-pop {
  position: absolute;
  top: calc(100% + 4px); left: 0;
  min-width: 200px;
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: var(--sh-3);
  z-index: 70;
  padding: 8px;
  display: flex; align-items: center; gap: 6px;
  animation: pop-in .1s ease;
}
/* Range variant — stacked from/to inputs with labels above each input. */
.tdrawer-due-pop--range {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px;
  min-width: 220px;
}
.tdrawer-date-field {
  display: flex; flex-direction: column;
  gap: 3px;
}
.tdrawer-date-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-4);
}
.tdrawer-date-clear {
  align-self: flex-end;
  margin-top: 2px;
}

.tdrawer-assignee {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-3);
}
.tdrawer-assignee > svg { color: var(--ink-4); }

.tdrawer-meta {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 18px;
  padding: 10px 12px;
  background: var(--bg-sunk);
  border-radius: 10px;
  font-size: 11.5px;
  color: var(--ink-4);
}
.tdrawer-meta-bit {
  display: inline-flex; align-items: center; gap: 4px;
}
.tdrawer-meta-bit > svg { color: var(--ink-4); }

/* Timeline zoom toolbar — pill toggle Dni/Tygodnie/Miesiące. */
.tt-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}
.tt-zoom {
  display: inline-flex;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.tt-zoom-btn {
  padding: 4px 12px;
  font-size: 12.5px;
  color: var(--ink-3);
  text-decoration: none;
  border-radius: 6px;
  transition: background .12s, color .12s;
}
.tt-zoom-btn:hover { color: var(--ink); }
.tt-zoom-btn[data-active="true"] {
  background: var(--bg-sunk);
  color: var(--ink);
  font-weight: 600;
}

/* Timeline view — mirrors sembot-angular: sticky title rail on the
   left + horizontal day axis on the right + status-tinted bars.
   --tt-rail is the title column width, --tt-col the per-day column
   width; --tt-cols is set inline on the root from the day count. */
.tt {
  --tt-rail: 220px;
  --tt-col: 60px;
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
  max-height: calc(100vh - 220px);
}
.tt-head {
  display: grid;
  grid-template-columns: var(--tt-rail) 1fr;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sunk);
  position: sticky; top: 0; z-index: 2;
  width: calc(var(--tt-rail) + var(--tt-cols) * var(--tt-col));
}
.tt-title-h {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-4);
  border-right: 1px solid var(--line);
  position: sticky; left: 0; background: var(--bg-sunk); z-index: 1;
}
.tt-axis {
  display: grid;
  grid-template-columns: repeat(var(--tt-cols), var(--tt-col));
}
.tt-col-h {
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 0;
  font-size: 11px; color: var(--ink-4);
  border-right: 1px solid var(--line);
}
.tt-col-h--mstart { background: var(--bg-elev); }
.tt-col-h-month {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-3);
}
.tt-col-h-day { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.tt-col-h-sub { font-size: 10px; color: var(--ink-4); margin-top: 2px; }
.tt-col-h--today .tt-col-h-day { color: var(--accent-deep); }
.tt-col-h--today .tt-col-h-sub { color: var(--accent-deep); }

.tt-body {
  display: block;
  /* Body width matches axis so the whole component scrolls as one
     unit (axis + rows together). Vertical scroll lives on the outer
     .tt container. */
  width: calc(var(--tt-rail) + var(--tt-cols) * var(--tt-col));
}
.tt-row {
  display: grid;
  grid-template-columns: var(--tt-rail) 1fr;
  border-bottom: 1px solid var(--line);
  min-height: 44px;
}
.tt-row:last-child { border-bottom: 0; }
.tt-row--clickable { cursor: pointer; transition: background .12s; }
.tt-row--clickable:hover { background: var(--bg-sunk); }
.tt-row--clickable:hover .tt-title { background: var(--bg-sunk); }
.tt-title {
  display: flex; flex-direction: column; justify-content: center;
  padding: 8px 14px;
  border-right: 1px solid var(--line);
  background: var(--bg-elev);
  position: sticky; left: 0; z-index: 1;
  width: var(--tt-rail);
}
/* Make sticky left columns play nice — title needs solid bg so the
   scrolling content underneath doesn't bleed through. */
.tt-row:hover .tt-title { background: var(--bg-sunk); }
.tt-title-text {
  font-size: 13px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tt-title-meta {
  font-size: 11px; color: var(--ink-4); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tt-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--tt-cols), var(--tt-col));
  align-items: center;
  min-height: 44px;
}
.tt-grid {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--tt-cols), var(--tt-col));
  pointer-events: none;
}
.tt-grid-cell { border-right: 1px solid var(--line); }
.tt-grid-cell--today { background: var(--accent-wash); opacity: .35; }

.tt-bar {
  position: relative;
  z-index: 1;
  margin: 6px 4px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: default;
  transition: filter .12s, box-shadow .12s, transform .12s;
}
.tt-bar:hover { filter: brightness(0.97); box-shadow: 0 2px 8px rgba(0,0,0,0.1); transform: translateY(-1px); }
.tt-bar-label {
  display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tt-bar--overdue {
  background: rgba(239, 68, 68, 0.12);
  border-color: var(--bad);
  color: var(--bad);
}
.tt-bar--done {
  background: var(--bg-sunk);
  border-color: var(--line-2);
  color: var(--ink-4);
  text-decoration: line-through;
}
.tt-offgrid {
  grid-column: 1 / -1;
  font-size: 11.5px;
  color: var(--ink-4);
  font-style: italic;
  padding-left: 12px;
}

/* today vertical line spans the entire body. Inline `left` offset is
   computed on the templ side from the column index. */
.tt-today-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--accent-deep);
  opacity: 0.5;
  pointer-events: none;
  z-index: 3;
}
