/* jira-bridge — 반복 패턴 레이어
   리스트/테이블 화면, 상태(빈·로딩·에러), 오버레이(모달·드로어·토스트·드롭다운)의 공통 규격.
   기존 클래스는 수정하지 않고 추가만 했습니다. */

/* ---------- tabs (페이지 내 하위 화면) ---------- */
.tabs { display:flex; align-items:center; gap:2px; border-bottom:1px solid var(--border); margin-bottom:18px; }
.tab { position:relative; padding:9px 12px; border:none; background:none; font-family:inherit; font-size:var(--fs-table); font-weight:600;
  color:var(--text-2); cursor:pointer; text-decoration:none; border-radius:var(--radius) var(--radius) 0 0; }
.jb .tab:hover { color:var(--text); background:var(--surface-2); text-decoration:none; }
.jb .tab.active { color:var(--accent); }
.tab.active:after { content:""; position:absolute; left:0; right:0; bottom:-1px; height:2px; background:var(--accent); }
.tab .side-count, .tab .tab-count { margin-left:6px; font-size:var(--fs-micro); font-weight:700; padding:1px 6px; border-radius:999px; background:var(--surface-3); color:var(--text-2); }

/* ---------- segmented control ---------- */
.seg { display:inline-flex; padding:2px; gap:2px; background:var(--surface-3); border-radius:var(--radius); }
.seg-item { padding:5px 11px; border:none; background:none; border-radius:4px; font-family:inherit; font-size:var(--fs-label); font-weight:600; color:var(--text-2); cursor:pointer; }
.seg-item.active { background:var(--surface); color:var(--text); box-shadow:0 1px 2px rgba(20,26,38,.10); }

/* ---------- filter chips (적용된 필터) ---------- */
.chips { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-bottom:12px; }
.fchip { display:inline-flex; align-items:center; gap:6px; padding:3px 6px 3px 9px; border-radius:var(--radius);
  background:var(--accent-soft); color:var(--accent); font-size:var(--fs-caption); font-weight:600; }
.fchip button { border:none; background:none; color:inherit; cursor:pointer; font-size:var(--fs-label); line-height:1; padding:0 2px; opacity:.7; }
.fchip button:hover { opacity:1; }
/* 링크로 동작하는 해제 버튼(JS 없이 GET 이동) — button 과 같은 모양 */
.jb .fchip .fchip-x { color:inherit; cursor:pointer; font-size:var(--fs-label); line-height:1; padding:0 2px; opacity:.7; text-decoration:none; }
.jb .fchip .fchip-x:hover { opacity:1; text-decoration:none; }
/* 칩 제거 버튼 — .fchip button 과 같은 모양. rules.php 가 이걸 안 쓰고 href 없는 <a onclick> 으로
   재구현하는 바람에 파괴 액션이 탭 순서 밖에 있었다(마우스로만 닿음). type="button" 필수 —
   폼 안의 맨 <button> 은 제출한다. */
.jb .chip-x { border:none; background:none; color:inherit; cursor:pointer; font-size:var(--fs-label); line-height:1;
  padding:0 2px; font-weight:700; opacity:.7; font-family:inherit; }
.jb .chip-x:hover { opacity:1; }
/* 행 확장 캐럿 — <span> 이었을 때는 탭으로 닿을 수 없어 키보드로 펼칠 방법이 없었다. */
.jb .py-caret { display:inline-block; width:12px; color:var(--text-2); border:none; background:none;
  padding:0; font:inherit; line-height:1; cursor:pointer; }
.jb .py-caret:hover { color:var(--text); }

/* 상태 범례 — 기본 접힘. 목록 헤더 오른쪽에 붙어 평소엔 한 줄만 차지한다. */
.status-legend { margin-left:auto; font-size:var(--fs-caption); }
.status-legend > summary { cursor:pointer; color:var(--text-3); list-style:none; }
.status-legend > summary::-webkit-details-marker { display:none; }
.status-legend > summary::before { content:"⌄ "; }
.status-legend[open] > summary::before { content:"⌃ "; }
.status-legend > summary:hover { color:var(--text-2); }
.legend-row { display:flex; flex-wrap:wrap; gap:6px; padding:8px 0 2px; }

/* 필터 pill — sync·audit 이 같은 마크업을 쓰면서 활성 표시를 인라인 3속성으로 각각 반복했다.
   ⚠ 목록 화면마다 필터 언어가 달라(select 7개 / 라벨 붙은 pill / 라벨 없는 pill / 탭)
     한 화면에서 배운 것이 다음 화면에서 안 통했다(critique P1). 여기서 pill 쪽을 하나로 묶는다.
   그룹 라벨은 선택이 아니라 필수다 — 라벨 없는 칩 7개는 무엇을 고르는 중인지 말하지 않는다. */
.filter-bar { display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin-bottom:14px; }
.filter-bar .filter-label { color:var(--text-3); font-size:var(--fs-caption); font-weight:600; }
.filter-bar .filter-label:not(:first-child) { margin-left:10px; }
.jb .filter-pill.is-on { background:var(--accent-soft); color:var(--accent); border-color:var(--accent); }

/* 도움말 산문 — max-width 가 없어 콘텐츠 폭(최대 1440px)을 가로지르며 줄당 160~200자가 됐다.
   눈이 다음 줄 첫 글자를 못 찾는 길이다(권장 65~75자). .state-desc 는 이미 380px 로 옳게
   하고 있었는데 인라인 도움말에는 적용돼 있지 않았다. ch 단위라 폰트 크기를 따라간다. */
.jb p.muted { max-width:70ch; }

/* ---------- list header (건수 · 우측 도구) ---------- */
.list-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:0 0 10px; }
.list-count { font-size:var(--fs-table); color:var(--text-2); }
.list-count b { color:var(--text); }
.list-tools { display:flex; align-items:center; gap:8px; }

/* ---------- table 보강 ---------- */
.table-scroll { overflow-x:auto; }
.table-scroll .table { min-width:960px; }
.table.compact td { padding:7px 14px; }
.table.compact th { padding:7px 14px; }
.table.roomy td { padding:14px 16px; }
.jb .table tbody tr:hover { background:var(--surface-2); }
.table tbody tr.is-selected { background:var(--accent-soft); }
.th-sort { display:inline-flex; align-items:center; gap:4px; border:none; background:none; padding:0; font:inherit; font-weight:600; color:inherit; cursor:pointer; }
.th-sort .caret { font-size:var(--fs-micro); opacity:.45; }
.th-sort.is-asc .caret, .th-sort.is-desc .caret { opacity:1; color:var(--accent); }
.num { text-align:right; font-variant-numeric:tabular-nums; }
.trunc { max-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
/* 고정 폭 레이아웃 — colgroup 으로 열 폭을 잡아 내용 길이에 따라 열이 밀리지 않게.
   긴 제목/담당자 때문에 상태 배지 칸이 좁아져 줄바꿈되는 문제 방지. */
.table.fixed { table-layout:fixed; }
.table.fixed th, .table.fixed td { overflow-wrap:anywhere; }
.table.fixed .nowrap { overflow-wrap:normal; white-space:nowrap; }
.table.fixed .checkcol { width:auto; }   /* 폭은 colgroup 이 결정 — th 의 width 지정과 충돌 방지 */
.cell-ellip { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }  /* 폭 넘치면 …, title 로 전문 */
.badge-wrap .badge { white-space:normal; }  /* 열 폭을 진짜로 넘는 긴 상태값은 배지 안에서 줄바꿈 허용 */
.rowact { display:flex; align-items:center; gap:4px; justify-content:flex-end; }

/* ---------- bulk bar (선택 액션) ---------- */
.bulkbar { position:sticky; bottom:14px; z-index:6; display:flex; align-items:center; gap:12px; margin-top:14px;
  padding:10px 16px; background:var(--surface); border:1px solid var(--border-strong); border-radius:var(--radius); box-shadow:var(--shadow-md); }
.bulkbar .spacer { flex:1; }

/* ---------- pagination ---------- */
.pager { display:flex; align-items:center; justify-content:center; gap:4px; margin-top:18px; flex-wrap:wrap; }
.pager-btn { min-width:28px; height:28px; padding:0 8px; display:inline-flex; align-items:center; justify-content:center;
  border:1px solid var(--border-strong); background:var(--surface); color:var(--text-2); border-radius:var(--radius);
  font-size:var(--fs-label); font-weight:600; font-family:inherit; cursor:pointer; text-decoration:none; }
.jb .pager-btn:hover { background:var(--surface-2); color:var(--text); text-decoration:none; }
.jb .pager-btn.is-current { background:var(--accent); border-color:var(--accent); color:var(--on-accent); cursor:default; }
.pager-btn[aria-disabled="true"] { opacity:.45; pointer-events:none; }
.pager-gap { color:var(--text-3); padding:0 2px; }
.pager-info { margin-left:10px; font-size:var(--fs-label); color:var(--text-3); }

/* ---------- empty / error state ---------- */
.state { display:flex; flex-direction:column; align-items:center; text-align:center; gap:6px; padding:56px 24px; }
.state-ico { width:40px; height:40px; border-radius:10px; background:var(--surface-3); color:var(--text-3);
  display:flex; align-items:center; justify-content:center; margin-bottom:6px; }
.state.is-error .state-ico { background:var(--danger-soft); color:var(--danger-fg); }
.state-title { font-size:var(--fs-card-title); font-weight:700; }
.state-desc { font-size:var(--fs-table); color:var(--text-2); max-width:380px; text-wrap:pretty; }
.state-actions { display:flex; gap:8px; margin-top:10px; }

/* ---------- loading ---------- */
@keyframes jb-spin { to { transform:rotate(360deg); } }
.spinner { width:15px; height:15px; border-radius:50%; border:2px solid var(--border-strong); border-top-color:var(--accent);
  animation:jb-spin .7s linear infinite; display:inline-block; vertical-align:-2px; }
.is-busy { position:relative; pointer-events:none; }
.is-busy:after { content:""; position:absolute; inset:0; background:var(--surface); opacity:.55; border-radius:inherit; }

/* ---------- dropdown menu ---------- */
.menu-wrap { position:relative; display:inline-block; }
.menu { position:absolute; right:0; top:calc(100% + 5px); z-index:20; min-width:180px; padding:5px;
  background:var(--surface); border:1px solid var(--border-strong); border-radius:var(--radius-lg); box-shadow:var(--shadow-md); }
.menu-item { display:flex; align-items:center; gap:8px; width:100%; padding:7px 9px; border:none; background:none; border-radius:5px;
  font-family:inherit; font-size:var(--fs-table); font-weight:600; color:var(--text); text-align:left; cursor:pointer; text-decoration:none; }
.jb .menu-item:hover { background:var(--surface-2); text-decoration:none; }
.menu-item.danger { color:var(--danger-fg); }
.jb .menu-item.danger:hover { background:var(--danger-soft); }
.menu-sep { height:1px; background:var(--border); margin:4px 0; }
.menu-label { font-size:var(--fs-micro); font-weight:700; color:var(--text-3); padding:6px 9px 3px; }

/* ---------- modal / drawer ---------- */
.scrim { position:fixed; inset:0; z-index:50; background:var(--scrim); display:flex; align-items:center; justify-content:center; padding:24px; }
.modal { width:100%; max-width:480px; background:var(--surface); border-radius:var(--radius-lg); box-shadow:var(--shadow-lg); overflow:hidden; }
.modal.lg { max-width:720px; }
.drawer { position:fixed; top:0; right:0; bottom:0; width:min(520px,92vw); z-index:51; display:flex; flex-direction:column;
  background:var(--surface); border-left:1px solid var(--border); box-shadow:var(--shadow-lg); }
.ov-head { display:flex; align-items:center; gap:10px; padding:14px 18px; border-bottom:1px solid var(--border); }
.ov-head h3 { font-size:var(--fs-card-title); font-weight:700; flex:1; }
.ov-close { border:none; background:none; color:var(--text-3); font-size:var(--fs-lead); line-height:1; cursor:pointer; padding:2px 4px; }
.ov-close:hover { color:var(--text); }
.ov-body { padding:18px; font-size:var(--fs-table); color:var(--text-2); overflow-y:auto; flex:1; }
.ov-foot { display:flex; align-items:center; justify-content:flex-end; gap:8px; padding:12px 18px; border-top:1px solid var(--border); background:var(--surface-2); }


/* ---------- stat (대시보드 지표) ---------- */
.stats { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }
.stat { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow); padding:14px 16px; }
.stat-k { font-size:var(--fs-caption); font-weight:600; color:var(--text-3); display:flex; align-items:center; gap:6px; margin-bottom:6px; }
.stat-v { font-size:var(--fs-stat); font-weight:700; letter-spacing:-.02em; font-variant-numeric:tabular-nums; }
.stat-sub { font-size:var(--fs-caption); color:var(--text-2); margin-top:3px; }
@media (max-width:1100px) { .stats { grid-template-columns:repeat(2,1fr); } }

/* ---------- form clarity (레이블·힌트·필수·푸터) ---------- */
.field { margin-bottom:16px; }
.field:last-child { margin-bottom:0; }
.field .label { margin-bottom:5px; }
.req { color:var(--danger-fg); font-weight:700; margin-left:2px; }
.hint { font-size:var(--fs-caption); color:var(--text-3); margin-top:5px; line-height:1.55; text-wrap:pretty; }
.hint b { color:var(--text-2); }
.hint.err { color:var(--danger-fg); }
.field-grid { display:grid; grid-template-columns:1fr 1fr; gap:0 16px; }
@media (max-width:760px) { .field-grid { grid-template-columns:1fr; } }
.span2 { grid-column:1/-1; }
.form-foot { display:flex; align-items:center; gap:8px; margin-top:18px; padding-top:16px; border-top:1px solid var(--border); }
.form-foot .spacer { flex:1; }
.btn-sm { padding:5px 10px; font-size:var(--fs-caption); }
.btn-lg { padding:10px 18px; font-size:var(--fs-body); }

/* ---------- explainer / 단계 안내 ---------- */
.helpbar { display:flex; align-items:flex-start; gap:9px; padding:11px 14px; border-radius:var(--radius);
  background:var(--surface-2); border:1px solid var(--border); font-size:var(--fs-label); color:var(--text-2); text-wrap:pretty; }
.helpbar b { color:var(--text); }
.flow { display:flex; align-items:center; flex-wrap:wrap; gap:6px; font-size:var(--fs-caption); }
.flow-step { display:inline-flex; align-items:center; gap:6px; padding:3px 9px; border-radius:999px;
  background:var(--surface-3); color:var(--text-2); font-weight:600; }
.flow-step .n { width:17px; height:17px; border-radius:50%; background:var(--accent); color:var(--on-accent); font-size:var(--fs-micro); display:inline-flex; align-items:center; justify-content:center; }
.flow-arrow { color:var(--text-3); }
.step-head { display:flex; align-items:center; gap:9px; margin-bottom:6px; }
.step-n { width:20px; height:20px; border-radius:50%; background:var(--accent-soft); color:var(--accent);
  font-size:var(--fs-micro); font-weight:700; display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; }
.step-head h2, .step-head h3 { font-size:var(--fs-body); font-weight:700; }
.checklist { display:flex; flex-direction:column; gap:5px; margin:8px 0 0; padding:0; list-style:none; font-size:var(--fs-caption); color:var(--text-2); }
.checklist li:before { content:"○ "; color:var(--text-3); }
.checklist li.pass { color:var(--ok-fg); } .checklist li.pass:before { content:"✓ "; color:var(--ok); }

/* ---------- detail layout ---------- */
.detail { display:grid; grid-template-columns:minmax(0,1fr) 320px; gap:18px; align-items:start; }
@media (max-width:1080px) { .detail { grid-template-columns:1fr; } }
.side-card-title { font-size:var(--fs-caption); font-weight:700; color:var(--text-3); padding:12px 16px 0; }

/* ---------- 검색 가능한 셀렉트 (combobox.js) ----------
   기존 <select> 는 DOM 에 그대로 두고 화면에서만 숨긴다 — JS 실패 시 native 로 되돌아간다. */
.combo { position:relative; display:inline-flex; }
.combo-native { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.combo-btn { text-align:left; white-space:nowrap; max-width:230px; overflow:hidden; text-overflow:ellipsis; }
.combo-btn::after { content:" ▾"; color:var(--text-3); }
.combo-panel { position:absolute; top:calc(100% + 5px); left:0; z-index:45; min-width:240px; max-width:340px;
  background:var(--surface); border:1px solid var(--border); border-radius:10px;
  box-shadow:0 10px 28px rgba(0,0,0,.22); padding:8px; }
.combo-search { width:100%; margin-bottom:6px; padding:7px 9px; font-size:var(--fs-table); }
.combo-list { max-height:264px; overflow-y:auto; }
.combo-group { font-size:var(--fs-micro); font-weight:700; color:var(--text-3); letter-spacing:.04em;
  padding:7px 8px 3px; text-transform:none; }
.combo-item { padding:6px 9px; border-radius:6px; font-size:var(--fs-table); color:var(--text-2);
  cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.combo-item:hover, .combo-item.is-active { background:var(--surface-2); color:var(--text); }
.combo-item.is-on { color:var(--accent); font-weight:600; }
.combo-item.is-on::before { content:"✓ "; }
.combo-empty { padding:10px 9px; font-size:var(--fs-label); color:var(--text-3); }
