/* Rich-text editor — ported from the Hub's .rte-* component (dark surface). */
.rte-bar {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 5px 6px; background: var(--panel-2); border: 1px solid var(--border); border-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.rte-btn {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 28px;
  padding: 0 6px; border: 0; background: transparent; color: var(--muted); border-radius: 5px;
  cursor: pointer; font-size: 14px; line-height: 1; transition: background .1s, color .1s;
}
.rte-btn:hover { background: var(--panel); color: var(--text); }
.rte-btn.active { background: rgba(var(--accent-rgb), 0.18); color: var(--accent-bright); }
.rte-btn svg { width: 15px; height: 15px; }
.rte-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; flex: 0 0 auto; }

.rte {
  min-height: 150px; max-height: 440px; overflow-y: auto; resize: vertical;
  padding: 11px 13px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm); color: var(--text);
  font: inherit; font-size: 15px; line-height: 1.6; outline: none;
}
.rte:focus { border-color: var(--accent); }
.rte:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.rte p { margin: 0 0 8px; }
.rte ul, .rte ol { margin: 4px 0; padding-left: 22px; }
.rte a { color: var(--accent); }
.rte code { font-family: var(--mono); background: var(--panel-2); border: 1px solid var(--border); border-radius: 5px; font-size: 0.92em; padding: 0 4px; }
.rte pre { font-family: var(--mono); background: var(--panel-2); border: 1px solid var(--border); border-radius: 5px; font-size: 12.5px; padding: 8px 10px; overflow-x: auto; white-space: pre-wrap; }

.rte-bar { align-items: center; }
.rte-label { font-family: var(--font-tech); font-size: 11px; color: var(--muted); letter-spacing: 0.04em; margin: 0 3px 0 6px; white-space: nowrap; }
.rte-label:first-child { margin-left: 0; }
/* scoped under .rte-bar so the global .field select/input rules don't bloat these */
.rte-bar select { appearance: none; -webkit-appearance: none; width: auto; min-width: 0; background: var(--panel); border: 1px solid var(--border); color: var(--text); border-radius: 5px; font-size: 12px; padding: 0 8px; height: 28px; cursor: pointer; }
.rte-color-btn { position: relative; flex-direction: column; gap: 1px; }
.rte-color-btn .rte-a { font-size: 13px; line-height: 1; font-weight: 700; }
.rte-color-bar { display: block; width: 14px; height: 3px; border-radius: 2px; background: var(--text); }
.rte-colorpop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; box-shadow: var(--shadow-2); }
.rte-swatch { width: 20px; height: 20px; padding: 0; border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.18); cursor: pointer; transition: transform .1s ease; }
.rte-swatch:hover { transform: scale(1.15); }

.rte-linkpop {
  position: absolute; top: calc(100% + 4px); left: 6px; z-index: 20; display: flex; gap: 6px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px; box-shadow: var(--shadow-2);
}
.rte-bar .rte-linkin { width: 220px; max-width: 50vw; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 5px; padding: 6px 8px; font-size: 14px; }
.rte-bar .rte-linkin:focus { border-color: var(--accent); outline: none; }
.rte-linkok { border: 0; background: var(--accent); color: #0c0c0c; font-weight: 700; border-radius: 5px; padding: 0 12px; cursor: pointer; font-size: 12px; }
