/* 결제 화면(구독 · 플랜) — billing.js 전용. 리파이너리 sys admin 결제 화면(DefaultTable · Modal · 매트릭스)과 같은 모양.
   색은 style.css 의 토큰만 쓴다(다크 모드는 토큰이 바뀌어 따라온다). */

.tnum { font-variant-numeric: tabular-nums; }

/* 넓은 표·매트릭스가 페이지를 넓히지 않게 — 한 칸 그리드를 0 까지 줄 수 있게 하고, 넘침은 표 틀 안에서 가로 스크롤 */
.billing.stack-lg, .billing .stack-sm, .billing .stack { grid-template-columns: minmax(0, 1fr); }

/* 구획 머리 + 오른쪽 도구 */
.bl-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; min-width: 0; }
.bl-desc { margin-top: 4px; color: var(--ink-500); font-size: 12px; line-height: 1.5; }
.bl-desc.center { padding: 32px 0; text-align: center; }
.billing .table-wrap { max-width: 100%; }
.billing .table .bl-name { color: var(--ink-900); font-weight: 600; }
.billing .table td.bl-summary { min-width: 16em; color: var(--ink-600); font-size: 12px; white-space: normal; line-height: 1.5; }
.billing .table td.bl-act { width: 1%; text-align: right; }
.billing .table td.bl-empty { padding: 28px 12px; color: var(--muted); text-align: center; white-space: normal; }
.billing .table.clickable tbody tr:focus-visible td { background: var(--hover); }
.billing .table.clickable tbody tr:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--brand); }
.bl-org { display: inline-flex; flex-direction: column; gap: 1px; color: inherit; }
.bl-org:hover { text-decoration: none; }
.bl-org:hover strong { color: var(--link); }
.bl-org .mono { font-size: 11px; }
.btn > .ph { flex: none; }

/* 구독 — 검색 · 거르기 */
.bl-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.bl-filters select { width: auto; max-width: 100%; }
.bl-search { position: relative; display: inline-flex; align-items: center; min-width: 0; flex: 0 1 320px; }
@media (max-width: 560px) { .bl-search { flex-basis: 100%; } .bl-filters select { flex: 1 1 0; } }
.bl-search > .ph { position: absolute; left: 10px; color: var(--ink-400); pointer-events: none; }
.bl-search input { padding-left: 30px; }

/* 모달 */
.modal-head { display: flex; align-items: flex-start; gap: 10px; }
.modal-head-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; border-radius: var(--radius); background: var(--brand-50); color: var(--brand-700);
}
.modal-head-text { display: grid; gap: 2px; min-width: 0; }
.modal-sub { color: var(--ink-500); font-size: 12.5px; font-weight: 500; letter-spacing: 0; overflow-wrap: anywhere; }
.bl-foot-left { margin-right: auto; }
.bl-modal-tabs { margin: -18px -18px 4px; padding: 0 10px; }
.bl-label { color: var(--ink-800); font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.bl-grid-2 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bl-grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bl-grid-2 > .full { grid-column: 1 / -1; }
.bl-align-end { align-items: end; }
@media (max-width: 560px) {
  .bl-grid-2, .bl-grid-3 { grid-template-columns: minmax(0, 1fr); }
}
.bl-input-check { display: flex; align-items: center; gap: 8px; }
.bl-input-check input[type="text"] { flex: 1 1 auto; }
.small-check { flex: none; font-size: 12px; color: var(--ink-600); }
.small-check input { width: 14px; height: 14px; }
.bl-usd { padding-top: 0; border-top: 0; }
.bl-usd[open] > summary { margin-bottom: 8px; }

.bl-limit-list { border: 1px solid var(--ink-200); border-radius: var(--radius); }
.bl-limit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 12px; }
.bl-limit-row + .bl-limit-row { border-top: 1px solid var(--ink-100); }
.bl-limit-label { flex: 0 0 11.5em; color: var(--ink-700); font-size: 12.5px; }
.bl-limit-input { flex: 1 1 120px; height: 28px; }
@media (max-width: 480px) { .bl-limit-label { flex-basis: 100%; } }

/* 플랜 배정 — 고른 플랜 요약 · 방식 */
.bl-plan-info { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--ink-200); border-radius: var(--radius); background: var(--surface-2); }
.bl-plan-info:empty { display: none; }
.bl-plan-info-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; }
.bl-seg { display: inline-flex; width: fit-content; max-width: 100%; padding: 2px; border: 1px solid var(--ink-200); border-radius: var(--radius); background: var(--surface-2); }
.bl-seg-item { position: relative; display: inline-flex; cursor: pointer; }
.bl-seg-item input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.bl-seg-item span { padding: 5px 14px; border-radius: 6px; color: var(--ink-600); font-size: 13px; font-weight: 500; }
.bl-seg-item input:checked + span { background: var(--surface); color: var(--ink-900); font-weight: 600; box-shadow: var(--shadow-sm); }
.bl-seg-item input:focus-visible + span { box-shadow: var(--ring); }
.bl-contract { padding: 12px; border: 1px dashed var(--ink-300); border-radius: var(--radius); }
.bl-contract[hidden] { display: none; }

/* 플랜 × 기능 매트릭스 — 첫 칸(기능) 고정, 가로 넘침은 이 틀 안에서만 */
.bl-matrix-wrap {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.bl-matrix { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.bl-matrix th, .bl-matrix td { padding: 8px 10px; border-bottom: 1px solid var(--ink-100); vertical-align: middle; }
.bl-matrix thead th {
  background: var(--ink-50); border-bottom-color: var(--ink-200);
  color: var(--ink-500); font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.bl-matrix .bl-mfeat {
  position: sticky; left: 0; z-index: 1;
  min-width: 200px; max-width: 240px;
  background: var(--surface); text-align: left; font-weight: 400;
  box-shadow: 1px 0 0 var(--ink-200);
}
.bl-matrix thead .bl-mfeat { z-index: 2; background: var(--ink-50); }
.bl-matrix .bl-mplan { min-width: 128px; text-align: center; color: var(--ink-800); font-size: 12.5px; }
.bl-mplan-code { margin-top: 2px; color: var(--ink-400); font: 400 10.5px var(--mono); }
.bl-matrix tr.bl-mgroup th { position: static; padding: 8px 12px; background: var(--surface-2); border-bottom-color: var(--ink-200); text-align: left; }
.bl-matrix tr.bl-mgroup .rfn-section-head__title { font-size: 12.5px; }
.bl-matrix tbody tr:last-child td, .bl-matrix tbody tr:last-child th { border-bottom-color: var(--ink-100); }
.bl-matrix tbody:last-child tr:last-child td, .bl-matrix tbody:last-child tr:last-child th { border-bottom: 0; }
.bl-fname { color: var(--ink-900); font-weight: 600; font-size: 13px; }
.bl-fsub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 2px; }
.bl-fsub .mono { color: var(--ink-400); font-size: 11px; }
.bl-fsub .badge { font-size: 10.5px; }
.bl-mcell { text-align: center; }
.bl-mcell-inner { display: grid; justify-items: center; gap: 6px; }
.bl-mcell input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.bl-mcell input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .45; }
.bl-mcell.is-changed { background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn-line); }
.bl-mlimit-box { display: grid; gap: 4px; width: 100%; max-width: 120px; }
.bl-mlimit-box[hidden] { display: none; }
.bl-mlimit { height: 28px; padding: 0 8px; font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.bl-mlimit.invalid { border-color: var(--bad); }
.bl-mperiod { color: var(--ink-500); font-size: 11px; }

.bl-matrix-bar {
  position: sticky; bottom: 12px; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  font-size: 13px;
}
.bl-matrix-bar[hidden] { display: none; }
.bl-matrix-bar-text { color: var(--ink-700); }
.bl-matrix-bar-text strong { color: var(--ink-900); }

@media (max-width: 560px) {
  .bl-matrix .bl-mfeat { min-width: 132px; max-width: 150px; }
  .bl-matrix .bl-mplan { min-width: 104px; }
}

/* ───────── 인보이스 · AI 크레딧 ───────── */
.bl-callout { display: grid; gap: 2px; }
.bl-callout-title { font-weight: 600; }
.bl-pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.bl-inv-no { font-size: 12px; }
.bl-stack { display: inline-flex; flex-direction: column; gap: 1px; }
.bl-stack.end { align-items: flex-end; }
.bl-sub { color: var(--ink-500); font-size: 11px; }
.bl-warn-text { color: var(--warn-ink); }
.billing .table td.bl-memo { white-space: normal; min-width: 9em; font-size: 12px; }
.billing .table tr.is-active td { background: var(--hover); }
.billing .table tr.is-active td:first-child { box-shadow: inset 3px 0 0 var(--brand); }

/* 요약 타일 — 네 칸을 한 테두리 안에(리파이너리 SummaryTile) */
.bl-tiles {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden;
  border: 1px solid var(--ink-200); border-radius: var(--radius); background: var(--ink-200);
}
@media (min-width: 768px) { .bl-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.bl-tile { display: grid; align-content: start; gap: 2px; min-width: 0; padding: 12px 16px; background: var(--surface); }
.bl-tile-label { color: var(--ink-500); font-size: 12px; }
.bl-tile-value { color: var(--ink-900); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bl-tile-value.bad { color: var(--crit-ink); }
.bl-tile-sub { color: var(--ink-500); font-size: 11px; line-height: 1.45; }

/* 조직 상세 패널 — 표 아래에 열린다 */
.bl-detail { display: grid; gap: 12px; margin-top: 12px; padding: 16px; scroll-margin-top: 16px;
  border: 1px solid var(--ink-200); border-radius: var(--radius); background: var(--surface); grid-template-columns: minmax(0, 1fr); }
.bl-detail-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px; }
.bl-detail-info { display: grid; gap: 2px; min-width: 0; }
.bl-detail-title { color: var(--ink-900); font-size: 14px; font-weight: 600; }
.bl-detail-line { color: var(--ink-600); font-size: 12px; }

/* 좁은 화면에서 덜 중요한 칸을 숨긴다(리파이너리 mobileHidden) */
@media (max-width: 640px) { .billing .table .bl-hide-sm { display: none; } }

input.invalid { border-color: var(--bad); }
.bl-danger-modal .modal-head-icon { background: var(--crit-bg); color: var(--crit-ink); }

/* ───────── AI 크레딧(#/billing/ai-credits) — 목록 · 조직 상세 · 지급 · 수수료 창 (billing.js 의 ac-*) ─────────
   폭 규칙은 화면 폭이 아니라 본문 폭(컨테이너 질의)으로 정한다 — 1024px 화면은 레일 · 서브 메뉴를 빼면 본문이 520px 남짓이다. */
.ac-page { container: ac / inline-size; }
/* 그림 색 — AI 원가(아래)와 그 위에 얹는 수수료는 순서 있는 두 몫이라 같은 색상의 두 단계를 쓴다(브랜드 파랑 700 · 기본).
   다크는 표면이 어두워 단계를 바꾼다(주된 몫이 더 밝게). 검증(dataviz 순서 팔레트): 라이트 #ffffff 위 2.56:1 · 다크 #212830 위 3.13:1. */
.ac-page, .ac-dlg { --ac-cost: var(--brand-700); --ac-fee: var(--brand); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ac-page, :root:not([data-theme="light"]) .ac-dlg { --ac-cost: var(--brand); --ac-fee: var(--brand-700); }
}
:root[data-theme="dark"] .ac-page, :root[data-theme="dark"] .ac-dlg { --ac-cost: var(--brand); --ac-fee: var(--brand-700); }

/* 출처 탭 + 달 고르기(한 줄, 좁으면 접힌다) */
.ac-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 4px 16px; border-bottom: 1px solid var(--ink-200); }
.ac-bar .tabs { border-bottom: 0; min-width: 0; }
.ac-month-pick { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding-bottom: 6px; }
.ac-month-pick select { width: auto; height: 30px; font-size: 13px; }
.ac-bar-detail { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: -6px; }
.ac-bar-detail .ac-month-pick { padding-bottom: 0; }
.ac-back { display: inline-flex; align-items: center; gap: 4px; width: fit-content; margin-bottom: -6px; color: var(--ink-600); font-size: 13px; font-weight: 600; }
.ac-back:hover { color: var(--ink-900); }

/* 숫자 카드 — 네 칸을 한 테두리 안에(1 · 2 · 4칸, 빈 칸이 생기지 않게) */
.ac-kpis {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; overflow: hidden;
  border: 1px solid var(--ink-200); border-radius: var(--radius-lg); background: var(--ink-200); box-shadow: var(--shadow-card);
}
@container ac (min-width: 440px) { .ac-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container ac (min-width: 880px) { .ac-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ac-kpi { position: relative; display: grid; align-content: start; gap: 3px; min-width: 0; padding: 14px 16px 15px; background: var(--surface); }
.ac-kpi::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 3px; background: transparent; }
.ac-kpi.crit::before { background: var(--crit-mark); }
.ac-kpi.warn::before { background: var(--warn-mark); }
.ac-kpi-label { color: var(--ink-600); font-size: 12.5px; font-weight: 600; }
/* 큰 숫자는 비례 숫자(고정 폭 숫자는 표 칸에만) */
.ac-kpi-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 5px; margin: 2px 0 3px; color: var(--ink-900); font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.ac-kpi-unit { color: var(--ink-500); font-size: 13px; font-weight: 600; letter-spacing: 0; }
.ac-kpi-ok { display: inline-flex; align-items: center; gap: 6px; }
.ac-kpi-ok .ph { color: var(--ok-ink); }
.ac-kpi-sub { color: var(--ink-500); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.ac-kpi-links { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 12px; }
.ac-dot { color: var(--ink-400); }
.ac-link { padding: 0; border: 0; background: none; color: var(--link); font: inherit; font-weight: 600; cursor: pointer; }
.ac-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.ac-link:disabled { color: var(--ink-400); font-weight: 500; cursor: default; text-decoration: none; }
.ac-meter-line { display: inline-flex; align-items: center; gap: 8px; }
.meter.ac-meter { width: 64px; height: 4px; vertical-align: middle; }
.meter.ac-meter-lg { width: 96px; height: 6px; }
.ac-kv { display: grid; gap: 3px; margin-top: 4px; font-size: 13px; }
.ac-kv-row { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-600); }
.ac-kv-row strong { color: var(--ink-900); font-variant-numeric: tabular-nums; }

/* 일별 막대 그림 */
.ac-chart-card { display: grid; gap: 10px; min-width: 0; }
.ac-chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; }
.ac-legend { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; color: var(--ink-600); font-size: 12px; }
.ac-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.ac-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--ac-cost); }
.ac-swatch.fee { background: var(--ac-fee); }
.ac-chart { position: relative; min-width: 0; min-height: 200px; }
.ac-chart svg { display: block; overflow: visible; }
.ac-chart .ac-grid { stroke: var(--divider); stroke-width: 1; }
.ac-chart .ac-base { stroke: var(--ink-300); stroke-width: 1; }
.ac-chart .ac-tick, .ac-chart .ac-xl { fill: var(--ink-500); font-size: 11px; font-variant-numeric: tabular-nums; }
.ac-chart .ac-xl.is-today { fill: var(--ink-900); font-weight: 700; }
.ac-chart .ac-cost { fill: var(--ac-cost); }
.ac-chart .ac-fee { fill: var(--ac-fee); }
.ac-chart .ac-band { fill: transparent; }
.ac-chart .ac-band.is-on { fill: var(--ink-100); }
.ac-chart .ac-band.is-focus { stroke: var(--brand); stroke-width: 2; }
.ac-chart .ac-hit { fill: transparent; outline: none; }
.ac-chart-empty { display: grid; place-items: center; min-height: 120px; color: var(--muted); font-size: 13px; }
.ac-tip {
  position: absolute; z-index: 3; min-width: 150px; padding: 8px 10px; pointer-events: none;
  border: 1px solid var(--ink-200); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-pop);
  font-size: 12px; line-height: 1.5; white-space: nowrap;
}
.ac-tip-date { margin-bottom: 3px; color: var(--ink-600); font-weight: 600; }
.ac-tip-row { display: flex; align-items: center; gap: 7px; }
.ac-tip-row strong { color: var(--ink-900); font-variant-numeric: tabular-nums; }
.ac-tip-key { flex: none; width: 12px; height: 3px; border-radius: 2px; background: var(--ac-cost); }
.ac-tip-key.fee { background: var(--ac-fee); }
.ac-tip-row:not(:has(.ac-tip-key)) { padding-left: 19px; }
.ac-tip-name { color: var(--ink-500); }
.ac-table-view > summary, .ac-recent > summary { width: fit-content; cursor: pointer; color: var(--ink-700); font-size: 12.5px; font-weight: 600; }
.ac-table-view > summary:hover, .ac-recent > summary:hover { color: var(--ink-900); }
.ac-table-view[open] > summary { margin-bottom: 8px; }
.ac-recent[open] > summary { margin-bottom: 10px; }
.billing .table tr.ac-total td { border-top: 1px solid var(--ink-200); background: var(--surface-2); }

/* 조직 표 — 검색 · 거르기 칩 · 정렬 머리 */
.ac-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; }
.ac-seg { display: inline-flex; flex-wrap: wrap; width: fit-content; max-width: 100%; }
.ac-seg .seg-opt { flex: 0 0 auto; }
.ac-seg .seg-opt:disabled { opacity: 0.5; cursor: not-allowed; }
.billing .table.ac-table th, .billing .table.ac-table td { padding-left: 10px; padding-right: 10px; }
.billing .table.ac-table td.ac-c-org { min-width: 9em; white-space: normal; }
.ac-org { display: inline-flex; flex-direction: column; gap: 1px; color: inherit; }
.ac-org:hover { text-decoration: none; }
.ac-org:hover strong { color: var(--link); }
.ac-org .mono { font-size: 11px; }
.ac-block { display: block; margin-top: 3px; }
.ac-sort { display: inline-flex; align-items: center; gap: 3px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.ac-sort:hover { color: var(--ink-900); }
.ac-sort:focus-visible { border-radius: 4px; box-shadow: var(--ring); }
.ac-sort .ph { opacity: 0.35; }
.ac-sort.on { color: var(--ink-900); }
.ac-sort.on .ph { opacity: 1; }
.ac-remain { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.ac-src { color: var(--ink-500); font-size: 11px; font-weight: 500; }
.ac-src.is-org { color: var(--info-ink); font-weight: 600; }
.ac-soon { color: var(--warn-ink); font-weight: 600; }
.ac-narrow { display: none; }
.billing .table td.ac-c-when { white-space: normal; min-width: 8.5em; }
.ac-wrap { max-width: 16em; white-space: normal; overflow-wrap: anywhere; }
@container ac (max-width: 879px) { .billing .table .ac-c-last, .billing .table .ac-c-tok { display: none; } }
@container ac (max-width: 719px) {
  .billing .table .ac-c-status, .billing .table .ac-c-fee, .billing .table .ac-c-exp, .billing .table .ac-c-calls,
  .billing .table .ac-c-used, .billing .table .ac-c-gmemo { display: none; }
  .ac-narrow { display: inline-flex; }
  .ac-narrow.ac-block { display: flex; }
  .billing .table td.ac-c-memo { min-width: 7em; }
}
@container ac (max-width: 479px) { .billing .table .ac-c-cost, .billing .table .ac-c-memo, .billing .table .ac-c-exhaust { display: none; } }
/* 온프레미스 상세 — 설치본별 · 모델별을 넓으면 나란히 */
.ac-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@container ac (min-width: 960px) { .ac-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Anthropic 청구 대사 — 날짜 × 출처 표(기준 넘은 줄 강조) · 펼친 내역 */
.billing .table.ac-recon-table td { vertical-align: top; }
.billing .table.ac-recon-table tr.ac-recon-over > td { background: var(--crit-bg); }
.billing .table.ac-recon-table tr.ac-recon-over > td:first-child { box-shadow: inset 3px 0 0 var(--crit-mark); }
.billing .table.ac-recon-table tr.ac-recon-detail > td { padding: 12px 14px 16px; background: var(--surface-2); white-space: normal; }
.ac-recon-gap { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px; color: var(--ink-600); font-size: 12px;
  font-variant-numeric: tabular-nums; }
.ac-recon-gap.is-over { color: var(--crit-ink); font-weight: 700; }
.ac-recon-badges { flex-wrap: wrap; gap: 4px; }
.billing .table th.ac-recon-more, .billing .table td.ac-recon-more { width: 1%; white-space: nowrap; text-align: right; }
.ac-recon-h { margin: 0; font-size: 13px; font-weight: 700; color: var(--ink-900); }
.ac-recon-src-detail + .ac-recon-src-detail { padding-top: 10px; border-top: 1px solid var(--divider); }
.billing .table.ac-recon-tok { width: auto; min-width: 24em; }
/* 좁은 본문 — 상태는 날짜 칸 아래 배지로(ac-narrow), 개발 · 기타 · 누적 · 청구액 칸은 접는다(출처별 표에 합계가 있다) */
@container ac (max-width: 879px) { .billing .table .ac-r-cum { display: none; } }
@container ac (max-width: 719px) {
  .billing .table .ac-r-state, .billing .table .ac-r-dev, .billing .table .ac-r-other, .billing .table .ac-r-billed { display: none; }
}

/* 지급 · 수수료 창 */
.ac-dlg .modal-body { gap: 16px; }
.ac-now { padding: 8px 12px; border-radius: var(--radius); background: var(--surface-2); color: var(--ink-700); font-size: 12.5px; }
.ac-amounts .bl-seg-item span { font-variant-numeric: tabular-nums; }
.ac-inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ac-num-input { width: 9em; text-align: right; font-variant-numeric: tabular-nums; }
.ac-conv { color: var(--ink-900); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ac-conv:empty { display: none; }
.ac-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ac-chip {
  height: 26px; padding: 0 10px; border: 1px solid var(--ink-300); border-radius: 999px; background: var(--surface);
  color: var(--ink-700); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
}
.ac-chip:hover { border-color: var(--ink-400); color: var(--ink-900); }
.ac-chip[aria-pressed="true"] { border-color: var(--info-line); background: var(--info-bg); color: var(--info-ink); font-weight: 600; }
.ac-choices { display: grid; gap: 8px; }
.ac-choice { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.ac-choice-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.ac-choice-hint { padding-left: 24px; }
.ac-preview {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 10px 12px;
  border: 1px solid var(--ink-200); border-radius: var(--radius); background: var(--surface-2); color: var(--ink-600); font-size: 13px;
}
.ac-preview strong { color: var(--ink-900); font-variant-numeric: tabular-nums; }
.ac-arrow { color: var(--ink-400); }
/* 창은 본문(.billing) 밖(body)에 붙는다 — 표 안 빈 줄 · 메모 칸 모양을 여기서도 */
.ac-dlg .table td.bl-empty { padding: 20px 12px; color: var(--muted); text-align: center; white-space: normal; }
.ac-dlg .table td.bl-memo { min-width: 8em; white-space: normal; font-size: 12px; }

/* 견적 계산기 — 질문 셋(설치 방식 · 쓰임새 · 장비)을 위에서 아래로 */
.bl-calc-q { display: grid; gap: 6px; min-width: 0; }
.bl-seg { flex-wrap: wrap; width: fit-content; max-width: 100%; }
.bl-seg .seg-opt { flex: 0 1 auto; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 12px; text-align: left; }
.bl-seg-label { font-size: 13px; }
.bl-seg-sub { color: var(--ink-500); font-size: 11px; font-weight: 400; }
.bl-seg .seg-opt[aria-pressed="true"] .bl-seg-sub { color: inherit; opacity: 0.75; }
.bl-calc-lines { display: grid; gap: 8px; }
.bl-calc-line { display: grid; gap: 8px; align-items: end; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)) auto; }
.bl-calc-del { padding-bottom: 4px; }
@media (max-width: 640px) {
  .bl-calc-line { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
  .bl-calc-line > .field:first-child { grid-column: 1 / -1; }
}
/* 금액 카드 — 좁은 화면에서 7자리 금액이 칸을 넘지 않게 */
.billing .stats .stat-value { font-size: clamp(18px, 5vw, 28px); overflow-wrap: anywhere; }

/* 견적서 — A4 폭(794px) 종이 한 장. 고객에게 가는 문서라 테마와 무관하게 흰 바탕·고정 색(이 블록만 토큰 대신 고정 색).
   PDF 는 이 요소를 그대로 떠서 만들고(quote.js downloadPdf), 인쇄는 @media print 가 틀을 뺀다. */
.q-page { display: grid; gap: 14px; }
.q-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.q-hint { flex: 1; min-width: 12em; color: var(--ink-500); font-size: 12px; }
.q-check { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-700); font-size: 12.5px; }
.q-scroll { overflow-x: auto; padding-bottom: 4px; }
.q-doc { width: 794px; margin: 0 auto; background: #fff; color: #13233f; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.08);
  font-size: 12.5px; line-height: 1.55; overflow: hidden; }
.q-doc h2, .q-doc h3 { color: inherit; }

.q-band { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 26px 40px; background: #13233f; color: #fff; }
.q-band-brand { display: flex; align-items: center; gap: 10px; }
.q-brand { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.q-brand-sub { color: #a9bbd6; font-size: 11px; }
.q-band-title { text-align: center; }
.q-title { font-size: 26px; font-weight: 700; letter-spacing: 0.35em; padding-left: 0.35em; }
.q-title-en { color: #a9bbd6; font-size: 10px; letter-spacing: 0.4em; padding-left: 0.4em; }
.q-meta { display: grid; grid-template-columns: auto auto; gap: 2px 10px; justify-self: end; margin: 0; font-size: 11.5px; }
.q-meta dt { color: #a9bbd6; }
.q-meta dd { margin: 0; }
.q-band .q-edit { background: rgba(255, 243, 176, 0.22); color: #fff; }
.q-accent { height: 4px; background: linear-gradient(90deg, #2f6db5, #76a6d7 60%, #13233f); }

.q-body { display: grid; gap: 20px; padding: 26px 40px 30px; }
.q-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.q-party { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid #dfe5ee; border-left: 3px solid #2f6db5; border-radius: 6px; }
.q-party-k { color: #2f6db5; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; }
.q-party-name { font-size: 15px; font-weight: 700; }
.q-party-sub { color: #5b6577; font-size: 11.5px; }
.q-party-en { color: #5b6577; font-size: 11px; font-weight: 600; }
.q-supplier { display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; margin: 2px 0 0; font-size: 11px; }
.q-supplier dt { color: #5b6577; }
.q-supplier dd { margin: 0; }
.q-brand-sub strong { color: #fff; letter-spacing: 0.08em; }

.q-hero { display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 12px; }
.q-hero-card { display: grid; gap: 4px; align-content: start; padding: 14px 16px; background: #f3f6fb; border-radius: 8px; }
.q-hero-card.total { background: #13233f; color: #fff; }
.q-hero-k { color: #5b6577; font-size: 11px; font-weight: 600; }
.q-hero-card.total .q-hero-k, .q-hero-card.total .q-hero-s { color: #a9bbd6; }
.q-hero-plan { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.q-hero-v { font: 700 23px/1.2 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.q-hero-s { color: #5b6577; font-size: 11px; }
.q-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.q-chip { padding: 1px 8px; border-radius: 999px; background: #dfe9f6; color: #24508a; font-size: 10.5px; font-weight: 600; }

.q-sec { display: grid; gap: 8px; align-content: start; }
.q-sec-head { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid #dfe5ee; }
.q-sec-head h3 { margin: 0; flex: 1; font-size: 14px; font-weight: 700; }
.q-sec-no { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #2f6db5; color: #fff; font-size: 11px; font-weight: 700; }
.q-sec-right { padding: 1px 8px; border-radius: 999px; background: #13233f; color: #fff; font-size: 11px; font-weight: 600; }

.q-table { width: 100%; border-collapse: collapse; }
.q-table th, .q-table td { padding: 7px 10px; text-align: left; vertical-align: top; }
.q-table thead th { background: #f3f6fb; color: #5b6577; font-size: 11px; font-weight: 600; }
.q-table tbody tr + tr th, .q-table tbody tr + tr td { border-top: 1px solid #edf1f6; }
.q-table tbody th { width: 8em; color: #13233f; font-weight: 600; white-space: nowrap; }
.q-table tfoot th, .q-table tfoot td { border-top: 2px solid #13233f; font-weight: 700; }
.q-table tfoot td.num { color: #2f6db5; font-size: 14px; }
.q-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-fine { margin: 0; color: #5b6577; font-size: 11px; }

.q-formula { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.q-device { display: grid; padding: 8px 12px; border: 1px solid #dfe5ee; border-radius: 6px; }
.q-device span { color: #5b6577; font-size: 11px; }
.q-device.strong { background: #13233f; border-color: #13233f; color: #fff; }
.q-device.strong span { color: #a9bbd6; }
.q-arrow { color: #2f6db5; font-size: 18px; font-weight: 700; }
.q-meters { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.q-meter { display: grid; gap: 4px; }
.q-meter-k { display: flex; justify-content: space-between; gap: 8px; color: #5b6577; font-size: 11px; }
.q-meter-k span:first-child { color: #13233f; font-weight: 600; }

.q-storage { display: grid; grid-template-columns: 170px 1fr; gap: 18px; align-items: center; }
.q-byte { display: grid; gap: 2px; padding: 14px; background: #f3f6fb; border-radius: 8px; text-align: center; }
.q-byte-v { color: #2f6db5; font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.q-byte-v small { margin-left: 3px; color: #13233f; font-size: 13px; font-weight: 600; letter-spacing: 0; }
.q-byte-k { font-size: 11.5px; font-weight: 600; }
.q-byte-s { color: #5b6577; font-size: 10.5px; }
.q-chart { display: block; }

.q-steps { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; margin: 4px 0 0; padding: 0; list-style: none; counter-reset: none; }
.q-step { position: relative; display: grid; justify-items: center; gap: 4px; padding: 0 6px; text-align: center; }
.q-step::before { content: ""; position: absolute; top: 12px; left: 0; right: 0; height: 2px; background: #dfe5ee; }
.q-step:first-child::before { left: 50%; }
.q-step:last-child::before { right: 50%; }
.q-step-dot { position: relative; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #2f6db5; color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 0 0 4px #fff; }
.q-step-k { font-size: 11.5px; font-weight: 600; }
.q-step-v { color: #2f6db5; font-size: 12px; font-weight: 700; }

.q-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.q-items { display: grid; gap: 9px; }
.q-items-2 { grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.q-item { display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: start; }
.q-item-ic { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: #eaf1fa; }
.q-item-k { font-size: 11.5px; font-weight: 700; }
.q-item-v { color: #3a4354; font-size: 11.5px; }

.q-foot { display: grid; grid-template-columns: 1fr 200px; gap: 14px; padding-top: 14px; border-top: 1px solid #dfe5ee; }
.q-note { display: grid; gap: 4px; align-content: start; }
.q-sign { position: relative; display: grid; gap: 2px; padding: 12px 14px; border: 1px solid #dfe5ee; border-radius: 6px; }
.q-sign-name { font-size: 15px; font-weight: 700; }
.q-stamp { position: absolute; right: 14px; top: 50%; display: grid; place-items: center; width: 44px; height: 44px; margin-top: -22px; border: 2px solid #c94b4b; border-radius: 50%; color: #c94b4b; font-size: 12px; font-weight: 700; opacity: 0.85; }
.q-bottom strong { color: #13233f; letter-spacing: 0.08em; }
.q-bottom { display: flex; justify-content: space-between; gap: 12px; padding: 10px 40px; background: #f3f6fb; color: #5b6577; font-size: 10.5px; }

.q-edit { padding: 0 2px; border-radius: 3px; background: #fff3b0; outline: none; }
.q-edit:focus { box-shadow: 0 0 0 2px #e6c200; }
.q-block { display: block; min-height: 1.5em; }
.q-capturing .q-edit, .q-capturing .q-band .q-edit { background: none; box-shadow: none; padding: 0; }
@media print {
  @page { size: A4; margin: 0; }
  .rail, .side, .topbar, .banner, .alerts, .no-print { display: none !important; }
  html, body, .shell, .frame, .main { display: block !important; margin: 0 !important; padding: 0 !important; background: #fff !important; overflow: visible !important; height: auto !important; }
  .q-scroll { overflow: visible; padding: 0; }
  .q-doc { width: auto; border-radius: 0; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .q-keep { break-inside: avoid; }
  .q-edit, .q-band .q-edit { background: none; padding: 0; }
}

/* 창 안의 한 줄 안내(적용 안내 · 「지금 설정과 같습니다」) — 비어 있어도 자리를 둬 창 높이가 바뀌지 않게 */
.hint.ac-status { min-height: 1lh; }
.hint.ac-status:empty { display: block; }
.ac-more { margin-top: 6px; }

/* 크레딧 지급 창 — 유상 충전 · 무상 지급의 칸을 같은 자리에 겹쳐 두고 안 보이는 쪽은 자리만 둔다(모드를 바꿔도 창 높이가 그대로).
   모드 안에서도 줄이 생겼다 사라지지 않게 직접 입력 칸 · 환산 줄 · 안내 줄 · 기록될 메모(두 줄) 자리를 늘 둔다. 자리는 그 칸의 줄 높이(lh)라
   글이 들어와도 소수점 픽셀만큼도 늘지 않는다. */
.ac-mode-stack { display: grid; }
.ac-mode-stack > * { grid-area: 1 / 1; min-width: 0; }
.ac-mode-stack > .is-off, .ac-reserve.is-off { visibility: hidden; }
.ac-grant-dlg .ac-conv { min-height: 1lh; }
.ac-grant-dlg .ac-conv:empty { display: block; }
.ac-unit { color: var(--ink-500); font-weight: 600; }
.ac-memo-preview {
  display: -webkit-box; min-height: 2lh; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow-wrap: anywhere;
}
/* 창 안 안내 줄의 경고(수수료율 모름 · 1 크레딧 미만 · 상한 넘김 · 지난 만료일) — .hint 가 .text-crit 보다 뒤에 있어 색이 덮인다 */
.ac-dlg .hint.text-crit { color: var(--crit-ink); }
/* 고를 수 없는 항목(수수료율을 모를 때의 「유상 충전」) */
.bl-seg-item:has(input:disabled) { cursor: not-allowed; }
.bl-seg-item input:disabled + span { color: var(--ink-400); }

/* 원화 환산 — 표시 통화 고르기 · 환산 설명 줄 · 환율 단추(환율이 없을 때 주의 톤) · 두 줄 미리 보기(원화 · 달러) · 환율 창 */
.ac-cur .seg-opt { padding: 4px 10px; }
.ac-fx-note { margin-top: -8px; color: var(--ink-600); }
.ac-bar-detail .ac-fx-note { flex-basis: 100%; margin-top: -2px; } /* 상세는 달 고르기 줄 아래 한 줄 */
.ac-fx-note.is-warn { color: var(--warn-ink); }
.btn.ac-btn-warn { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); }
.btn.ac-btn-warn:hover { border-color: var(--warn-ink); background: var(--warn-bg); color: var(--warn-ink); }
.ac-preview.ac-two { display: grid; gap: 2px; }
.ac-pv-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.ac-pv-sub { display: block; min-height: 1lh; color: var(--ink-500); font-size: 12px; font-variant-numeric: tabular-nums; }
/* 지급 창의 계산 줄(원화 줄이 붙은 때) — 큰 금액이면 위 줄이 두 줄로 접히므로 그 자리까지 늘 둔다(입력 중에 창 높이가 바뀌지 않게).
   줄 높이를 정수로 박아 자리 셈에 소수점 픽셀이 생기지 않게 한다: 테두리 · 안쪽 여백 22 + 위 두 줄 20 × 2 + 줄 사이 4 + 칸 사이 2 + 원화 줄 18 = 86 */
.ac-topup.ac-two { min-height: 86px; align-content: center; line-height: 20px; }
.ac-topup.ac-two .ac-pv-sub { line-height: 18px; }
.ac-tip-usd { color: var(--ink-500); font-variant-numeric: tabular-nums; }
.ac-now.is-warn { background: var(--warn-bg); color: var(--warn-ink); }
.ac-fx-auto { color: var(--ink-700); font-size: 12.5px; overflow-wrap: anywhere; }
.ac-fx-key { width: 18em; max-width: 100%; }
.ac-fx-day { width: 11.5em; max-width: 100%; }
.ac-fx-keylabel { color: var(--ink-600); font-size: 12.5px; font-weight: 600; }
.ac-fx-recent { max-height: 260px; overflow: auto; }
.ac-dlg .table td.ac-c-act { width: 1%; white-space: nowrap; text-align: right; }
