/* ==========================================================================
   Winterhoff Soft Glass — forms layer (forms.css)
   Every form element, every state, and the rich text editor.
   Load after core.css (and app.css if present). Behaviour: js/forms.js.
   Base field look (.wh-input, .wh-select, .wh-textarea, .wh-field, .wh-label,
   .wh-help, .wh-error, .wh-affix) lives in core.css; this file extends it.
   Spec: docs/10-forms.md and docs/11-rich-text-editor.md
   ========================================================================== */

/* ---------- Form layout ---------- */
.wh-form { display: flex; flex-direction: column; gap: 20px; }
.wh-form-grid { display: grid; gap: 16px 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.wh-form-grid > * { min-width: 0; }
.wh-form-grid > .wh-span-all { grid-column: 1 / -1; }
.wh-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.wh-fieldset > legend { padding: 0; margin-bottom: 4px; font-size: 13px; font-weight: 600; }
.wh-form-section { display: flex; flex-direction: column; gap: 16px; padding-top: 24px; border-top: 1px solid var(--line); }
.wh-form-section:first-child { padding-top: 0; border-top: 0; }
.wh-form-section__head { display: flex; flex-direction: column; gap: 4px; }
.wh-form-section__head h3 { font-size: 17px; letter-spacing: -.015em; }
.wh-form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding-top: 8px; }
.wh-form-actions--start { justify-content: flex-start; }
@media (max-width: 480px) { .wh-form-actions .wh-btn { flex: 1 1 100%; } .wh-form-actions { flex-direction: column-reverse; } }

/* Inline (label left) layout from 720px */
@media (min-width: 720px) {
  .wh-field--inline { display: grid; grid-template-columns: 200px minmax(0, 1fr); column-gap: 24px; align-items: start; }
  .wh-field--inline > .wh-label, .wh-field--inline > .wh-label-row { padding-top: 13px; grid-row: span 3; }
  .wh-field--inline > :not(.wh-label):not(.wh-label-row) { grid-column: 2; }
}

/* ---------- Labels ---------- */
.wh-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.wh-req { color: var(--error); margin-left: 2px; font-weight: 700; }
.wh-opt { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--faint); }
.wh-label-row .wh-link { font-size: 13px; font-weight: 600; color: var(--accent-text); text-decoration: none; }
.wh-label-row .wh-link:hover { text-decoration: underline; }
.wh-counter { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wh-counter.is-over { color: var(--error); font-weight: 700; }

/* ---------- Field states (extend core) ---------- */
.wh-input[aria-invalid="false"].is-valid, .wh-field.is-valid .wh-input { border-color: var(--brand); }
.wh-success { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--accent-text); }
.wh-error { display: flex; align-items: center; gap: 6px; }
.wh-error:not([hidden])::before { content: "!"; flex-shrink: 0; width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; background: var(--error-solid); color: var(--on-error); font-size: 10px; font-weight: 800; }
.wh-success::before { content: "✓"; flex-shrink: 0; width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-fill); color: var(--on-brand); font-size: 9px; font-weight: 800; }
.wh-input[readonly], .wh-textarea[readonly] { background: transparent; border-style: dashed; cursor: default; }
.wh-input[readonly]:focus, .wh-textarea[readonly]:focus { box-shadow: none; border-color: var(--line-strong); }
.wh-select:disabled, .wh-textarea:disabled { background: var(--disabled-bg); color: var(--disabled-fg); border-style: dashed; cursor: not-allowed; }
.wh-input--sm, .wh-select.wh-input--sm { min-height: 38px; font-size: 14px; padding-inline: 12px; }
.wh-input--lg { min-height: 54px; font-size: 17px; }

/* ---------- Input groups: prefix / suffix / buttons ---------- */
.wh-group { display: flex; align-items: stretch; min-height: 46px; border-radius: var(--r-field); border: 1px solid var(--field-line); background: var(--field-bg); transition: border-color .2s, box-shadow .2s; overflow: hidden; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.wh-group:hover { border-color: var(--line-strong); }
.wh-group:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.wh-group.is-invalid { border-color: var(--error); box-shadow: 0 0 0 4px var(--error-bg); }
.wh-group.is-disabled { background: var(--disabled-bg); border-style: dashed; color: var(--disabled-fg); }
.wh-group > .wh-input { flex: 1; min-width: 0; border: 0; background: transparent; box-shadow: none !important; border-radius: 0; -webkit-backdrop-filter: none; backdrop-filter: none; animation: none; }
.wh-group__addon { display: flex; align-items: center; padding: 0 14px; color: var(--muted); font-size: 15px; font-weight: 600; white-space: nowrap; }
.wh-group__addon:first-child { padding-right: 0; }
.wh-group__addon:last-child { padding-left: 0; }
.wh-group__addon--box { background: var(--hover); border-right: 1px solid var(--field-line); padding-right: 14px; }
.wh-group__addon--box:last-child { border-right: 0; border-left: 1px solid var(--field-line); padding-left: 14px; }
.wh-group__addon.wh-group__addon--box { padding: 0 14px; }
.wh-group__addon svg { width: 18px; height: 18px; }
.wh-group__btn { display: grid; place-items: center; width: 46px; flex-shrink: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: color .2s, background-color .2s; }
.wh-group__btn:hover { color: var(--fg); background: var(--hover); }
.wh-group__btn svg { width: 18px; height: 18px; }
.wh-group__btn:disabled { opacity: .4; cursor: not-allowed; }
.wh-group .wh-select { border: 0; background: transparent; box-shadow: none; width: auto; min-height: 0; padding-right: 30px; -webkit-backdrop-filter: none; backdrop-filter: none; }

/* Password strength */
.wh-strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.wh-strength span { height: 4px; border-radius: 4px; background: var(--track); transition: background-color .3s; }
.wh-strength[data-score="1"] span:nth-child(-n+1) { background: var(--error-solid); }
.wh-strength[data-score="2"] span:nth-child(-n+2) { background: var(--warn); }
.wh-strength[data-score="3"] span:nth-child(-n+3) { background: var(--brand); }
.wh-strength[data-score="4"] span { background: var(--brand); }
.wh-rules { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.wh-rules li::before { content: "○"; margin-right: 6px; }
.wh-rules li.is-met { color: var(--accent-text); }
.wh-rules li.is-met::before { content: "✓"; font-weight: 800; }

/* Number stepper */
.wh-stepper .wh-input { text-align: center; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.wh-stepper .wh-input::-webkit-outer-spin-button, .wh-stepper .wh-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.wh-stepper { max-width: 180px; }

/* Native date/time/color: themed */
.wh-input[type="date"], .wh-input[type="time"], .wh-input[type="datetime-local"], .wh-input[type="month"] { padding-right: 12px; }
.wh-input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .6; }
.wh-color { display: flex; align-items: center; gap: 10px; }
.wh-color input[type="color"] { -webkit-appearance: none; appearance: none; width: 46px; height: 46px; padding: 4px; border-radius: var(--r-field); border: 1px solid var(--field-line); background: var(--field-bg); cursor: pointer; }
.wh-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.wh-color input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 9px; }
.wh-color input[type="color"]::-moz-color-swatch { border: 0; border-radius: 9px; }
.wh-swatch-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.wh-swatch-pick label { position: relative; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; background: var(--c); box-shadow: inset 0 0 0 1px var(--line-strong); transition: transform .2s var(--spring); }
.wh-swatch-pick label:hover { transform: scale(1.08); }
.wh-swatch-pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.wh-swatch-pick label:has(input:checked) { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--brand); }
.wh-swatch-pick label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 5px; }

/* ---------- Custom checkbox & radio (replaces native look) ---------- */
.wh-check input[type="checkbox"], .wh-check input[type="radio"], .wh-cb {
  -webkit-appearance: none; appearance: none; flex-shrink: 0; width: 20px; height: 20px; margin: 0;
  display: inline-grid; place-items: center; border: 1.5px solid var(--line-strong); background: var(--field-bg);
  cursor: pointer; transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.wh-check input[type="checkbox"], .wh-cb { border-radius: 6px; }
.wh-check input[type="radio"] { border-radius: 50%; }
.wh-check input:hover, .wh-cb:hover { border-color: var(--brand); }
.wh-check input:focus-visible, .wh-cb:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); border-color: var(--brand); }
.wh-check input[type="checkbox"]::after, .wh-cb::after { content: ""; width: 10px; height: 6px; border-left: 2px solid var(--on-brand); border-bottom: 2px solid var(--on-brand); transform: translateY(-1px) rotate(-45deg) scale(0); transition: transform .2s var(--spring); }
.wh-check input[type="checkbox"]:checked, .wh-cb:checked, .wh-check input[type="checkbox"]:indeterminate, .wh-cb:indeterminate { background: var(--brand-fill); border-color: transparent; }
.wh-check input[type="checkbox"]:checked::after, .wh-cb:checked::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
.wh-check input[type="checkbox"]:indeterminate::after, .wh-cb:indeterminate::after { width: 10px; height: 0; border-left: 0; border-bottom: 2px solid var(--on-brand); transform: none; }
.wh-check input[type="radio"]::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--on-brand); transform: scale(0); transition: transform .2s var(--spring); }
.wh-check input[type="radio"]:checked { background: var(--brand-fill); border-color: transparent; }
.wh-check input[type="radio"]:checked::after { transform: scale(1); }
.wh-check input:disabled, .wh-cb:disabled { background: var(--disabled-bg); border-color: var(--line); cursor: not-allowed; }
.wh-check input:disabled:checked { background: var(--disabled-fg); }
.wh-check:has(input:disabled) { color: var(--disabled-fg); cursor: not-allowed; }
.wh-check input[aria-invalid="true"] { border-color: var(--error); }
.wh-check { align-items: flex-start; line-height: 1.4; }
.wh-check input { margin-top: 1px; }
.wh-check small { display: block; font-size: 13px; color: var(--muted); }
.wh-choices { display: flex; flex-direction: column; gap: 12px; }
.wh-choices--row { flex-direction: row; flex-wrap: wrap; gap: 12px 24px; }

/* Choice cards (radio or checkbox as a card) */
.wh-choice-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.wh-choice-card {
  position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--r-md);
  border: 1.5px solid var(--card-line); background: var(--card-bg); cursor: pointer; transition: border-color .2s, box-shadow .2s, transform .25s var(--spring);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.wh-choice-card:hover { border-color: var(--line-strong); }
.wh-choice-card:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.wh-choice-card:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }
.wh-choice-card:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.wh-choice-card__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.wh-choice-card__body strong { font-size: 15px; }
.wh-choice-card__body span { font-size: 13px; color: var(--muted); }
.wh-choice-card__price { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Switch with label row */
.wh-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wh-switch:disabled { opacity: .45; cursor: not-allowed; }
.wh-switch:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }

/* Range with ticks + dual range */
.wh-range-ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wh-range:focus-visible { outline: none; }
.wh-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px var(--ring); }
.wh-dual { position: relative; height: 26px; }
.wh-dual__track { position: absolute; left: 0; right: 0; top: 50%; height: 6px; translate: 0 -50%; border-radius: 999px; background: var(--track); }
.wh-dual__fill { position: absolute; top: 0; bottom: 0; border-radius: inherit; background: var(--brand); }
.wh-dual input { position: absolute; inset: 0; width: 100%; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.wh-dual input::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--knob); border: 2px solid var(--brand); box-shadow: var(--shadow-sm); cursor: grab; }
.wh-dual input::-moz-range-thumb { pointer-events: auto; width: 18px; height: 18px; border-radius: 50%; background: var(--knob); border: 2px solid var(--brand); cursor: grab; }
.wh-dual input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px var(--ring); }

/* Rating */
.wh-rating { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; align-self: flex-start; gap: 2px; border: 0; padding: 0; margin: 0; }
.wh-rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wh-rating label { cursor: pointer; color: var(--track); transition: color .15s, transform .2s var(--spring); }
.wh-rating label svg { width: 28px; height: 28px; display: block; }
.wh-rating label:hover, .wh-rating label:hover ~ label, .wh-rating input:checked ~ label { color: var(--brand); }
.wh-rating label:active { transform: scale(.88); }
.wh-rating input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* ---------- Combobox / multi-select / tags ---------- */
.wh-combo { position: relative; }
.wh-combo:focus-within { z-index: 30; }
/* Glass cards create stacking contexts (backdrop-filter); lift the card holding an open popup */
.wh-card:has(.wh-combo:focus-within), .wh-card:has(.wh-rte:focus-within) { position: relative; z-index: 10; }
.wh-tags-field { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 46px; padding: 6px 10px; border-radius: var(--r-field); border: 1px solid var(--field-line); background: var(--field-bg); cursor: text; transition: border-color .2s, box-shadow .2s; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.wh-tags-field:hover { border-color: var(--line-strong); }
.wh-tags-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.wh-tags-field input { flex: 1 1 120px; min-width: 80px; height: 32px; border: 0; background: transparent; outline: none; font-size: 15px; color: var(--fg); }
.wh-tags-field input::placeholder { color: var(--faint); }
.wh-token { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 4px 0 10px; border-radius: 999px; background: var(--chip); color: var(--accent-text); font-size: 13px; font-weight: 700; animation: wh-pop .2s var(--spring); }
.wh-token button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: inherit; display: grid; place-items: center; cursor: pointer; font-size: 15px; line-height: 1; }
.wh-token button:hover { background: var(--ring); }
.wh-listbox { position: absolute; z-index: 25; left: 0; right: 0; top: calc(100% + 6px); max-height: 260px; overflow-y: auto; margin: 0; padding: 6px; list-style: none; border-radius: var(--r-md); background: var(--menu-bg); border: 1px solid var(--card-line); box-shadow: var(--shadow-lg); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.wh-listbox:not([hidden]) { animation: wh-pop .18s var(--ease); }
.wh-option { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); font-size: 15px; cursor: pointer; }
.wh-option[aria-selected="true"] { font-weight: 700; }
.wh-option[aria-selected="true"]::after { content: "✓"; margin-left: auto; color: var(--accent-text); font-weight: 800; }
.wh-option.is-active { background: var(--hover); }
.wh-option mark { background: transparent; color: var(--accent-text); font-weight: 800; }
.wh-option--empty { color: var(--muted); cursor: default; }

/* ---------- One-time code ---------- */
.wh-otp { display: flex; gap: 8px; max-width: 380px; }
.wh-otp input { flex: 1 1 0; min-width: 0; max-width: 52px; height: 56px; padding: 0; text-align: center; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; border-radius: var(--r-field); border: 1px solid var(--field-line); background: var(--field-bg); color: var(--fg); transition: border-color .2s, box-shadow .2s, transform .2s var(--spring); }
.wh-otp input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); transform: translateY(-2px); }
.wh-otp input.is-filled { border-color: var(--brand); }
.wh-otp.is-invalid input { border-color: var(--error); animation: wh-shake .35s var(--ease); }
.wh-otp__sep { align-self: center; color: var(--faint); font-weight: 800; }
@media (max-width: 400px) { .wh-otp { gap: 6px; } .wh-otp input { height: 50px; font-size: 19px; } }

/* ---------- Textarea autosize hint ---------- */
.wh-textarea[data-autosize] { resize: none; overflow: hidden; }

/* ---------- Upload with progress list ---------- */
.wh-file-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.wh-file { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--card-line); background: var(--card-bg); animation: wh-fade-up .3s var(--ease); }
.wh-file__icon { grid-row: span 2; width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--chip); color: var(--accent-text); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.wh-file__name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-file__meta { grid-column: 2; font-size: 12px; color: var(--muted); }
.wh-file .wh-progress { grid-column: 2; height: 4px; }
.wh-file__remove { grid-row: 1 / span 2; grid-column: 3; }

/* ==========================================================================
   Rich text editor — .wh-rte
   ========================================================================== */
.wh-rte { position: relative; display: flex; flex-direction: column; border-radius: var(--r-field); border: 1px solid var(--field-line); background: var(--field-bg); transition: border-color .2s, box-shadow .2s; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.wh-rte:hover { border-color: var(--line-strong); }
.wh-rte:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); z-index: 6; } /* lift above later cards so menus aren't covered */
.wh-rte.is-invalid { border-color: var(--error); box-shadow: 0 0 0 4px var(--error-bg); }
.wh-rte.is-disabled { background: var(--disabled-bg); border-style: dashed; }
.wh-rte.is-disabled .wh-rte__toolbar { opacity: .45; pointer-events: none; }

.wh-rte__toolbar { position: sticky; top: calc(var(--rte-sticky, 0px) + env(safe-area-inset-top, 0px)); z-index: 5; display: flex; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--menu-bg); border-radius: calc(var(--r-field) - 1px) calc(var(--r-field) - 1px) 0 0; overflow-x: auto; scrollbar-width: none; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.wh-rte__toolbar::-webkit-scrollbar { display: none; }
.wh-rte__btn { flex-shrink: 0; display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; transition: background-color .15s, color .15s; }
.wh-rte__btn svg { width: 18px; height: 18px; }
.wh-rte__btn:hover { background: var(--hover); color: var(--fg); }
.wh-rte__btn[aria-pressed="true"] { background: var(--chip); color: var(--accent-text); }
.wh-rte__btn:disabled { opacity: .35; cursor: not-allowed; }
.wh-rte__btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.wh-rte__sep { flex-shrink: 0; width: 1px; height: 20px; margin: 0 4px; background: var(--line); }
.wh-rte__block { flex-shrink: 0; height: 34px; padding: 0 28px 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--fg); font-size: 13px; font-weight: 700; cursor: pointer; -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: right 13px center, right 9px center; background-size: 4px 4px; background-repeat: no-repeat; }
.wh-rte__block:hover { background-color: var(--hover); }
.wh-rte__block option { color: #0F1A10; }
.wh-rte__spacer { flex: 1; }

/* Editable area: typography for content */
.wh-rte__content { min-height: var(--rte-min, 200px); max-height: var(--rte-max, none); overflow-y: auto; padding: 16px 18px; outline: none; font-size: 16px; line-height: 1.65; color: var(--fg); overflow-wrap: anywhere; caret-color: var(--brand); }
.wh-rte__content:empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; }
.wh-rte__content > :first-child { margin-top: 0; }
.wh-rte__content > :last-child { margin-bottom: 0; }
.wh-prose p { margin: 0 0 .9em; }
.wh-prose h2 { margin: 1.4em 0 .5em; font-size: 24px; line-height: 1.25; letter-spacing: -.025em; }
.wh-prose h3 { margin: 1.2em 0 .4em; font-size: 19px; line-height: 1.3; letter-spacing: -.015em; }
.wh-prose ul, .wh-prose ol { margin: 0 0 .9em; padding-left: 1.4em; }
.wh-prose li { margin: .25em 0; }
.wh-prose li::marker { color: var(--accent-text); font-weight: 700; }
.wh-prose ul[data-checklist] { list-style: none; padding-left: 0; }
.wh-prose ul[data-checklist] li { display: flex; gap: 10px; align-items: flex-start; }
.wh-prose ul[data-checklist] li::before { content: ""; flex-shrink: 0; width: 18px; height: 18px; margin-top: 4px; border-radius: 5px; border: 1.5px solid var(--line-strong); cursor: pointer; }
.wh-prose ul[data-checklist] li[data-checked="true"] { color: var(--muted); text-decoration: line-through; }
.wh-prose ul[data-checklist] li[data-checked="true"]::before { background: var(--brand-fill); border-color: transparent; box-shadow: inset 0 0 0 3px var(--brand); }
.wh-prose blockquote { margin: 0 0 .9em; padding: 4px 0 4px 16px; border-left: 3px solid var(--brand); color: var(--muted); font-style: italic; }
.wh-prose code { padding: 2px 6px; border-radius: 6px; background: var(--track); font: 600 .88em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.wh-prose pre { margin: 0 0 .9em; padding: 14px 16px; border-radius: var(--r-sm); background: var(--toast-bg); color: var(--toast-fg); overflow-x: auto; font: 500 14px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.wh-prose pre code { padding: 0; background: none; font: inherit; }
.wh-prose a { color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.wh-prose hr { margin: 1.4em 0; border: 0; border-top: 1px solid var(--line); }
.wh-prose mark { padding: 0 3px; border-radius: 4px; background: rgba(245, 165, 36, .35); color: inherit; }
.wh-prose img { border-radius: var(--r-sm); }

.wh-rte__footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wh-rte__status { display: inline-flex; align-items: center; gap: 6px; }
.wh-rte__status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.wh-rte__status.is-saving::before { background: var(--warn); animation: wh-pulse 1s ease-out infinite; }

/* Link popover */
.wh-rte__pop { position: absolute; z-index: 20; display: flex; gap: 6px; padding: 6px; border-radius: var(--r-md); background: var(--menu-bg); border: 1px solid var(--card-line); box-shadow: var(--shadow-lg); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); animation: wh-pop .18s var(--ease); width: min(360px, calc(100% - 16px)); }
.wh-rte__pop .wh-input { min-height: 38px; font-size: 14px; }
.wh-rte__pop .wh-btn { --h: 38px; }

/* Slash command menu */
.wh-rte__slash { position: absolute; z-index: 20; width: 240px; margin: 0; padding: 6px; list-style: none; border-radius: var(--r-md); background: var(--menu-bg); border: 1px solid var(--card-line); box-shadow: var(--shadow-lg); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); animation: wh-pop .18s var(--ease); }
.wh-rte__slash li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); font-size: 14px; font-weight: 600; cursor: pointer; }
.wh-rte__slash li span { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--chip); color: var(--accent-text); font-size: 12px; font-weight: 800; }
.wh-rte__slash li.is-active { background: var(--hover); }

/* Compact variant (comments, chat): toolbar below content */
.wh-rte--compact { --rte-min: 72px; }
.wh-rte--compact .wh-rte__toolbar { order: 2; position: static; border-bottom: 0; border-top: 1px solid var(--line); background: transparent; border-radius: 0 0 calc(var(--r-field) - 1px) calc(var(--r-field) - 1px); }
.wh-rte--compact .wh-rte__content { padding: 12px 14px; }

/* Rendered output (read view) */
.wh-rich-view { font-size: 16px; line-height: 1.65; color: var(--fg); }
