/* =========================================================
   모바일 청구서 · style.css
   디자인 토큰(색상/타이포/여백/반경) 및 전체 스타일
   ========================================================= */

:root {
  /* Ink */
  --ink-900: #0B1B2B;
  --ink-800: #14263A;
  --ink-500: #5A6B80;
  --ink-400: #8593A6;
  --ink-300: #B4BEC9;
  --ink-100: #EEF2F7;

  /* Semantic */
  --npay-green-700: #02864A;
  --danger-600: #D64545;
  --danger-bg: #FFEBEC;

  --font-primary: 'SUIT Variable', 'SUIT', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;

  /* Typography scale : 통일된 폰트 크기 체계 (전역 1pt 증가) */
  --fs-3xs: 12px;   /* 배지, 저작권 등 최소 캡션 */
  --fs-2xs: 13px;   /* 캡션, 라벨, 법적고지 */
  --fs-xs: 14px;    /* 보조 본문(meta, notice, banner) */
  --fs-sm: 15px;    /* 본문(line item, hero desc) */
  --fs-md: 16px;    /* 상호명 등 소제목 */
  --fs-lg: 21px;    /* 히어로 수취인 */
  --fs-xl: 23px;    /* 강조 금액(단위) */

  /* Line-height 체계 */
  --lh-tight: 1.3;
  --lh-base: 1.5;
  --lh-relaxed: 1.7;

  /* Reference design palette (mint / flat navy) */
  --page-bg: #F5F6F8;
  --mint-bg: #E6F7F4;
  --mint-border: #BFEAE3;
  --mint-text: #0E9488;
  --flat-navy: #1D3557;
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
html, body {
  margin: 0;
  padding: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
body {
  font-family: var(--font-primary);
  background: var(--page-bg);
  min-height: 100vh;
  color: var(--ink-800);
  font-feature-settings: "tnum" 1;
  display: flex;
  justify-content: center;
  padding: 24px 20px 24px;
  padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
  width: 100%;
}
a, button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.sr-only {
  position: absolute;
  left: -9999px;
}

/* ===================== Shell ===================== */
.invoice-shell {
  width: 100%;
  max-width: 400px;
  min-width: 0;
}

.invoice-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* ===================== ① Top bar ===================== */
.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 4px 4px 4px;
}
.secure-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: #fff;
  border: 1px solid var(--mint-border);
  color: var(--mint-text);
  border-radius: 999px;
  font-size: var(--fs-3xs);
  font-weight: 700;
  letter-spacing: -0.005em;
  box-shadow: 0 2px 6px rgba(14,148,136,0.08);
}
.secure-pill svg { width: 11px; height: 11px; }

/* ===================== ② Merchant row ===================== */
.merchant-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 4px;
}
.merchant-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.merchant-name {
  font-size: 19px;
  font-weight: 800;
  color: var(--flat-navy);
  letter-spacing: -0.01em;
  line-height: var(--lh-tight);
}

/* ===================== ③ D-day chip ===================== */
.dday-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: var(--danger-bg);
  color: var(--danger-600);
  border-radius: 999px;
  font-size: var(--fs-2xs);
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}
.dday-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger-600);
  box-shadow: 0 0 0 4px rgba(214, 69, 69, 0.18);
}

/* ===================== ④ Hero ===================== */
.hero-card {
  position: relative;
  background: linear-gradient(135deg, #EAF2FE 0%, #DCEAFB 100%);
  color: var(--flat-navy);
  border: 1px solid #C9DEF7;
  border-radius: 20px;
  padding: 24px 22px 26px;
  box-shadow: 0 4px 16px rgba(29, 89, 168, 0.12);
  overflow: hidden;
  text-align: center;
}
.hero-recipient {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--flat-navy);
  letter-spacing: -0.01em;
  line-height: var(--lh-tight);
  margin: 0 0 8px;
}
.hero-recipient-tag {
  flex-shrink: 0;
  padding: 3px 10px;
  background: var(--flat-navy);
  border-radius: 999px;
  font-size: var(--fs-3xs);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}
.hero-desc {
  position: relative;
  z-index: 1;
  font-size: var(--fs-sm);
  color: var(--ink-500);
  font-weight: 500;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
  line-height: var(--lh-base);
}
.hero-amount-label {
  position: relative;
  z-index: 1;
  font-size: var(--fs-xs);
  color: var(--ink-500);
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
  line-height: var(--lh-base);
}
.hero-amount {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.hero-amount .num {
  font-size: 43px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--flat-navy);
  line-height: 1;
}
.hero-amount .won {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--flat-navy);
}
.hero-due {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  font-size: var(--fs-xs);
  color: var(--ink-500);
  line-height: var(--lh-base);
  text-align: center;
}
.hero-due b {
  color: var(--flat-navy);
  font-weight: 700;
}

/* Responsive amount shrink below 380px viewport */
@media (max-width: 380px) {
  .hero-amount .num { font-size: 39px; }
  .hero-amount .won { font-size: 19px; }
}

/* ===================== Glass card (shared) ===================== */
.glass-card {
  background: #FFFFFF;
  border-radius: 18px;
  padding: 20px 20px 22px;
  box-shadow: 0 2px 10px rgba(15,43,74,0.05);
  border: 1px solid var(--ink-100);
}
.glass-card h3 {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--flat-navy);
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.glass-card h3 .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--flat-navy);
}

/* ===================== ⑤ Line items ===================== */
.line-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.line-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-sm);
  line-height: var(--lh-tight);
}
.line-row .k {
  color: var(--ink-500);
  font-weight: 400;
}
.line-row .v {
  color: var(--ink-900);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.line-row.discount .v {
  color: var(--npay-green-700);
  font-weight: 700;
}
.line-divider-dashed {
  margin: 10px 0;
  height: 1px;
  background: var(--ink-100);
}
.line-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--ink-100);
}
.line-total .k {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-900);
}
.line-total .v {
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--flat-navy);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ===================== ⑥ 청구서 정보 ===================== */
.meta-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-xs);
  line-height: var(--lh-tight);
  gap: 8px;
}
.meta-row .k {
  color: var(--ink-500);
  flex-shrink: 0;
}
.meta-row .v {
  color: var(--ink-800);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.meta-row .v.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 600;
}

/* ===================== ⑦ 결제 전 안내 (notice) ===================== */
.notice-card {
  background: var(--danger-bg);
  border: 1px solid #F7C6CB;
  border-radius: 14px;
  padding: 16px 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.notice-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--danger-600);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: var(--fs-xs);
  font-weight: 800;
  flex-shrink: 0;
}
.notice-body {
  font-size: var(--fs-xs);
  color: var(--ink-500);
  line-height: var(--lh-relaxed);
}
.notice-body p {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--danger-600);
  font-size: var(--fs-xs);
}
.notice-body ul {
  margin: 0;
  padding-left: 8px;
  font-size: var(--fs-3xs);
}
.notice-body li {
  margin-bottom: 4px;
}
.notice-body li:last-child { margin-bottom: 0; }

/* ===================== ⑨ 안전결제 배너 ===================== */
.secure-banner {
  background: var(--mint-bg);
  border: 1px solid var(--mint-border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--mint-text);
  line-height: var(--lh-tight);
}
.secure-banner svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ===================== ⑪ CTA : 하단 고정(sticky) 버튼 바 ===================== */
.cta-fixed-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  background: var(--page-bg);
  box-shadow: 0 -4px 16px rgba(15,43,74,0.06);
  padding: 16px 16px calc(14px + env(safe-area-inset-bottom, 0px));
}
.cta-wrap {
  width: 100%;
  max-width: 400px;
  padding: 4px;
}
.pay-cta {
  width: 100%;
  min-height: 56px;
  background: var(--flat-navy);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 16px 20px;
  font-family: inherit;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(29,53,87,.25);
  transition: transform 0.15s ease, filter 0.2s ease, box-shadow 0.2s ease;
  touch-action: manipulation;
}
.pay-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.pay-cta:active {
  transform: translateY(0);
  filter: brightness(0.98);
}
.pay-cta:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}
.pay-cta .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cta-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes cta-spin {
  to { transform: rotate(360deg); }
}

/* ===================== ⑫ 법적 고지 ===================== */
.legal-footer {
  text-align: center;
  padding: 6px 12px 0;
}
.legal-links {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}
.legal-links a {
  font-size: var(--fs-2xs);
  color: var(--ink-500);
  text-decoration: none;
  font-weight: 600;
}
.legal-links a:hover { text-decoration: underline; }
.legal-links .sep {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--ink-300);
}
.legal-text {
  font-size: 11px;
  color: var(--ink-500);
  line-height: var(--lh-relaxed);
  margin: 0 0 8px;
}
.legal-copyright {
  font-size: var(--fs-3xs);
  color: var(--ink-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0;
}

/* ===================== Toast (demo feedback) ===================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink-900);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: var(--fs-xs);
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(15,43,74,0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 100;
  max-width: 320px;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===================== Mobile full-bleed ===================== */
@media (max-width: 480px) {
  body {
    padding: 16px 18px;
    padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px));
  }
  .invoice-shell { max-width: 100%; }
  .cta-fixed-bar { padding: 16px 18px calc(14px + env(safe-area-inset-bottom, 0px)); }
}

/* ===================== 초소형 화면 (iPhone SE 등 320–360px) ===================== */
@media (max-width: 360px) {
  body { padding: 12px 16px; padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
  .invoice-page { gap: 12px; }
  .hero-card { padding: 20px 18px 22px; }
  .hero-recipient { font-size: 18px; }
  .glass-card { padding: 16px 16px 18px; }
  .cta-fixed-bar { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
}

/* ===================== 링크/버튼 터치 타겟 확보 ===================== */
.legal-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 4px;
}
