/* ---------------------------------------------------------------------------
   Categories: badges, filter bar, dialogs
   --------------------------------------------------------------------------- */
.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  height: 22px;
  padding: 0 8px 0 7px;
  border-radius: 11px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  color: color-mix(in srgb, var(--cat-color, #8e9aaf) 55%, #f2f2f0);
  background: color-mix(in srgb, var(--cat-color, #8e9aaf) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--cat-color, #8e9aaf) 28%, transparent);
}

.category-badge.is-none {
  color: var(--text-3);
  background: transparent;
  border-style: dashed;
  border-color: var(--border-strong);
}

.category-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--cat-color, #8e9aaf);
}

.category-dot.is-empty {
  background: transparent;
  border: 1.5px dashed var(--text-4);
}

/* Row */
.task-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.task-main .task-title {
  min-width: 0;
  flex: 0 1 auto;
}

.row-category {
  display: inline-flex;
  flex: none;
  max-width: 45%;
  border-radius: 12px;
  transition: filter 100ms var(--ease);
}

.row-category:hover {
  filter: brightness(1.18);
}

.row-category .category-badge {
  max-width: 100%;
}

.task-row.is-done .row-category {
  opacity: 0.65;
}

.prop-empty {
  color: var(--text-3);
}

/* Filter bar: one row per group (Category, Area) plus a summary line */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 0 2px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.filter-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 96px;
  margin-right: 6px;
  font-size: 13px;
  color: var(--text-3);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px 0 6px;
  border-radius: 16px;
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
  transition: background-color 100ms var(--ease), border-color 100ms var(--ease);
}

.filter-chip > span:first-child:not(.category-badge) {
  padding-left: 6px;
}

.filter-chip .category-badge {
  border-color: transparent;
}

.filter-chip:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.filter-chip.is-active {
  background: var(--bg-active);
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--text);
}

.filter-count {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.filter-chip.is-active .filter-count {
  color: var(--text-2);
}

.filter-lead {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  width: 132px;
  flex: none;
}

.filter-lead .filter-label {
  min-width: 0;
  margin-right: 0;
  flex: 1;
}

.filter-manage {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 6px;
  border-radius: var(--radius);
  color: var(--text-4);
  transition: background-color 100ms var(--ease), color 100ms var(--ease);
}

.filter-manage:hover,
.filter-manage:focus-visible {
  background: var(--bg-hover);
  color: var(--text);
}

/* Small tooltip for icon-only buttons */
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%) translateY(2px);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: #2f2f2f;
  box-shadow: var(--shadow-pop);
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms var(--ease), transform 120ms var(--ease);
  z-index: 20;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%);
}

.filter-empty-link {
  font-size: 13px;
  color: var(--text-4);
}

.filter-empty-link:hover {
  color: var(--text-2);
  text-decoration: underline;
}

.filter-hint {
  padding: 0 4px;
  font-size: 12.5px;
  color: var(--text-4);
  cursor: help;
}

.category-manage {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-3);
}

.filter-action:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.filter-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-3);
}

.filter-clear {
  color: var(--accent);
  font-size: 13px;
}

.filter-clear:hover {
  text-decoration: underline;
}

/* Category dialog */
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  --swatch: transparent;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: transform 100ms var(--ease);
}

.swatch:hover {
  transform: scale(1.08);
}

.swatch.is-selected {
  box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 0 4px var(--text);
}

.swatch-auto {
  width: auto;
  padding: 0 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-active);
}

.swatch-custom:not(.is-selected) {
  border: 1.5px dashed var(--text-4);
  box-shadow: none;
}

.color-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.category-preview {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-hint {
  font-size: 12.5px;
  color: var(--text-3);
}

.category-list {
  display: flex;
  flex-direction: column;
}

.category-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border-bottom: 1px solid var(--border);
}

.category-list-row .category-badge {
  max-width: 60%;
}

.category-list-count {
  flex: 1;
  font-size: 13px;
  color: var(--text-3);
}

.category-list-empty {
  color: var(--text-3);
  padding: 8px 0;
}

@media (max-width: 760px) {
  .task-main {
    grid-area: title;
    flex-wrap: wrap;
    gap: 2px 8px;
  }

  .filter-summary {
    margin-left: 0;
    width: 100%;
  }
}
