/* tags.css -- tag pills, chips, picker */
.tag-pill { display: inline-block; padding: 0.2em 0.6em; border-radius: var(--rm); font-size: 0.75rem; font-weight: 600; line-height: 1.4; white-space: nowrap; margin: 0.1rem; }
.tag-pill.selected {
  box-shadow: 0 0 0 1px var(--text-primary);
  filter: brightness(1.18);
}
.tag-pill.selected:hover { filter: brightness(1.25); }
.tag-pill .tag-pill-x {
  margin-left: 0.35em;
  cursor: pointer;
  opacity: 0.65;
  font-weight: 700;
}
.tag-pill .tag-pill-x:hover { opacity: 1; }
.tag-pill[data-cat="Plan Compliance"] { background: #071a0f; color: #6ee7b7; }
.tag-pill[data-cat="Setup"]      { background: #0a1829; color: #93c5fd; }
.tag-pill[data-cat="Emotion"]    { background: #1a0a2e; color: #d8b4fe; }
.tag-pill[data-cat="Mistake"]    { background: #2d0808; color: #fca5a5; }
.tag-pill[data-cat="Risk"]       { background: #1c1400; color: #fcd34d; }
.tag-pill[data-cat="Confidence"] { background: #120826; color: #c4b5fd; }
.tag-pill[data-cat="Lesson"]     { background: #021414; color: #5eead4; }
.tag-pill[data-cat="Custom"]     { background: #111111; color: #e5e7eb; }
.tag-pill[data-cat="Market Condition"] { background: #0c1a2e; color: #7dd3fc; }
.tag-pill[data-cat="Entry Signal"]     { background: #2a1e05; color: #fbbf24; }
.tag-pill[data-cat="Execution Rule"]   { background: #2a0c1f; color: #f9a8d4; }
.tag-cell { max-width: 12rem; }
.tag-cell .tag-pill { cursor: default; }
.tag-picker { display: flex; flex-direction: column; gap: 0.625rem; padding-bottom: 1.5rem; }
.tag-cat-row { display: flex; align-items: flex-start; gap: 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.tag-cat-row:last-child { border-bottom: none; padding-bottom: 0; }
.tag-cat-label { min-width: 5.5rem; font-size: 0.875rem; font-weight: 600; color: var(--text-muted); padding-top: 0.25rem; flex-shrink: 0; }
.tag-cat-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; flex: 1; }
.tag-chip { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.25em 0.65em; border-radius: 0.25rem; font-size: 0.8125rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: border-color 0.12s, filter 0.12s; user-select: none; }
.tag-chip:hover { filter: brightness(1.15); }
.tag-chip.selected { border-color: rgba(255,255,255,0.3); }
.tag-chip[data-cat="Plan Compliance"] { background: #071a0f; color: #6ee7b7; }
.tag-chip[data-cat="Setup"]      { background: #0a1829; color: #93c5fd; }
.tag-chip[data-cat="Emotion"]    { background: #1a0a2e; color: #d8b4fe; }
.tag-chip[data-cat="Mistake"]    { background: #2d0808; color: #fca5a5; }
.tag-chip[data-cat="Risk"]       { background: #1c1400; color: #fcd34d; }
.tag-chip[data-cat="Confidence"] { background: #120826; color: #c4b5fd; }
.tag-chip[data-cat="Lesson"]     { background: #021414; color: #5eead4; }
.tag-chip[data-cat="Custom"]     { background: #111111; color: #e5e7eb; }
.tag-chip[data-cat="Market Condition"] { background: #0c1a2e; color: #7dd3fc; }
.tag-chip[data-cat="Entry Signal"]     { background: #2a1e05; color: #fbbf24; }
.tag-chip[data-cat="Execution Rule"]   { background: #2a0c1f; color: #f9a8d4; }
.tag-custom-row { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.375rem; }
.tag-custom-inp option { background: var(--bg-elevated); color: var(--text-primary); }
.tag-custom-inp { flex: 1; background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--rm); color: var(--text-primary); padding: 0.55rem 0.75rem; font-size: 0.9375rem; min-height: 2.5rem; outline: none; transition: border-color 0.15s; }
.tag-custom-inp:focus { border-color: var(--green); }
.tag-custom-inp::placeholder { color: var(--text-ph); }
.tag-custom-add { background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-primary); border-radius: var(--rm); padding: 0.55rem 0.875rem; font-size: 0.8125rem; font-weight: 500; cursor: pointer; white-space: nowrap; min-height: 2.5rem; display: inline-flex; align-items: center; transition: background 0.15s; }
.tag-custom-add:hover { background: var(--bg-elevated); filter: brightness(1.15); }
/* ── Inline add chips ───────────────────────────────────────────────── */
.tag-chip-add {
  background: var(--bg-elevated);
  border: 1px dashed var(--text-faint);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.875rem;
  min-width: 1.6em;
  justify-content: center;
}
.tag-chip-add:hover { border-color: var(--green); color: var(--green); background: rgba(74, 222, 128, 0.08); }
.tag-chip-add-cat {
  background: var(--bg-elevated);
  border: 1px dashed var(--text-faint);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}
.tag-chip-add-cat:hover { border-color: var(--green); color: var(--green); background: rgba(74, 222, 128, 0.08); }
body.light .tag-chip-add:hover,
body.light .tag-chip-add-cat:hover { background: rgba(21, 128, 61, 0.08); }

/* "+ Category" inline creator: pill-styled input + color swatches */
.tag-cat-inline-input { display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start; }
.tag-cat-inline-top { display: inline-flex; gap: 0.375rem; align-items: center; }
.tag-cat-inline-pill {
  width: 12rem;
  max-width: 100%;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  padding: 0.25em 0.65em;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  transition: border-color 0.12s, filter 0.12s;
}
.tag-cat-inline-pill::placeholder { color: currentColor; opacity: 0.55; font-weight: 500; }
.tag-cat-inline-pill:focus { border-color: rgba(255,255,255,0.3); }
.tag-cat-inline-add { font-size: 0.8125rem; min-height: 1.875rem; padding: 0.25rem 0.625rem; }
.tag-cat-swatch-row { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.tag-cat-swatch {
  width: 1.65rem;
  height: 1.4rem;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.12s, transform 0.12s;
  flex-shrink: 0;
}
.tag-cat-swatch:hover { transform: scale(1.08); }
.tag-cat-swatch.selected { border-color: var(--text-primary); }
.tag-inline-inp {
  background: var(--bg-base);
  border: 1px solid var(--green);
  border-radius: 0.25rem;
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.2em 0.5em;
  outline: none;
  width: 7rem;
  min-height: 0;
}
.tag-inline-inp::placeholder { color: var(--text-ph); }

.tag-selected-bar { display: flex; flex-wrap: wrap; gap: 0.25rem; min-height: 1.5rem; padding: 0 0 0.5rem; margin-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.tag-selected-bar:empty { display: none; }
.tag-selected-bar .tag-pill { cursor: pointer; position: relative; }
.tag-selected-bar .tag-pill:hover::after { content: '\00d7'; margin-left: 0.25rem; font-weight: 700; }

/* ── SortableJS drag reorder ────────────────────────────────────────── */
.tag-cat-label { cursor: grab; }
.tag-chip[data-val] { cursor: grab; }
.sortable-ghost { }
.sortable-chosen { cursor: grabbing; }
