/* ════════ AWS 사용량 모달 — aws-cost.js 짝 ════════
   ideas.css 오버레이/카드 톤 + finance.css KPI/카드 결을 세이지 톤으로 통일.
   라이트 테마 전용. 색·간격은 common.css 토큰 사용. */
.awsc-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(16, 24, 40, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.awsc-overlay[hidden] { display: none; }

.awsc-modal {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 620px; max-height: 86vh;
  display: flex; flex-direction: column;
  box-shadow: 0 12px 44px rgba(16, 24, 40, .22);
  overflow: hidden;
}

/* ── 헤더 ── */
.awsc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line, #ECEEF1); flex: 0 0 auto;
}
.awsc-head h3 {
  margin: 0; font-size: 15px; font-weight: 700; color: var(--text, #1A1D21);
  display: flex; align-items: center; gap: 8px;
}
.awsc-stale {
  font-size: 10.5px; font-weight: 600; color: #9A6A1E;
  background: #FBF1DE; border: 1px solid #F0DFB8;
  border-radius: 999px; padding: 2px 8px; letter-spacing: 0;
}
.awsc-x {
  border: none; background: none; font-size: 15px; cursor: pointer;
  color: var(--muted, #79818B); padding: 4px 9px; border-radius: 8px;
}
.awsc-x:hover { background: var(--surface-2, #F4F5F7); color: var(--text, #1A1D21); }

/* ── 본문(세로 스크롤) ── */
.awsc-body {
  padding: 16px 18px 20px; flex: 1 1 auto; min-height: 0;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;   /* 모든 박스(KPI·크레딧·차트) 간격 균일 */
}
.awsc-body > * { flex: 0 0 auto; }   /* flex column에서 카드 내용 축소·잘림 방지(세로 넘치면 body가 스크롤) */
.awsc-note { color: var(--muted, #79818B); font-size: 13px; text-align: center; padding: 34px 0; }
.awsc-note-sm { padding: 26px 0; font-size: 12.5px; }

/* 안내문 */
.awsc-intro {
  margin: 0 0 14px; font-size: 12px; line-height: 1.55; color: var(--text-2, #4A5159);
  background: var(--sage-tint-3, #EEF2EF); border: 1px solid var(--sage-tint-2, #DFE7E1);
  border-radius: 10px; padding: 10px 12px;
}

/* ── KPI 2×2 ── (finance .kpi 결 차용) */
.awsc-kpis {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.awsc-kpi {
  background: var(--surface, #FFFFFF);
  border: 1px solid var(--line, #ECEEF1); border-radius: 12px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 3px;
}
.awsc-k { font-size: 12px; color: var(--muted, #79818B); font-weight: 500; }
.awsc-v {
  font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15;
  color: var(--text, #1A1D21);
  font-variant-numeric: tabular-nums; text-align: right;
}
.awsc-v.pos { color: var(--pos, #1F8A4C); }
.awsc-v.neg { color: var(--neg-strong, #B82828); }
.awsc-m {
  font-size: 11px; color: var(--muted, #79818B); min-height: 15px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.awsc-v.pos + .awsc-m { color: var(--pos, #1F8A4C); font-weight: 600; }
.awsc-v.neg + .awsc-m { color: var(--neg, #D23B3B); font-weight: 600; }

/* ── 차트 카드 ── (finance .card 결 차용) */
.awsc-card {
  background: var(--surface, #FFFFFF);
  border: 1px solid var(--line, #ECEEF1); border-radius: 12px;
  overflow: hidden;
}
.awsc-card-hd {
  padding: 12px 14px; border-bottom: 1px solid var(--line, #ECEEF1);
  font-size: 13px; font-weight: 700; color: var(--text, #1A1D21); letter-spacing: -.01em;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.awsc-hint { font-size: 11px; color: var(--muted, #79818B); font-weight: 500; letter-spacing: 0; }
.awsc-chart { padding: 12px 12px 6px; position: relative; }
.awsc-chart svg { display: block; }
.awsc-chart .awsc-seg { cursor: pointer; transition: opacity .1s ease; }
.awsc-chart svg:hover .awsc-seg { opacity: .55; }        /* 호버 시 나머지 흐리고 */
.awsc-chart svg .awsc-seg:hover { opacity: 1; }          /* 짚은 세그먼트만 선명 */

/* 커스텀 툴팁(#74) — 즉시 뜨는 세이지 톤. chartEl 기준 절대위치, 커서 추적. */
.awsc-tip {
  position: absolute; z-index: 5; pointer-events: none;
  min-width: 132px; max-width: 220px;
  padding: 8px 10px;
  background: #2E3A30; color: #fff;             /* --accent-deep */
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(16, 24, 40, .22);
  font-size: 12px; line-height: 1.4;
}
.awsc-tip[hidden] { display: none; }
.awsc-tip-mon { font-size: 11px; color: #C8D2CB; font-weight: 600; margin-bottom: 3px; }
.awsc-tip-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.awsc-tip-svc { font-weight: 600; }
.awsc-tip-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.awsc-tip-pct { font-size: 11px; color: #9BAA9E; margin-top: 2px; }

/* 범례 */
.awsc-legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  padding: 4px 14px 13px;
}
.awsc-lg {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-2, #4A5159);
}
.awsc-lg i { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }

/* 활성 크레딧 표 (billing:GetCredits — 크레딧ID별 잔여·만료·남은 일수) */
.awsc-credits-wrap { overflow-x: auto; margin: 2px -2px 0; }
.awsc-credits { width: 100%; border-collapse: collapse; font-size: 13px; }
.awsc-credits th, .awsc-credits td {
  padding: 8px 10px; text-align: left;
  border-bottom: 1px solid var(--line, #ECEEF1); white-space: nowrap;
}
.awsc-credits thead th {
  font-size: 11.5px; font-weight: 600; color: var(--muted, #79818B);
}
.awsc-credits tbody tr:last-child td { border-bottom: none; }
.awsc-credits td.awsc-cn { font-weight: 600; color: var(--text, #1A1D21); white-space: normal; min-width: 160px; }
.awsc-credits th.awsc-cr, .awsc-credits td.awsc-cr { text-align: right; }
.awsc-credits td.awsc-cr { font-variant-numeric: tabular-nums; color: var(--text, #1A1D21); }
.awsc-credits .awsc-csub { color: var(--muted, #79818B); font-size: 11.5px; }
.awsc-credits th.awsc-ce, .awsc-credits td.awsc-ce { text-align: center; color: var(--text-2, #4A5159); }
.awsc-credits th.awsc-cd, .awsc-credits td.awsc-cd {
  text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text, #1A1D21);
}
.awsc-credits td.awsc-cd-soon { color: var(--neg-strong, #B82828); }

/* 좁은 화면 — KPI 세로 1열 폴백 */
@media (max-width: 480px) {
  .awsc-kpis { grid-template-columns: 1fr; }
  .awsc-v { font-size: 22px; }
}
