/* Tasks page: board, list, bulk selection, kanban, archive, import. */
/* ========== Tasks page: Board / List (#977) ==========
   One grouped markup, two layouts. data-view on .kw-tasks-view picks columns
   (board) or stacked sections (list); the Eisenhower grid has its own layout
   and ignores both. */
.kw-tasks-actions { display: flex; align-items: center; gap: var(--space-xs); flex-wrap: wrap; justify-content: flex-end; }
.kw-segmented { display: flex; gap: var(--space-xxs); padding: var(--space-xxxs); background: var(--bg-subtle); border-radius: var(--radius-sm); }
.kw-segmented .kw-btn { background: transparent; border-color: transparent; }
.kw-segmented .kw-btn[aria-pressed="true"] { background: var(--bg); border-color: var(--border); color: var(--fg); }
.kw-tasks-search {
  display: flex; align-items: center; gap: var(--space-xs);
  height: 36px; padding: 0 var(--space-sm);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--fg-muted);
}
.kw-tasks-search:focus-within { border-color: var(--orange); }
.kw-tasks-search .material-symbols-rounded { font-size: 18px; }
.kw-tasks-search input {
  width: 160px; border: 0; outline: none; background: transparent;
  color: var(--fg); font: inherit; font-size: var(--text-body-md);
}
.kw-group-tasks { display: flex; flex-direction: column; gap: var(--space-xs); }
.kw-tasks-view[data-view="board"] .kw-task-groups {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(200px, 1fr);
  gap: var(--space-sm);
  align-items: start;
  overflow-x: auto;
}
/* A board column is too narrow to share a line with the buttons (#1150): the title
   takes the full width and the buttons drop beside the meta pills. display:contents
   lets the head's children join the card's grid. Skip stays in the card's menu. */
.kw-tasks-view[data-view="board"] .kw-kanban-col .kw-task {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-xxs) var(--space-xs);
  align-items: center;
  padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-lg); /* right snapped down: the card stays compact (#1150) */
}
.kw-tasks-view[data-view="board"] .kw-kanban-col .kw-task-head { display: contents; }
.kw-tasks-view[data-view="board"] .kw-kanban-col .kw-checkbox { align-self: start; }
.kw-tasks-view[data-view="board"] .kw-kanban-col .kw-task-open { grid-column: 2 / -1; min-height: 0; }
.kw-tasks-view[data-view="board"] .kw-kanban-col .kw-task-meta { grid-row: 2; grid-column: 1 / 3; padding: 0; margin: 0; }
.kw-tasks-view[data-view="board"] .kw-kanban-col .kw-task-actions { grid-row: 2; grid-column: 3; }
.kw-tasks-view[data-view="board"] .kw-kanban-col [data-task-skip-button] { display: none; }
.kw-tasks-view[data-view="list"] .kw-task-groups { display: flex; flex-direction: column; gap: var(--space-lg); }
.kw-tasks-view[data-view="list"] .kw-kanban-col { background: transparent; padding: 0; min-height: 0; }
/* A list reads top to bottom, so neither the column's "no tasks here" filler nor
   the card's equal-height floor (.kw-task-open min-height, #791) earns its space. */
.kw-tasks-view[data-view="list"] .kw-kanban-empty { display: none; }
.kw-tasks-view[data-view="list"] .kw-task-open { min-height: 0; }

/* Due tabs (#977). They filter both views, so they show in both. */
.kw-due-tabs {
  /* overflow-x:auto makes y scroll too, so nothing may hang past the bottom edge:
     an inset divider rather than a border the tabs overlap with a negative margin,
     which gave the row a stray vertical scrollbar (#1150). */
  display: flex; gap: var(--space-xxxs); overflow-x: auto; overflow-y: hidden;
  margin-bottom: var(--space-md);
  box-shadow: inset 0 -1px 0 var(--divider);
}
.kw-due-tab {
  padding: var(--space-sm) var(--space-sm);
  border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--fg-muted);
  font: inherit; font-size: var(--text-label-lg); font-weight: 500; white-space: nowrap;
  cursor: pointer;
}
.kw-due-tab:hover { color: var(--fg); }
.kw-due-tab[aria-pressed="true"] { color: var(--fg); border-bottom-color: var(--fg-muted); }

/* List + detail (#977). The pane only has room on a wide list view; app.js
   (taskDetailPane) uses the same 1024px to decide pane or modal. */
.kw-task-detail {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--divider); border-radius: var(--radius-md);
  position: sticky; top: 16px;
  max-height: calc(100vh - 32px);
  min-width: 0;
}
@media (min-width: 840px) { /* --bp-expanded; app.js taskDetailPane matches it */
  .kw-tasks-split-open { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--space-md); align-items: start; }
  .kw-tasks-split-open .kw-tasks-main { min-width: 0; }
}
@media (max-width: 839px) { /* below --bp-expanded */
  .kw-task-detail { display: none !important; }
}
.kw-checkbox {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: transparent;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: border-color 100ms, background 100ms;
}
.kw-checkbox:hover { border-color: var(--orange); }
.kw-checkbox.checked { background: var(--success); border-color: var(--success); }
.kw-checkbox.checked .material-symbols-rounded { font-size: 13px; color: white; }

/* Completion feedback (#645): the tick pops and the card dims briefly, so
   finishing a task registers visually before the list re-sorts. */
.kw-checkbox.checked .material-symbols-rounded { animation: kw-check-pop 220ms ease-out; }
@keyframes kw-check-pop {
  0%   { transform: scale(0.3); opacity: 0; }
  60%  { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.kw-task-completing { animation: kw-task-settle 320ms ease-out; }
@keyframes kw-task-settle {
  0%   { background: color-mix(in srgb, var(--success) 22%, transparent); }
  100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .kw-checkbox.checked .material-symbols-rounded,
  .kw-task-completing { animation: none; }
}
.kw-task-play {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--border-strong);
  color: var(--fg-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-family: inherit;
  text-decoration: none;
  transition: background 100ms, border-color 100ms, color 100ms;
}
.kw-task-play:hover { background: var(--orange); border-color: var(--orange); color: white; }
.kw-task-play.running { background: var(--orange); border-color: var(--orange); color: white; }
.kw-task-play .material-symbols-rounded { font-size: 16px; }

/* ========== Task bulk selection ========== */
.kw-bulk-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--lavender-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
}
.kw-task[data-bulk-selected="true"] {
  border-color: var(--orange);
  background: rgba(255, 107, 53, 0.04);
  box-shadow: 0 0 0 1px var(--orange) inset;
}
.kw-bulk-energy-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 120px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  padding: var(--space-xxs);
}
.kw-bulk-energy-item {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-body-md);
  border-radius: var(--radius-sm);
  color: var(--fg);
}
.kw-bulk-energy-item:hover {
  background: var(--bg-subtle);
}

/* ========== Kanban columns ========== */
.kw-kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-sm);
  align-items: flex-start;
}
.kw-kanban-col {
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-height: 200px;
  /* Transparent by default so the dropping state does not resize the column. */
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 120ms ease, background 120ms ease;
}
/* Drop target under a dragged card (issue #602). */
.kw-kanban-col-dropping {
  outline-color: var(--orange);
  background: var(--bg);
}
.kw-task[draggable="true"] { cursor: grab; }
.kw-task[draggable="true"]:active { cursor: grabbing; }
.kw-kanban-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xxxs) var(--space-xxs) var(--space-xxs);
}
.kw-kanban-head .label {
  margin: 0;
  font-size: var(--text-label-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}
.kw-kanban-head .count {
  font-size: var(--text-label-sm);
  color: var(--fg-muted);
  background: var(--bg);
  border-radius: var(--radius-full);
  padding: 1px var(--space-xs);
}

/* Page-level classes (#1231): one class per element, replacing the Tailwind
   utilities the templates used to carry. Kept after this sheet's component
   rules so they win equal-specificity ties on the same element. */
/* ---------- pages/task_conflict.templ ---------- */
.kw-conflict > :not([hidden]) ~ :not([hidden]) { margin-top: var(--space-lg); margin-bottom: 0; }
.kw-conflict-notice { border-radius: var(--radius-md); border-width: 1px; border-color: rgb(252 211 77); background-color: rgb(255 251 235); padding: var(--space-md); }
.dark .kw-conflict-notice { border-color: rgb(180 83 9); background-color: rgb(69 26 3); }
.kw-conflict-notice-title { font-size: var(--text-title-sm); line-height: 1.25rem; font-weight: 600; color: rgb(120 53 15); }
.dark .kw-conflict-notice-title { color: rgb(253 230 138); }
.kw-conflict-notice-text { margin-top: var(--space-xxs); font-size: var(--text-body-md); line-height: 1.25rem; color: rgb(146 64 14); }
.dark .kw-conflict-notice-text { color: rgb(252 211 77); }
.kw-conflict-form > :not([hidden]) ~ :not([hidden]) { margin-top: var(--space-lg); margin-bottom: 0; }
.kw-conflict-fields > :not([hidden]) ~ :not([hidden]) { margin-top: var(--space-md); margin-bottom: 0; }
.kw-conflict-field { border-radius: var(--radius-md); border-width: 1px; border-color: var(--border); padding: var(--space-sm); }
.kw-conflict-field-label { padding-left: var(--space-xxs); padding-right: var(--space-xxs); font-size: var(--text-label-lg); line-height: 1.25rem; font-weight: 500; color: var(--fg); }
.kw-conflict-options > :not([hidden]) ~ :not([hidden]) { margin-top: var(--space-xs); margin-bottom: 0; }
.kw-conflict-option { display: flex; cursor: pointer; align-items: flex-start; gap: var(--space-xs); }
.kw-conflict-radio { margin-top: var(--space-xxs); height: 1rem; width: 1rem; accent-color: var(--orange-solid); }
.kw-conflict-option-body { font-size: var(--text-body-md); line-height: 1.25rem; }
.kw-conflict-option-source { display: block; font-size: var(--text-label-md); line-height: 1rem; text-transform: uppercase; letter-spacing: 0.025em; color: var(--fg-muted); }
.kw-conflict-option-value { display: block; overflow-wrap: break-word; color: var(--fg); }
.kw-conflict-actions { display: flex; align-items: center; gap: var(--space-sm); padding-top: var(--space-xs); }

/* ---------- pages/tasks.templ, pages/archived_tasks.templ, pages/import.templ (shared page head) ---------- */
.kw-tasks-page-select-active { border-color: var(--lavender-100) !important; background-color: var(--lavender-100) !important; }
.kw-tasks-page-head { margin-bottom: var(--space-lg); }
.kw-tasks-page-bulk-count { font-size: var(--text-label-lg); line-height: 1.25rem; font-weight: 500; color: var(--fg); }
.kw-tasks-page-bulk-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-xs); }
.kw-tasks-page-bulk-energy { position: relative; }
.kw-tasks-page-sort-toggle { margin-left: auto; }
.kw-tasks-page-search-empty { margin-bottom: var(--space-md); }
.kw-eisenhower-axis { margin-bottom: var(--space-xxs); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xxs); padding-left: var(--space-xxs); }
.kw-eisenhower-axis-urgent { padding-top: var(--space-xxs); padding-bottom: var(--space-xxs); text-align: center; font-size: var(--text-label-md); line-height: 1rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.025em; color: var(--error-text); }
.kw-eisenhower-axis-not-urgent { padding-top: var(--space-xxs); padding-bottom: var(--space-xxs); text-align: center; font-size: var(--text-label-md); line-height: 1rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.025em; color: var(--flow-work); }
.kw-eisenhower-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); }
.kw-eisenhower-cell { overflow: hidden; border-radius: var(--radius-lg); border-width: 2px; }
.kw-eisenhower-cell--do { border-color: color-mix(in srgb, var(--error) 35%, var(--bg)); }
.kw-eisenhower-cell--schedule { border-color: color-mix(in srgb, var(--pomo-work) 35%, var(--bg)); }
.kw-eisenhower-cell--eliminate { border-color: var(--border); }
.kw-eisenhower-head { padding-left: var(--space-md); padding-right: var(--space-md); padding-top: var(--space-sm); padding-bottom: var(--space-sm); }
.kw-eisenhower-head--do { background-color: color-mix(in srgb, var(--error) 8%, var(--bg)); }
.kw-eisenhower-head--schedule { background-color: color-mix(in srgb, var(--pomo-work) 8%, var(--bg)); }
.kw-eisenhower-head--eliminate { background-color: var(--bg-subtle); }
.kw-eisenhower-head-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xs); }
.kw-eisenhower-label { font-size: var(--text-title-sm); line-height: 1.25rem; font-weight: 600; }
.kw-eisenhower-label--do { color: var(--error-text); }
.kw-eisenhower-label--schedule { color: var(--flow-work); }
.kw-eisenhower-label--eliminate { color: var(--fg-muted); }
.kw-eisenhower-subtitle { font-size: var(--text-body-sm); line-height: 1rem; color: var(--fg-muted); }
.kw-eisenhower-count { font-size: var(--text-body-sm); line-height: 1rem; color: var(--fg-subtle); }
.kw-eisenhower-body { max-height: 24rem; overflow-y: auto; padding: var(--space-sm); }
.kw-eisenhower-empty { border-radius: var(--radius-lg); border-width: 1px; border-style: dashed; border-color: var(--border); padding-top: var(--space-lg); padding-bottom: var(--space-lg); text-align: center; font-size: var(--text-body-md); line-height: 1.25rem; color: var(--fg-subtle); }
.kw-archived-empty { border-radius: var(--radius-lg); border-width: 1px; border-style: dashed; border-color: var(--border); padding-top: var(--space-3xl); padding-bottom: var(--space-3xl); text-align: center; font-size: var(--text-body-md); line-height: 1.25rem; color: var(--fg-muted); }
.kw-archived-list { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: var(--space-sm); }
@media (min-width: 600px) { /* --bp-medium */ .kw-archived-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 840px) { /* --bp-expanded */ .kw-archived-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kw-archived-card { border-radius: var(--radius-lg); border-width: 1px; border-color: var(--border); background-color: var(--surface); padding: var(--space-md); opacity: 0.75; }
.kw-archived-card-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-sm); }
.kw-archived-card-text { min-width: 0px; flex: 1 1 0%; }
.kw-archived-card-title { font-size: var(--text-label-lg); line-height: 1.25rem; font-weight: 500; color: var(--fg); text-decoration-line: line-through; }
.kw-archived-card-due { margin-top: var(--space-xxs); font-size: var(--text-body-sm); line-height: 1rem; color: var(--fg-subtle); }
.kw-archived-restore { flex-shrink: 0; white-space: nowrap; border-radius: var(--radius-md); border-width: 1px; border-color: var(--border); padding-left: var(--space-sm); padding-right: var(--space-sm); padding-top: var(--space-xs); padding-bottom: var(--space-xs); font-size: var(--text-body-sm); line-height: 1rem; color: var(--fg-muted); transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.kw-archived-restore:hover { background-color: var(--bg-subtle); }
.kw-import { margin-left: auto; margin-right: auto; max-width: 42rem; padding-left: var(--space-md); padding-right: var(--space-md); padding-top: var(--space-xl); padding-bottom: var(--space-xl); }
.kw-import-mapping { margin-bottom: var(--space-lg); border-radius: var(--radius-lg); border-width: 1px; border-color: var(--border); background-color: var(--bg-subtle); padding: var(--space-md); }
.kw-import-mapping-title { margin-bottom: var(--space-xs); font-size: var(--text-label-lg); line-height: 1.25rem; font-weight: 500; color: var(--fg); }
.kw-import-mapping-list { list-style-position: inside; list-style-type: disc; }
.kw-import-mapping-list > :not([hidden]) ~ :not([hidden]) { margin-top: var(--space-xxs); margin-bottom: 0; }
.kw-import-mapping-list { font-size: var(--text-body-md); line-height: 1.25rem; color: var(--fg-muted); }
.kw-import-form > :not([hidden]) ~ :not([hidden]) { margin-top: var(--space-md); margin-bottom: 0; }
.kw-import-label { margin-bottom: var(--space-xxs); display: block; font-size: var(--text-label-lg); line-height: 1.25rem; font-weight: 500; color: var(--fg); }
.kw-import-file { display: block; width: 100%; font-size: var(--text-body-md); line-height: 1.25rem; color: var(--fg-muted); transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.kw-import-file::file-selector-button { margin-right: var(--space-md); border-radius: var(--radius-md); border-width: 0px; background-color: var(--lavender-100); padding-left: var(--space-md); padding-right: var(--space-md); padding-top: var(--space-xs); padding-bottom: var(--space-xs); font-size: var(--text-label-lg); line-height: 1.25rem; font-weight: 500; color: var(--fg); }
.kw-import-file::file-selector-button:hover { background-color: var(--bg-tinted); }
.kw-import-hint { margin-top: var(--space-xxs); font-size: var(--text-body-sm); line-height: 1rem; color: var(--fg-muted); }

/* ---------- pages/tasks.templ (group heads) ---------- */
.kw-group-head-actions { gap: 6px; }
.kw-kanban-empty { padding: var(--space-lg) var(--space-xxs); font-size: var(--text-body-sm); color: var(--fg-subtle); }
.kw-group-add { width: 22px; height: 22px; }
