/* ═══════════════════════════════════════════════════════════
   모바일 밀도·정렬 보정 (2026-10-29)
   - 버튼 글자가 "배경음/악"처럼 한 글자씩 꺾이던 것 → 줄바꿈 금지 + 한 줄에 고르게 채움
   - 탭이 세로로 쌓이거나 글자가 꺾이던 것 → 가로를 꽉 채우는 한 줄/고른 격자
   - 제목 옆 빈 공간 → 제목 줄 오른쪽에 도구 버튼, 설명 글자는 작게
   모듈 CSS(snshub.css 등)는 나중에 불러오므로 #stage 를 앞에 붙여 우선순위를 높였습니다.
   ═══════════════════════════════════════════════════════════ */

/* ── 공통: 머리글·도구 줄의 버튼은 글자를 꺾지 않는다 ── */
#stage .ag-head-act .btn-sm, #stage .ct-top-btns .btn-sm, #stage .sp-trow .btn-sm, #stage .sr-trow .btn-sm,
#stage .sh-head .btn-sm, #stage .sh-bar .btn-sm, #stage .st-tools .btn-sm, #stage .row > .btn-sm,
#stage .seg button, #stage .sh-tabs button, #stage .sh-seg button, #stage .sp-sub-tabs button, #stage .sr-subtabs button {
  white-space: nowrap; max-width: 100%; line-height: 1.25;
}
/* 제목 줄(제목 + 사용 설명서 버튼) — 데스크톱에서도 한 줄 */
#stage .sp-trow, #stage .sr-trow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* 위험 버튼: 어두운 바탕에 빨간 글자라 읽기 어려웠음 → 밝은 바탕 + 빨간 테두리 */
#stage .ct-top-btns .danger-btn { background: var(--panel); border: 1px solid var(--rise); color: var(--rise) !important; }

@media (max-width: 860px) {
  /* 제목·설명 */
  #stage .h1 { font-size: 22px; margin-bottom: 2px; }
  #stage .lede { font-size: 13px; line-height: 1.5; margin-bottom: 12px; }

  /* 한 줄짜리 segmented 탭(품셈·주식 등): 가로를 꽉 채우고 칸 폭을 글자 길이에 맞춤 */
  #stage .row > .seg:only-child { display: flex; width: 100%; overflow-x: auto; scrollbar-width: none; }
  #stage .row > .seg:only-child::-webkit-scrollbar { display: none; }
  #stage .row > .seg:only-child button { flex: 1 1 auto; padding: 9px 5px; font-size: 13px; text-align: center; }
  #stage .row:has(> .seg:only-child) { margin-bottom: 10px !important; }

  /* 밑줄 탭(.tabs): 줄마다 오른쪽이 비지 않게 칸을 늘려 채움 */
  #stage .tabs { gap: 0 2px; margin-bottom: 12px; }
  #stage .tabs .tab { flex: 1 1 auto; text-align: center; white-space: nowrap; padding: 8px 8px; font-size: 13px; }

  /* 알약 하위 탭 */
  #stage .sp-sub-tabs, #stage .sr-subtabs { gap: 5px; margin-bottom: 10px; }
  #stage .sp-sub-tabs button, #stage .sr-subtabs button { flex: 1 1 auto; padding: 7px 10px; font-size: 13px; }

  /* 스튜디오 머리글: 가속 칩 + 도구 버튼 3개 */
  #stage .st-head .ag-head-act { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  #stage .st-head .ag-head-act .btn-sm { padding: 8px 2px; font-size: 12.5px; text-align: center; }
  #stage .st-head .ag-head-act #stHw { grid-column: 1 / -1; }
  #stage .st-head .ag-head-act #stHw:empty { display: none; }

  /* AI 에이전트 머리글: 사용 설명서·배경음악·메신저·새 업무를 한 줄에 */
  #stage .ag-head-act { gap: 6px; }
  #stage .ag-head-act .btn-sm { flex: 1 1 auto; padding: 8px 7px; font-size: 12.5px; text-align: center; }

  /* 관제 패널 머리: 제목 한 줄, 아래에 버튼 두 개를 나란히 */
  #stage .ag-sec-h { flex-wrap: wrap; }
  #stage .ag-sec-h h4 { flex: 1 1 100%; }
  #stage .ct-top-btns { width: 100%; }
  #stage .ct-top-btns .btn-sm { flex: 1 1 auto; padding: 8px 8px; font-size: 12.5px; text-align: center; }
  #stage .ct-top-btns .btn-sm[data-cact="pause-all"], #stage .ct-top-btns .btn-sm[data-cact="resume-all"] { flex: 2 1 auto; }

  /* 제휴 마케팅·SNS Radar: 제목 줄 오른쪽에 사용 설명서 */
  #stage .sp-head, #stage .sr-head { gap: 8px; margin-bottom: 10px; }
  #stage .sp-hbox, #stage .sr-hbox { width: 100%; }
  #stage .sp-trow, #stage .sr-trow { justify-content: space-between; }
  #stage .sp-trow .h1 .mini { display: none; }
  #stage .sp-sub, #stage .sr-sub { font-size: 12.5px; line-height: 1.45; margin-top: 3px; }
  #stage .sp-trow .btn-sm, #stage .sr-trow .btn-sm { padding: 7px 11px; font-size: 12.5px; }
  /* 상태 알약: 2열 격자로 정렬 */
  #stage .sp-conn { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; }
  #stage .sp-pill { padding: 5px 9px; font-size: 12px; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #stage .sr-act { width: 100%; justify-content: space-between; gap: 8px; }

  /* SNS 발행센터 머리글: [제목 · 사용 설명서] / [탭 4칸] / [연결 상태] */
  #stage .sh-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "t m" "tabs tabs" "conn conn"; gap: 6px 8px; align-items: center; padding-bottom: 8px; }
  #stage .sh-head .h1 { grid-area: t; }
  #stage .sh-act { display: contents; }
  #stage #shManual { grid-area: m; padding: 7px 11px; font-size: 12.5px; }
  #stage .sh-tabs { grid-area: tabs; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
  #stage .sh-tabs button { padding: 8px 2px; font-size: 12.5px; text-align: center; border: 1px solid var(--line); }
  #stage .sh-tabs button.on { border-color: var(--text); }
  #stage #shConn { grid-area: conn; display: flex; justify-content: space-between; gap: 6px; white-space: nowrap; overflow: hidden; }
  #stage #shConn span { margin-right: 0 !important; }

  /* 발행센터 하단 게시 바: 화면을 덮던 고정(sticky)을 풀고 버튼 3개를 한 줄로 */
  #stage .sh-bar { position: static; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px; }
  #stage .sh-bar > .btn-sm { padding: 9px 4px; font-size: 12.5px; text-align: center; }
  #stage .sh-bar #shNow { order: 1; } #stage .sh-bar #shAppr { order: 2; } #stage .sh-bar #shSave { order: 3; }
  #stage .sh-bar > .sh-row { order: 4; grid-column: 1 / -1; }
  #stage .sh-bar > .sh-row .sh-in { flex: 1 1 auto; width: auto; min-width: 0; }
  #stage .sh-bar > .sh-row .btn-sm { padding: 8px 12px; }
  #stage .sh-bar > .sh-hint { order: 5; grid-column: 1 / -1; margin-left: 0 !important; font-size: 11.5px; line-height: 1.45; }
  #stage .sh-bar > .sh-hint .btn-sm { margin-left: 4px; padding: 5px 10px; font-size: 12px; }

  /* 주식: 시세 갱신 줄 — 버튼 둘을 나란히, 안내 글자는 아래 한 줄 */
  #stage .st-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px !important; }
  #stage .st-tools .spacer { display: none; }
  #stage .st-tools #btnRefresh { order: 1; } #stage .st-tools #btnPing { order: 2; }
  #stage .st-tools .btn-sm { width: 100%; padding: 9px 6px; font-size: 13px; text-align: center; }
  #stage .st-tools .mini { order: 3; grid-column: 1 / -1; text-align: center; margin: 0; }
  #stage .st-tools .mini:empty { display: none; }
}

/* ── AI 에이전트 모바일(2026-10-30): 업무보드는 가로 스크롤 대신 상태 탭으로 한 칸씩 ── */
.ag-coltabs{display:none}
@media (max-width:860px){
  .ag-tabs{position:sticky;top:0;z-index:5;background:var(--bg,var(--panel));margin-bottom:12px;scroll-snap-type:x proximity}
  .ag-tab{scroll-snap-align:center;padding:11px 14px;min-height:44px}
  .ag-toolbar{gap:8px;margin-bottom:10px}
  .ag-toolbar .ag-seg{flex:1 1 auto}
  .ag-toolbar .ag-seg button{flex:1;padding:8px 6px}
  .ag-coltabs{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:4px;position:sticky;top:44px;z-index:4;background:var(--bg,var(--panel));padding:6px 0 8px;margin-bottom:6px}
  .ag-coltab{display:flex;flex-direction:column;align-items:center;gap:2px;padding:7px 2px;font-size:12px;line-height:1.2;color:var(--text-3);background:var(--panel-2);border:1px solid var(--line);border-top:3px solid var(--line);border-radius:8px;font-family:inherit;cursor:pointer;min-width:0;white-space:nowrap}
  .ag-coltab b{font-family:var(--mono);font-size:14px;color:var(--text)}
  .ag-coltab.on{background:var(--panel-3);color:var(--text);font-weight:600}
  .ag-coltab.ag-col-queued{border-top-color:#5E6A80}.ag-coltab.ag-col-working{border-top-color:#4F8CFF}.ag-coltab.ag-col-review{border-top-color:#36B3C9}
  .ag-coltab.ag-col-approval{border-top-color:#A883FF}.ag-coltab.ag-col-done{border-top-color:#3FB97A}.ag-coltab.ag-col-closed{border-top-color:var(--rise)}
  .ag-kanban{display:block;overflow:visible;padding-bottom:0}
  .ag-col{display:none;max-height:none;border:0;background:none;overflow:visible}
  .ag-col.on{display:flex}
  .ag-col .ag-col-h{display:none}
  .ag-col-b{padding:0;gap:10px;overflow:visible}
  .ag-card{padding:13px;gap:8px;border-radius:12px}
  .ag-card-t{font-size:15px;line-height:1.4}
}

/* 네이버 붙여넣기 단계 버튼(2026-10-30): 순서 번호 + 복사하면 체크 표시, 모바일은 2열 */
.bl-nvsteps{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0}
.bl-nvsteps .btn-sm{display:inline-flex;align-items:center;gap:6px}
.bl-nvsteps i{font-style:normal;font-size:11px;font-weight:700;width:18px;height:18px;border-radius:50%;display:inline-grid;place-items:center;background:var(--panel-3);color:var(--text-2)}
.bl-nvsteps .btn-sm.done i{background:#3FB97A;color:#fff;font-size:0}
.bl-nvsteps .btn-sm.done i::after{content:"✓";font-size:11px}
@media (max-width:860px){.bl-nvsteps{display:grid;grid-template-columns:1fr 1fr}.bl-nvsteps .btn-sm{justify-content:center;min-height:44px}}
