/* ==========================================================================
   FGSS 이용 가이드 · 국세청 인증 방법 · 구성 및 용어설명 공용 스타일
   - 색은 fgss_design.css 토큰만 사용 (라이트/다크 자동)
   - 상태 칩은 기존 .cap / .cap-* 재사용
   ========================================================================== */

/* ---------- 공통 : 모달 껍데기 ---------- */
.fg-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(15, 18, 23, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.fg-overlay[hidden] { display: none; }
.fg-dialog {
  position: relative;
  width: min(1180px, 100%);
  height: min(760px, calc(100dvh - 32px));
  background: var(--bg-surface);
  color: var(--fg-default);
  border-radius: 18px;
  box-shadow: var(--shadow-modal, 0 28px 72px rgba(15, 18, 23, 0.32));
  display: flex; flex-direction: column; overflow: hidden;
  letter-spacing: -0.01em;
}
.fg-dialog:focus { outline: none; }

/* ---------- 상단 : 제목 + 단계 표시 ---------- */
.fg-top { padding: 16px 28px 12px; border-bottom: 1px solid var(--border-default); flex: none; }
.fg-brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fg-brand b { font-size: 15px; font-weight: 700; color: var(--brand-500); }
[data-theme="dark"] .fg-brand b { color: var(--brand-700); }
.fg-brand span { font-size: 12px; color: var(--fg-muted); }
.fg-x {
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent;
  color: var(--fg-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.fg-x:hover { background: var(--bg-hover); color: var(--fg-strong); }
.fg-x[hidden] { display: none; }

.fg-ind { display: flex; align-items: center; margin-top: 12px; }
.fg-it { display: flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; color: var(--fg-muted); }
.fg-it.is-cur { color: var(--fg-strong); font-weight: 700; }
.fg-c {
  width: 28px; height: 28px; border-radius: 999px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: var(--brand-50); color: var(--brand-500);
}
[data-theme="dark"] .fg-c { color: var(--brand-700); }
.fg-it.is-cur .fg-c, .fg-it.is-done .fg-c { background: var(--brand-500); color: #fff; }
.fg-line { flex: 1; height: 0; border-top: 1px solid var(--border-default); margin: 0 8px; min-width: 6px; }

/* ---------- 본문 ---------- */
.fg-body { flex: 1; min-height: 0; display: flex; position: relative; }
.fg-step { display: contents; }
.fg-step[hidden] { display: none; }
.fg-left {
  width: 400px; flex: none; padding: 18px 24px 16px 28px;
  display: flex; flex-direction: column; overflow-y: auto;
}
.fg-menu {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: 6px;
  background: var(--brand-500); color: #fff; font-size: 12px; font-weight: 700;
}
.fg-menu i { font-style: normal; font-weight: 500; opacity: 0.8; }
.fg-t { margin: 8px 0 0; font-size: 22px; line-height: 1.35; font-weight: 700; color: var(--fg-strong); }
.fg-lead { margin: 6px 0 0; font-size: 14px; line-height: 1.6; color: var(--fg-default); opacity: 0.85; }

.fg-open {
  margin-top: 12px; border: 1px solid var(--brand-200); background: var(--brand-50);
  border-radius: 10px; padding: 9px 11px;
}
.fg-open .ol { font-size: 11.5px; font-weight: 700; color: var(--brand-500); margin-bottom: 6px; }
[data-theme="dark"] .fg-open .ol { color: var(--brand-700); }
.fg-open .orow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fg-open .orow img { display: block; height: 40px; width: auto; border-radius: 6px; background: #fff; }
.fg-open .ar { font-size: 15px; font-weight: 700; color: var(--fg-muted); }
.fg-open .ot { font-size: 12.5px; line-height: 1.5; color: var(--fg-default); margin-top: 6px; }
.fg-open .ot b {
  display: inline-flex; width: 17px; height: 17px; border-radius: 50%;
  background: var(--brand-500); color: #fff; font-size: 10.5px;
  align-items: center; justify-content: center; margin-right: 3px; vertical-align: 1px;
}
.fg-open.one { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fg-open.one .ol, .fg-open.one .ot { margin: 0; }

.fg-acts { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.fg-acts li { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; color: var(--fg-default); }
.fg-n {
  width: 21px; height: 21px; flex: none; border-radius: 50%;
  background: var(--brand-500); color: #fff; font-size: 11.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.fg-s { display: block; font-size: 12.5px; color: var(--fg-muted); margin-top: 1px; }
.fg-k {
  display: inline-block; padding: 0 5px; border-radius: 5px;
  background: var(--bg-sunken); font-size: 12.5px; font-weight: 700; color: var(--fg-strong);
}
.fg-grp { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; font-weight: 700; color: var(--fg-strong); }
.fg-grp span { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 700; }
.fg-grp .au { background: var(--brand-50); color: var(--brand-500); }
[data-theme="dark"] .fg-grp .au { color: var(--brand-700); }
.fg-grp .mn { background: var(--bg-sunken); color: var(--fg-default); }
.fg-grp + .fg-acts { margin-top: 6px; }
.fg-sub { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.fg-sub li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 6px; font-size: 12.5px; line-height: 1.45; color: var(--fg-muted); }
.fg-sub li b { color: var(--fg-strong); font-weight: 700; }

.fg-res { margin-top: auto; border-radius: 10px; background: var(--brand-500); color: #fff; padding: 10px 13px; font-size: 13px; line-height: 1.55; display: flex; gap: 10px; }
.fg-res b { flex: none; font-size: 11.5px; letter-spacing: 0.06em; opacity: 0.85; padding-top: 2px; }
.fg-note { margin-top: 9px; border-radius: 10px; padding: 8px 11px; font-size: 12.5px; line-height: 1.5; border: 1px solid transparent; }
.fg-note.warn { background: var(--status-red-bg); color: var(--status-red-text); border-color: var(--status-red-border); }
.fg-note.tip { background: var(--status-yellow-bg); color: var(--status-yellow-text); border-color: var(--status-yellow-border); }
.fg-note.info { background: var(--status-green-bg); color: var(--status-green-text); border-color: var(--status-green-border); }

.fg-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 10px; }
.fg-tbl td { padding: 6px 3px; border-bottom: 1px solid var(--border-default); vertical-align: middle; line-height: 1.4; }
.fg-tbl td.k { font-weight: 700; white-space: nowrap; color: var(--fg-strong); }
.fg-tbl td.v { color: var(--fg-muted); }
.fg-cap { font-size: 12px; padding: 3px 9px 3px 7px; }
.fg-cap .cap-icon { font-size: 15px; }

/* ---------- 오른쪽 : 예시 화면 ---------- */
.fg-right {
  flex: 1; min-width: 0; background: var(--bg-canvas);
  border-left: 1px solid var(--border-default);
  padding: 12px 20px 18px; display: flex; flex-direction: column; overflow: hidden;
}
.fg-ex { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg-muted); margin-bottom: 10px; flex: none; flex-wrap: wrap; }
.fg-ex .material-symbols-outlined { font-size: 16px; }
.fg-ex em { margin-left: auto; font-style: normal; color: var(--fg-subtle); }
.fg-stage { flex: 1; min-height: 0; display: flex; gap: 14px; align-items: center; justify-content: center; }
.fg-shot {
  display: block; max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain; border-radius: 10px; background: #fff;
  box-shadow: 0 2px 10px rgba(15, 18, 23, 0.10); cursor: zoom-in;
  padding: 0; border: 0;
}
.fg-col { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; height: 100%; justify-content: center; }
.fg-capt { font-size: 11.5px; font-weight: 700; color: var(--fg-default); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.fg-capt .au { color: var(--brand-500); }
[data-theme="dark"] .fg-capt .au { color: var(--brand-700); }
.fg-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fg-gc { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.fg-tile { display: flex; flex-direction: column; min-height: 0; }
.fg-tile .fg-shot { align-self: flex-start; }
.fg-tn {
  display: inline-flex; width: 18px; height: 18px; border-radius: 50%;
  background: var(--fg-default); color: var(--bg-surface); font-size: 10.5px; font-weight: 700;
  align-items: center; justify-content: center;
}

/* ---------- 하단 버튼 ---------- */
.fg-foot { padding: 12px 28px; border-top: 1px solid var(--border-default); display: flex; align-items: center; gap: 10px; flex: none; }
.fg-fn { margin-right: auto; font-size: 12.5px; color: var(--fg-muted); }
.fg-b {
  height: 44px; padding: 0 22px; border-radius: 10px; font-size: 15px; font-weight: 700;
  border: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--fg-default); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.fg-b:hover { background: var(--bg-hover); }
.fg-b.p { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }
.fg-b.p:hover { background: var(--brand-600); }
.fg-b[hidden] { display: none; }

/* ---------- 그림 크게 보기 ---------- */
.fg-zoom { position: absolute; inset: 0; z-index: 5; background: rgba(15, 18, 23, 0.82); display: flex; flex-direction: column; padding: 14px 20px 18px; }
.fg-zoom[hidden] { display: none; }
.fg-zh { display: flex; align-items: center; justify-content: space-between; color: #fff; font-size: 13px; margin-bottom: 10px; flex: none; }
.fg-zx { height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, 0.4); background: transparent; color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; }
.fg-zb { flex: 1; min-height: 0; overflow: auto; display: flex; justify-content: center; align-items: flex-start; }
.fg-zb img { display: block; max-width: 100%; height: auto; border-radius: 10px; background: #fff; }

/* ---------- 국세청 인증 방법 모달 ---------- */
.fg-nts .fg-dialog { height: min(720px, calc(100dvh - 32px)); }
.fg-nts-hd { padding: 18px 28px 14px; border-bottom: 1px solid var(--border-default); flex: none; position: relative; }
.fg-nts-hd .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-right: 36px; }
.fg-nts-hd .fg-x { position: absolute; right: 18px; top: 14px; }
.fg-nts-hd h2 { margin: 8px 0 0; font-size: 22px; font-weight: 700; color: var(--fg-strong); }
.fg-nts-hd p { margin: 6px 0 0; font-size: 14px; line-height: 1.55; color: var(--fg-default); opacity: 0.85; }
.fg-nts-hd .sub { font-size: 13px; color: var(--fg-muted); }
.fg-nts-left { width: 420px; flex: none; padding: 16px 24px 16px 28px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.fg-nts-box { border: 1px solid var(--border-default); border-radius: 12px; padding: 4px 10px; }
.fg-nts-box td { padding: 5px 6px; border-bottom: 1px solid var(--border-default); vertical-align: top; line-height: 1.45; font-size: 12.5px; }
.fg-nts-box tr:last-child td { border-bottom: 0; }
.fg-nts-box table { width: 100%; border-collapse: collapse; }
.fg-nts .fg-note { margin-top: auto; }

/* ---------- 구성 및 용어설명 페이지 ---------- */
.rf-page { max-width: 1280px; margin: 0 auto; color: var(--fg-default); letter-spacing: -0.01em; }
.rf-hd { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 14px; padding: 18px 24px 0; }
.rf-hrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rf-h1 { margin: 0; font-size: 22px; font-weight: 700; color: var(--fg-strong); }
.rf-sub { margin: 4px 0 0; font-size: 13.5px; color: var(--fg-muted); }
.rf-how { display: flex; gap: 14px; flex-wrap: wrap; border: 1px solid var(--border-default); border-radius: 12px; padding: 8px 12px; background: var(--bg-surface-alt); }
.rf-hw { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--fg-default); white-space: nowrap; }
.rf-hw .n1 { width: 20px; height: 20px; border-radius: 50%; background: var(--brand-500); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.rf-hw .t1 { display: inline-block; width: 30px; height: 18px; border: 2px dashed #7C3AED; border-radius: 4px; background: rgba(124, 58, 237, 0.08); }
.rf-hw .l1 { display: inline-flex; height: 20px; padding: 0 7px; border-radius: 5px; background: var(--brand-50); color: var(--brand-500); font-size: 11px; font-weight: 700; align-items: center; }
[data-theme="dark"] .rf-hw .l1 { color: var(--brand-700); }
.rf-tabs { display: flex; gap: 4px; margin-top: 10px; }
.rf-tab { padding: 10px 16px; font-size: 15px; font-weight: 700; color: var(--fg-muted); border: 0; border-bottom: 2.5px solid transparent; background: none; cursor: pointer; }
.rf-tab[aria-selected="true"] { color: var(--brand-500); border-bottom-color: var(--brand-500); }
[data-theme="dark"] .rf-tab[aria-selected="true"] { color: var(--brand-700); border-bottom-color: var(--brand-700); }
.rf-bd { display: flex; gap: 20px; padding: 18px 0 32px; align-items: flex-start; }
.rf-bd[hidden] { display: none; }
.rf-toc { width: 210px; flex: none; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 8px; }
.rf-ti { height: 38px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-radius: 8px; font-size: 14px; color: var(--fg-default); cursor: pointer; border: 0; background: none; text-align: left; }
.rf-ti:hover { background: var(--bg-hover); }
.rf-ti b { font-size: 12px; color: var(--fg-subtle); width: 18px; }
.rf-ti[aria-current="true"] { background: var(--brand-50); color: var(--brand-500); font-weight: 700; }
.rf-ti[aria-current="true"] b { color: var(--brand-500); }
[data-theme="dark"] .rf-ti[aria-current="true"], [data-theme="dark"] .rf-ti[aria-current="true"] b { color: var(--brand-700); }
.rf-card { flex: 1; min-width: 0; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 14px; padding: 22px; }
.rf-card[hidden] { display: none; }
.rf-sh { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rf-no { font-size: 13px; font-weight: 700; color: var(--brand-500); }
.rf-h2 { margin: 0; font-size: 20px; font-weight: 700; color: var(--fg-strong); }
.rf-d { font-size: 13.5px; color: var(--fg-muted); }
.rf-open { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 8px 12px; border: 1px solid var(--brand-200); background: var(--brand-50); border-radius: 10px; max-width: 100%; }
.rf-open .ol { font-size: 11.5px; font-weight: 700; color: var(--brand-500); }
[data-theme="dark"] .rf-open .ol { color: var(--brand-700); }
.rf-open img { display: block; height: 36px; width: auto; border-radius: 6px; background: #fff; }
.rf-open .ar { font-size: 14px; font-weight: 700; color: var(--fg-muted); }
.rf-open .ot { font-size: 12.5px; color: var(--fg-default); }
.rf-ex { font-size: 12px; color: var(--fg-muted); margin-top: 14px; }
.rf-fig { position: relative; flex: none; align-self: flex-start; margin-top: 8px; max-width: 100%; }
.rf-fig > img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border-default); background: #fff; }
.rf-tb { position: absolute; border: 2px dashed #7C3AED; border-radius: 5px; background: rgba(124, 58, 237, 0.08); cursor: pointer; padding: 0; margin: 0; }
.rf-tb:hover, .rf-tb:focus-visible { background: rgba(124, 58, 237, 0.18); outline: none; }
.rf-tb[aria-expanded="true"] { border-style: solid; background: rgba(124, 58, 237, 0.2); }
.rf-pop { position: absolute; z-index: 3; width: min(300px, 90vw); background: var(--bg-surface); border: 1px solid #c4b5fd; border-radius: 12px; box-shadow: var(--shadow-popover, 0 12px 32px rgba(15, 18, 23, 0.18)); padding: 12px 14px; }
.rf-pop[hidden] { display: none; }
.rf-pk { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rf-pk b { font-size: 14.5px; font-weight: 700; color: #6D28D9; }
[data-theme="dark"] .rf-pk b { color: #c4b5fd; }
.rf-pk button { border: 0; background: rgba(124, 58, 237, 0.1); color: #6D28D9; width: 24px; height: 24px; border-radius: 6px; font-size: 13px; cursor: pointer; }
[data-theme="dark"] .rf-pk button { color: #c4b5fd; }
.rf-pv { font-size: 13px; line-height: 1.6; color: var(--fg-default); margin-top: 6px; }
.rf-nts { display: inline-flex; margin-top: 8px; height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--brand-500); color: var(--brand-500); background: var(--bg-surface); font-size: 12.5px; font-weight: 700; align-items: center; cursor: pointer; }
.rf-nts[hidden] { display: none; }
.rf-side { display: flex; gap: 24px; margin-top: 4px; align-items: flex-start; }
.rf-rows { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rf-rows.two { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; margin-top: 16px; }
.rf-r { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-default); }
.rf-n { width: 22px; height: 22px; border-radius: 50%; background: var(--brand-500); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.rf-rt { font-size: 14.5px; font-weight: 700; color: var(--fg-strong); line-height: 1.4; }
.rf-rd { font-size: 13px; color: var(--fg-muted); line-height: 1.55; margin-top: 2px; }
.rf-rk { font-size: 12.5px; color: var(--fg-default); line-height: 1.5; margin-top: 5px; background: var(--bg-sunken); border-radius: 7px; padding: 5px 9px; }
.rf-rk b { color: var(--brand-500); margin-right: 6px; }
[data-theme="dark"] .rf-rk b { color: var(--brand-700); }
.rf-note { margin-top: 12px; border-radius: 10px; background: var(--status-yellow-bg); color: var(--status-yellow-text); border: 1px solid var(--status-yellow-border); padding: 10px 13px; font-size: 12.5px; line-height: 1.55; }
.rf-tcard { flex: 1; min-width: 0; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 14px; padding: 22px 26px; }
.rf-grp { font-size: 13.5px; font-weight: 700; color: var(--brand-500); margin: 0 0 4px; }
[data-theme="dark"] .rf-grp { color: var(--brand-700); }
.rf-terms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; margin-bottom: 18px; }
.rf-tm { padding: 11px 0; border-bottom: 1px solid var(--border-default); }
.rf-tk { font-size: 15px; font-weight: 700; color: var(--fg-strong); }
.rf-tk small { font-size: 12.5px; font-weight: 500; color: var(--fg-muted); margin-left: 6px; }
.rf-tv { font-size: 13px; color: var(--fg-muted); line-height: 1.55; margin-top: 3px; }

/* ---------- 좁은 화면 ---------- */
@media (max-width: 900px) {
  .fg-overlay { padding: 8px; }
  .fg-dialog { height: calc(100dvh - 16px); border-radius: 14px; }
  .fg-top { padding: 12px 16px 10px; }
  .fg-it span:not(.fg-c) { display: none; }
  .fg-it.is-cur span:not(.fg-c) { display: inline; }
  .fg-line { margin: 0 4px; }
  .fg-ind { overflow: hidden; }
  .rf-hw { white-space: normal; }
  .fg-body { flex-direction: column; overflow-y: auto; }
  .fg-step:not([hidden]) { display: flex; flex-direction: column; }
  .fg-left, .fg-nts-left { width: auto; overflow: visible; padding: 14px 16px; }
  .fg-right { border-left: 0; border-top: 1px solid var(--border-default); overflow: visible; padding: 12px 16px 16px; }
  .fg-stage { flex-direction: column; }
  .fg-grid { grid-template-columns: 1fr; }
  .fg-col { height: auto; max-width: 100% !important; }
  .fg-shot { max-height: none; }
  .fg-res { margin-top: 12px; }
  .fg-foot { padding: 10px 16px; }
  .fg-fn { display: none; }
  .fg-nts-hd { padding: 14px 16px 12px; }
  .rf-bd { flex-direction: column; }
  .rf-toc { width: 100%; flex-direction: row; overflow-x: auto; position: static; }
  .rf-ti { flex: none; }
  .rf-side { flex-direction: column; }
  .rf-side .rf-fig { width: 100% !important; }
  .rf-rows.two, .rf-terms { grid-template-columns: 1fr; }
}

/* ---------- 큰 화면 : 앱 본문(zoom 1.25)과 같은 비율 ---------- */
@media (min-width: 1600px) and (min-height: 880px) {
  .fg-dialog {
    zoom: 1.25;
    width: min(1180px, calc((100vw - 48px) / 1.25));
    height: min(760px, calc((100dvh - 24px) / 1.25));
  }
  .fg-nts .fg-dialog { height: min(720px, calc((100dvh - 24px) / 1.25)); }
}