/* comments_section_html: the form's stylesheet. It is an asset because the
 * Anvil server strips the body of a template style block, so a screen would
 * render unstyled at runtime while still looking right on the designer canvas.
 *
 * The form's old template had TWO top-level nodes (the panel and its loading
 * overlay), so the conversion wraps them in one root div carrying the private
 * class `cs-root`. There is no root rule: the div this root replaces (Anvil's
 * .anvil-html-templated-panel wrapper) carried no declarations of its own, and
 * this is a mounted component rather than a screen, so no position/flex/
 * min-height is added either. The toolkit still writes `position: relative`
 * onto it at runtime through pxEnsureOverlayAnchor, exactly as it wrote it
 * onto the wrapper before.
 *
 * `.comments-section` is a CHILD of the root, not the root, so every rule
 * that names it stays a scoped descendant rule. :where() adds no specificity,
 * so which rule wins is unchanged.
 *
 * THE SIX .cs-mention-* RULES ARE DELIBERATELY UNSCOPED. The script appends
 * `state.mentionDropdown` to document.body (comments_section_html.mjs,
 * showMentionDropdown), so the element leaves this form's root the moment it
 * is shown; a :where(.cs-root) prefix would stop matching and the mention
 * list would render naked with nothing thrown. `cs-mention-` is declared
 * nowhere else in the estate, which is what makes unscoped safe here.
 *
 * ONE RULE IS NEW: `.cs-loading-overlay { --px-loading-accent: ... }` at the
 * foot replaces the inline attribute the old overlay div carried, because a
 * template may not carry one. Nothing else in the estate declares that
 * property on this element, and a declaration on the element itself beats the
 * theme's inherited default regardless of specificity, so the accent is
 * unchanged.
 */

/* Comments Section - Light mode default (matches warning items) */
:where(.cs-root) .comments-section {
  --cs-bg-primary: #f8fafc;
  --cs-bg-secondary: #f1f5f9;
  --cs-bg-tertiary: #e2e8f0;
  --cs-bg-elevated: #ffffff;
  --cs-text-primary: #1e293b;
  --cs-text-secondary: #475569;
  --cs-text-muted: #94a3b8;
  --cs-home-primary: #3b82f6;
  --cs-home-bg: rgba(59, 130, 246, 0.12);
  --cs-cycle-primary: #10b981;
  --cs-cycle-bg: rgba(16, 185, 129, 0.12);
  --cs-item-primary: #a855f7;
  --cs-item-bg: rgba(168, 85, 247, 0.12);
  --cs-resolved-opacity: 0.45;
  --cs-pinned-gold: #f59e0b;
  --cs-overdue-red: #ef4444;
  --cs-mention-highlight: rgba(59, 130, 246, 0.25);
  --cs-border-subtle: rgba(0, 0, 0, 0.06);
  --cs-border-medium: rgba(0, 0, 0, 0.12);
  --cs-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --cs-font-body: 'IBM Plex Sans', -apple-system, sans-serif;
  --cs-font-mono: 'IBM Plex Mono', monospace;
  --cs-transition-fast: 150ms ease;
  --cs-transition-medium: 250ms ease;
  --cs-body-max-height: 500px;
}

/* Dark mode - triggered by data-theme attribute on document */
[data-theme="dark"] :where(.cs-root) .comments-section {
  --cs-bg-primary: #1e293b;
  --cs-bg-secondary: #293548;
  --cs-bg-tertiary: #334155;
  --cs-bg-elevated: #3d4a5c;
  --cs-text-primary: #f1f5f9;
  --cs-text-secondary: #cbd5e1;
  --cs-text-muted: #94a3b8;
  --cs-border-subtle: rgba(255, 255, 255, 0.06);
  --cs-border-medium: rgba(255, 255, 255, 0.12);
  --cs-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

:where(.cs-root) .comments-section {
  font-family: var(--cs-font-body);
  background: var(--cs-bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--cs-border-subtle);
  margin-top: 16px;
}

:where(.cs-root) .comments-section .cs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--cs-bg-tertiary);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--cs-border-subtle);
}

:where(.cs-root) .comments-section .cs-header:hover { background: var(--cs-bg-elevated); }

:where(.cs-root) .comments-section .cs-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

:where(.cs-root) .comments-section .cs-header-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--cs-text-secondary);
  text-transform: uppercase;
}

:where(.cs-root) .comments-section .cs-header-count {
  font-size: 12px;
  color: var(--cs-text-muted);
  font-family: var(--cs-font-mono);
}

:where(.cs-root) .comments-section .cs-header-count .open-count { color: var(--cs-overdue-red); }

:where(.cs-root) .comments-section .cs-collapse-icon {
  width: 20px;
  height: 20px;
  color: var(--cs-text-muted);
  transition: transform var(--cs-transition-fast);
}

:where(.cs-root) .comments-section .cs-header.collapsed .cs-collapse-icon { transform: rotate(-90deg); }

:where(.cs-root) .comments-section .cs-body {
  max-height: var(--cs-body-max-height);
  overflow-y: auto;
  padding: 12px;
}

:where(.cs-root) .comments-section .cs-level-section { margin-bottom: 16px; }
:where(.cs-root) .comments-section .cs-level-section:last-child { margin-bottom: 0; }

:where(.cs-root) .comments-section .cs-level-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

:where(.cs-root) .comments-section .cs-level-header-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

:where(.cs-root) .comments-section .cs-level-indicator {
  width: 4px;
  height: 16px;
  border-radius: 2px;
}

:where(.cs-root) .comments-section .cs-level-section.home .cs-level-indicator { background: var(--cs-home-primary); }
:where(.cs-root) .comments-section .cs-level-section.cycle .cs-level-indicator { background: var(--cs-cycle-primary); }
:where(.cs-root) .comments-section .cs-level-section.item .cs-level-indicator { background: var(--cs-item-primary); }

:where(.cs-root) .comments-section .cs-level-header span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--cs-text-secondary);
}

:where(.cs-root) .comments-section .cs-level-comments { padding-left: 12px; }

:where(.cs-root) .comments-section .cs-comment {
  margin-bottom: 8px;
  position: relative;
}

:where(.cs-root) .comments-section .cs-comment.resolved { opacity: var(--cs-resolved-opacity); }
:where(.cs-root) .comments-section .cs-comment.deleted .cs-comment-content { font-style: italic; }

:where(.cs-root) .comments-section .cs-comment-card {
  background: var(--cs-bg-elevated);
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid var(--cs-border-subtle);
  transition: border-color var(--cs-transition-fast);
}

:where(.cs-root) .comments-section .cs-comment.overdue .cs-comment-card {
  border-left: 3px solid var(--cs-overdue-red);
}

:where(.cs-root) .comments-section .cs-comment.pinned .cs-comment-card {
  border-left: 3px solid var(--cs-pinned-gold);
}

:where(.cs-root) .comments-section .cs-comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

:where(.cs-root) .comments-section .cs-comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

:where(.cs-root) .comments-section .cs-pinned-icon, :where(.cs-root) .comments-section .cs-overdue-icon {
  width: 14px;
  height: 14px;
}

:where(.cs-root) .comments-section .cs-pinned-icon { color: var(--cs-pinned-gold); }
:where(.cs-root) .comments-section .cs-overdue-icon { color: var(--cs-overdue-red); }

:where(.cs-root) .comments-section .cs-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--cs-text-primary);
}

:where(.cs-root) .comments-section .cs-timestamp {
  font-size: 11px;
  color: var(--cs-text-muted);
  font-family: var(--cs-font-mono);
}

:where(.cs-root) .comments-section .cs-comment-content {
  font-size: 13px;
  line-height: 1.5;
  color: var(--cs-text-primary);
  word-wrap: break-word;
  white-space: pre-wrap;
}

:where(.cs-root) .comments-section .cs-deleted-text { color: var(--cs-text-muted); }

:where(.cs-root) .comments-section .cs-mention {
  background: var(--cs-mention-highlight);
  color: var(--cs-home-primary);
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 500;
}

:where(.cs-root) .comments-section .cs-comment-footer {
  display: none; /* Hidden - reply moved to meta row */
}

:where(.cs-root) .comments-section .cs-reply-link {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--cs-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: opacity var(--cs-transition-fast), transform var(--cs-transition-fast), background-color var(--cs-transition-fast), color var(--cs-transition-fast), border-color var(--cs-transition-fast), box-shadow var(--cs-transition-fast);
}

:where(.cs-root) .comments-section .cs-reply-link:hover {
  color: var(--cs-text-primary);
  background: var(--cs-bg-tertiary);
}

:where(.cs-root) .comments-section .cs-reply-link svg { width: 12px; height: 12px; }

:where(.cs-root) .comments-section .cs-edited-indicator {
  font-size: 10px;
  color: var(--cs-text-muted);
  font-style: italic;
}

:where(.cs-root) .comments-section .cs-level-tag {
  font-size: 9px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px;
  display: inline;
  word-break: break-word;
}

:where(.cs-root) .comments-section .cs-level-section.home .cs-level-tag {
  background: var(--cs-home-bg);
  color: var(--cs-home-primary);
}

:where(.cs-root) .comments-section .cs-level-section.cycle .cs-level-tag {
  background: var(--cs-cycle-bg);
  color: var(--cs-cycle-primary);
}

:where(.cs-root) .comments-section .cs-level-section.item .cs-level-tag {
  background: var(--cs-item-bg);
  color: var(--cs-item-primary);
}

:where(.cs-root) .comments-section .cs-comment-menu { position: relative; }

:where(.cs-root) .comments-section .cs-menu-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--cs-text-muted);
  transition: opacity var(--cs-transition-fast), transform var(--cs-transition-fast), background-color var(--cs-transition-fast), color var(--cs-transition-fast), border-color var(--cs-transition-fast), box-shadow var(--cs-transition-fast);
}

:where(.cs-root) .comments-section .cs-menu-trigger:hover {
  background: var(--cs-bg-tertiary);
  color: var(--cs-text-primary);
}

:where(.cs-root) .comments-section .cs-menu-trigger svg { width: 16px; height: 16px; }

:where(.cs-root) .comments-section .cs-menu-dropdown {
  display: none;
  position: fixed;
  background: var(--cs-bg-elevated);
  border: 1px solid var(--cs-border-medium);
  border-radius: 8px;
  box-shadow: var(--cs-shadow-md);
  min-width: 140px;
  z-index: 10000;
}

:where(.cs-root) .comments-section .cs-menu-dropdown.open { display: block; }

:where(.cs-root) .comments-section .cs-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--cs-text-primary);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background var(--cs-transition-fast);
}

:where(.cs-root) .comments-section .cs-menu-item:hover { background: var(--cs-bg-tertiary); }
:where(.cs-root) .comments-section .cs-menu-item svg { width: 14px; height: 14px; color: var(--cs-text-muted); }

:where(.cs-root) .comments-section .cs-replies {
  margin-left: 20px;
  padding-left: 12px;
  border-left: 2px solid var(--cs-border-subtle);
  margin-top: 8px;
}

:where(.cs-root) .comments-section .cs-inline-reply {
  margin-top: 8px;
  padding: 10px;
  background: var(--cs-bg-tertiary);
  border-radius: 8px;
}

:where(.cs-root) .comments-section .cs-inline-reply-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

:where(.cs-root) .comments-section .cs-textarea {
  width: 100%;
  min-height: 60px;
  padding: 10px;
  font-size: 13px;
  font-family: var(--cs-font-body);
  background: var(--cs-bg-elevated);
  border: 1px solid var(--cs-border-medium);
  border-radius: 6px;
  color: var(--cs-text-primary);
  resize: vertical;
  box-sizing: border-box;
}

:where(.cs-root) .comments-section .cs-textarea:focus {
  outline: none;
  border-color: var(--cs-home-primary);
}

:where(.cs-root) .comments-section .cs-textarea::placeholder { color: var(--cs-text-muted); }

:where(.cs-root) .comments-section .cs-cancel-btn {
  padding: 6px 12px;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--cs-border-medium);
  border-radius: 6px;
  color: var(--cs-text-secondary);
  cursor: pointer;
  transition: opacity var(--cs-transition-fast), transform var(--cs-transition-fast), background-color var(--cs-transition-fast), color var(--cs-transition-fast), border-color var(--cs-transition-fast), box-shadow var(--cs-transition-fast);
}

:where(.cs-root) .comments-section .cs-cancel-btn:hover {
  background: var(--cs-bg-tertiary);
  color: var(--cs-text-primary);
}

:where(.cs-root) .comments-section .cs-submit-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  background: var(--cs-home-primary);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  transition: opacity var(--cs-transition-fast), transform var(--cs-transition-fast), background-color var(--cs-transition-fast), color var(--cs-transition-fast), border-color var(--cs-transition-fast), box-shadow var(--cs-transition-fast);
}

:where(.cs-root) .comments-section .cs-submit-btn:hover { filter: brightness(1.1); }
:where(.cs-root) .comments-section .cs-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
:where(.cs-root) .comments-section .cs-submit-btn svg { width: 14px; height: 14px; }

:where(.cs-root) .comments-section .cs-compose {
  padding: 12px;
  background: var(--cs-bg-tertiary);
  border-top: 1px solid var(--cs-border-subtle);
}

:where(.cs-root) .comments-section .cs-compose-inner { display: flex; flex-direction: column; gap: 10px; }

:where(.cs-root) .comments-section .cs-attachments { display: flex; flex-direction: column; gap: 8px; }

:where(.cs-root) .comments-section .cs-attachments-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--cs-text-muted);
}

:where(.cs-root) .comments-section .cs-checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }

:where(.cs-root) .comments-section .cs-checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--cs-bg-elevated);
  border: 1px solid var(--cs-border-medium);
  border-radius: 6px;
  cursor: pointer;
  transition: opacity var(--cs-transition-fast), transform var(--cs-transition-fast), background-color var(--cs-transition-fast), color var(--cs-transition-fast), border-color var(--cs-transition-fast), box-shadow var(--cs-transition-fast);
}

:where(.cs-root) .comments-section .cs-checkbox-item:hover { border-color: var(--cs-text-muted); }

:where(.cs-root) .comments-section .cs-checkbox-item input { display: none; }

:where(.cs-root) .comments-section .cs-checkbox-indicator {
  width: 16px;
  height: 16px;
  border: 2px solid var(--cs-border-medium);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--cs-transition-fast), transform var(--cs-transition-fast), background-color var(--cs-transition-fast), color var(--cs-transition-fast), border-color var(--cs-transition-fast), box-shadow var(--cs-transition-fast);
}

:where(.cs-root) .comments-section .cs-checkbox-indicator svg {
  width: 10px;
  height: 10px;
  color: white;
  opacity: 0;
  transition: opacity var(--cs-transition-fast);
}

:where(.cs-root) .comments-section .cs-checkbox-item.checked .cs-checkbox-indicator {
  background: var(--cs-home-primary);
  border-color: var(--cs-home-primary);
}

:where(.cs-root) .comments-section .cs-checkbox-item.checked .cs-checkbox-indicator svg { opacity: 1; }

:where(.cs-root) .comments-section .cs-checkbox-item.cycle.checked .cs-checkbox-indicator {
  background: var(--cs-cycle-primary);
  border-color: var(--cs-cycle-primary);
}

:where(.cs-root) .comments-section .cs-checkbox-item.item.checked .cs-checkbox-indicator {
  background: var(--cs-item-primary);
  border-color: var(--cs-item-primary);
}

:where(.cs-root) .comments-section .cs-checkbox-label {
  font-size: 12px;
  color: var(--cs-text-primary);
}

:where(.cs-root) .comments-section .cs-item-selector {
  margin-top: 8px;
  background: var(--cs-bg-elevated);
  border: 1px solid var(--cs-border-medium);
  border-radius: 8px;
  overflow: hidden;
}

:where(.cs-root) .comments-section .cs-item-search {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--cs-border-subtle);
  color: var(--cs-text-primary);
  box-sizing: border-box;
}

:where(.cs-root) .comments-section .cs-item-search:focus { outline: none; }
:where(.cs-root) .comments-section .cs-item-search::placeholder { color: var(--cs-text-muted); }

:where(.cs-root) .comments-section .cs-item-list {
  max-height: 150px;
  overflow-y: auto;
}

:where(.cs-root) .comments-section .cs-item-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background var(--cs-transition-fast);
}

:where(.cs-root) .comments-section .cs-item-option:hover { background: var(--cs-bg-tertiary); }

:where(.cs-root) .comments-section .cs-item-option-check {
  width: 16px;
  height: 16px;
  border: 2px solid var(--cs-border-medium);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

:where(.cs-root) .comments-section .cs-item-option-check svg {
  width: 10px;
  height: 10px;
  color: white;
  opacity: 0;
}

:where(.cs-root) .comments-section .cs-item-option.selected .cs-item-option-check {
  background: var(--cs-item-primary);
  border-color: var(--cs-item-primary);
}

:where(.cs-root) .comments-section .cs-item-option.selected .cs-item-option-check svg { opacity: 1; }

:where(.cs-root) .comments-section .cs-item-option-name {
  font-size: 12px;
  color: var(--cs-text-primary);
}

:where(.cs-root) .comments-section .cs-compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

:where(.cs-root) .comments-section .cs-compose-extras { display: flex; gap: 8px; }

:where(.cs-root) .comments-section .cs-extra-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 11px;
  background: transparent;
  border: 1px solid var(--cs-border-medium);
  border-radius: 6px;
  color: var(--cs-text-secondary);
  cursor: pointer;
  transition: opacity var(--cs-transition-fast), transform var(--cs-transition-fast), background-color var(--cs-transition-fast), color var(--cs-transition-fast), border-color var(--cs-transition-fast), box-shadow var(--cs-transition-fast);
}

:where(.cs-root) .comments-section .cs-extra-btn:hover {
  background: var(--cs-bg-elevated);
  color: var(--cs-text-primary);
}

:where(.cs-root) .comments-section .cs-extra-btn svg { width: 14px; height: 14px; }

:where(.cs-root) .comments-section .cs-empty-state {
  padding: 32px;
  text-align: center;
  color: var(--cs-text-muted);
  font-size: 13px;
}

:where(.cs-root) .comments-section .cs-loading {
  padding: 24px;
  text-align: center;
  color: var(--cs-text-muted);
  font-size: 13px;
}

.cs-mention-dropdown {
  display: none;
  position: fixed;
  background: var(--cs-bg-elevated);
  border: 1px solid var(--cs-border-medium);
  border-radius: 8px;
  box-shadow: var(--cs-shadow-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
}

.cs-mention-dropdown.open { display: block; }

.cs-mention-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--cs-transition-fast);
}

.cs-mention-option:hover { background: var(--cs-bg-tertiary); }

.cs-mention-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cs-home-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

.cs-mention-name {
  font-size: 12px;
  color: var(--cs-text-primary);
}

:where(.cs-root) .comments-section .cs-alert-picker {
  display: none;
  margin-top: 8px;
  padding: 10px;
  background: var(--cs-bg-elevated);
  border: 1px solid var(--cs-border-medium);
  border-radius: 8px;
}

:where(.cs-root) .comments-section .cs-alert-picker.open { display: block; }

:where(.cs-root) .comments-section .cs-alert-picker label {
  display: block;
  font-size: 11px;
  color: var(--cs-text-muted);
  margin-bottom: 4px;
}

:where(.cs-root) .comments-section .cs-alert-picker input {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  background: var(--cs-bg-tertiary);
  border: 1px solid var(--cs-border-medium);
  border-radius: 4px;
  color: var(--cs-text-primary);
  box-sizing: border-box;
}

:where(.cs-root) .comments-section .cs-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

:where(.cs-root) .comments-section .cs-reply-banner {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--cs-home-primary);
  background: var(--cs-home-bg);
  padding: 3px 8px;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}

:where(.cs-root) .comments-section .cs-reply-cancel-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--cs-text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
}

:where(.cs-root) .comments-section .cs-reply-cancel-btn:hover {
  color: var(--cs-text-primary);
}

:where(.cs-root) .comments-section .cs-comment.cs-reply-target > .cs-comment-card {
  border-color: var(--cs-home-primary);
  box-shadow: 0 0 0 1px var(--cs-home-primary);
}

/* ========== ULTRA CONDENSED LAYOUT ========== */

/* Tighter header */
:where(.cs-root) .comments-section .cs-header { padding: 4px 8px; }
:where(.cs-root) .comments-section .cs-header-title { font-size: 9px; }
:where(.cs-root) .comments-section .cs-header-count { font-size: 10px; }

/* Auto-size to content, capped at max-height, user can still resize */
:where(.cs-root) .comments-section .cs-body {
  position: relative;
  padding: 6px 8px;
  min-height: 60px;
  max-height: 420px;
  resize: vertical;
  overflow-y: auto;
}

/* Visual resize handle indicator */
:where(.cs-root) .comments-section .cs-body::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: var(--cs-border-medium);
  border-radius: 2px;
  opacity: 0.5;
  pointer-events: none;
}

/* Reply link inline with timestamp */
:where(.cs-root) .comments-section .cs-comment-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

:where(.cs-root) .comments-section .cs-meta-reply-link {
  font-size: 9px;
  color: var(--cs-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  margin-left: auto;
}

:where(.cs-root) .comments-section .cs-meta-reply-link:hover {
  color: var(--cs-home-primary);
  text-decoration: underline;
}

/* Compact compose form - horizontal layout */
:where(.cs-root) .comments-section .cs-compose { padding: 6px 8px; }
:where(.cs-root) .comments-section .cs-compose-inner {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}

/* Textarea takes most space */
:where(.cs-root) .comments-section .cs-compose-inner .cs-textarea {
  flex: 1;
  min-width: 200px;
  min-height: 32px;
  max-height: 60px;
  padding: 6px 8px;
  font-size: 12px;
  resize: none;
}

/* Attachments inline */
:where(.cs-root) .comments-section .cs-attachments {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
:where(.cs-root) .comments-section .cs-attachments-label { font-size: 9px; margin-right: 2px; }
:where(.cs-root) .comments-section .cs-checkbox-group { gap: 4px; }

/* Compose actions inline */
:where(.cs-root) .comments-section .cs-compose-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Smaller comment cards - ultra compact */
:where(.cs-root) .comments-section .cs-comment { margin-bottom: 2px; }
:where(.cs-root) .comments-section .cs-comment-card { padding: 4px 6px; border-radius: 4px; }
:where(.cs-root) .comments-section .cs-comment-header { margin-bottom: 2px; }
:where(.cs-root) .comments-section .cs-level-section { margin-bottom: 6px; }
:where(.cs-root) .comments-section .cs-level-header { margin-bottom: 2px; }
:where(.cs-root) .comments-section .cs-level-header span { font-size: 9px; }
:where(.cs-root) .comments-section .cs-level-comments { padding-left: 4px; }
:where(.cs-root) .comments-section .cs-replies { margin-left: 8px; padding-left: 4px; margin-top: 2px; border-left-width: 1px; }

/* Smaller text */
:where(.cs-root) .comments-section .cs-author { font-size: 10px; }
:where(.cs-root) .comments-section .cs-timestamp { font-size: 9px; }
:where(.cs-root) .comments-section .cs-comment-content { font-size: 11px; line-height: 1.3; }

/* Smaller buttons */
:where(.cs-root) .comments-section .cs-checkbox-item { padding: 2px 6px; }
:where(.cs-root) .comments-section .cs-checkbox-indicator { width: 12px; height: 12px; }
:where(.cs-root) .comments-section .cs-checkbox-indicator svg { width: 8px; height: 8px; }
:where(.cs-root) .comments-section .cs-checkbox-label { font-size: 10px; }
:where(.cs-root) .comments-section .cs-submit-btn { padding: 4px 10px; font-size: 10px; }
:where(.cs-root) .comments-section .cs-cancel-btn { padding: 4px 8px; font-size: 10px; }
:where(.cs-root) .comments-section .cs-extra-btn { padding: 3px 6px; font-size: 9px; }
:where(.cs-root) .comments-section .cs-reply-link { font-size: 10px; }

/* Empty state smaller */
:where(.cs-root) .comments-section .cs-empty-state { padding: 16px; font-size: 12px; }

/* Alert picker compact */
:where(.cs-root) .comments-section .cs-alert-picker { margin-top: 0; padding: 6px; }
:where(.cs-root) .comments-section .cs-alert-picker label { font-size: 10px; }
:where(.cs-root) .comments-section .cs-alert-picker input { padding: 4px 6px; font-size: 11px; }

/* Mobile responsive - stack compose form vertically */
@media (max-width: 600px) {
  :where(.cs-root) .comments-section { border-radius: 6px; }
  :where(.cs-root) .comments-section .cs-header { padding: 4px 8px; }
  :where(.cs-root) .comments-section .cs-body { max-height: 150px; }
  :where(.cs-root) .comments-section .cs-compose-inner {
    flex-direction: column;
    align-items: stretch;
  }
  :where(.cs-root) .comments-section .cs-compose-inner .cs-textarea {
    min-width: 100%;
    min-height: 28px;
  }
  :where(.cs-root) .comments-section .cs-attachments { flex-wrap: wrap; }
  :where(.cs-root) .comments-section .cs-compose-actions { justify-content: flex-end; }
}

/* Replaces the inline attribute on #cs-loading-overlay. The spinner ring
   colour is this panel's own purple; the theme's inherited default is blue. */
:where(.cs-root) .cs-loading-overlay { --px-loading-accent:#a855f7; }
