/*
 * ss-pages — 공지 주제 관리 배치 (ss = shadcn-studio). 설계 §5.5.
 *
 * 원본 블록(shadcn-studio, MCP로 소스를 읽었다. tmp/shadcn-studio/blocks/topics/):
 *   datatable-component-06  카드 한 장 = 도구 막대(p-6, border-b: 검색 · 필터) · 표(머리글 보조 글자색, 첫 열 pl-4) · 꼬리
 *   dashboard-dialog-04     머리(text-left 제목·설명) · 입력 하나(Label + Input) · 꼬리(취소 outline, 주 동작)
 *   form-layout-01          라벨 위·입력 아래의 세로 묶음(gap-2), 묶음 사이 gap-6, 제출 단추는 끝
 * 표 카드 틀(.ss-table-card·.ss-table-toolbar·.ss-table-search·.ss-table-alert)은 pages/view.css의 공용 배치다. 이 파일은 주제 화면에만
 * 있는 것을 둔다. 색·모서리·글자는 components.css의 [data-slot] 규칙이 맡는다.
 *
 * 블록과 다른 점:
 *   - 필터는 블록의 Select 셋 대신 ToggleGroup 하나(개수 배지)다. 줄을 바꾸지 않고 좁으면 가로 줄 상자(.ss-scroll-row) 안에서 밀린다.
 *   - 표 꼬리(쪽 이동)가 없다. 서버가 주제를 한 번에 돌려준다(원본 화면과 같다).
 *   - 행 동작 메뉴(⋯) 대신 주제 이름 단추가 상세 시트를 연다. 쓰기는 모두 시트 안에 있다.
 *   - 주제 추가는 Dialog가 아니라 오른쪽 Sheet(서랍)다(파일럿·운영과 같은 자리). 삭제 확인만 Dialog다.
 *   - 경계는 640px다(블록은 sm·md).
 * sticky: 없다. 화면 머리는 다른 새로 쓴 화면처럼 따라 내려오지 않고, 표 머리는 표 상자(가로 넘침 상자)에 묶여 세로로 붙지 않는다.
 * 상세 시트는 본문만 스크롤하므로 시트 제목·닫기는 늘 보인다.
 */
@layer ss-pages {
  /* ── 목록 카드 ── 도구 막대 첫 줄: 제목 · '?' 도움말 · 사용 중인 주제 수 */
  .ss-topics-heading-row { position: relative; display: flex; flex: 1 1 100%; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; min-width: 0; }
  /* '?' 도움말 팝오버는 단추가 아니라 제목 줄 왼쪽 끝에 맞춘다. 단추 옆에 두면 390px에서 오른쪽으로 넘쳐 페이지가 가로로 밀린다. */
  .ss-topics-heading-row > .ss-help-anchor { position: static; }
  .ss-topics-heading-row > .ss-help-anchor > [data-slot="popover-content"] { width: min(20rem, 100%); }
  .ss-topics-heading { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.5; }
  .ss-topics-total { margin: 0 0 0 auto; color: var(--ss-muted-foreground); font-size: .75rem; line-height: 1.5; }
  /* 필터 줄: 가로 줄 상자의 안쪽 여백(포커스 링 자리)만큼 바깥으로 당겨 검색 입력과 줄을 맞춘다. */
  .ss-topics-filters { flex: 0 1 auto; margin: -.375rem; }

  /* 목록 표: 주제 이름 단추(link)가 상세 시트를 연다. 긴 이름은 칸 안에서 줄을 바꾼다(8~20rem, 표의 줄바꿈 칸과 같다). */
  .ss-topics-row-trigger {
    justify-content: flex-start;
    min-width: 8rem;
    max-width: 20rem;
    padding-inline: 0;
    font-weight: 600;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  /* 행 선택은 행(data-state="selected")이 보인다. 이름 단추의 aria-pressed(원본 계약)에는 Button의 '고른 모양'을 쓰지 않는다. */
  .ss-topics-row-trigger[aria-pressed="true"] { color: var(--ss-primary); background: transparent; border-color: transparent; }
  .ss-topics-owner-name { display: block; }
  .ss-topics-owner-kind { display: block; color: var(--ss-muted-foreground); font-size: .75rem; line-height: 1.5; }
  .ss-topics-route-state { color: var(--ss-muted-foreground); }
  .ss-topics-route-state[data-tone="warning"] { color: var(--ss-status-warning-fg); font-weight: 600; }

  /* ── 상세(시트 본문) ── 화면의 직접 자식일 때(시트가 옮기기 전)는 숨긴다. studio/sheet.js가 이 노드를 시트 본문으로 옮긴다. */
  .ss-view > .ss-topics-detail { display: none; }
  .ss-topics-detail-body,
  .ss-topics-chats { display: grid; gap: 1rem; min-width: 0; }
  .ss-topics-sheet-status { margin: 0; color: var(--ss-muted-foreground); font-size: .75rem; line-height: 1.5; }
  .ss-topics-sheet-status:empty { display: none; }
  .ss-topics-guidance { margin: 0; color: var(--ss-muted-foreground); font-size: .8125rem; line-height: 1.5; }
  .ss-topics-detail-heading { display: grid; gap: .25rem; }
  .ss-topics-detail-description { margin: 0; color: var(--ss-muted-foreground); font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere; }
  .ss-topics-actions { display: grid; gap: .75rem; }
  .ss-topics-action-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
  .ss-topics-edit { max-width: 28rem; }
  /* 주의 동작(사용 중지·경로 재시도): 지우지 않으므로 outline이고, 되돌리기 번거로워 위험 색 글자·경계다(원본 outline-button is-danger). */
  .ss-topics-caution { color: var(--ss-destructive); border-color: var(--ss-destructive); }
  .ss-topics-caution:hover { color: var(--ss-destructive); background: var(--ss-destructive-surface); }

  .ss-topics-routes-heading { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; }
  .ss-topics-subheading { margin: 0; font-size: .875rem; font-weight: 600; line-height: 1.5; }
  .ss-topics-route-summary { margin: 0; color: var(--ss-muted-foreground); font-size: .8125rem; line-height: 1.5; }
  .ss-topics-show-all { margin-left: auto; }
  .ss-topics-routes [data-slot="table-head"] { color: var(--ss-muted-foreground); }
  .ss-topics-room-title { display: block; font-weight: 600; }
  .ss-topics-room-role { display: block; color: var(--ss-muted-foreground); font-size: .75rem; line-height: 1.5; }
  .ss-topics-status-line { display: flex; align-items: center; gap: .5rem; }
  .ss-topics-status-line + .ss-topics-status-line { margin-top: .375rem; }
  .ss-topics-status-label { min-width: 2rem; color: var(--ss-muted-foreground); font-size: .75rem; }
  /* 운영 안내 칸: 문장·조치 단추·기술 정보. 표 셀은 max-width를 무시하므로 폭은 이 상자가 정한다. */
  .ss-topics-guidance-cell { display: grid; gap: .5rem; min-width: 14rem; max-width: 24rem; }
  .ss-topics-route-guidance { margin: 0; font-weight: 450; line-height: 1.5; overflow-wrap: anywhere; }
  .ss-topics-technical pre { padding: .5rem .75rem; background: var(--ss-muted); border-radius: var(--ss-radius-md); font-size: .75rem; line-height: 1.5; }
  .ss-topics-deletion-targets { gap: .5rem; }
  /* 빈 상태(선택 없음·공지방 없음·확인 기록 없음 …): empty-state 블록의 점선 상자. */
  .ss-topics-empty { margin: 0; padding: 1.5rem; color: var(--ss-muted-foreground); text-align: center; border: 1px dashed var(--ss-border); border-radius: var(--ss-radius-md); }

  /* ── 주제 추가 서랍(Sheet 오른쪽) ── 파일럿 서랍과 같은 28rem. 닫기 X(sheet-close)가 머리 오른쪽 위에 놓인다. */
  .ss-topics-create-content { width: min(28rem, 100%); max-width: none; }
  .ss-topics-create [data-slot="sheet-header"] { padding-right: 3.5rem; }
  .ss-topics-create-form { display: flex; flex: 1; flex-direction: column; gap: 1.5rem; min-height: 0; margin: 0; padding: 0 1rem; overflow-y: auto; }
  .ss-topics-create-footer { padding-inline: 0; }

  /* ── 삭제 확인(Dialog) ── 지울 Telegram 주제 목록. 길면 그 안에서 스크롤한다. */
  .ss-topics-delete-targets {
    display: grid;
    gap: .25rem;
    max-height: 12rem;
    margin: 0;
    padding: .75rem 1rem;
    overflow-y: auto;
    list-style: none;
    background: var(--ss-muted);
    border-radius: var(--ss-radius-md);
    font-size: .875rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }
  .ss-topics-delete-form { display: grid; gap: 1rem; }

  @media (max-width: 640px) {
    .ss-topics-total { flex-basis: 100%; margin-left: 0; }
    .ss-topics-show-all { margin-left: 0; }
  }
}
