/* ============================================================
   admin-dashboard.css — 관리자 대쉬보드(#/admin/dashboard) 전용.
   claude.ai/design 'Admin Dashboard (remodel)' 이식.
   KPI 5장 → 좌(액션 큐 · 매출 추이) / 우(승인 · 도넛 · 계약 · 정산) 2열.
   색은 tokens.css 토큰만 — 시안의 raw hex 는 전부 기존 토큰에 대응한다.
   ============================================================ */

.page-dash .admin-inner { max-width: 1560px; }

/* 페이지 타이틀 우측 스코프 배지 */
.dsh-scope {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  background: var(--c-surface-2); color: var(--c-text-4);
  font-size: 11.5px; font-weight: var(--fw-semibold); white-space: nowrap;
}

/* ── KPI ─────────────────────────────────────────────────── */
.dsh-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
@media (max-width: 1400px) { .dsh-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 980px) { .dsh-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.dsh-kpi {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); padding: 16px 18px 14px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}
/* 통합매출은 브랜드색, 미수금은 위험색 테두리로 성격을 구분한다 */
.dsh-kpi.is-brand { border-color: var(--c-orange); }
.dsh-kpi.is-danger { border-color: var(--c-danger-border); }
.dsh-kpi__l { font-size: 12.5px; color: var(--c-text-muted); font-weight: var(--fw-medium); }
.dsh-kpi__v {
  font-size: 24px; font-weight: var(--fw-bold); color: var(--c-text-strong);
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 6px; line-height: 1.25;
}
.dsh-kpi__v.is-danger { color: var(--c-danger-ink); }
.dsh-kpi__tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }

.dsh-tag {
  font-size: 11.5px; font-weight: var(--fw-bold); padding: 2.5px 9px;
  border-radius: 999px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.dsh-tag--brand { background: var(--c-orange-soft); color: var(--c-orange-ink); }
.dsh-tag--blue { background: var(--c-blue-soft); color: var(--c-blue); }
.dsh-tag--up { background: var(--c-success-bg); color: var(--c-success-ink); }
.dsh-tag--down { background: var(--c-danger-bg); color: var(--c-danger-ink); }
.dsh-tag--danger { background: var(--c-danger-bg); color: var(--c-danger-ink); }
.dsh-tag--mute { background: var(--c-surface-3); color: var(--c-text-muted); font-weight: var(--fw-medium); }

/* ── 2열 레이아웃 ────────────────────────────────────────── */
.dsh-cols { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1240px) { .dsh-cols { grid-template-columns: minmax(0, 1fr); } }
.dsh-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.dsh-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04); overflow: hidden;
}
.dsh-card.is-danger { border-color: var(--c-danger-border); }
.dsh-card__h {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 18px; border-bottom: 1px solid var(--c-divider);
}
.dsh-card__h b { font-size: var(--fs-14); font-weight: var(--fw-bold); color: var(--c-text-strong); }
.dsh-card__h--tabs { padding: 0 18px; }
.dsh-card__b { padding: 18px 20px 18px; }
.dsh-card__b--queue { padding: 8px 20px 16px; }

.dsh-badge {
  font-size: 11.5px; font-weight: var(--fw-semibold); color: var(--c-text-muted);
  background: var(--c-surface-2); padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.dsh-badge--danger { color: var(--c-danger-ink); background: var(--c-danger-bg); font-weight: var(--fw-bold); }
.dsh-none { font-size: var(--fs-13); color: var(--c-text-muted); margin: 16px 0; text-align: center; }

/* ── 액션 큐 ─────────────────────────────────────────────── */
.dsh-tabs { display: flex; align-items: center; }
.dsh-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 14px 2px; margin-right: 26px; margin-bottom: -1px;
  background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; font-size: var(--fs-14); font-weight: var(--fw-medium); color: var(--c-text-2);
}
.dsh-tab.is-on { border-bottom-color: var(--c-orange); color: var(--c-text-strong); font-weight: var(--fw-bold); }
/* 키보드 초점 — 탭이 카드(overflow:hidden) 맨 위에 붙어 전역 바깥 링의 윗변(4px)이 잘렸다(2026-10-19 실측) — 안쪽으로. */
.dsh-tab:focus-visible { outline-offset: -2px; }
.dsh-tab__n { font-size: var(--fs-13); font-weight: var(--fw-bold); color: var(--c-text-5); }
.dsh-tab__n.is-hot { color: var(--c-danger-ink); }
.dsh-hint { font-size: var(--fs-12); color: var(--c-text-5); white-space: nowrap; }

.dsh-q {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 12px; margin: 0 -12px;
  border-bottom: 1px solid var(--c-fill-1); border-radius: var(--r-md);
}
.dsh-q:last-child { border-bottom: 0; }
.dsh-q:hover { background: var(--c-surface-hover); }

/* 남은시간 칩 — 6시간 미만 위험 / 24시간 미만 주의 / 그 외 중립 */
.dsh-clock {
  flex: 0 0 104px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 10px; border-radius: var(--r-md);
  background: var(--c-surface-2); color: var(--c-text-3);
}
.dsh-clock--hot { background: var(--c-orange-soft); color: var(--c-orange-ink); }
.dsh-clock--over { background: var(--c-danger-bg); color: var(--c-danger-ink); }
.dsh-clock--warm { background: var(--c-orange-soft); color: var(--c-orange-ink); }
.dsh-clock__l { font-size: var(--fs-14); font-weight: var(--fw-bold); white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.3; }
.dsh-clock__e { font-size: 10.5px; opacity: 0.75; white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.3; }

.dsh-q__main { flex: 1; min-width: 0; }
.dsh-q__place { font-size: 14.5px; font-weight: var(--fw-bold); color: var(--c-text-strong); letter-spacing: -0.01em; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-q__sub { font-size: 12.5px; color: var(--c-text-5); line-height: 1.45; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-q__prod { flex: 0 0 132px; min-width: 0; text-align: right; }
.dsh-q__p { font-size: 13.5px; font-weight: var(--fw-semibold); color: var(--c-text); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-q__a { font-size: 12.5px; color: var(--c-text-5); line-height: 1.45; margin-top: 2px; font-variant-numeric: tabular-nums; }
.dsh-q__dv { flex: 0 0 1px; width: 1px; height: 30px; background: var(--c-fill-1); }
.dsh-q__cta {
  flex: 0 0 92px; height: 34px; border-radius: var(--r-md);
  border: 1px solid var(--c-border-strong); background: var(--c-surface);
  color: var(--c-text-2); font-size: var(--fs-13); font-weight: var(--fw-semibold);
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.dsh-q__cta:hover { border-color: var(--c-orange); background: var(--c-orange-soft); color: var(--c-orange-ink); }

/* ── 막대 차트 (매출 추이 · 계약 통계 공용) ──────────────── */
.dsh-lead { font-size: 19px; font-weight: var(--fw-bold); color: var(--c-text-strong); line-height: 1.5; letter-spacing: -0.01em; }
.dsh-lead b { color: var(--c-danger-ink); }
.dsh-bars { display: flex; align-items: flex-end; gap: 14px; margin-top: 22px; height: 150px; }
.dsh-bars--tight { gap: 4px; height: 130px; margin-top: 16px; }
.dsh-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; height: 100%; }
.dsh-bars--tight .dsh-bar { gap: 5px; }
.dsh-bar__v { font-size: 11px; font-weight: var(--fw-semibold); color: var(--c-text-muted); font-variant-numeric: tabular-nums; }
.dsh-bar__v.is-on { color: var(--c-orange-ink); font-weight: var(--fw-bold); }
.dsh-bar__r { width: 100%; max-width: 56px; border-radius: 7px 7px 3px 3px; background: var(--c-fill-3); }
.dsh-bars--tight .dsh-bar__r { border-radius: 4px 4px 2px 2px; }
.dsh-bar__r.is-on { background: var(--c-orange); }
.dsh-bar__l { font-size: 11px; color: var(--c-text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dsh-bar__l.is-on { color: var(--c-orange-ink); font-weight: var(--fw-bold); }

/* ── 가입 승인 대기 ──────────────────────────────────────── */
.dsh-apv { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--c-fill-1); }
.dsh-apv:last-child { border-bottom: 0; }
.dsh-apv__m { flex: 1; min-width: 0; }
.dsh-apv__n { font-size: 13.5px; font-weight: var(--fw-bold); color: var(--c-text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-apv__s { font-size: 11.5px; color: var(--c-text-ghost); margin-top: 2px; }
.dsh-apv__a { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.dsh-btn { padding: 6px 13px; border-radius: var(--r-sm); font-size: var(--fs-13); font-weight: var(--fw-semibold); cursor: pointer; }
.dsh-btn--ok { border: none; background: var(--c-success); color: var(--c-surface); }
.dsh-btn--ok:hover { background: var(--c-success-ink); }

/* ── 상태 알약 — 약관 경고 칩 · 정산 진행 칩 줄 공용 ─────────────
   시안: 24px · 좌우 10px · 12px 굵게. 발급 전(D-n · 오늘 발급)은 호박, 발급 뒤·마감 지남·정산 조치(연락 필요 · 기한 초과)는 빨강,
   '금액 바뀜' 은 주황(정산회계 '바뀜' 칩과 같은 토큰 — 칩 면 --c-orange-soft 위 4.7:1 · AA), '0원' 은 회색(.dsh-badge 기본 면과 같은 짝). */
.dsh-pill {
  display: inline-flex; align-items: center; flex-shrink: 0;
  height: 24px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: var(--fs-12); font-weight: var(--fw-bold); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.dsh-pill--warn { background: var(--c-warn-soft-bg); color: var(--c-amber-ink); }
.dsh-pill--danger { background: var(--c-danger-bg); color: var(--c-danger-ink); }
.dsh-pill--orange { background: var(--c-orange-soft); color: var(--c-orange-ink-strong); }
.dsh-pill--gray { background: var(--c-surface-2); color: var(--c-text-2); }
/* '정산 진행' 의 '기한 초과 N' 칩은 누를 수 있다(가장 오래된 기한 초과 달의 정산회계 '조치 필요' 탭 — 사용자 결정 B).
   모양은 알약 그대로 두고 버튼 기본값만 지운다. 초점 링은 전역 :focus-visible 링(--ring)이 흰 면에서 1.1:1 이던 때 직접 그렸고,
   2026-10-19 부터 전역(base.css · 인디고 2px · 바깥 2px)과 같은 값이다(떼도 같다 — 실측 · 지우지 않는다, CLAUDE.md 초점 줄). */
button.dsh-pill { border: none; margin: 0; font-family: inherit; line-height: 1; cursor: pointer; }
button.dsh-pill:focus-visible { outline: 2px solid var(--c-indigo); outline-offset: 2px; box-shadow: none; }

/* ── 약관 동의 전 · 명세서 마감 임박 (시안 'S-05 대쉬보드 약관 경고' 2차) ─────────────────
   건이 있을 때만 오른쪽 열 맨 위에 나타난다('가입 승인 대기' 와 같은 문법) — 없으면 카드째 사라진다.
   껍데기는 이웃 카드(.dsh-card)와 같고 호박 면·테두리만 다르다. 머리 글자 크기는 이웃 카드 규격(14px)을 따른다.
   항목 = 거래처 하나, 그 안에 경고할 달 블록(.dsh-tw__m)을 쌓는다(2차 ⑨). */
.dsh-card.is-warn { border-color: var(--c-amber-line); }
.dsh-card.is-warn > .dsh-card__h { background: var(--c-warn-bg); border-bottom-color: var(--c-amber-line); align-items: baseline; }
.dsh-card.is-warn > .dsh-card__h b { color: var(--c-amber-ink); }
.dsh-tw__hl { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; }
.dsh-badge--warn { color: var(--c-amber-ink); background: var(--c-warn-soft-bg); font-weight: var(--fw-bold); }
.dsh-tw__sort { font-size: var(--fs-12); color: var(--c-amber-ink); white-space: nowrap; }
/* 좁은 열(1280 — 407px)에서 두 줄로 꺾인다 — 낱말 가운데('동의|할')서 끊지 않게 keep-all. */
.dsh-tw__desc { margin: 0; padding: 10px 18px 0; font-size: var(--fs-13); line-height: 1.5; color: var(--c-amber-ink); word-break: keep-all; }
.dsh-tw__list { list-style: none; margin: 0; padding: 0; }
.dsh-tw { margin-top: 10px; padding: 12px 18px; border-top: 1px solid var(--c-amber-line); }
.dsh-tw__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dsh-tw__n {
  min-width: 0; font-size: var(--fs-15); font-weight: var(--fw-semibold); color: var(--c-text-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 달 블록 — 왼쪽 2px 막대가 단계를 가른다(마감 지남 빨강 · 발급 뒤 주황 · 발급 전 호박). 막대는 장식이고 글자가 단계를 말한다.
   색은 단계 클래스가 --tw-bar 로 넘긴다(폴백 = 발급 전 호박). */
.dsh-tw__m { margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--tw-bar, var(--c-warn)); }
.dsh-tw__m--closed { --tw-bar: var(--c-danger-ink); }
.dsh-tw__m--open { --tw-bar: var(--c-orange); }
.dsh-tw__m--before { --tw-bar: var(--c-warn); }
/* 좁은 열(1280 — 407px)에서 '발급 예정 (D-3)' · 0원 안내가 꺾인다 — 낱말 가운데서 끊지 않게 keep-all. */
.dsh-tw__line { margin: 0; font-size: var(--fs-13); line-height: 1.5; color: var(--c-text-2); font-variant-numeric: tabular-nums; word-break: keep-all; }
.dsh-tw__line--2 { margin-top: 1px; }
.dsh-tw__line--late { color: var(--c-danger-ink); }
.dsh-tw__tag { font-weight: var(--fw-semibold); color: var(--c-text-strong); }
.dsh-tw__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
/* 연락 줄 — 보조 글자는 --c-text-4(13px 에서 5.7:1). --c-text-muted 는 AA 미달. */
.dsh-tw__ct { min-width: 0; font-size: var(--fs-13); color: var(--c-text-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.dsh-tw__ct b { font-weight: var(--fw-semibold); color: var(--c-text-strong); }
.dsh-tw__open {
  flex-shrink: 0; height: 30px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--c-border-strong); background: var(--c-surface);
  font-size: var(--fs-13); font-weight: var(--fw-semibold); color: var(--c-text-2);
  white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.dsh-tw__open:hover { border-color: var(--c-orange); background: var(--c-orange-soft); color: var(--c-orange-ink); }
/* 전역 :focus-visible 링(--ring, 9% 알파)이 흰 면에서 1.1:1 이던 때 직접 그린 링이다 — 2026-10-19 부터 전역(base.css)과
   같은 값이다(떼도 같다 — 실측 · 지우지 않는다). */
.dsh-tw__open:focus-visible,
.dsh-more:focus-visible { outline: 2px solid var(--c-indigo); outline-offset: 2px; box-shadow: none; }

/* ── 상품별 이용 비중 ────────────────────────────────────── */
.dsh-chips { display: flex; align-items: center; gap: 6px; }
.dsh-chip {
  height: 28px; padding: 0 12px; border-radius: var(--r-md); cursor: pointer;
  font-size: 12.5px; font-weight: var(--fw-medium); white-space: nowrap;
  border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text-3);
}
.dsh-chip.is-on { border-color: var(--c-orange); background: var(--c-orange-soft); color: var(--c-orange-ink); font-weight: var(--fw-bold); }

.dsh-mix { display: flex; align-items: center; gap: 22px; }
.dsh-donut { flex: 0 0 146px; width: 146px; height: 146px; position: relative; }
.dsh-donut svg { width: 100%; height: 100%; display: block; }
.dsh-donut__c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; pointer-events: none; }
.dsh-donut__cap { font-size: 10px; color: var(--c-text-muted); white-space: nowrap; }
.dsh-donut__t { font-size: 15px; font-weight: var(--fw-bold); color: var(--c-text-strong); letter-spacing: -0.02em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dsh-donut__o { font-size: 10px; color: var(--c-text-5); white-space: nowrap; font-variant-numeric: tabular-nums; }

.dsh-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.dsh-lg { min-width: 0; }
.dsh-lg__h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.dsh-lg__n { font-size: 12.5px; font-weight: var(--fw-semibold); color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsh-lg__p { font-size: 12.5px; font-weight: var(--fw-bold); color: var(--c-text-strong); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dsh-lg__track { height: 6px; border-radius: 3px; background: var(--c-surface-2); overflow: hidden; }
.dsh-lg__bar { display: block; height: 100%; border-radius: 3px; }

.dsh-legend2 { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--c-fill-1); }
.dsh-lg2 { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--c-text-3); white-space: nowrap; }
.dsh-lg2 b { color: var(--c-text-strong); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.dsh-lg2__d { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 8px; }

/* ── 거래처 계약 통계 ────────────────────────────────────── */
.dsh-cstat { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dsh-cstat__v { font-size: 24px; font-weight: var(--fw-bold); color: var(--c-text-strong); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dsh-cstat__s { font-size: 12.5px; color: var(--c-text-5); }
.dsh-cstat__c { font-size: 11.5px; color: var(--c-text-ghost); margin-left: auto; font-variant-numeric: tabular-nums; }
.dsh-cfoot {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--c-fill-1);
  font-size: var(--fs-12); color: var(--c-text-5);
}
.dsh-cfoot b { color: var(--c-text); font-weight: var(--fw-bold); }
.dsh-cfoot b.is-danger { color: var(--c-danger-ink); }
.dsh-cfoot--plain { border-top: 0; padding-top: 0; margin-top: 14px; }

/* ── 정산 진행 ───────────────────────────────────────────── */
.dsh-prog { height: 10px; border-radius: 5px; background: var(--c-surface-2); overflow: hidden; }
.dsh-prog span { display: block; height: 100%; border-radius: 5px; background: var(--c-success-ink); }
.dsh-stgs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.dsh-stg { background: var(--c-surface-2); border-radius: var(--r-md); padding: 10px 12px; }
.dsh-stg b { display: block; font-size: 11.5px; color: var(--c-text-muted); font-weight: var(--fw-semibold); }
.dsh-stg span { font-size: var(--fs-14); font-weight: var(--fw-bold); color: var(--c-text-2); }
.dsh-stg.is-done { background: var(--c-success-bg); }
.dsh-stg.is-done span { color: var(--c-success-ink); }
.dsh-stg.is-zero { background: var(--c-danger-bg); }
.dsh-stg.is-zero span { color: var(--c-danger-ink); }

/* 조치 필요 칩 줄 — 0건 칩은 숨기고, 둘 다 0이면 줄째 없다(시안: 위 1px 선 · 12px 띄움). */
.dsh-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--c-fill-1); }

.dsh-more {
  display: flex; align-items: center; justify-content: center; gap: 4px; /* flex 라 글자 끝 공백이 접힌다 — '열기 ›' 사이 */
  width: 100%; margin-top: 14px; height: 42px; border-radius: var(--r-lg);
  background: var(--c-surface); border: 1px solid var(--c-border-strong);
  color: var(--c-text-2); font-size: 13.5px; font-weight: var(--fw-semibold); cursor: pointer;
}
.dsh-more:hover { border-color: var(--c-text-muted); background: var(--c-bg); }
