/* Figma Comments section 4091:13932 — layout and interaction states. */
.comments-section { display: flex; flex-direction: column; gap: var(--prism-space-16); padding: 0 var(--prism-space-20); min-height: calc(100dvh - max(54px, env(safe-area-inset-top))); }
.comments-issue-header { padding: var(--prism-space-16) 0; border-bottom: 1px solid var(--prism-color-border-subtle); }
.comments-issue-header h1 { margin: var(--prism-space-8) 0 0; font-size: var(--prism-font-title-18); font-weight: var(--prism-font-weight-bold); line-height: var(--prism-line-title-18); }
.comments-controls-row { display: flex; min-height: 52px; align-items: center; justify-content: space-between; gap: var(--prism-space-8); padding: 4px 0; }
.comments-sort-bar { position: relative; display: flex; min-width: 0; align-items: center; justify-content: flex-start; gap: var(--prism-space-8); }
.sort-chip { width: auto; min-height: 44px; border: 0; border-radius: 0; padding: 0; background: transparent; color: var(--prism-color-text-primary); font-size: var(--prism-font-body-15); font-weight: var(--prism-font-weight-medium); white-space: nowrap; }
.sort-chip.active { background: var(--prism-color-brand-subtle); color: var(--prism-color-brand); }
.comments-list { display: flex; flex-direction: column; }
.comments-section > .comments-issue-header, .comments-section > .opinion-issue-header { order: 2; }
.comments-section > .comments-controls-row, .comments-section > .comments-sort-bar { order: 3; }
.comments-section > .comments-list, .comments-section > .comments-empty, .comments-section > .comments-loading, .comments-section > .comments-error { order: 4; }
/* The composer is pinned below the list. It is wrapped in `.comments-main-composer` (hidden in reply mode)
   and the reply composer sits in `.reply-composer-wrapper`; both wrappers must take the same order or
   they fall back to order 0 and render above the header (regression seen on TestFlight 0.2.11). */
.comments-section > .comment-composer,
.comments-section > .comments-main-composer,
.comments-section > .reply-composer-wrapper { order: 5; }
/* Sticky input bar (user requirement): the composer wrappers are the sticky elements, pinned above the
   safe area while the list scrolls underneath. A sticky child cannot leave its own wrapper, so the
   wrappers carry the position, not the inner form. `.comments-section > .comments-list` keeps bottom
   padding so the last comment is never hidden behind the bar. */
.comments-section > .comments-main-composer,
.comments-section > .reply-composer-wrapper {
  position: sticky; bottom: calc(var(--comments-keyboard-inset, 0px) + max(34px, env(safe-area-inset-bottom))); z-index: 10;
}
/* Long lists reserve space before the sticky composer so the last comment is never covered. */
.comments-section > .comments-list { padding-bottom: 160px; }
.comment-thread { padding: var(--prism-space-16) 0; border-bottom: 1px solid var(--prism-color-border-subtle); }
.comment-profile-link { display: inline-flex; align-items: center; gap: var(--prism-space-8); border: 0; padding: 0; color: inherit; background: none; }
.comment-menu-overlay, .confirm-overlay, .report-sheet-overlay, .comments-sheet-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: transparent; }
.comment-menu { justify-self: end; align-self: start; margin: 120px 20px 0 0; min-width: 176px; padding: 4px 0; border-radius: var(--prism-radius-lg); background: var(--prism-color-surface); box-shadow: var(--prism-shadow-floating); }
.comment-menu-item { display: block; width: 100%; min-height: 44px; border: 0; padding: 0 12px 0 16px; text-align: left; background: transparent; }
.comment-menu-item.danger, .danger-text { color: #e5484d; }
.bottom-sheet { align-self: end; width: 100%; max-height: 80dvh; overflow: auto; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: var(--prism-color-surface); box-shadow: var(--prism-shadow-sheet); }
/* Comment sheets use the shared chrome, which supplies the 20/8px insets and the
   trailing safe area (`.prism-sheet-safe-area`), so the safe area has exactly one
   owner: this sheet keeps only its own top inset and its 24px bottom gap and must
   not re-add env(safe-area-inset-bottom). */
.comments-sheet { align-self: end; width: 100%; max-height: 80dvh; overflow: auto; padding: 8px 0 24px; border-radius: 24px 24px 0 0; background: var(--prism-color-surface); box-shadow: var(--prism-shadow-sheet); }
.comments-sheet > :not(.prism-sheet-handle):not(.prism-sheet-header):not(.prism-sheet-safe-area) { margin-inline: 20px; }
.comments-sheet-overlay { background: var(--prism-color-bg-overlay); }
.comments-sheet header { display: flex; align-items: center; justify-content: space-between; }
.comments-sheet button, .bottom-sheet button { min-height: 44px; }
.profile-stats { display: flex; justify-content: space-between; gap: 8px; margin-top: 24px; }
.profile-stats p { display: flex; flex-direction: column; color: var(--prism-color-text-secondary); }
.comment-composer { position: relative; z-index: 10; display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--prism-color-border-subtle); background: var(--prism-color-surface); }
.comment-composer textarea { width: 100%; min-height: 40px; max-height: 120px; border: 0; border-radius: 999px; padding: 10px 14px; font: inherit; background: var(--prism-color-surface-subtle); }
.comment-composer textarea:focus { outline: 2px solid var(--prism-color-brand); }
.edit-inline-wrapper textarea { width: 100%; min-height: 40px; max-height: 120px; resize: vertical; border: 1px solid var(--prism-color-border-subtle); border-radius: 24px; padding: 10px 14px; font: inherit; }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
/* Figma CommentComposer 4009:539 buttons are 36px visuals inside the 44px
   touch targets — the approved .reaction-chip/.reaction-pill pattern. The
   44px targets sit side by side with a 6px gap and never overlap. */
.composer-thought { display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; flex: none; border: 0; padding: 0; border-radius: 999px; background: transparent; cursor: pointer; }
.composer-thought-pill { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 18px; background: var(--prism-color-surface-subtle); }
.composer-thought-pill img { width: 18px; height: 18px; filter: none; }
.composer-send { display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; flex: none; border: 0; padding: 0; border-radius: 999px; background: transparent; cursor: pointer; }
.composer-send-pill { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 18px; background: var(--prism-color-brand-subtle); }
.composer-send-pill img { width: 18px; height: 18px; filter: none; }
.composer-send:disabled { cursor: not-allowed; }
.composer-send:disabled .composer-send-pill { background: var(--prism-color-disabled); }
.composer-send:disabled .composer-send-pill img { opacity: .6; }
.composer-spinner { display: grid; place-items: center; width: 44px; height: 44px; flex: none; color: var(--prism-color-brand); font-size: 24px; animation: prism-comments-spin 900ms linear infinite; }
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; }
.suggest-bar { display: flex; align-items: center; gap: 8px; min-height: 40px; overflow-x: auto; border-radius: var(--prism-radius-md); padding: 0 12px; background: var(--prism-color-surface-subtle); color: var(--prism-color-brand); }
.suggest-bar button { flex: 0 0 auto; min-height: 36px; border: 0; border-radius: var(--prism-radius-full); padding: 0 10px; background: transparent; color: var(--prism-color-brand); }
.reply-composer-wrapper, .edit-inline-wrapper { margin: 12px 0; padding: 12px; border-radius: var(--prism-radius-lg); background: var(--prism-color-brand-subtle); }
/* MVP tier 2 (5-7, Figma 8010:5361): reply thread header with an arrow icon back button and an 18px bold title. */
.comments-replies-header { display: flex; align-items: center; gap: var(--prism-space-8); min-height: var(--prism-touch-min); }
.comments-replies-header button { display: inline-flex; align-items: center; justify-content: center; width: var(--prism-touch-min); height: var(--prism-touch-min); padding: 0; border: 0; background: transparent; color: inherit; font-size: 0; }
.comments-replies-header button::before { content: ""; width: 24px; height: 24px; background: url("public/brand/icons/arrow-left.svg") center / contain no-repeat; }
.comments-replies-header h2 { margin: 0; font-size: var(--prism-font-title-18); font-weight: var(--prism-font-weight-bold); line-height: var(--prism-line-title-18); }
/* MVP tier 2 (5-16, Figma 8010:5404): the comment the reply composer targets is highlighted light blue. */
.comment-thread.is-reply-target { background: #DCEBFF; border-radius: 12px; }
.comments-main-composer.is-reply-active { display: none; }
.more-replies { display: inline-flex; min-height: var(--prism-touch-min); align-items: center; gap: 4px; border: 0; padding: 4px 20px 16px 52px; background: transparent; color: var(--prism-color-brand); font-size: var(--prism-font-caption-12); font-weight: var(--prism-font-weight-medium); }
.more-replies img { width: 14px; height: 14px; filter: none; }
.comments-empty, .comments-error, .comments-loading { padding: 36px 0; text-align: center; }
.comments-error { color: var(--prism-color-text-tertiary); }
.comments-error > p:first-child { color: var(--prism-color-text-primary); }
.comments-error .prism-button { width: auto; min-width: 120px; min-height: 44px; padding: 0 24px; border: 1px solid var(--prism-color-border-default); border-radius: 999px; background: var(--prism-color-surface); color: var(--prism-color-text-primary); box-shadow: none; }
.feedback-banner { position: sticky; bottom: 150px; padding: 12px 16px; border-radius: var(--prism-radius-lg); background: var(--prism-color-surface-subtle); }
.tone-suggestion h3 { margin-bottom: 4px; font-size: var(--prism-font-caption-12); color: var(--prism-color-text-secondary); }
.tone-suggestion > button { width: 100%; margin-top: 8px; border: 0; border-radius: var(--prism-radius-full); background: var(--prism-color-brand-subtle); color: var(--prism-color-brand); }
.comments-filter-row { position: sticky; top: 0; z-index: 5; display: flex; flex: none; align-items: center; justify-content: flex-end; padding: 0; background: var(--prism-color-surface); }
/* Figma ToneFilterChip 4007:419: a 30px brand-subtle pill inside the 44px
   touch target — the same pattern as .reaction-chip/.reaction-pill. */
.comments-filter-trigger { display: inline-flex; align-items: center; min-height: var(--prism-touch-min); padding: 0; border: 0; background: transparent; }
.comments-filter-pill { display: inline-flex; height: 30px; min-height: 30px; align-items: center; padding: 4px 12px 4px 10px; border-radius: var(--prism-radius-full); background: var(--prism-color-brand-subtle); color: var(--prism-color-text-brand); font-size: var(--prism-font-caption-12); font-weight: var(--prism-font-weight-medium); }
.comments-sort-bar { position: relative; display: flex; justify-content: flex-end; }
.comments-sort-menu { position: absolute; top: calc(100% + 4px); right: 0; z-index: 12; min-width: 176px; padding: 4px 0; border-radius: var(--prism-radius-lg); background: var(--prism-color-surface); box-shadow: var(--prism-shadow-floating); }
.sort-option { width: 100%; min-height: 44px; border: 0; padding: 0 12px 0 16px; text-align: left; background: transparent; }
.tone-filter-toggle, .blocked-users-row { width: 100%; min-height: 48px; border: 0; padding: 10px 0; text-align: left; background: transparent; }
.blocked-users-row { display: flex; justify-content: space-between; border-top: 1px solid var(--prism-color-border-subtle); }
.comment-tone-controls { display: flex; align-items: center; gap: 12px; color: var(--prism-color-text-secondary); font-size: var(--prism-font-caption-12); }
.comment-tone-controls button { border: 0; padding: 6px 0; background: transparent; color: var(--prism-color-brand); }
.comment-reported-hidden, .reply-reported-hidden { padding: 12px 0; color: var(--prism-color-text-secondary); }
.comment-reported-hidden button, .reply-reported-hidden button { min-height: 36px; border: 0; padding: 0; background: transparent; color: var(--prism-color-brand); }
.comment-card.is-editing { border-radius: var(--prism-radius-lg); padding: 12px; background: var(--prism-color-brand-subtle); }
.comment-card.is-editing .comment-time { color: var(--prism-color-brand); }
@keyframes prism-comments-spin { to { transform: rotate(360deg); } }
.composer-toast { position: fixed; left: 20px; right: 20px; bottom: calc(110px + env(safe-area-inset-bottom)); z-index: 20; padding: 12px 16px; border-radius: var(--prism-radius-lg); background: var(--prism-color-surface); box-shadow: var(--prism-shadow-sheet); color: var(--prism-color-text-primary); }

/* MVP D / Figma 8010:558: 생각 정리 초안 안내. */
.composer-draft-dismiss { margin-left: 8px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.composer-draft-notice { margin: 0 0 6px; padding: 8px 12px; border-radius: var(--prism-radius-lg); background: var(--prism-color-brand-subtle); color: var(--prism-color-text-brand); font-size: var(--prism-font-caption-12); line-height: var(--prism-line-caption-12); }

/* MVP fidelity (Figma 8010:653/677/807/842/874/905/299): production states. */
.comments-loading { padding: 16px 0 0; }
.comment-skeleton { display: grid; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--prism-color-border-default); }
.comment-skeleton-head { display: flex; align-items: center; gap: 8px; }
.comment-skeleton-head i { display: block; width: 32px; height: 32px; border-radius: 50%; background: var(--prism-color-surface-subtle); }
.comment-skeleton-head b { display: block; width: 64px; height: 14px; border-radius: 6px; background: var(--prism-color-surface-subtle); }
.comment-skeleton-head em { display: block; width: 40px; height: 12px; border-radius: 6px; background: var(--prism-color-surface-subtle); }
.comment-skeleton > span { display: block; height: 14px; border-radius: 6px; background: var(--prism-color-surface-subtle); }
.comment-skeleton > span:nth-of-type(1) { width: 100%; }
.comment-skeleton > span:nth-of-type(2) { width: 100%; }
.comment-skeleton > span:nth-of-type(3) { width: 57%; }

.confirm-overlay { background: rgba(17, 17, 17, 0.4); }
.comments-error img { display: block; width: 120px; height: auto; margin: 0 auto 16px; }
.confirm-dialog { display: grid; justify-items: center; gap: 12px; width: min(313px, calc(100% - 40px)); box-sizing: border-box; padding: 24px 20px 20px; border-radius: 24px; background: var(--prism-color-surface); text-align: center; }
.confirm-dialog h2 { margin: 0; color: var(--prism-color-text-primary); font-size: var(--prism-font-title-18); font-weight: var(--prism-font-weight-bold); }
.confirm-dialog p { margin: 0; color: var(--prism-color-text-secondary); font-size: var(--prism-font-body-14); line-height: 1.5; }
.confirm-actions { display: grid; gap: 8px; width: 100%; margin-top: 8px; }
.confirm-actions .prism-button, .confirm-actions .prism-button--danger, .confirm-actions .prism-button--primary { width: 100%; }
.confirm-actions > .prism-button { border: 0; background: transparent; color: var(--prism-color-text-brand); box-shadow: none; }

.comment-deleted-hint { display: flex; align-items: center; gap: 8px; margin: 0; padding: 14px 16px; border-radius: var(--prism-radius-lg); background: var(--prism-color-surface-subtle); color: var(--prism-color-text-tertiary); font-size: var(--prism-font-body-14); }

.feedback-banner.toast { position: fixed; left: 20px; right: 20px; bottom: calc(env(safe-area-inset-bottom) + 108px); z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 0; padding: 14px 16px; border-radius: 12px; background: var(--prism-color-text-primary); color: var(--prism-color-surface); font-size: var(--prism-font-body-14); }
.feedback-banner.toast .feedback-dismiss { flex: none; width: 24px; height: 24px; min-height: 0; padding: 0; border: 0; background: transparent; color: inherit; font-size: 18px; line-height: 1; }

.briefing-unavailable img { display: block; width: 120px; height: auto; margin: 0 auto 16px; }
.briefing-unavailable p { max-width: 220px; margin: 0 auto 24px; color: var(--prism-color-text-tertiary); font-size: var(--prism-font-body-14); line-height: 1.5; }
.briefing-unavailable .prism-button { width: auto; min-width: 180px; min-height: 44px; padding: 0 24px; border: 1px solid var(--prism-color-border-default); border-radius: 999px; background: var(--prism-color-surface); color: var(--prism-color-text-primary); box-shadow: none; }
.comment-deleted-hint img { width: 18px; height: 18px; flex: none; }

/* Figma 8010:254 briefing skeleton: chip/title/meta, two cards, then text lines. */
.briefing-skeleton { display: grid; gap: 12px; padding: 16px 20px; }
.briefing-skeleton > span { display: block; border-radius: 12px; background: var(--prism-color-surface-subtle); }
.bs-chip { width: 72px; height: 22px; border-radius: 999px !important; }
.bs-title { width: 260px; height: 22px; border-radius: 6px !important; }
.bs-meta { width: 180px; height: 12px; border-radius: 6px !important; }
.bs-block { height: 200px; margin-top: 8px; }
.bs-block-short { height: 96px; margin-top: 0; }
.bs-line { height: 14px; border-radius: 6px !important; }
.bs-line-short { width: 60%; }
.confirm-character { width: 72px; height: auto; }
