/* Toggleable text formatting toolbar and safe rich-text palette styles.
   Loaded after core/style.css and before edition/edition.css. Zero inline styles. */

.fmt-field { display: flex; flex-direction: column; gap: 0.35rem; width: 100%; min-width: 0; flex: 1; }
.fmt-field [hidden] { display: none; }
.fmt-input-row { position: relative; display: flex; align-items: flex-start; gap: 0.35rem; width: 100%; }
.fmt-input-row > input, .fmt-input-row > textarea { flex: 1; min-width: 0; }

.fmt-toggle {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 0.4rem; margin-top: 0.2rem;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted);
  font-size: 0.74rem; font-weight: 700; cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.fmt-toggle:hover { border-color: var(--accent); color: var(--text); }
.fmt-toggle[aria-expanded="true"] {
  background: var(--soft); border-color: var(--accent); color: var(--soft-text);
}

.fmt-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem;
  padding: 0.3rem 0.4rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.fmt-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 0.4rem;
  border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--text);
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
.fmt-btn:hover { background: var(--surface); border-color: var(--border); }
.fmt-b { font-weight: 800; }
.fmt-i { font-style: italic; font-family: Georgia, serif; }
.fmt-s { text-decoration: line-through; }
.fmt-h { font-size: 0.72rem; }
.fmt-sep { width: 1px; height: 16px; background: var(--border); margin: 0 0.15rem; }

.fmt-swatch { width: 20px; min-width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 1.5px solid var(--border-strong); }
.fmt-swatch:hover { transform: scale(1.1); }
.fmt-preview {
  padding: 0.45rem 0.65rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px dashed var(--border);
  line-height: 1.45; overflow-wrap: anywhere;
}
.fmt-preview-label { font-weight: 600; }

/* Safe rich-text rendered elements (dark + light contrast-safe palette) */
.rt-list { margin: 0.3rem 0 0.3rem 1.25rem; padding: 0; }
.rt-list li { margin: 0.15rem 0; }
:root[data-mode="light"] .rt-mark { background: #FEF3C7; color: #78350F; padding: 0.05rem 0.25rem; border-radius: 4px; }
:root[data-mode="dark"] .rt-mark  { background: rgba(252, 211, 77, 0.22); color: #FDE68A; padding: 0.05rem 0.25rem; border-radius: 4px; }

:root[data-mode="light"] .rt-c-amber    { color: #B45309; }
:root[data-mode="light"] .rt-c-rose     { color: #BE185D; }
:root[data-mode="light"] .rt-c-sky      { color: #0369A1; }
:root[data-mode="light"] .rt-c-mint     { color: #15803D; }
:root[data-mode="light"] .rt-c-lavender { color: #4338CA; }
:root[data-mode="dark"] .rt-c-amber     { color: #FCD34D; }
:root[data-mode="dark"] .rt-c-rose      { color: #F9A8D4; }
:root[data-mode="dark"] .rt-c-sky       { color: #7DD3FC; }
:root[data-mode="dark"] .rt-c-mint      { color: #6EE7B7; }
:root[data-mode="dark"] .rt-c-lavender  { color: #C4B5FD; }

.rt-dot-amber    { background: #F59E0B; }
.rt-dot-rose     { background: #EC4899; }
.rt-dot-sky      { background: #0EA5E9; }
.rt-dot-mint     { background: #10B981; }
.rt-dot-lavender { background: #8B5CF6; }

/* Multi-category picker (+ Category panel) */
.cat-picker [hidden] { display: none; }
.cat-more-btn { border-style: dashed; color: var(--muted); border-radius: 999px; min-height: 34px; }
.cat-more-btn[aria-expanded="true"] { border-style: solid; border-color: var(--accent); background: var(--soft); color: var(--soft-text); }
.cat-panel {
  padding: 0.6rem 0.75rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.cat-panel-grid { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.cat-option {
  display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer;
  padding: 0.3rem 0.65rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 0.8rem; font-weight: 600;
}
.cat-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cat-option:has(input:checked) { border-color: var(--accent); background: var(--soft); color: var(--soft-text); }
.cat-option:has(input:focus-visible) { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.cat-option-icon { display: inline-flex; align-items: center; }

/* Connected ideas (idea relations) */
.links-section [hidden] { display: none; }
.links-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.link-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem;
  padding: 0.45rem 0.65rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.link-rel {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem; border-radius: 999px;
  background: var(--soft); color: var(--soft-text);
}
.link-target { font-weight: 600; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.link-target:hover { text-decoration: underline; color: var(--accent); }
.link-meta { white-space: nowrap; }
.link-state { font-size: 0.72rem; }
.link-remove {
  margin-left: auto; min-width: 26px; height: 26px; border: 1px solid transparent;
  border-radius: var(--radius-sm); background: transparent; color: var(--muted);
  font-size: 1rem; line-height: 1; cursor: pointer;
}
.link-remove:hover { color: var(--danger, #e11d48); border-color: var(--border); background: var(--surface); }
.link-picker {
  padding: 0.65rem 0.75rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.link-picker-bar { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.link-rel-select { flex: 0 0 auto; width: auto; min-width: 9rem; }
.link-filter { flex: 1 1 11rem; min-width: 0; }
.link-candidates { display: flex; flex-direction: column; gap: 0.3rem; max-height: 14rem; overflow-y: auto; }
.link-candidate {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  width: 100%; text-align: left; padding: 0.45rem 0.6rem; cursor: pointer;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 0.88rem;
}
.link-candidate:hover { border-color: var(--accent); background: var(--soft); }
.link-candidate-text { font-weight: 500; overflow-wrap: anywhere; }

/* Idea detail category editor & footer action spacing */
.cat-editor { padding: 0.75rem 0.9rem; }
.cat-editor-actions { padding-top: 0.5rem; border-top: 1px solid var(--border); }
.detail-foot { padding-top: 0.85rem; border-top: 1px solid var(--border); }
.btn-sm.btn-icon { width: 34px; min-height: 34px; padding: 0; }



