/* 관리자 / 파트너 공통 백오피스 스타일 */
* { box-sizing: border-box; }
body {
  margin: 0; font-family: "Noto Sans KR", "Malgun Gothic", sans-serif;
  background: #f4f5f7; color: #222; font-size: 14px;
}
a { color: inherit; text-decoration: none; }
:root { --pt: #b08d57; --dk: #23272f; }

/* 레이아웃 */
.admin_wrap { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: #23272f; color: #cfd3da; flex: none;
  display: flex; flex-direction: column; position: sticky; top: 0;
  height: 100vh; height: 100dvh;   /* dvh: 모바일 주소창 높이 변화 대응 */
}
.sidebar .brand { padding: 22px 20px; font-size: 18px; font-weight: 700; color: #fff; border-bottom: 1px solid #343a44; }
.sidebar .brand span { color: var(--pt); }
/* 메뉴가 화면 높이를 넘으면 사이드바 안에서 스크롤한다.
   min-height:0 이 없으면 flex 자식이 내용 높이 아래로 줄지 않아 스크롤이 생기지 않고,
   넘친 메뉴가 검은 배경 밖으로 흘러나가 클릭할 수 없게 된다. */
.sidebar nav { padding: 10px 0; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.sidebar nav::-webkit-scrollbar { width: 6px; }
.sidebar nav::-webkit-scrollbar-thumb { background: #434a56; border-radius: 3px; }
.sidebar nav::-webkit-scrollbar-thumb:hover { background: #5a6373; }
.sidebar nav { scrollbar-width: thin; scrollbar-color: #434a56 transparent; }
.sidebar nav a { display: block; padding: 13px 22px; color: #cfd3da; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: #2c313a; color: #fff; }
.sidebar nav a.on { background: #2c313a; color: #fff; border-left-color: var(--pt); }
.sidebar .bottom { padding: 16px 22px; border-top: 1px solid #343a44; font-size: 13px; }
.sidebar .bottom a { color: #9aa0aa; }

.admin_main { flex: 1; min-width: 0; }
.topbar {
  background: #fff; padding: 0 26px; height: 60px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid #e6e8ec; position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar .user { font-size: 13px; color: #666; }
.topbar .user a { color: var(--pt); margin-left: 12px; }
.logout_btn { background: none; border: 0; padding: 0; font: inherit; color: var(--pt); margin-left: 12px; cursor: pointer; }
.content { padding: 26px; }

/* 카드/통계 */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 26px; }
.card { position: relative; overflow: hidden; background: #fff; border: 1px solid #eaecef; border-radius: 12px; padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(20,22,40,.05); transition: box-shadow .22s ease, transform .22s ease; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--pt); opacity: 0; transition: opacity .22s ease; }
.card:hover { box-shadow: 0 10px 26px rgba(20,22,40,.10); transform: translateY(-3px); }
.card:hover::before { opacity: 1; }
.card .label { color: #8a8f98; font-size: 13px; font-weight: 500; }
.card .value { font-size: 30px; font-weight: 800; margin-top: 8px; color: #1f2430; letter-spacing: -.02em; }
.card .value small { font-size: 13px; color: var(--pt); font-weight: 600; margin-left: 6px; }
.card .value a { color: inherit; }

.panel { background: #fff; border: 1px solid #eaecef; border-radius: 12px; padding: 24px; margin-bottom: 22px; box-shadow: 0 1px 3px rgba(20,22,40,.05); }
.panel h2 { font-size: 16px; margin: 0 0 16px; font-weight: 700; color: #1f2430; }

/* 테이블 */
table.list { width: 100%; border-collapse: collapse; background: #fff; }
table.list th, table.list td { padding: 12px 10px; border-bottom: 1px solid #eceef1; text-align: left; font-size: 13px; vertical-align: middle; }
table.list thead th { background: #fafbfc; color: #555; font-weight: 600; }
table.list tbody tr:hover { background: #fafbfc; }
table.list .center { text-align: center; }

/* 버튼/뱃지 */
.btn { display: inline-block; padding: 8px 16px; border-radius: 5px; border: 1px solid #d4d7dd; background: #fff; cursor: pointer; font-size: 13px; color: #333; }
.btn:hover { background: #f3f4f6; }
.btn.primary { background: var(--dk); color: #fff; border-color: var(--dk); }
.btn.primary:hover { background: #000; }
.btn.gold { background: var(--pt); color: #fff; border-color: var(--pt); }
.btn.danger { background: #fff; color: #c0392b; border-color: #e6b8b3; }
.btn.danger:hover { background: #fdecea; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; }
.badge.wait { background: #fff4e0; color: #b9770a; }
.badge.ok { background: #e6f5ea; color: #1e7d39; }
.badge.no { background: #fdecea; color: #c0392b; }
.badge.new { background: #e8f0fe; color: #1a56db; }
.tag { display:inline-block; background:#f0eee9; color:#7a6a45; border-radius:4px; padding:2px 7px; font-size:11px; margin-right:4px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.tabs a { display: inline-block; padding: 7px 14px; border: 1px solid #dfe2e7; border-radius: 20px; margin-right: 6px; color: #555; font-size: 13px; }
.tabs a.on { background: var(--dk); color: #fff; border-color: var(--dk); }

/* 폼 */
.form_row { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.form_field { flex: 1; min-width: 200px; }
.form_field.full { flex-basis: 100%; }
.form_field label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; font-weight: 500; }
.form_field input[type=text], .form_field input[type=number], .form_field input[type=password],
.form_field input[type=email], .form_field select, .form_field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d4d7dd; border-radius: 5px; font-size: 14px; font-family: inherit;
}
.form_field textarea { min-height: 120px; resize: vertical; }
.checks { display: flex; gap: 18px; flex-wrap: wrap; }
.checks label { font-size: 14px; color: #444; display: flex; align-items: center; gap: 6px; }
.form_actions { display: flex; gap: 10px; margin-top: 10px; }
.hint { color: #999; font-size: 12px; margin-top: 5px; }

/* 로그인 화면 */
.login_wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #23272f; padding: 20px; }
.login_box { background: #fff; border-radius: 10px; padding: 40px 36px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,0.3); }
.login_box h1 { margin: 0 0 6px; font-size: 22px; text-align: center; }
.login_box h1 span { color: var(--pt); }
.login_box .sub { text-align: center; color: #888; font-size: 13px; margin-bottom: 26px; }
.login_box .form_field { margin-bottom: 14px; }
.login_box .btn { width: 100%; padding: 12px; text-align: center; }
.login_err { background: #fdecea; color: #c0392b; padding: 11px 14px; border-radius: 5px; font-size: 13px; margin-bottom: 16px; }

@media (max-width: 768px) {
  .admin_wrap { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
  .sidebar nav { display: flex; flex-wrap: wrap; padding: 4px; overflow-y: visible; }
  .sidebar nav a { border-left: 0; padding: 10px 14px; }
  .sidebar .brand { width: 100%; }
  .sidebar .bottom { border-top: 0; }
  .cards { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .content { padding: 16px; }
}

/* 열이 많은 목록 테이블 — 1600px 이하에서는 표만 가로 스크롤시킨다.
   이 규칙이 768 이하에만 걸려 있어서 1024~1280 구간에서 페이지 전체가 가로로 밀리고
   "센터이름" 같은 글자가 한 자씩 세로로 쪼개졌다. */
@media (max-width: 1600px) {
  table.list { display: block; overflow-x: auto; white-space: nowrap; }
  table.list th, table.list td { white-space: nowrap; }
  /* 스크롤 가능하다는 힌트 */
  .panel > table.list, .content > table.list { scrollbar-width: thin; }
}

/* 파트너 조직도 트리 (admin) — 2가지 뷰(조직도형/목록형) 공용 */

/* ----- 노드 공통 ----- */
.atree_node { position: relative; background: #fff; border: 1px solid #e2e5ea; border-radius: 6px;
  padding: 14px 16px 15px; transition: border-color .15s, box-shadow .15s; }
.atree_node:hover { border-color: #c4cad3; box-shadow: 0 3px 12px rgba(35,39,47,.07); }

/* 단계별 좌측 띠 (의사요소 — 테두리/호버와 독립) */
.atree_node { --band: var(--pt); }
.atree_node.lv1 { --band: #c8a16a; }
.atree_node.lv2 { --band: #6f8f86; }
.atree_node.lv3 { --band: #9b8499; }
.atree_node.lv4 { --band: #a9776a; }
.atree_node.lv5 { --band: #6b7d99; }
.atree_node::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 5px;
  background: var(--band); border-radius: 6px 0 0 6px; }
.atree_head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.atree_name { font-size: 14px; font-weight: 600; color: #23272f; }
.atree_rate { flex: none; font-size: 12.5px; font-weight: 700; color: var(--pt); }
.atree_sub { font-size: 12px; color: #8a909a; margin-top: 6px; }
.atree_st { font-size: 10px; border-radius: 3px; padding: 0 5px; margin-left: 5px; white-space: nowrap; }
.atree_st.wait { color: #b07d1e; border: 1px solid #e7d3a8; }
.atree_st.no { color: #c0392b; border: 1px solid #e6b4ad; }
.atree_stat { display: flex; gap: 16px; margin-top: 11px; padding-top: 10px; border-top: 1px solid #eef0f3; font-size: 11.5px; color: #9298a2; }
.atree_stat b { color: #3a3f48; font-weight: 600; }
.atree_stat .earn b { color: #1e7d39; }

/* 루트(본사) 강조 — 공통 */
.atree_wrap > ul > li > .atree_node { background: #23272f; border-color: #23272f; }
.atree_wrap > ul > li > .atree_node .atree_name { color: #fff; }
.atree_wrap > ul > li > .atree_node .atree_sub { color: #a7adb7; }
.atree_wrap > ul > li > .atree_node .atree_stat { color: #9298a2; border-top-color: rgba(255,255,255,.12); }
.atree_wrap > ul > li > .atree_node .atree_stat b { color: #e3e6ea; }
.atree_wrap > ul > li > .atree_node .atree_stat .earn b { color: #7fd49a; }

/* 토글 공통 (CSS 셰브런, FA 미사용) */
.tnode_toggle { position: absolute; width: 22px; height: 22px; padding: 0; border-radius: 50%;
  border: 1px solid #d4d7dd; background: #fafbfc; color: #8a909a; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: color .15s, border-color .15s; z-index: 2; }
.tnode_toggle::before { content: ""; width: 6px; height: 6px; position: relative; top: 1px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-135deg); }
.tnode_toggle:hover { color: var(--pt); border-color: var(--pt); }
.atree_wrap > ul > li > .atree_node .tnode_toggle { background: #23272f; border-color: #3a4049; color: var(--pt); }
.atree_wrap li.collapsed > ul { display: none; }

/* ============ 모드 ①: 조직도형 (하향식) ============ */
.mode_chart { overflow-x: auto; padding: 34px 12px 28px; background: #fafbfc; border: 1px solid #e6e8ec; border-radius: 8px; }
.mode_chart ul { display: flex; justify-content: center; align-items: flex-start; margin: 0; padding: 30px 0 0; list-style: none; position: relative; }
.mode_chart > ul { padding-top: 0; width: max-content; margin-inline: auto; } /* 좁으면 가운데, 넓으면 왼쪽기준(스크롤) */
.mode_chart li { list-style: none; position: relative; padding: 30px 1px 0;
  display: flex; flex-direction: column; align-items: center; } /* 자식들 위 중앙정렬 → 연결선이 각 박스 가로중앙에 */
.mode_chart > ul > li { padding-top: 0; }
.mode_chart li::before, .mode_chart li::after {
  content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 30px; border-top: 1px solid #d4d7dd; }
.mode_chart li::after { right: auto; left: 50%; border-left: 1px solid #d4d7dd; }
.mode_chart li:only-child::before, .mode_chart li:only-child::after { display: none; }
.mode_chart li:only-child { padding-top: 30px; }
.mode_chart li:first-child::before, .mode_chart li:last-child::after { border: 0; }
.mode_chart li:last-child::before { border-right: 1px solid #d4d7dd; }
.mode_chart ul ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 30px; border-left: 1px solid #d4d7dd; }
.mode_chart > ul > li::before, .mode_chart > ul > li::after { display: none; }
.mode_chart .atree_node { display: block; width: 214px; vertical-align: top; text-align: left; white-space: normal; }
.mode_chart .atree_name, .mode_chart .atree_sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode_chart .tnode_toggle { left: 50%; bottom: -11px; transform: translateX(-50%); }
.mode_chart li.collapsed > .atree_node .tnode_toggle { transform: translateX(-50%) rotate(180deg); }

/* ============ 모드 ②: 목록형 (이전 방식, 들여쓰기) ============ */
.mode_list { overflow-x: auto; padding: 10px 6px 14px; }
.mode_list ul { list-style: none; margin: 0; padding: 0; }
.mode_list ul ul { padding-left: 32px; }
.mode_list > ul { padding-left: 4px; }
.mode_list li { position: relative; padding-left: 30px; }
.mode_list li::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1px solid #d4d7dd; }
.mode_list li:last-child::before { bottom: auto; height: 42px; }
.mode_list li::after { content: ""; position: absolute; left: 0; top: 42px; width: 24px; border-top: 1px solid #d4d7dd; }
.mode_list > ul > li { padding-left: 0; }
.mode_list > ul > li::before, .mode_list > ul > li::after { display: none; }
.mode_list .atree_node { display: inline-block; width: auto; min-width: 256px; max-width: 380px; vertical-align: top;
  border-radius: 6px; margin: 7px 0; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.mode_list .atree_rate { background: #fbf3e3; color: #a9770a; border-radius: 10px; padding: 2px 8px; font-size: 12px; }
.mode_list .tnode_toggle { left: -13px; top: 42px; transform: translateY(-50%); }
.mode_list li.collapsed > .atree_node .tnode_toggle { transform: translateY(-50%) rotate(180deg); }

/* ----- 툴바 / 뷰 전환 ----- */
.tree_toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.tree_toolbar .btn { border-radius: 16px; }
.tree_toolbar_sp { flex: 1; }
.tree_viewswitch { display: inline-flex; border: 1px solid #d4d7dd; border-radius: 18px; overflow: hidden; background: #fff; }
.tree_viewswitch .vw { border: 0; background: transparent; padding: 7px 16px; font-size: 13px; color: #6b7280; cursor: pointer; transition: background .15s, color .15s; }
.tree_viewswitch .vw + .vw { border-left: 1px solid #e6e8ec; }
.tree_viewswitch .vw.on { background: #23272f; color: #fff; }

/* 직급 뱃지 (보상플랜) */
.rank-badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; background: #eef2fb; color: #3a4a7a; }
.rank-badge.팀장 { background: #eaf4ff; color: #1f6fb0; }
.rank-badge.국장 { background: #eef7ee; color: #2e8b57; }
.rank-badge.본부장 { background: #f6eefb; color: #7a3a9a; }

/* ── 쿠폰/리뷰/옵션 관리 폼 ── */
.form_row{display:flex;gap:12px;flex-wrap:wrap;align-items:flex-end}
.form_field{display:flex;flex-direction:column;gap:4px}
.form_field label{font-size:12px;color:#666}
.form_field input,.form_field select{padding:8px;border:1px solid #d5d5d5;border-radius:5px;min-width:120px}
.btn.sm{padding:5px 10px;font-size:12px}
.btn.danger{background:#c0392b;color:#fff;border-color:#c0392b}
.btn.primary{background:#b08d57;color:#fff;border-color:#b08d57}

/* ===== 제품 등록/수정 폼: 50대 운영자 친화(큰 글씨·큰 입력칸) + 이미지 업로드 + 에디터 ===== */
.prd_form .form_field label { font-size: 15px; color: #333; font-weight: 600; margin-bottom: 7px; }
.prd_form .form_field input[type=text], .prd_form .form_field input[type=number],
.prd_form .form_field input[type=password], .prd_form .form_field select, .prd_form .form_field textarea {
  width: 100%; padding: 12px 14px; font-size: 15px; border: 1px solid #cfd3da; border-radius: 7px; background: #fff;
}
.prd_form .form_field input:focus, .prd_form .form_field select:focus, .prd_form .form_field textarea:focus {
  outline: none; border-color: var(--pt, #b08d57); box-shadow: 0 0 0 3px rgba(176,141,87,0.15);
}
.prd_form .checks label { font-size: 15px; }
.prd_form .form_actions .btn { padding: 13px 30px; font-size: 16px; }

/* 대표 이미지 업로드 영역 */
.img_upload { display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
  border: 2px dashed #cfd3da; border-radius: 10px; padding: 18px; background: #fafbfc; transition: all .15s; }
.img_upload.drag { border-color: var(--pt, #b08d57); background: #fbf7f0; }
.img_preview { width: 150px; height: 150px; flex: none; border: 1px solid #e6e8ec; border-radius: 8px;
  background: #f6f4f1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.img_preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.img_ph { color: #aaa; font-size: 14px; }
.img_ctrl { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.img_pick { font-size: 15px; padding: 12px 22px; cursor: pointer; }
.img_ctrl .hint { font-size: 13px; color: #777; line-height: 1.6; margin: 0; }

/* CKEditor: 큰 편집 영역 */
.ck-editor__editable { min-height: 300px !important; font-size: 15px; line-height: 1.7; }
.ck.ck-editor { width: 100%; }
.ck.ck-toolbar { border-radius: 7px 7px 0 0 !important; }
.ck.ck-editor__main > .ck-editor__editable { border-radius: 0 0 7px 7px !important; }

/* 제품 폼: 섹션 구분(가독성) */
.prd_form .fsec { border-top: 1px solid #edeef1; padding-top: 22px; margin-top: 24px; }
.prd_form .fsec:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.prd_form .fsec_t { font-size: 15px; font-weight: 700; color: #333; margin: 0 0 16px; padding-left: 11px; border-left: 4px solid var(--pt, #b08d57); line-height: 1.1; }
.prd_form .fhint { font-size: 13px; color: #8a8f96; margin: 7px 0 0; line-height: 1.6; }
.prd_form .req { color: #c0392b; font-style: normal; }
.prd_form .form_field input::placeholder { color: #b6bac1; }

/* 조직도형: 박스 마우스 드래그 이동 */
.mode_chart { position: relative; }
.mode_chart .atree_node { cursor: grab; touch-action: none; user-select: none; }
.mode_chart .atree_node.dragging { cursor: grabbing; box-shadow: 0 8px 22px rgba(0,0,0,.18); opacity: .92; }
.mode_chart .atree_node.drop_target { border-color: var(--pt); box-shadow: 0 0 0 2px rgba(0,0,0,.05), 0 0 0 3px var(--pt); }
.mode_chart .atree_node.moving { opacity: .5; pointer-events: none; }
/* JS 로 그리는 SVG 연결선 (박스를 옮겨도 항상 이어짐) */
.tree_links { display: none; position: absolute; left: 0; top: 0; pointer-events: none; z-index: 0; overflow: visible; }
.mode_chart > .tree_links, .pc_chart > .tree_links { display: block; } /* 목록형에서는 숨김 */
.tree_links path { fill: none; stroke: #d4d7dd; stroke-width: 1.5; }
.js_links li::before, .js_links li::after, .js_links ul::before { display: none !important; }
.js_links .atree_node, .js_links .orgnode { position: relative; z-index: 1; }

/* ─────────────────────────────────────────────────────────────
   등급 조직도 — 본사 루트 + 상세 박스 + 관계 수정 (요구사항 9.6)
   ───────────────────────────────────────────────────────────── */
.atree_root { position: relative; }
.atree_hq {
  display: inline-block; margin: 0 0 14px; padding: 10px 26px; border-radius: 6px;
  background: #23272f; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .04em;
}
.atree_hq::after {
  content: ""; display: block; width: 2px; height: 14px; background: #cdd2d9; margin: 10px auto -14px;
}
/* 박스 안 항목표 (이름/등급/센터/연락처/추천인/후원인/가입일/매출/선결재/산하) */
.atree_grid {
  display: grid; grid-template-columns: auto 1fr; gap: 3px 10px;
  margin-top: 9px; padding-top: 9px; border-top: 1px solid #eef0f3; font-size: 11.5px;
}
.atree_grid .k { color: #9298a2; white-space: nowrap; }
.atree_grid .v { color: #3a3f48; font-weight: 600; text-align: right; }
.atree_grid .v small { color: #9298a2; font-weight: 400; }
.atree_foot {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 9px; padding-top: 8px; border-top: 1px solid #eef0f3; font-size: 11px;
}
.atree_join { padding: 1px 7px; border-radius: 3px; background: #eaf3ff; color: #2b6cb0; font-weight: 600; }
.atree_join.sp { background: #f3eaff; color: #6b46c1; }
.atree_no { color: #9298a2; }
.atree_edit {
  margin-left: auto; padding: 3px 9px; border: 1px solid #d7dbe1; border-radius: 4px;
  background: #fff; color: #4a5059; font-size: 11px; cursor: pointer;
}
.atree_edit:hover { border-color: #b9bfc8; background: #f7f8fa; }
/* 루트(1차) 박스는 어두운 배경이므로 대비 조정 */
.atree_wrap > ul > li > .atree_node .atree_grid { border-top-color: rgba(255,255,255,.12); }
.atree_wrap > ul > li > .atree_node .atree_grid .k { color: #9298a2; }
.atree_wrap > ul > li > .atree_node .atree_grid .v { color: #e3e6ea; }
.atree_wrap > ul > li > .atree_node .atree_foot { border-top-color: rgba(255,255,255,.12); }
.atree_wrap > ul > li > .atree_node .atree_no { color: #9298a2; }

/* 관계 수정 모달 */
.relink_modal {
  position: fixed; inset: 0; z-index: 9000; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.relink_modal[hidden] { display: none; }
.relink_box {
  background: #fff; border-radius: 10px; padding: 26px 24px; width: 100%; max-width: 460px;
  box-shadow: 0 14px 44px rgba(0,0,0,.25);
}
.relink_box h3 { font-size: 16px; margin: 0 0 16px; color: #23272f; }
.relink_box label { display: block; font-size: 13px; color: #555; margin-bottom: 14px; }
.relink_box select { width: 100%; margin-top: 5px; padding: 9px 10px; border: 1px solid #d7dbe1; border-radius: 5px; }
.relink_hint { font-size: 12px; color: #888; line-height: 1.6; margin: 0 0 16px; }
.relink_btns { display: flex; gap: 8px; justify-content: flex-end; }

/* ─────────────────────────────────────────────────────────────
   반응형 보정 (7개 뷰포트 실측 결과 반영)
   ───────────────────────────────────────────────────────────── */

/* 툴바 버튼이 좁은 화면에서 한 글자씩 세로로 쪼개지고 마지막 항목이 잘리던 문제
   (주문 상태 필터, 조직도 뷰 전환/펼치기) — 줄바꿈 허용 + 버튼 내부는 nowrap */
.tree_toolbar { flex-wrap: wrap; }
.tree_toolbar .btn,
.tree_viewswitch .vw { white-space: nowrap; }
.tree_toolbar_sp { flex: 1 1 0; min-width: 0; }
@media (max-width: 640px) {
  .tree_toolbar_sp { display: none; }          /* 좁은 화면에선 밀어내기 스페이서 제거 */
}

/* 마케팅 설정: 입력칸이 16px 로 찌그러져 값이 안 보이던 문제.
   table.list 가 display:block 이 되면 % 폭이 축소된 블록 기준으로 계산된다. */
table.list.settings_table th, table.list.settings_table td { white-space: normal; }
.settings_table .set_label { min-width: 220px; }
.settings_table .set_value { min-width: 180px; }
.settings_table .set_value input { width: 100%; min-width: 150px; box-sizing: border-box; }
.settings_table .set_key { min-width: 160px; }

/* 마케팅 설정: 모바일에서는 항목/값을 가로로 나열할 폭이 안 나온다.
   가로 스크롤 대신 세로로 쌓아 라벨 전문과 입력칸이 한눈에 보이게 한다. */
@media (max-width: 560px) {
  .settings_table,
  .settings_table tbody,
  .settings_table tr,
  .settings_table td { display: block; width: 100%; box-sizing: border-box; }
  .settings_table thead { display: none; }
  .settings_table tr { border-bottom: 1px solid #eceef1; padding: 12px 2px; }
  .settings_table tr:last-child { border-bottom: 0; }
  table.list.settings_table td { border: 0; padding: 0; white-space: normal; }
  .settings_table .set_label { min-width: 0; font-weight: 600; color: #23272f; margin-bottom: 7px; line-height: 1.5; }
  .settings_table .set_value { min-width: 0; margin-bottom: 5px; }
  .settings_table .set_value input { width: 100%; min-width: 0; }
  .settings_table .set_key { min-width: 0; }
}

/* 선결재 회원 검색 자동완성 */
.pp_suggest {
  position: absolute; z-index: 40; top: 100%; left: 0; right: 0; margin-top: 3px;
  background: #fff; border: 1px solid #d7dbe1; border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 260px; overflow-y: auto;
}
.pp_sg_item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px;
  border: 0; border-bottom: 1px solid #f0f2f5; background: #fff; cursor: pointer; text-align: left;
}
.pp_sg_item:last-child { border-bottom: 0; }
.pp_sg_item:hover { background: #f7f8fa; }
.pp_sg_item b { font-size: 13.5px; color: #23272f; }
.pp_sg_item span { font-size: 12px; color: #8a909a; }
.pp_sg_item em { margin-left: auto; font-style: normal; font-size: 12px; color: #2b6cb0; white-space: nowrap; }

/* 등급 관리 — 추천인·후원인 편집 칸 */
.line_form { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; }
.line_form label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: #888; }
.line_form select { padding: 5px 6px; font-size: 12px; max-width: 150px; }
.line_now { margin-top: 4px; font-size: 11px; color: #999; }
.line_now b { color: #555; }

/* ── 조직도(/admin/ranks/tree) 박스 접기/펼치기 ─────────────────────────
   기본은 이름·등급(헤드)만 보이고, 헤드를 클릭하면 상세(.atree_grid/.atree_foot)를 펼친다. */
#adminTree .atree_grid,
#adminTree .atree_foot { display: none; }
#adminTree .atree_node.box_open .atree_grid { display: grid; }
#adminTree .atree_node.box_open .atree_foot { display: flex; }
#adminTree .atree_head { cursor: pointer; justify-content: flex-start; }
#adminTree .atree_head .rank-badge { margin-left: auto; }
#adminTree .atree_head::after {
  content: ""; flex: none; align-self: center; margin-left: 4px;
  border: 4px solid transparent; border-top-color: #9298a2; border-bottom: 0;
  transition: transform .15s;
}
#adminTree .atree_node.box_open .atree_head::after { transform: rotate(180deg); }
