/* naver-ad-monitor 디자인 시스템 이식 */
:root {
  --green: #03c75a;       /* 네이버 그린 */
  --green-dark: #02a64c;
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e3e6ea;
  --text: #1c1e21;
  --muted: #8b95a1;
  --pc: #2f6fed;
  --topbar-h: 56px;
  /* 채널 색 (차트/도트) */
  --smartstore: #2a78d6;
  --coupang: #eb6834;
  --cafe24: #1baf7a;
  --st11: #e63946;
  --toss: #3182f6;
  --kakao: #f2b900;
  --gmarket: #00a05a;
  --auction: #ff5b00;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Pretendard", -apple-system, "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ── 레이아웃: 탑바 + 좌측 사이드바 ─────────────────── */
#layout { display: flex; flex-direction: column; min-height: 100vh; }
#content-row { display: flex; flex: 1; min-height: 0; }
#main-col { flex: 1; min-width: 0; }

#topbar { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; justify-content: space-between;
  height: var(--topbar-h); padding: 0 20px; background: var(--card); border-bottom: 1px solid var(--border); }
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-left #page-title { font-size: 15px; margin: 0; font-weight: 700; white-space: nowrap; }
.topbar-divider { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; margin: 0 2px; }
.header-right { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.header-right button { font-size: 13px; }
#hamburger { border: none; background: none; font-size: 18px; padding: 4px 4px; line-height: 1; color: var(--text); flex-shrink: 0; }
#hamburger:hover { background: var(--bg); border-radius: 6px; }
.side-brand { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.brand-logo { width: 24px; height: 24px; flex-shrink: 0; }
.brand-text { color: #1d3f8f; }
.user-sep { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }
.user-chip { font-size: 13px; color: #445; font-weight: 600; }

#sidebar {
  width: 232px; flex-shrink: 0; background: var(--card);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
  overflow-y: auto; transition: width .15s ease; padding-top: 8px;
}

/* 브랜드 선택 블록 (naver의 광고주 블록) */
.side-adv { margin: 4px 12px 12px; padding: 12px; border-radius: 10px;
  background: linear-gradient(135deg, var(--green), var(--green-dark)); display: flex; flex-direction: column; gap: 8px; }
.side-adv select { width: 100%; border: none; border-radius: 6px; padding: 8px 10px; font-size: 13px; background: #fff; color: var(--text); }
.side-adv > *:last-child { margin-bottom: 0; }

/* 네비게이션 */
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 8px; }
.nav-parent { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: none; background: none;
  border-radius: 8px; color: var(--text); font-size: 14px; font-weight: 600; text-align: left; }
.nav-parent:hover { background: var(--bg); }
.nav-ico { width: 22px; text-align: center; flex-shrink: 0; font-size: 16px; }
.nav-label { flex: 1; white-space: nowrap; }
.nav-caret { font-size: 11px; color: var(--muted); transition: transform .15s ease; }
.nav-group.open > .nav-parent .nav-caret { transform: rotate(180deg); }
.nav-children { display: none; flex-direction: column; gap: 1px; padding: 2px 0 6px; }
.nav-group.open > .nav-children { display: flex; }
.nav-children button { width: 100%; text-align: left; border: none; background: none; border-left: 3px solid transparent;
  padding: 8px 12px 8px 44px; color: var(--muted); font-size: 13px; border-radius: 0 6px 6px 0; }
.nav-children button:hover { background: var(--bg); color: var(--text); }
.nav-children button.active { color: var(--green-dark); background: #eef9f1; border-left-color: var(--green); font-weight: 600; }
/* 3단계 메뉴(상위 메뉴의 하위 항목) — 들여쓰기 + 트리 표시 */
.nav-children button.nav-sub { padding-left: 60px; font-size: 12.5px; position: relative; }
.nav-children button.nav-sub::before { content: "└"; position: absolute; left: 44px; color: #c3cbd4; font-size: 11px; }
.nav-children button.nav-sub.active::before { color: var(--green); }

#sidebar.collapsed { width: 60px; }
#sidebar.collapsed .side-adv,
#sidebar.collapsed .nav-label,
#sidebar.collapsed .nav-caret,
#sidebar.collapsed .nav-children { display: none; }
#sidebar.collapsed .nav-parent { justify-content: center; padding: 12px 0; }

.badge { background: #eef2f7; color: #445; border-radius: 12px; padding: 3px 10px; font-size: 13px; }
.badge.mock { background: #fff4e5; color: #b06a00; }
.muted { color: var(--muted); font-size: 13px; }

button { cursor: pointer; border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 7px 12px; font-size: 13px; font-family: inherit; }
button.primary { background: var(--green); color: #fff; border-color: var(--green); }
button.primary:hover { background: var(--green-dark); }
button.danger { background: #fdecec; color: #b00020; border-color: #f0c0c0; }
select, input, textarea { font-family: inherit; }
select, input { border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; font-size: 13px; background: #fff; color: var(--text); }

main { padding: 18px 22px 60px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* 카드 */
.cards { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 6px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; flex: 0 0 auto; min-width: 210px; }
.card .label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.card .value { font-size: 24px; font-weight: 700; margin-top: 6px; white-space: nowrap; }
.card .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.mom { font-weight: 600; }
/* 증감 색은 한국 증시 관례를 따른다 — 오르면 빨강, 내리면 파랑(2026-08-25 지시).
   모든 화면이 이 두 클래스를 쓰므로 여기만 바꾸면 전부 따라온다. */
.mom.up { color: #d12b2b; }
.mom.down { color: #1b64da; }

/* 블록/표 (kw-block 스타일) */
.kw-block { background: var(--card); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; overflow: hidden; }
.kw-block h3 { margin: 0; padding: 12px 16px; background: #fafbfc; border-bottom: 1px solid var(--border); font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.kw-block h3 .ts { font-size: 12px; color: var(--muted); font-weight: 400; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
/* 정렬 규칙(전 화면 공통): 컬럼명·데이터 모두 가운데 정렬 */
th, td { text-align: center; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
/* 컬럼명은 스크롤해도 붙어 있게 한다(2026-08-25 지시) — 표가 길어지면 지금 보는
   숫자가 어느 열인지 알 수 없다. 세로 스크롤이 있는 표(.table-wrap 에 max-height)
   에서만 실제로 붙고, 짧은 표는 그대로다. 배경은 불투명해야 밑줄이 비치지 않는다. */
th { background: #fafbfc; color: #556; font-weight: 600;
     position: sticky; top: 0; z-index: 2; }
/* 합계 줄이 헤더 바로 아래에 있는 표는 그 줄도 함께 붙인다 — 스크롤 중에도
   전체 합계를 옆에 두고 개별 행을 읽을 수 있다. */
.table-wrap tr.sum-top td { position: sticky; top: 33px; z-index: 1; }
tr:hover td { background: #fafdff; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: center; font-variant-numeric: tabular-nums; }
td.left, th.left { text-align: left; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }

.section-title { margin: 28px 0 10px; font-size: 16px; border-top: 1px solid var(--border); padding-top: 20px; }
.cov-controls { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.cov-controls label { font-size: 13px; color: var(--muted); }
.cov-controls select, .cov-controls input { margin-left: 4px; }
.ctl-label { font-size: 13px; color: var(--muted); }

/* 차트 */
.chart-box { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin: 12px 0; position: relative; }
/* 넓은 모니터에서 차트가 화면을 다 채워 과하게 커 보이지 않도록 폭을 묶는다.
   viewBox 비율이 유지되므로 폭을 제한하면 높이도 함께 줄어든다(표는 전체 폭 그대로). */
/* 차트는 보이는 화면 폭을 그대로 쓴다 (2026-08-05 지시 — 1080px 고정폭 제거) */
.legend { display: flex; gap: 16px; font-size: 12px; color: #556; margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
#tooltip, #so-tooltip { position: absolute; pointer-events: none; display: none; z-index: 5;
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12); min-width: 150px; }
#tooltip .t, #so-tooltip .t { font-weight: 700; margin-bottom: 4px; }
#tooltip .row, #so-tooltip .row { display: flex; justify-content: space-between; gap: 12px; color: #556; }
#tooltip .row b { color: var(--text); font-variant-numeric: tabular-nums; }

/* 상태 뱃지 */
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status .ic { font-size: 11px; }
.status.good { color: var(--green-dark); }
.status.warn { color: #b06a00; }
.status.crit { color: #b00020; }
.chip { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 12px; background: #eef2f7; color: #445; margin-right: 6px; }
.chip.warn { background: #fff4e5; color: #b06a00; }
.chip.crit { background: #fdecec; color: #b00020; }
/* 주문을 어디서 받아왔는지 — 마켓 이름 옆에 작게 덧붙인다 */
.chip.src { font-size: 11px; padding: 2px 7px; background: transparent; border: 1px solid var(--border); color: #778; }
/* 카페24 마켓연동으로 들어온 주문 — 직접 연동 마켓과 색으로 구분한다 */
.chip.via24 { background: #eef4ff; color: #3a63c8; }

/* 로그인 */
.login-overlay { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.login-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 4px 24px rgba(0,0,0,.06); }
.login-card h2 { margin: 0 0 6px; font-size: 20px; }
.login-card label { display: block; font-size: 13px; color: #445; margin: 14px 0 0; }
.login-card input { width: 100%; margin-top: 5px; padding: 9px 10px; }
.login-card button { margin-top: 20px; width: 100%; padding: 11px; }
.login-error { color: #b00020; font-size: 13px; min-height: 18px; margin: 10px 0 0; }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* 모달 */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 1100; }

/* 원본 미리보기 — 받기 전에 화면에서 먼저 본다. 모달보다 위(z-index)에 둔다:
   업로드 실패 안내 모달에서 원본을 열어 볼 수 있어야 한다. */
.fpv { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex;
  align-items: center; justify-content: center; z-index: 1200; padding: 24px; }
.fpv-card { background: #fff; border-radius: 10px; width: min(1040px, 100%);
  height: min(88vh, 100%); display: flex; flex-direction: column; overflow: hidden; }
.fpv-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 14px;
  border-bottom: 1px solid #e7e9ec; }
.fpv-name { font-size: 13px; font-weight: 600; color: #333d4b; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.fpv-btn { display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 6px; border: 1px solid #dfe3e8;
  background: #fff; color: #4b5563; cursor: pointer; padding: 0; }
.fpv-btn:hover { background: #f2f4f6; color: #111; }
.fpv-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fpv-body { flex: 1; min-height: 0; background: #f5f6f8; }
.fpv-body iframe { width: 100%; height: 100%; border: 0; display: block; }
.fpv-body img { max-width: 100%; max-height: 100%; display: block; margin: 0 auto; }
.modal-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 22px; width: 100%; max-width: 420px; max-height: 88vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,.18); }
/* 상세 표 팝업이 좁아 가로 스크롤이 생겼다(2026-08-26 지시) — 화면의 94%까지 쓴다 */
.modal-card.wide { max-width: min(1180px, 94vw); }
.modal-card h3 { margin: 0 0 12px; font-size: 16px; }
.modal-card label { display: block; font-size: 13px; color: #445; margin: 10px 0 0; }
.modal-card input, .modal-card select { width: 100%; margin-top: 5px; padding: 9px 10px; }
.modal-card .chk { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13px; color: #445; }
.modal-card .chk input { width: auto; margin: 0; }

/* 선택형 팝업(다운로드·업로드 선택 등) — 라디오 + 설명 + 보조 버튼 한 줄 */
.io-options { display: flex; flex-direction: column; gap: 8px; }
.modal-card label.io-option {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-weight: 400;
}
.modal-card label.io-option:hover { background: #fafdff; }
.modal-card label.io-option input[type="radio"] { width: 16px; height: 16px; flex: 0 0 16px; margin: 0; }
.io-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; line-height: 1.45; }
.io-text b { font-size: 13.5px; color: var(--text); }
.io-text .muted { font-size: 12px; white-space: normal; }
.modal-card .io-side { flex: 0 0 auto; width: auto; margin: 0; font-size: 12px; padding: 6px 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-error { color: #b00020; font-size: 13px; min-height: 16px; margin: 8px 0 0; }
.modal-card p.msg { margin: 0; font-size: 14px; line-height: 1.6; white-space: pre-line; }

/* 토스트 알림 (confirm/alert 대체) */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
  background: #1c1e21; color: #fff; font-size: 13px; padding: 10px 18px;
  border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  z-index: 1200; max-width: 80vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 온보딩(브랜드 없을 때) */
.onboarding { display: flex; justify-content: center; padding: 60px 20px; }
.onboarding-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 32px; width: 100%; max-width: 520px; box-shadow: 0 4px 24px rgba(0,0,0,.06); }
.onboarding-card h2 { margin: 0 0 6px; }
.onboarding-card label { display: block; font-size: 13px; color: #445; margin: 12px 0 0; }
.onboarding-card input { width: 100%; margin-top: 5px; }
.onboarding-card button { margin-top: 20px; width: 100%; padding: 11px; }

/* 사용자 관리 행 (naver 스타일) */
/* 페이지 레이아웃 통일(2026-08-05): 상품별 정산내역처럼 플랫하게 —
   카드 박스 래퍼를 없애고 섹션 구분은 제목·여백으로만 한다 */
.manage-section { background: transparent; border: none; border-radius: 0; padding: 0; margin-bottom: 24px; }
.manage-section > h3 { margin: 0 0 4px; font-size: 15px; }
.manage-section > .muted { margin-bottom: 12px; }
.row-toolbar { display: flex; gap: 8px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
/* 판매중지 상품 — 목록에서 흐리게 두어 판매중과 한눈에 구분되게 한다 */
tr.off-sale td { opacity: .55; }
tr.off-sale td:first-child, tr.off-sale td button { opacity: 1; }

/* 주문의 상품 한 줄 — 이름 아래에 수량·금액을 작게 붙인다 */
.item-line { padding: 2px 0; }
.item-line + .item-line { border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 5px; }
.item-line .muted { display: block; font-size: 11.5px; }

/* 표 바로 위에 붙는 조회 기간 안내 — 첫 컬럼과 나란히 보이도록 왼쪽 정렬 */
.list-meta { padding: 2px 4px 6px; font-size: 12px; }

/* 페이지 넘김 — 목록이 한 화면을 넘어가는 곳에서 공통으로 쓴다 */
.pager { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 14px 4px 2px; border-top: 1px solid var(--border); margin-top: 6px; }
.pager button { min-width: 34px; padding: 5px 9px; font-size: 13px; }
.pager button:disabled { opacity: .4; cursor: default; }
/* 설정 화면의 입력 폼 — 라벨 위, 입력 아래. 모달 폼과 같은 글꼴·크기를 쓴다 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; margin: 14px 0 4px; max-width: 900px; }
.form-grid label { display: block; font-size: 13px; color: #445; margin: 0; }
/* textarea 를 빼면 기본 inline 크기(20칸)로 라벨 옆에 붙어 버린다 — 네이버웍스 봇의
   Private Key(PEM) 칸이 그랬다. 다른 입력칸과 같은 폭·같은 자리로 맞춘다. */
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%; margin-top: 5px; padding: 9px 10px; }
.form-grid textarea { display: block; resize: vertical; min-height: 76px; }
.form-grid .chk { display: flex; align-items: center; gap: 8px; align-self: end; padding-bottom: 8px; }
.form-grid .chk input { width: auto; margin: 0; }
.form-grid .hint { grid-column: 1 / -1; margin: 0; }
/* 기간 빠른 선택(오늘·어제·최근 7일·최근 30일·이번 달·저번 달) — 기간 입력 옆 셀렉트 */
.preset-select { min-width: 108px; }
.user-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 13px 4px; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: none; }
.user-row .who { flex: 1; min-width: 200px; }
.user-row .who b { font-size: 14px; }
.user-row .who .meta { color: var(--muted); font-size: 12.5px; }
.user-row button { font-size: 12px; padding: 5px 10px; }

.rank-badge { display: inline-block; min-width: 22px; text-align: center; background: var(--green); color: #fff; border-radius: 5px; padding: 2px 6px; font-weight: 700; }
.ded-link { color: var(--pc); cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.ded-link:hover { color: #1c53b8; }
.warn-banner { background: #fff4e5; border: 1px solid #f0d8b0; border-radius: 8px;
  padding: 12px 16px; margin-bottom: 12px; font-size: 13px; color: #7a5200; line-height: 1.9; }
.warn-banner button { font-size: 12px; padding: 3px 10px; margin: 0 3px; }
.tag-link { cursor: pointer; text-decoration: none; }
.tag-link:hover .ch-tag { text-decoration: underline; text-underline-offset: 3px; }

/* 채널 태그 */
.ch-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }

/* ── 멀티 셀렉트 드롭다운 (브랜드 복수 선택) ─────────── */
.msel { position: relative; }
.msel-btn { width: 100%; text-align: left; background: #fff; border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 28px 8px 10px; font-size: 13px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.msel-btn::after { content: "▾"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--muted); }
.msel.open .msel-btn { border-color: var(--green); }
.msel-panel { display: none; position: absolute; z-index: 120; top: calc(100% + 4px); left: 0; right: 0;
  min-width: 180px; background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 260px; overflow-y: auto; padding: 6px; }
.msel.open .msel-panel { display: block; }
.msel-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px;
  font-size: 13px; cursor: pointer; user-select: none; }
.msel-item:hover { background: var(--bg); }
.msel-item input { margin: 0; accent-color: var(--green); }
.msel-all { border-bottom: 1px solid var(--border); margin-bottom: 4px; font-weight: 600; }

/* ── 상태/진단 (naver-ad-monitor 이식) ──────────────── */
.diag-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.diag-ok { color: #02a64c; }
.diag-warn { color: #e06b00; }
.diag-err { color: #d8000c; }
.diag-banner { display: flex; align-items: center; gap: 8px; border-radius: 10px; padding: 14px 16px;
  font-size: 15px; margin-bottom: 14px; border: 1px solid var(--border); background: var(--card); }
.diag-banner .diag-dot { font-size: 16px; }
.diag-banner.diag-ok { background: #eefaf2; border-color: #bfe9cf; }
.diag-banner.diag-warn { background: #fff6ec; border-color: #ffd9ad; }
.diag-banner.diag-err { background: #fdeced; border-color: #f3c0c4; }
.diag-comp { background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 8px; display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.diag-comp b { margin-left: 4px; }
.diag-comp-detail { color: var(--muted); font-size: 13px; margin-top: 6px; flex-basis: 100%; }
.diag-pill { display: inline-block; border-radius: 12px; padding: 2px 10px; font-size: 12px;
  font-weight: 700; border: 1px solid currentColor; }
.diag-pill.diag-ok { background: #eefaf2; }
.diag-pill.diag-warn { background: #fff6ec; }
.diag-pill.diag-err { background: #fdeced; }
.diag-event { border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px;
  background: var(--card); padding: 10px 14px; margin-bottom: 8px; }
.diag-event.diag-ok-row { border-left-color: #03c75a; }
.diag-event.diag-err-row { border-left-color: #d8000c; }
.diag-event-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.diag-time { color: var(--muted); }
.diag-event-msg { margin-top: 6px; font-size: 14px; }
.section-title { font-size: 15px; margin: 20px 0 10px; }

/* 표 하단 합계 행 — 본문과 구분되게 옅은 배경 + 윗선 */
tr.sum-row td { background: #f7f9fa; border-top: 2px solid #d6dae0; }
/* 컬럼명 바로 아래에 붙는 합계 행 — 음영으로 구분(2026-08-05 지시) */
tr.sum-top td { background: #eef3f0; border-bottom: 2px solid #d6dae0; font-weight: 600; }

/* 재고 현황 상단 차트 (품절 예상 · 출고 상위) — 2026-08-05 */
.inv-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
@media (max-width: 1100px) { .inv-charts { grid-template-columns: 1fr; } }
.hbar-row { display: flex; align-items: center; gap: 8px; margin: 5px 0; }
.hbar-label { flex: 0 0 240px; text-align: left; font-size: 12.5px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.hbar-label b { margin-right: 4px; }
.hbar-track { flex: 1; background: #f1f3f5; border-radius: 4px; height: 16px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 4px; min-width: 2px; }
.hbar-val { flex: 0 0 84px; font-size: 12px; text-align: left; white-space: nowrap; }

/* 개요: 추이 + 전월 동기간 비교 나란히 (2026-08-05) */
.ov-charts { display: grid; grid-template-columns: 2fr 1fr; gap: 0 14px; align-items: stretch; }
.ov-charts > div { min-width: 0; }
.ov-charts .chart-box { height: calc(100% - 46px); }
@media (max-width: 1250px) { .ov-charts { grid-template-columns: 1fr; } }
.mom-grp { margin: 10px 0 14px; }
.mom-head { font-size: 13px; font-weight: 600; margin-bottom: 4px; display: flex;
  align-items: center; gap: 6px; }
.mom-grp .hbar-label { flex: 0 0 70px; }
.mom-grp .hbar-val { flex: 0 0 90px; }

/* 필터 정렬 규칙(.flt) — 라벨 폭을 고정해 단마다 입력칸 시작을 맞추고,
   버튼은 각 단의 오른쪽 끝에 둔다 (2026-08-05, 배송대행 주문에 먼저 적용) */
.row-toolbar.flt { gap: 18px; margin: 6px 0; }
.row-toolbar.flt .ctl-label { display: inline-flex; align-items: center; gap: 7px; margin: 0; }
/* 각 단의 첫 라벨만 폭을 고정해 입력칸 시작 세로선을 맞춘다 —
   중간 라벨(국가·마켓 등)은 글자 폭 그대로 붙여 빈 공간이 생기지 않게 한다 */
.row-toolbar.flt .cap { flex: 0 0 auto; font-weight: 600; color: #4b5563; }
.row-toolbar.flt .ctl-label:first-child .cap { flex: 0 0 3.6em; }
.row-toolbar.flt input[type="date"], .row-toolbar.flt select, .row-toolbar.flt input { height: 34px; }

/* 필터 박스 — 필터 묶음을 연한 배경으로 감싸 표와 시각적으로 분리한다 */
.flt-box { background: #f7f9fa; border: 1px solid var(--border, #e3e6ea);
  border-radius: 10px; padding: 12px 16px; margin: 10px 0 14px; }
.flt-box .row-toolbar.flt { margin: 4px 0; }
.flt-box .row-toolbar.flt:first-child { margin-top: 0; }
.flt-box .row-toolbar.flt:last-child { margin-bottom: 0; }
/* 단 우측 버튼 묶음 — 화면이 좁아도 묶음째 우측 정렬을 유지한 채 내려온다 */
.flt .flt-actions { margin-left: auto; display: inline-flex; gap: 8px; white-space: nowrap; }

/* 사업자별·브랜드별 정산 표 — 컬럼 구성이 같으므로 고정 레이아웃 + 첫 컬럼 폭 통일로
   두 표의 세로줄을 나란히 맞춘다 (2026-08-07 지시). 나머지 10개 숫자 컬럼은 균등 분배 */
#settle-biz-table, #settle-brand-table { table-layout: fixed; width: 100%; }
#settle-biz-table th:first-child, #settle-brand-table th:first-child { width: 190px; }
#settle-biz-table td, #settle-brand-table td,
#settle-biz-table th, #settle-brand-table th { overflow-wrap: break-word; }

/* 전역 로딩 표시 — 화면 가운데 원형 게이지. 12시 방향에서 시계방향으로 0→100%.
   모든 화면이 api()를 거치므로 한 곳에서 켜고 끈다. 짧은 조회는 깜빡임을 막으려고
   잠깐 기다렸다 띄운다(app.js LOAD_DELAY). */
#load-ring { position: fixed; inset: 0; z-index: 10000; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(255, 255, 255, .62); backdrop-filter: blur(1.5px); }
body.is-loading #load-ring { display: flex; }

#load-ring .ring-box { position: relative; width: 104px; height: 104px; }
#load-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }  /* 12시에서 시작 */
#load-ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
#load-ring .track { stroke: #e6eaee; }
#load-ring .bar { stroke: var(--green, #16a34a);
  stroke-dasharray: 263.9; stroke-dashoffset: 263.9;
  transition: stroke-dashoffset .18s linear; }
#load-ring .pct { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 20px; font-weight: 700; color: #1c1e21;
  font-variant-numeric: tabular-nums; }
#load-ring .ring-label { font-size: 13px; color: #4b5563; letter-spacing: .01em; }

/* 표·카드 자리에 넣는 뼈대(스켈레톤) — 값이 오기 전 빈 화면 대신 보여준다 */
.skel { background: linear-gradient(90deg, #eef1f4 25%, #f7f9fa 37%, #eef1f4 63%);
  background-size: 400% 100%; animation: skel 1.2s ease-in-out infinite;
  border-radius: 6px; height: 14px; margin: 9px 0; }
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ── 네이버웍스 로그인 버튼 ────────────────────────────
   공식 버튼 이미지가 공개 배포되지 않아(로고는 네이버클라우드 소유, 임의 변형 금지)
   로고를 흉내 내지 않고 브랜드 그린 위에 워드마크를 얹은 형태로 만든다.
   공식 에셋을 받으시면 .nw-mark 자리에 <img>만 갈아끼우면 된다. */
.nw-login {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px 16px; margin-top: 0;
  background: #03C75A; color: #fff; border: 0; border-radius: 8px;
  font-size: 15px; font-weight: 700; letter-spacing: -.2px;
  text-decoration: none; cursor: pointer;
  transition: background .15s ease, transform .05s ease;
}
.nw-login:hover { background: #02B350; }
.nw-login:active { transform: translateY(1px); }
.nw-login .nw-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 5px;
  background: #fff; color: #03C75A; font-size: 13px; font-weight: 900;
  line-height: 1; flex: 0 0 auto;
}
.nw-login .nw-word { font-weight: 800; }
/* 로그인 버튼 아래 구분선("또는") + SSO 배너 + 안내 한 줄 */
.login-or { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; color: var(--muted); font-size: 12px; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-sso-hint { margin: 10px 0 0; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.5; }

/* ── 내 알림 설정 — 채널 카드 + 토글 스위치 (2026-08-26 지시) ── */
.nf-list { max-width: 680px; }
.nf-item {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  border: 1px solid var(--c-border, #e3e6ec); border-radius: 12px;
  margin-bottom: 10px; background: #fff; transition: box-shadow .15s;
}
.nf-item:hover { box-shadow: 0 2px 8px rgba(20, 40, 90, .08); }
.nf-ico {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; background: #eef2fb;
}
.nf-body { flex: 1; min-width: 0; }
.nf-title { font-weight: 700; }
.nf-title .chip { margin-left: 6px; font-size: 10px; vertical-align: 1px; }
.nf-desc { font-size: 12px; color: #7a8194; margin-top: 2px; }
/* 토글 스위치 — 체크박스를 시각만 바꾼다(id·동작은 그대로) */
.tgl { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; }
.tgl input { opacity: 0; width: 0; height: 0; }
.tgl .knob {
  position: absolute; inset: 0; cursor: pointer; border-radius: 24px;
  background: #cdd3df; transition: background .15s;
}
.tgl .knob::before {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  left: 3px; top: 3px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .15s;
}
.tgl input:checked + .knob { background: var(--accent, #2f5fd8); }
.tgl input:checked + .knob::before { transform: translateX(20px); }
.tgl input:focus-visible + .knob { outline: 2px solid var(--accent, #2f5fd8); outline-offset: 2px; }
.nf-warn {
  display: flex; gap: 8px; align-items: flex-start; max-width: 680px;
  background: #fff7ed; border: 1px solid #f5d9b0; color: #8a5a1e;
  border-radius: 10px; padding: 10px 14px; font-size: 12.5px;
}
