/* Thread presentation consumes community.css tokens; no workflow overrides. */
.community-page .ct-thread { margin: var(--community-space-4) 0 var(--community-space-5); }
.community-page .ct-row { display: grid; grid-template-columns: 28px minmax(0,1fr); gap: var(--community-space-2); position: relative; scroll-margin-top: var(--community-scroll-offset); }
.community-page .ct-avatar { border-radius: 50%; width: 28px; height: 28px; }
.community-page .ct-content { min-width: 0; }
.community-page .ct-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--community-space-1) var(--community-space-2); font-size: var(--community-text-sm); line-height: var(--community-line-ui); color: var(--community-secondary); }
.community-page .ct-meta strong { font-size: var(--community-text-sm); font-weight: 600; color: var(--community-text); }
.community-page .ct-body { font-size: var(--community-text-body); line-height: var(--community-line-body); white-space: pre-wrap; overflow-wrap: anywhere; margin: var(--community-space-1) 0; max-width: var(--community-reading-width); }
.community-page .ct-recipient { color: var(--community-brand); font-weight: 500; }
.community-page .ct-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--community-space-1); position: relative; }
.community-page :is(.ct-actions summary,.ct-controls button,.ct-more,.ct-replies>summary) { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-height: var(--community-touch); min-width: var(--community-touch); padding: 8px 10px; border: 0; border-radius: var(--community-radius-sm); background: transparent; font: inherit; font-size: var(--community-text-sm); line-height: var(--community-line-ui); color: var(--community-brand); cursor: pointer; list-style: none; }
.community-page :is(.ct-actions summary,.ct-top-composer>summary)::-webkit-details-marker { display: none; }
.community-page .ct-menu { position: relative; }
.community-page .ct-menu > summary { height: var(--community-touch); font-size: 20px; line-height: 1; }
.community-page .ct-menu-panel { position: absolute; top: 100%; left: 0; z-index: 20; min-width: 120px; padding: var(--community-space-1); border: 1px solid var(--community-border); border-radius: var(--community-radius-sm); background: var(--community-surface); box-shadow: var(--community-menu-shadow); }
.community-page .ct-menu-panel > a { display: flex; align-items: center; box-sizing: border-box; min-height: var(--community-touch); padding: 8px 12px; border-radius: var(--community-radius-sm); font-size: var(--community-text-sm); line-height: var(--community-line-ui); color: var(--community-text); white-space: nowrap; margin: 0; }
.community-page :is(.ct-actions summary,.ct-menu-panel a,.ct-more,.ct-replies>summary):hover { background: var(--community-neutral); }
.community-page .ct-replies { margin-left: 28px; }
.community-page .ct-replies > summary { font-weight: 600; }
/* One region owns the uninterrupted spine; rows own branches only.
   ResizeObserver measures the final avatar, independent of row/composer height. */
.community-page .ct-replies-body { display: flow-root; position: relative; padding-left: 16px; margin-left: 5px; }
.community-page .ct-replies-body::before { content: ""; position: absolute; left: 0; top: 0; height: var(--ct-spine-end, 0px); border-left: 1px solid var(--community-thread-line); }
.community-page .ct-replies:not([open]) > .ct-replies-body::before { display: none; }
.community-page .ct-reply { --ct-avatar-half: 12px; position: relative; margin: var(--community-space-3) 0; scroll-margin-top: var(--community-scroll-offset); }
.community-page .ct-reply::before { content: ""; position: absolute; box-sizing: border-box; left: -16px; top: calc(var(--ct-avatar-half) - 10px); width: 13px; height: 10px; border-left: 1px solid var(--community-thread-line); border-bottom: 1px solid var(--community-thread-line); border-bottom-left-radius: 10px; }
.community-page .ct-reply::after { content: none; }
.community-page .ct-reply .ct-avatar { width: 24px; height: 24px; }
.community-page .ct-reply .ct-row { grid-template-columns: 24px minmax(0,1fr); gap: var(--community-space-2); }

/* One shell for top-level, reply, and edit forms. 46 / 88 / 200px contract. */
.community-page :is(.ct-top-composer,.ct-composer[open],.ct-inline-slot .ct-input) { width: 100%; max-width: var(--community-composer-width); box-sizing: border-box; }
.community-page .ct-composer[open] { flex-basis: 100%; }
/* Question/answer editors follow their cards; comments/replies retain 700px. */
.community-page :is(.ct-top-composer.ct-document-composer,.ct-inline-slot .ct-input.ct-document-composer) { max-width: none; }
.community-page .ct-top-composer { margin: var(--community-space-3) 0; border: 1px solid var(--community-control-border); border-radius: var(--community-radius-composer); background: var(--community-surface); }
.community-page .ct-top-composer > summary { display: flex; align-items: center; box-sizing: border-box; min-height: var(--community-collapsed-height); padding: 10px 16px; color: var(--community-secondary); font-size: var(--community-text-body); line-height: var(--community-line-ui); cursor: pointer; list-style: none; border-radius: calc(var(--community-radius-composer) - 1px); }
.community-page .ct-composer:not([open]) > form { display: none; }
.community-page .ct-composer > summary { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.community-page .ct-top-composer:not([open]) { height: 46px; }
.community-page .ct-top-composer > summary { height: 44px; min-height: 44px; padding-top: 0; padding-bottom: 0; }
.community-page .ct-top-composer[open] > summary { display: none; }
.community-page .ct-top-composer > summary:hover { background: var(--community-neutral); }
.community-page .ct-input { box-sizing: border-box; min-width: 0; margin: var(--community-space-2) 0 var(--community-space-3); padding: var(--community-space-3); border: 1px solid var(--community-control-border); border-radius: var(--community-radius-composer); background: var(--community-surface); }
.community-page .ct-top-composer .ct-input { border: 0; margin: 0; max-width: none; border-radius: 0; background: transparent; }
/* The details summary inherits through a UA slot in Chromium. Explicit radii
   and a shell-level ring avoid a square child outline over the rounded border. */
.community-page :is(.ct-input,.ct-top-composer):hover { border-color: var(--community-brand); }
.community-page :is(.ct-input,.ct-top-composer):focus-within { border-color: var(--community-focus); outline: 2px solid var(--community-focus); outline-offset: 3px; box-shadow: none; }
.community-page .ct-top-composer > summary:focus-visible { outline: none; box-shadow: none; border-radius: calc(var(--community-radius-composer) - 1px); }
.community-page .ct-top-composer .ct-input:focus-within { outline: none; box-shadow: none; }
.community-page .ct-input label { display: block; position: static; height: auto; min-height: 0; padding: 0; margin: 0 0 var(--community-space-2); transform: none; font-size: var(--community-text-sm); font-weight: 500; line-height: var(--community-line-ui); color: var(--community-brand); }
.community-page .ct-input textarea { display: block; width: 100%; box-sizing: border-box; height: auto; min-height: var(--community-editor-min); max-height: var(--community-editor-max); margin-top: var(--community-space-1); padding: 6px 4px; border: 0; border-radius: var(--community-radius-sm); outline: none; box-shadow: none; background: transparent; color: var(--community-text); font: inherit; font-size: var(--community-text-editor); font-weight: 400; line-height: var(--community-line-ui); resize: none; overflow-y: auto; overflow-wrap: anywhere; }
.community-page .ct-input textarea:focus-visible { outline: none; box-shadow: none; }
.community-page .ct-input textarea::placeholder { color: var(--community-secondary); opacity: 1; }
.community-page .ct-input .community-trust-note { font-size: var(--community-text-xs); margin: var(--community-space-2) 0; color: var(--community-secondary); }
.community-page .ct-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--community-space-2); margin-top: var(--community-space-2); }
.community-page .ct-controls button { min-width: 64px; border-radius: var(--community-radius-composer); padding: 8px 16px; background: var(--community-neutral); color: var(--community-text); }
.community-page .ct-controls .ct-primary { background: var(--moment-green); color: #fff; }
.community-page .ct-controls .ct-primary:hover:not(:disabled) { background: var(--moment-green-dark); }
.community-page .ct-controls button:not(.ct-primary):hover { background: color-mix(in srgb,var(--community-border) 40%,var(--community-neutral)); }
.community-page .ct-error { margin-top: var(--community-space-2); }
.community-page .ct-error:empty { display: none; }
.community-page .ct-inline-slot .community-form { margin: var(--community-space-2) 0; }
.community-page .ct-inline-slot [data-thread-cancel] { min-height: var(--community-touch); }
.community-page .ct-kind { display: inline-flex; align-items: center; gap: var(--community-space-1); font-size: var(--community-text-sm); font-weight: 700; margin-bottom: var(--community-space-2); }
.community-page .ct-kind > [aria-hidden=true] { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 1px solid currentColor; border-radius: 7px; font-size: 14px; line-height: 1; flex: none; }
.community-page .ct-question-kind { color: var(--community-question-label); }
.community-page .ct-answer-kind { color: var(--community-brand); }
.community-page .ct-reveal { animation: community-reveal 2s ease-out; }
.community-page .ct-reveal:focus { outline: 2px solid var(--community-focus); outline-offset: 4px; }
@keyframes community-reveal { from { box-shadow: 0 0 0 3px var(--community-thread-line); background-color: var(--community-success-bg); } to { box-shadow: 0 0 0 0 transparent; } }
@media(max-width:640px) {
    .community-page .ct-row { grid-template-columns: 26px minmax(0,1fr); }
    .community-page .ct-avatar { width: 26px; height: 26px; }
    .community-page .ct-replies { margin-left: 21px; }
    .community-page .ct-replies-body { padding-left: 12px; }
    .community-page .ct-reply::before { left: -12px; width: 10px; }
    .community-page .ct-reply { --ct-avatar-half: 11px; }
    .community-page .ct-reply .ct-row { grid-template-columns: 22px minmax(0,1fr); gap: 6px; }
    .community-page .ct-reply .ct-avatar { width: 22px; height: 22px; }
    .community-page :is(.ct-top-composer,.ct-composer[open],.ct-inline-slot .ct-input) { max-width: none; }
    .community-page .ct-input { padding: var(--community-space-3); }
    .community-page .ct-top-composer > summary { padding: 10px 14px; }
}
@media(prefers-reduced-motion:reduce) {
    .community-page .ct-reveal { animation: none; box-shadow: 0 0 0 2px var(--community-thread-line); }
}

/* Dirty-editor discard confirmation uses the established Community controls. */
.ct-discard-dialog { margin: auto; inset: 0; box-sizing: border-box; max-width: calc(100% - 32px); width: min(420px, calc(100% - 32px)); padding: 24px; border: 1px solid #cbd5e1; border-radius: 16px; color: #24362d; background: #fff; box-shadow: 0 12px 36px #152b2426; }
.ct-discard-dialog::backdrop { background: #152b2459; }
.ct-discard-dialog h2 { font-size: 1.125rem; margin: 0 0 12px; }
.ct-discard-dialog p { line-height: 1.6; margin: 0 0 20px; }
.ct-discard-dialog .ct-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.ct-discard-dialog button { min-height: 44px; padding: 8px 12px; border: 1px solid #bdcdc4; border-radius: 24px; background: #fff; color: #244637; }
.ct-discard-dialog button.ct-primary { background: #176b48; color: #fff; border-color: #176b48; }
.ct-discard-dialog button:focus-visible { outline: 3px solid #218560; outline-offset: 3px; }

