/* ==========================================================================
   Work Items Styles
   ========================================================================== */

@layer components {

/* Work items list */
.work-items-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Nested steps group - indented under parent card */
.work-item-steps-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-left: var(--space-6);
  padding-left: var(--space-4);
  border-left: 2px solid var(--color-border);
}

/* Nested cards group - indented under parent milestone */
.work-item-cards-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-left: var(--space-6);
  padding-left: var(--space-4);
  border-left: 3px solid var(--rd-accent);
}

/* Collapsed state for steps/cards group */
.work-item-steps-group.collapsed,
.work-item-cards-group.collapsed {
  display: none;
}

/* Empty cards/steps groups should not take up space or show borders.
   Using :has() because :empty doesn't match containers with whitespace text nodes from ERB. */
.work-item-cards-group:not(:has(.work-item-card)),
.work-item-steps-group:not(:has(.work-item-card)) {
  display: none;
}

/* Steps nested within cards that are inside a cards group (3-level nesting) */
.work-item-cards-group .work-item-steps-group {
  margin-left: var(--space-4);
  padding-left: var(--space-3);
  border-left-color: var(--color-border-muted);
}

/* Nested step cards - slightly smaller/lighter */
.work-item-card.work-item-nested {
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-raised);
  border-color: var(--color-border-muted);
}

.work-item-card.work-item-nested .work-item-title {
  font-size: var(--text-sm);
}

.work-item-card.work-item-nested .work-item-type {
  font-size: 9px;
  padding: 1px 5px;
}

/* ==========================================================================
   Work Item Card - Pop Art Style
   ========================================================================== */

.work-item-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--rd-shadow-sm, 0 1px 3px rgb(0 0 0 / 0.1));
  transition: all 0.15s ease;
  /* Card is navigable - pointer cursor on empty space */
  cursor: pointer;
}

/* Lift on hover + subtle blue tint to indicate navigability */
.work-item-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--rd-shadow-sm, 0 1px 3px rgb(0 0 0 / 0.1));
  background: light-dark(
    color-mix(in oklch, var(--color-surface) 97%, var(--rd-info)),
    color-mix(in oklch, var(--color-surface) 95%, var(--rd-info))
  );
}

/* Suppress navigation feedback when hovering interactive elements */
.work-item-card:has(.inline-editable:hover),
.work-item-card:has(.inline-assignee-wrapper:hover),
.work-item-card:has(.work-item-actions:hover),
.work-item-card:has(.work-item-checkbox:hover) {
  background: var(--color-surface);
}

/* Disable transform when dropdown is open to prevent z-index stacking issues */
.work-item-card:has(.inline-assignee-dropdown:not(.hidden)):hover {
  transform: none;
}

/* Completed work items - muted/faded appearance */
.work-item-card.work-item-completed {
  background: light-dark(#f9fafb, #1a202c);
  border-color: light-dark(#d1d5db, #2d3748);
  box-shadow: var(--rd-shadow-sm, 0 1px 3px rgb(0 0 0 / 0.1));
  opacity: 0.85;
}

.work-item-card.work-item-completed:hover {
  transform: translate(-1px, -1px);
  box-shadow: var(--rd-shadow-sm, 0 1px 3px rgb(0 0 0 / 0.1));
  opacity: 1;
  /* More subtle hover feedback for completed items */
  background: light-dark(
    color-mix(in oklch, #f9fafb 98%, var(--rd-info)),
    color-mix(in oklch, #1a202c 97%, var(--rd-info))
  );
}

/* Suppress navigation feedback for completed items when hovering interactive elements */
.work-item-card.work-item-completed:has(.inline-editable:hover),
.work-item-card.work-item-completed:has(.inline-assignee-wrapper:hover),
.work-item-card.work-item-completed:has(.work-item-actions:hover),
.work-item-card.work-item-completed:has(.work-item-checkbox:hover) {
  background: light-dark(#f9fafb, #1a202c);
}

/* Overdue indicator - subtle left border accent */
.work-item-card.work-item-overdue {
  border-left-color: var(--rd-danger);
  border-left-width: 5px;
}

/* Checkbox indicator */
.work-item-checkbox {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.checkbox-icon {
  display: block;
}

.checkbox-icon-unchecked {
  color: var(--color-ink-muted);
}

.checkbox-icon-checked {
  color: var(--color-positive);
}

/* Milestone indicator - diamond icon */
.milestone-indicator .checkbox-icon-unchecked {
  color: var(--rd-info);
  opacity: 0.6;
}

.milestone-indicator .checkbox-icon-checked {
  color: var(--rd-info);
}

/* Milestone progress display */
.milestone-progress {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-ink-muted);
  padding: 2px 6px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
}

/* Milestone rollup values (hours, budget) */
.milestone-rollup {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-ink-muted);
  padding: 2px 6px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
}

/* Work item content — grid layout so actions sit on the right alongside title+meta */
.work-item-content {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0 var(--space-3);
  align-items: center;
}

.work-item-content > .work-item-title-row {
  grid-column: 1;
  grid-row: 1;
}

.work-item-content > .work-item-meta {
  grid-column: 1;
  grid-row: 2;
}

.work-item-content > .work-item-actions {
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: center;
}

.work-item-content > .save-status {
  grid-column: 1 / -1;
}

/* Work item title link */
.work-item-title-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: inherit;
}

.work-item-title-link:hover {
  text-decoration: none;
}

.work-item-title-link:hover .work-item-title {
  color: var(--color-link);
}

.work-item-title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--color-ink);
}

.work-item-completed .work-item-title {
  text-decoration: line-through;
  color: var(--color-ink-muted);
}

/* Work item type badge - Pop Art style (no radius) */
.work-item-type {
  display: inline-block;
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Work item type colors - uses badge color system */
.work-item-type-todo { --badge-color: var(--color-info); }
.work-item-type-card { --badge-color: light-dark(var(--color-amber-600), var(--color-amber-500)); }
.work-item-type-step { --badge-color: var(--color-positive); }

.work-item-type-todo,
.work-item-type-card,
.work-item-type-step {
  background-color: color-mix(in oklch, var(--badge-color) 18%, var(--color-surface) 82%);
  color: var(--badge-color);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--badge-color) 30%, transparent 70%);
}

/* Work item meta */
.work-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-ink-muted);
}

.work-item-meta > span,
.work-item-meta > div {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.work-item-meta svg {
  flex-shrink: 0;
  opacity: 0.7;
}

/* Meta groups - logical grouping of related info */
.work-item-meta-group {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

/* Dates display */
.work-item-dates {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.work-item-date {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.work-item-date.overdue {
  color: var(--color-negative);
}

.work-item-date-separator {
  color: var(--color-border);
  font-size: var(--rd-text-xs);
  padding: 0 2px;
}

/* Billing type */
.work-item-billing {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: 2px 6px;
  border-radius: 2px;
}

.work-item-billing.billable {
  background: color-mix(in oklch, var(--color-positive) 15%, transparent);
  color: var(--color-positive);
}

.work-item-billing.non-billable {
  background: var(--color-surface-raised);
  color: var(--color-ink-muted);
}

.work-item-fixed-amount {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: 2px 6px;
  border-radius: 2px;
  background: color-mix(in oklch, var(--color-positive) 10%, transparent);
  color: var(--color-positive);
}

.work-item-fixed-amount .text-muted {
  color: var(--color-ink-muted);
  font-weight: var(--font-normal);
}

.work-item-column {
  color: var(--color-ink-muted);
}

.work-item-appetite {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: 2px 6px;
}

/* Estimated hours */
.work-item-hours {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: 2px 6px;
  border-radius: 2px;
  background: color-mix(in oklch, var(--rd-info) 10%, transparent);
  color: var(--rd-info);
}

.appetite-guidance-text {
  font-size: var(--text-sm);
  color: var(--color-ink-muted);
  font-style: italic;
}

.appetite-warning {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-warning-canvas);
  border: 1px solid var(--color-border);
  color: var(--color-amber-700);
  font-size: var(--text-sm);
}

.appetite-warning svg {
  flex-shrink: 0;
  margin-top: 2px;
}

/* ==========================================================================
   Work Item Overview Card
   ========================================================================== */

.work-item-overview {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Legacy - kept for work item list views */
.work-item-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}

/* Work item actions - moved to bottom of file near title-row */

/* ==========================================================================
   Work Item Detail Page
   ========================================================================== */

.work-item-details {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 768px) {
  .work-item-details {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .work-item-details .detail-card:first-child,
  .work-item-details .detail-card:last-child {
    grid-column: 1 / -1;
  }
}

/* Work item title row - badge + title + status inline */
.work-item-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.work-item-title-row h1 {
  margin: 0;
  flex: 1;
  min-width: 200px;
}

.work-item-title-row .badge {
  flex-shrink: 0;
}

/* Appetite level text (not badge) */
.appetite-level {
  font-weight: var(--font-semibold);
}

.appetite-trivial { color: var(--color-ink-muted); }
.appetite-small { color: light-dark(var(--color-sky-600), var(--color-sky-400)); }
.appetite-medium { color: light-dark(var(--color-amber-600), var(--color-amber-500)); }
.appetite-large { color: light-dark(oklch(0.65 0.18 45), oklch(0.72 0.15 50)); }
.appetite-major { color: var(--color-negative); }

/* Appetite warning - inline style (Pop Art) */
.appetite-warning {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-2);
  background: color-mix(in oklch, var(--color-warning) 12%, var(--color-surface) 88%);
  border: 1px solid var(--color-border);
  color: var(--color-warning);
  font-size: var(--text-sm);
}

.appetite-warning svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* Work item assignees in detail list */
.work-item-assignees {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.work-item-assignee {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.work-item-description {
  color: var(--color-ink);
  line-height: var(--leading-relaxed);
}

/* Steps list */
.steps-list {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 0 0;
}

.step-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.step-item:last-child {
  border-bottom: none;
}

.step-item.step-completed .step-title {
  text-decoration: line-through;
  color: var(--color-ink-muted);
}

.step-checkbox {
  flex-shrink: 0;
}

.step-title {
  flex: 1;
}

.step-title-link {
  color: var(--color-ink);
  text-decoration: none;
}

.step-title-link:hover {
  color: var(--color-link);
}

.step-completed .step-title-link {
  text-decoration: line-through;
  color: var(--color-ink-muted);
}

.step-completed .step-title-link:hover {
  color: var(--color-link);
}

.step-due {
  font-size: var(--text-sm);
  color: var(--color-ink-muted);
}

/* Assignee list */
.assignee-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.assignee-item {
  display: flex;
  flex-direction: column;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.assignee-item:last-child {
  border-bottom: none;
}

.assignee-name {
  font-weight: var(--font-medium);
}

.assignee-email {
  font-size: var(--text-sm);
  color: var(--color-ink-muted);
}

/* Status badges for detail page */
.status-completed {
  color: var(--color-positive);
}

.status-overdue {
  color: var(--color-negative);
}

.status-incomplete {
  color: var(--color-ink-muted);
}

.status-badge.status-completed {
  background-color: var(--color-positive-canvas);
  color: var(--color-green-800);
}

.status-badge.status-overdue {
  background-color: var(--color-negative-canvas);
  color: var(--color-red-800);
}

.status-badge.status-incomplete {
  background-color: var(--color-warning-canvas);
  color: var(--color-amber-800);
}

/* Empty state - uses .empty-state from layout.css */

.empty-state-inline {
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
  font-style: italic;
}

/* ==========================================================================
   Detail Card Enhancements
   ========================================================================== */

.detail-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-3);
}

.detail-card-header h2 {
  margin-bottom: 0;
}

.detail-card-actions {
  display: flex;
  gap: var(--space-2);
}

.text-emphasis {
  font-weight: var(--font-semibold);
  font-size: var(--text-lg);
}

/* ==========================================================================
   Dependencies Section
   ========================================================================== */

/* Full-width card override for dependencies */
.detail-card-full-width {
  grid-column: 1 / -1 !important;
}

/* Two-column layout for blocked by / blocking */
.dependency-columns {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 900px) {
  .dependency-columns {
    grid-template-columns: repeat(2, 1fr);
  }
}

.dependency-section-title {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-3) 0;
}

/* Table-like layout for dependencies */
.dependency-table {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.dependency-row {
  padding: var(--space-3);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  box-shadow: var(--rd-shadow-sm, 0 1px 3px rgb(0 0 0 / 0.1));
  transition: all 0.15s ease;
}

.dependency-row:hover {
  transform: translate(-1px, -1px);
  box-shadow: var(--rd-shadow-sm, 0 1px 3px rgb(0 0 0 / 0.1));
}

.dependency-row-violated {
  border-color: var(--color-negative-border);
  border-left-width: 3px;
  border-left-color: var(--color-negative);
}

.dependency-row-main {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.dependency-title {
  font-weight: var(--font-medium);
  color: var(--color-link);
  text-decoration: none;
  flex: 1;
  min-width: 0;
}

.dependency-title:hover {
  text-decoration: underline;
}

/* Tiny type badge (single letter) */
.work-item-type-badge.badge-tiny {
  padding: 2px 6px;
  font-size: var(--rd-text-2xs);
  min-width: 20px;
  text-align: center;
  margin-bottom: 0;
  flex-shrink: 0;
}

/* Dependency status badges - Pop Art style */
.dependency-badge {
  --badge-color: var(--color-ink-muted);
  
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: 2px 6px;
  flex-shrink: 0;
  background: color-mix(in oklch, var(--badge-color) 18%, var(--color-surface) 82%);
  color: var(--badge-color);
  border: 1px solid var(--badge-color);
}

.dependency-badge-done {
  --badge-color: var(--color-positive);
}

.dependency-badge-overdue {
  --badge-color: var(--color-negative);
}

/* Details row (dates, assignees) */
.dependency-row-details {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border-muted);
}

.dependency-detail {
  display: flex;
  align-items: baseline;
  gap: var(--space-1);
  font-size: var(--text-sm);
}

.dependency-detail-label {
  color: var(--color-ink-muted);
}

.dependency-detail-value {
  color: var(--color-ink);
}

.dependency-detail-value.text-danger {
  color: var(--color-negative);
}

/* Conflict warning - Pop Art style */
.dependency-row-warning {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-2);
  background: oklch(var(--color-red-500) / 0.1);
  border: 1px solid var(--color-negative);
  color: var(--color-negative);
  font-size: var(--text-sm);
}

.dependency-row-warning svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* Badge danger variant - solid style for high emphasis */
.badge-danger.badge-solid {
  background-color: var(--color-negative);
  color: white;
  box-shadow: none;
}

/* ==========================================================================
   Dependency Picker (Edit Form)
   ========================================================================== */

.dependency-picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.dependency-picker-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.dependency-picker-section-readonly {
  opacity: 0.85;
}

.dependency-picker-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-ink);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dependency-picker-label svg {
  color: var(--color-ink-muted);
}

.dependency-picker-count {
  font-weight: var(--font-normal);
  color: var(--color-ink-muted);
}

/* Selected predecessors/successors list */
.dependency-picker-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.dependency-picker-empty-list {
  color: var(--color-ink-muted);
  font-style: italic;
  font-size: var(--text-sm);
  margin: 0;
  padding: var(--space-2) 0;
}

/* Individual dependency entry */
.dependency-picker-entry {
  padding: var(--space-3);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  box-shadow: var(--rd-shadow-sm, 0 1px 3px rgb(0 0 0 / 0.1));
}

.dependency-picker-entry-completed {
  opacity: 0.7;
}

.dependency-picker-entry-readonly {
  background: var(--color-surface);
}

.dependency-picker-entry-main {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.dependency-picker-entry-title {
  flex: 1;
  min-width: 0;
  font-weight: var(--font-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dependency-picker-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  margin-left: auto;
  background: none;
  border: none;
  color: var(--color-ink-muted);
  font-size: var(--text-lg);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.dependency-picker-remove:hover {
  background: var(--color-negative);
  color: white;
}

/* Dependency type and lag configuration */
.dependency-picker-entry-config {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border-muted);
  flex-wrap: wrap;
}

.dependency-picker-type {
  max-width: 180px;
}

.dependency-picker-lag {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-ink-muted);
}

.dependency-picker-lag-input {
  width: 60px;
  text-align: center;
}

/* Read-only info row (for successors) */
.dependency-picker-entry-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border-muted);
  font-size: var(--text-sm);
  color: var(--color-ink-muted);
}

.dependency-picker-type-label {
  font-weight: var(--font-medium);
}

.dependency-picker-lag-label {
  padding: 2px 6px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  font-size: var(--text-xs);
}

/* Search wrapper */
.dependency-picker-search-wrapper {
  position: relative;
}

.dependency-picker-search {
  width: 100%;
}

/* Dropdown - Pop Art style */
.dependency-picker-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--rd-shadow-sm, 0 1px 3px rgb(0 0 0 / 0.1));
  margin-top: var(--space-1);
}

.dependency-picker-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s;
}

.dependency-picker-item:hover {
  background: var(--color-surface-raised);
}

.dependency-picker-item:focus {
  outline: none;
  background: var(--color-info-canvas);
}

.dependency-picker-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--font-medium);
  color: var(--color-ink);
}

.dependency-picker-item-date {
  flex-shrink: 0;
  font-size: var(--text-sm);
  color: var(--color-ink-muted);
}

.dependency-picker-empty,
.dependency-picker-error {
  padding: var(--space-3);
  text-align: center;
  color: var(--color-ink-muted);
  font-style: italic;
}

.dependency-picker-error {
  color: var(--color-negative);
}

/* ==========================================================================
   Cascade Preview Modal
   Modal base (header/body/footer/header-warning) lives in layout.css
   and already uses the redesign rd-* tokens.
   ========================================================================== */

/* Cascade summary section */
.cascade-summary {
  margin-bottom: 16px;
}

.cascade-summary-text {
  font-size: var(--rd-text-base);
  color: var(--rd-fg);
  margin: 0;
  line-height: var(--rd-leading-snug);
}

.cascade-summary-text strong {
  font-weight: 600;
  color: var(--rd-fg);
}

/* Items list container */
.cascade-items-list {
  background: var(--rd-bg-sunken);
  border: 1px solid var(--rd-border);
  border-radius: var(--rd-radius-md);
  padding: 12px;
}

.cascade-items-header {
  font-size: var(--rd-text-xs);
  font-weight: 600;
  color: var(--rd-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 10px 0;
}

/* Individual cascade items */
.cascade-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

.cascade-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 8px 12px;
  background: var(--rd-bg-raised);
  border: 1px solid var(--rd-border);
  border-radius: var(--rd-radius-sm);
}

.cascade-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.cascade-item-title {
  font-size: var(--rd-text-sm);
  font-weight: 500;
  color: var(--rd-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Date change display */
.cascade-item-dates {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: var(--rd-text-sm);
  font-variant-numeric: tabular-nums;
}

.cascade-item-old {
  color: var(--rd-fg-subtle);
  text-decoration: line-through;
}

.cascade-item-arrow {
  color: var(--rd-fg-subtle);
}

.cascade-item-new {
  color: var(--rd-fg);
  font-weight: 500;
}

.cascade-item-delta {
  color: var(--rd-warn);
  font-weight: 600;
  font-size: var(--rd-text-xs);
  padding: 2px 8px;
  background: var(--rd-warn-soft);
  border-radius: var(--rd-radius-full);
}

/* Carry-parent option (offered when a step's new dates fall outside its
   parent card's saved range). Visually distinct from the cascade-items
   list so it reads as a separate choice. */
.cascade-carry-parent {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--rd-accent-soft);
  border: 1px solid var(--rd-border);
  border-radius: var(--rd-radius-md);
}

.cascade-carry-parent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: var(--rd-text-sm);
  color: var(--rd-fg);
  line-height: var(--rd-leading-snug);
}

.cascade-carry-parent-label input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
}

.cascade-carry-parent-dates {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
  color: var(--rd-fg-muted);
}

/* Modal footer for cascade: pick up the redesign footer chrome and just
   lay out the icon-bearing buttons consistently. */
#cascade-modal .modal-footer .rd-btn,
#gantt-cascade-modal .modal-footer .rd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Cascade Undo Notification */
.cascade-undo-notification {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}

.cascade-undo-notification span {
  flex: 1;
}

.cascade-undo-notification .cascade-undo-btn {
  flex-shrink: 0;
}

.cascade-undo-notification .cascade-undo-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  padding: 0 var(--space-1);
}

.cascade-undo-notification .cascade-undo-dismiss:hover {
  opacity: 1;
}

/* ==========================================================================
   Sync Indicators
   ========================================================================== */

.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: 2px 8px;
  background-color: var(--color-info-canvas);
  color: var(--color-info);
  border: 1px solid var(--color-info);
}

.sync-indicator-inline {
  vertical-align: middle;
}

.sync-indicator-local {
  background-color: var(--color-surface-raised);
  color: var(--color-ink-muted);
  border: 1px solid var(--color-border);
}

.sync-indicator-warning {
  background-color: var(--color-warning-canvas);
  color: var(--color-amber-700);
}

/* ==========================================================================
   Work Item Edit Form
   ========================================================================== */

.form-group-half {
  flex: 1;
}

.form-checkbox-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.form-checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-link);
}

.form-checkbox-label {
  font-weight: var(--font-medium);
}

/* ==========================================================================
   Assignee Picker
   ========================================================================== */

.assignee-picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Selected assignees display */
.assignee-selected {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-height: 32px;
  align-items: center;
}

.assignee-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: var(--color-info-canvas);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
  color: var(--color-info);
}

.assignee-tag-name {
  font-weight: var(--font-medium);
}

.assignee-tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  color: var(--color-info);
  font-size: var(--text-base);
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.assignee-tag-remove:hover {
  background: var(--color-negative);
  color: white;
}

.assignee-none {
  color: var(--color-ink-muted);
  font-style: italic;
}

/* Search input wrapper */
.assignee-search-wrapper {
  position: relative;
}

.assignee-search {
  width: 100%;
}

/* Dropdown - Pop Art style */
.assignee-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--rd-shadow-sm, 0 1px 3px rgb(0 0 0 / 0.1));
  margin-top: var(--space-1);
}

.assignee-dropdown-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s;
}

.assignee-dropdown-item:hover {
  background: var(--color-surface-raised);
}

.assignee-dropdown-item:focus {
  outline: none;
  background: var(--color-info-canvas);
}

.assignee-dropdown-name {
  font-weight: var(--font-medium);
  color: var(--color-ink);
}

.assignee-dropdown-title {
  font-size: var(--text-sm);
  color: var(--color-ink-muted);
}

.assignee-dropdown-empty {
  padding: var(--space-3);
  text-align: center;
  color: var(--color-ink-muted);
  font-style: italic;
}

/* Fallback display - Pop Art style */
.assignee-fallback {
  padding: var(--space-3);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
}

.assignee-current-list {
  margin: 0 0 var(--space-2) 0;
  font-weight: var(--font-medium);
}

/* Status display for cards */
.status-display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.status-display .form-hint {
  margin: 0;
  width: 100%;
}

.column-name {
  font-weight: var(--font-medium);
  color: var(--color-ink);
}

/* ==========================================================================
   Work Item Notes/Content
   ========================================================================== */

.work-item-notes {
  color: var(--color-ink);
  line-height: var(--leading-relaxed);
}

.work-item-notes p {
  margin-block: var(--space-3);
}

.work-item-notes p:first-child {
  margin-block-start: 0;
}

.work-item-notes p:last-child {
  margin-block-end: 0;
}

/* Override Lexxy's default color for saved rich text content */
.work-item-notes.lexxy-content,
.work-item-notes .lexxy-content {
  --lexxy-color-ink: var(--color-ink);
  color: var(--color-ink);
  
  /* Paragraph styling consistent with work item notes */
  & p {
    margin-block: var(--space-3);
    color: inherit;
  }

  & p:first-child {
    margin-block-start: 0;
  }

  & p:last-child {
    margin-block-end: 0;
  }
}

.work-item-notes a {
  color: var(--color-link);
}

/* =========================================================================
   Lexxy Editor Theming for Description Forms
   Mirrors comment form theming for dark mode compatibility.
   ========================================================================= */

/* Override Lexxy color variables for description edit form */
.description-form lexxy-editor {
  --lexxy-color-canvas: var(--color-surface);
  --lexxy-color-ink: var(--color-ink);
  --lexxy-color-ink-medium: var(--color-ink-muted);
  --lexxy-color-ink-light: var(--color-zinc-500);
  --lexxy-color-ink-lighter: light-dark(var(--color-zinc-300), var(--color-zinc-600));
  --lexxy-color-ink-lightest: light-dark(var(--color-zinc-100), var(--color-zinc-700));
  --lexxy-color-ink-inverted: light-dark(white, var(--color-zinc-900));
  --lexxy-color-text: var(--color-ink);
  --lexxy-color-selected: light-dark(var(--color-blue-100), var(--color-blue-900));
  --lexxy-color-selected-hover: light-dark(var(--color-blue-200), var(--color-blue-800));
  --lexxy-radius: 0; /* Match Pop Art sharp corners */

  display: block;
  position: relative; /* Required for lexxy-prompt-menu positioning */
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.description-form lexxy-editor:focus-within {
  border-color: var(--rd-info);
}

.description-form .lexxy-editor__content {
  padding: var(--space-3);
  min-block-size: 6lh;
}

/* Description form toolbar styling */
.description-form lexxy-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid light-dark(var(--color-zinc-200), var(--color-zinc-700));
  padding: var(--space-1);
}

.description-form lexxy-toolbar svg,
.description-form .lexxy-editor__toolbar-button svg {
  display: inline-block;
  block-size: var(--lexxy-toolbar-icon-size, 1.25em);
  inline-size: var(--lexxy-toolbar-icon-size, 1.25em);
}

.description-form .lexxy-editor__toolbar-button {
  display: inline-grid;
  place-items: center;
  aspect-ratio: 1;
  block-size: 2em;
  padding: 0.25em;
}

.description-form lexxy-toolbar details,
.description-form lexxy-toolbar summary,
.description-form .lexxy-editor__toolbar-dropdown {
  display: inline-flex;
  align-items: center;
}

.description-form .lexxy-editor__toolbar-spacer {
  flex: 1;
  min-inline-size: 0.5em;
}

.work-item-notes ul,
.work-item-notes ol {
  margin-block: var(--space-3);
  padding-inline-start: var(--space-6);
}

.work-item-notes ul {
  list-style-type: disc;
}

.work-item-notes ol {
  list-style-type: decimal;
}


.work-item-notes li {
  margin-block: var(--space-1);
}

/* ==========================================================================
   Invoice Links (in Financials section)
   ========================================================================== */

.invoice-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.invoice-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
}

.invoice-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.invoice-link:hover .invoice-link-name {
  text-decoration: underline;
  color: var(--color-link);
}

.invoice-link-name {
  font-weight: var(--font-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invoice-link-amount {
  font-weight: var(--font-medium);
  color: var(--color-ink);
  white-space: nowrap;
}

/* ==========================================================================
   Inline Editing Styles
   ========================================================================== */

/* Wrapper for inline editable fields */
.inline-editable-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.inline-editable-title {
  /* Shrink to fit content - don't expand to fill row */
  flex: 0 1 auto;
  min-width: 0;
}

/* Clickable display element */
.inline-editable {
  cursor: pointer;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background-color 0.15s;
}

/* Text cursor for title (indicates editable text) */
.inline-editable.work-item-title {
  cursor: text;
}

.inline-editable:hover {
  background-color: var(--color-surface-raised);
}

/* Edit input - sized to fit inline */
.inline-edit-input {
  min-width: 100px;
  max-width: 300px;
  height: 28px;
  padding: 2px 8px;
  font-size: var(--text-sm);
  border: 2px solid var(--rd-info);
}

.inline-edit-input:focus {
  outline: none;
}

/* Title input - wider */
.inline-editable-title .inline-edit-input {
  min-width: 200px;
  max-width: 100%;
  width: 100%;
}

/* Date input */
input[type="date"].inline-edit-input {
  min-width: 130px;
  max-width: 150px;
}

/* Select input */
select.inline-edit-input {
  min-width: 100px;
  max-width: 160px;
  cursor: pointer;
}

/* Save indicator */
.inline-save-indicator {
  margin-left: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  white-space: nowrap;
}

.inline-save-indicator.saving {
  color: var(--color-ink-muted);
}

.inline-save-indicator.saved {
  color: var(--color-positive);
}

.inline-save-indicator.error {
  color: var(--color-negative);
}

/* ==========================================================================
    Multi-Inline Editor Coordinator
    ========================================================================== */

/* Save status indicator container */
.save-status {
  position: absolute;
  top: -28px;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--rd-shadow-sm, 0 1px 3px rgb(0 0 0 / 0.1));
  z-index: 10;
}

.save-status [data-status="saving"] {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--rd-info);
}

.save-status [data-status="saving"]::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--rd-info);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.save-status [data-status="saved"] {
  color: var(--rd-success);
}

.save-status [data-status="saved"]::before {
  content: "✓";
  margin-right: var(--space-1);
}

.save-status [data-status="error"] {
  color: var(--rd-danger);
}

.save-status [data-status="error"]::before {
  content: "✕";
  margin-right: var(--space-1);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
    Inline Assignee Picker
    ========================================================================== */

.inline-assignee-wrapper {
  position: relative;
}

/* Boost z-index when dropdown is open to escape card stacking context */
.inline-assignee-wrapper:has(.inline-assignee-dropdown:not(.hidden)) {
  z-index: 500;
}

.inline-assignee-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  background: none;
  border: none;
  border-radius: var(--rd-radius-sm);
  font-family: var(--rd-font-sans);
  font-size: var(--rd-text-sm);
  color: var(--rd-fg-muted);
  cursor: pointer;
  transition: background var(--rd-dur-fast) var(--rd-ease),
              color var(--rd-dur-fast) var(--rd-ease);
}

.inline-assignee-trigger:hover {
  background: var(--rd-bg-hover);
  color: var(--rd-fg);
}

.inline-assignee-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 500;
  min-width: 220px;
  max-width: 280px;
  margin-top: 4px;
  background: var(--rd-bg-raised);
  border: 1px solid var(--rd-border);
  border-radius: var(--rd-radius-md);
  box-shadow: var(--rd-shadow-md);
  overflow: hidden;
}

.inline-assignee-search {
  padding: 8px;
  border-bottom: 1px solid var(--rd-border);
}

.inline-assignee-search input {
  width: 100%;
}

.inline-assignee-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
}

.inline-assignee-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  background: none;
  border: none;
  border-radius: var(--rd-radius-sm);
  font-family: var(--rd-font-sans);
  font-size: var(--rd-text-sm);
  color: var(--rd-fg);
  text-align: left;
  cursor: pointer;
  transition: background var(--rd-dur-fast) var(--rd-ease),
              color var(--rd-dur-fast) var(--rd-ease);
}

.inline-assignee-item:hover,
.inline-assignee-item:focus-visible {
  background: var(--rd-bg-hover);
  outline: none;
}

.inline-assignee-item.selected {
  background: var(--rd-accent-soft);
  color: var(--rd-accent);
}

.inline-assignee-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--rd-accent);
}

.inline-assignee-name {
  flex: 1;
  font-size: var(--rd-text-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-assignee-empty,
.inline-assignee-loading {
  padding: 12px;
  text-align: center;
  font-size: var(--rd-text-sm);
  color: var(--rd-fg-muted);
}

/* Checkbox toggle button (completion) */
.work-item-checkbox .btn-icon {
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

/* Static checkbox indicator for Cards (non-interactive) */
.work-item-checkbox .checkbox-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.work-item-checkbox .btn-icon:hover {
  transform: scale(1.1);
}

.work-item-checkbox .btn-icon:hover .checkbox-icon-unchecked {
  color: var(--color-positive);
}

/* Title row layout fix - separate type badge link from title */
.work-item-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.work-item-type-link {
  flex-shrink: 0;
  text-decoration: none;
}

.work-item-type-link:hover .badge {
  opacity: 0.8;
}

/* Actions column - right aligned, vertically centered */
.work-item-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Unified action button style - larger click targets */
.work-item-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2);
  min-width: 36px;
  min-height: 36px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  color: var(--color-ink-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.work-item-action-btn:hover {
  background: var(--color-info-canvas);
  border-color: var(--color-info);
  color: var(--color-info);
}

/* View link - remove link styling */
a.work-item-action-btn {
  text-decoration: none;
}

/* Legacy btn-icon support in actions (if any remain) */
.work-item-actions .btn-icon {
  padding: var(--space-1);
  color: var(--color-ink-muted);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s;
}

.work-item-card:hover .work-item-actions .btn-icon {
  opacity: 1;
}

.work-item-actions .btn-icon:hover {
  color: var(--color-link);
}

/* ==========================================================================
   Steps Expand/Collapse Toggle
   ========================================================================== */

/* Steps/cards toggle with count - slightly wider for count */
.work-item-action-btn.steps-toggle-btn {
  padding: var(--space-2) var(--space-3);
}

.steps-toggle-count {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

/* Icon rotation on expand */
.steps-toggle-icon {
  transition: transform 0.2s ease;
}

.steps-toggle-btn.expanded .steps-toggle-icon {
  transform: rotate(90deg);
}

/* Danger variant for delete/archive actions */
.work-item-action-btn--danger {
  color: var(--color-negative);
}

.work-item-action-btn--danger:hover {
  background: oklch(var(--rd-danger) / 0.1);
  color: var(--rd-danger);
}

/* Bulk action buttons container */
.steps-toggle-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.steps-toggle-actions .btn {
  padding: var(--space-1) var(--space-2);
  gap: var(--space-1);
}

/* ==========================================================================
   Attachment Previews (Action Text)
   ========================================================================== */

/* Attachment previews in description content */
.work-item-notes action-text-attachment,
.work-item-notes .attachment {
  display: block;
  max-width: 100%;
  margin: var(--space-3) 0;
}

.work-item-notes action-text-attachment img,
.work-item-notes .attachment img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--color-border);
  border-radius: 0; /* Pop Art sharp corners */
}

/* Attachment previews in editor */
.description-form lexxy-editor action-text-attachment,
.description-form lexxy-editor .attachment {
  display: block;
  max-width: 100%;
  margin: var(--space-2) 0;
}

.description-form lexxy-editor action-text-attachment img,
.description-form lexxy-editor .attachment img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--color-ink-light);
  border-radius: 0;
}

/* File attachments (non-images) show as styled download links */
.work-item-notes action-text-attachment[content-type^="application/"],
.description-form lexxy-editor action-text-attachment[content-type^="application/"] {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  color: var(--color-ink);
  text-decoration: none;
}

.work-item-notes action-text-attachment[content-type^="application/"]:hover {
  background: var(--color-surface-hover);
}

/* ==========================================================================
   Basecamp Attachment Rendering
   Styles for bc-attachment tags converted by BasecampAttachmentHelper
   ========================================================================== */

/* Image attachments from Basecamp */
.attachment-preview {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--color-border);
  margin: var(--space-3) 0;
}

/* File download links from Basecamp */
.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-link);
  text-decoration: underline;
}

.attachment-link:hover {
  color: var(--color-link-hover);
}

/* Placeholder for pending downloads */
.attachment-pending {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--color-ink-muted);
}

/* ==========================================================================
   Todolist & Group Sections (Todos filter view)
   ========================================================================== */

/* Todolist section header - matches work-item-card aesthetic */
.todolist-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--rd-shadow-sm, 0 1px 3px rgb(0 0 0 / 0.1));
  transition: all 0.15s ease;
}

.todolist-section-header:first-child {
  margin-top: 0;
}

.todolist-section-header:hover {
  transform: translate(-1px, -1px);
  box-shadow: var(--rd-shadow-sm, 0 1px 3px rgb(0 0 0 / 0.1));
}

.todolist-section-header--orphan {
  background: var(--color-surface-inset);
  border-style: dashed;
  box-shadow: none;
}

.todolist-section-header--orphan:hover {
  transform: none;
  box-shadow: none;
}

.todolist-name {
  font-family: var(--font-sans);
  font-weight: normal;
  font-size: var(--text-lg);
  letter-spacing: 0.025em;
  margin: 0;
  cursor: text;
}

.todolist-name:hover {
  color: var(--rd-info);
}

/* Inline name input for todolists */
.todolist-name-input {
  font-family: var(--font-sans);
  font-weight: normal;
  font-size: var(--text-lg);
  letter-spacing: 0.025em;
  border: 1px solid var(--rd-info);
  padding: var(--space-1) var(--space-2);
  background: var(--color-surface);
  outline: none;
  min-width: 200px;
}

/* Todolist/group action buttons - show on hover */
.todolist-action-btn,
.todo-group-action-btn {
  opacity: 0;
  transition: opacity 0.15s ease;
  padding: var(--space-1);
  color: var(--color-ink-muted);
  background: none;
  border: none;
  cursor: pointer;
}

.todolist-section-header:hover .todolist-action-btn,
.todo-group-header:hover .todo-group-action-btn {
  opacity: 1;
}

.todolist-action-btn:hover,
.todo-group-action-btn:hover {
  color: var(--color-negative);
}

/* Todolist section body (contains todos and groups) */
.todolist-section-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-left: var(--space-2);
  border-left: 3px solid var(--rd-info);
  margin-left: var(--space-2);
}

/* Collapsed state */
.todolist-section-body.collapsed {
  display: none;
}

/* Group section within a todolist */
.todo-group-section {
  margin-top: var(--space-2);
}

/* Group header - lighter weight than the todolist row. */
.todo-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  box-shadow: var(--rd-shadow-sm, 0 1px 3px rgb(0 0 0 / 0.1));
  transition: all 0.15s ease;
}

.todo-group-header:hover {
  box-shadow: var(--rd-shadow-sm, 0 1px 3px rgb(0 0 0 / 0.1));
}

.todo-group-name {
  font-weight: 600;
  font-size: var(--text-base);
  cursor: text;
}

.todo-group-name:hover {
  color: var(--rd-info);
}

/* Inline name input for groups */
.todo-group-name-input {
  font-weight: 600;
  font-size: var(--text-base);
  border: 1px solid var(--rd-info);
  padding: var(--space-1) var(--space-2);
  background: var(--color-surface);
  outline: none;
  min-width: 160px;
}

/* Group color dots */
.todo-group-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.todo-group-color-white   { background: #ffffff; border: 1px solid var(--color-border); }
.todo-group-color-red     { background: var(--rd-danger); }
.todo-group-color-orange  { background: oklch(0.70 0.18 45); }
.todo-group-color-yellow  { background: var(--rd-warn); }
.todo-group-color-green   { background: var(--rd-success); }
.todo-group-color-blue    { background: var(--rd-info); }
.todo-group-color-aqua    { background: oklch(0.7 0.12 200); }
.todo-group-color-purple  { background: oklch(0.55 0.2 300); }
.todo-group-color-gray    { background: oklch(0.6 0 0); }
.todo-group-color-pink    { background: var(--rd-accent); }
.todo-group-color-brown   { background: oklch(0.5 0.1 50); }

/* Group body (contains grouped todos) */
.todo-group-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-left: var(--space-4);
  padding-left: var(--space-3);
  border-left: 2px solid var(--color-border-muted);
}

.todo-group-body.collapsed {
  display: none;
}

/* Inline form for quick group creation */
.inline-form {
  display: inline;
}

} /* end @layer components */
