/* 현금흐름 스튜디오 — Carbon Design System 스타일
   흰 캔버스 + 연회색 면 + 차콜 글자, 강조색은 IBM Blue 하나. 모서리는 모두 0, 깊이는 1px 선과 면 색 변화로만 표현 */
:root {
  --canvas: #FFFFFF; --surface-1: #F4F4F4; --surface-2: #E0E0E0;
  --hairline: #E0E0E0; --hairline-strong: #8D8D8D;
  --ink: #161616; --ink-muted: #525252; --ink-subtle: #6F6F6F;
  --inverse-canvas: #161616; --inverse-surface-1: #262626; --inverse-ink: #FFFFFF; --inverse-ink-muted: #C6C6C6;
  --primary: #0F62FE; --blue-hover: #0353E9; --blue-60: #0043CE; --blue-80: #002D9C; --info-soft: #EDF5FF;
  --pos: #198038; --pos-soft: #DEFBE6; --neg: #DA1E28; --neg-soft: #FFF1F1; --warn: #F1C21B; --warn-ink: #8E6A00; --warn-soft: #FCF4D6;
  --font: "IBM Plex Sans", "IBM Plex Sans KR", "Helvetica Neue", Arial, sans-serif;
  --track: 0.16px;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--canvas); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.43; letter-spacing: var(--track); font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; letter-spacing: inherit; }
h1, h2, h3 { margin: 0; font-weight: 400; }
a { color: var(--primary); }
a:hover { color: var(--blue-60); }

/* ---------- 유틸리티 바 · 상단 바 ---------- */
.util-bar { background: var(--surface-1); color: var(--ink-muted); font-size: 12px; letter-spacing: .32px; }
.util-in { max-width: 1584px; margin: 0 auto; padding: 0 32px; height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.util-in a { color: var(--ink-muted); text-decoration: none; }
.util-in a:hover { color: var(--ink); text-decoration: underline; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--canvas); border-bottom: 1px solid var(--hairline); }
.topbar-in { max-width: 1584px; margin: 0 auto; padding: 0 16px 0 32px; height: 48px; display: flex; align-items: stretch; gap: 24px; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; text-decoration: none; white-space: nowrap; }
.logo-mark { width: 16px; height: 16px; background: var(--primary); }
.nav { display: flex; overflow-x: auto; scrollbar-width: none; }
.nav button { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ink-muted); padding: 0 16px; cursor: pointer; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.nav button b { font-weight: 400; font-size: 12px; color: var(--ink-subtle); }
.nav button:hover { color: var(--ink); background: var(--surface-1); }
.nav button.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--primary); }
.plan-chip { margin-left: auto; align-self: center; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; letter-spacing: .32px; color: var(--ink-muted); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; background: var(--pos); flex-shrink: 0; }

.wrap { max-width: 1584px; margin: 0 auto; padding: 32px 32px 64px; }
.view { display: none; flex-direction: column; gap: 16px; }
.view.on { display: flex; }
.view-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; padding-bottom: 8px; }
.view-title { font-size: 42px; line-height: 1.2; font-weight: 300; color: var(--ink); letter-spacing: 0; }
.sub { color: var(--ink-muted); margin: 4px 0 0; font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note, .hint { font-size: 12px; letter-spacing: .32px; line-height: 1.33; color: var(--ink-muted); margin: 0; }
.mt8 { margin-top: 8px; } .mt14 { margin-top: 16px; }

/* ---------- 공통 컴포넌트 ---------- */
.panel, .sec, .kpi, .yearbox { background: var(--canvas); border: 1px solid var(--hairline); }
.sec { padding: 16px; min-width: 0; }
.sec h2, .panel h2 { font-size: 16px; line-height: 1.5; color: var(--ink); font-weight: 600; margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn { border-radius: 0; background: var(--ink); border: 1px solid transparent; color: var(--inverse-ink); min-height: 40px; padding: 0 16px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.btn:hover { background: #474747; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--blue-hover); }
.btn.primary:active { background: var(--blue-80); }
.btn.tertiary { background: var(--canvas); color: var(--primary); border-color: var(--primary); }
.btn.tertiary:hover { background: var(--primary); color: #fff; }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--surface-1); }
.btn.danger { background: var(--canvas); color: var(--neg); border-color: var(--neg); }
.btn.danger:hover { background: var(--neg); color: #fff; }
.btn.lg { min-height: 48px; padding: 0 64px 0 16px; font-size: 16px; }
.btn.full { width: 100%; justify-content: space-between; }
.btn.add { width: 100%; margin-top: 8px; background: transparent; border: 1px dashed var(--hairline-strong); color: var(--primary); justify-content: center; }
.btn.add:hover { background: var(--surface-1); }
.btn:disabled { background: var(--surface-2); color: var(--ink-subtle); border-color: transparent; cursor: not-allowed; }
input, select { color: var(--ink); background: var(--surface-1); border: 0; border-bottom: 1px solid var(--hairline-strong); border-radius: 0; padding: 0 12px; height: 40px; min-width: 0; width: 100%; }
input.amt { text-align: right; }
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -2px; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
label.mini { display: flex; flex-direction: column; font-size: 12px; letter-spacing: .32px; color: var(--ink-muted); gap: 4px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--ink); }
.tag-example, .dirty { font-size: 12px; letter-spacing: .32px; color: var(--blue-80); background: var(--info-soft); padding: 2px 8px; border-radius: 2px; }
.dirty { color: var(--warn-ink); background: var(--warn-soft); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--inverse-canvas); color: var(--inverse-ink); border-left: 3px solid var(--pos); padding: 14px 16px; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); }
.pos { color: var(--pos); } .neg { color: var(--neg); }

/* ---------- 01 소개 ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px; align-items: center; padding: 32px 0 48px; border-bottom: 1px solid var(--hairline); background: linear-gradient(90deg, #fff 55%, var(--info-soft)); margin: -32px -32px 16px; padding-left: 32px; padding-right: 32px; }
.eyebrow { font-size: 14px; color: var(--ink-muted); }
.hero-title { font-size: 60px; line-height: 1.17; font-weight: 300; color: var(--ink); letter-spacing: -.4px; margin: 16px 0 24px; text-wrap: balance; }
.hero-title em { font-style: normal; font-weight: 400; }
.hero-sub { color: var(--ink-muted); font-size: 18px; line-height: 1.5; letter-spacing: 0; max-width: 640px; margin: 0 0 32px; }
.hero-card { background: var(--canvas); border: 1px solid var(--hairline); padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.hc-top { display: flex; justify-content: space-between; color: var(--ink-muted); font-size: 12px; letter-spacing: .32px; }
.hc-big { font-size: 42px; line-height: 1.2; font-weight: 300; color: var(--ink); }
.hc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); }
.hc-grid div { background: var(--canvas); padding: 12px 16px; }
.hc-grid span { display: block; font-size: 12px; letter-spacing: .32px; color: var(--ink-muted); }
.hc-grid b { font-size: 18px; font-weight: 400; color: var(--ink); }
.hc-bar { display: flex; height: 8px; background: var(--surface-1); }
.hc-bar i { display: block; height: 100%; }
.sec-title { font-size: 32px; line-height: 1.25; font-weight: 300; color: var(--ink); margin-top: 32px; }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--hairline); }
.step { text-align: left; background: var(--canvas); border: 0; border-right: 1px solid var(--hairline); padding: 24px; color: var(--ink); display: flex; flex-direction: column; gap: 8px; min-height: 220px; }
.step:last-child { border-right: 0; }
button.step { cursor: pointer; }
button.step:hover { background: var(--surface-1); }
.step-n { font-size: 14px; color: var(--ink-muted); }
.step h3 { font-size: 20px; line-height: 1.4; font-weight: 400; }
.step p { margin: 0; font-size: 14px; color: var(--ink-muted); line-height: 1.43; }
.step.neg { box-shadow: inset 0 3px 0 var(--neg); }
.step.pos { box-shadow: inset 0 3px 0 var(--pos); }
.step.info { box-shadow: inset 0 3px 0 var(--primary); }
.step.neg .step-n { color: var(--neg); } .step.pos .step-n { color: var(--pos); } .step.info .step-n { color: var(--primary); }
.notice { padding: 16px; font-size: 14px; color: var(--ink-muted); background: var(--surface-1); border: 0; border-left: 3px solid var(--primary); }
.notice b { color: var(--ink); margin-right: 8px; font-weight: 600; }

/* ---------- 02 입력 ---------- */
.planbar { padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-1); border: 0; }
.pb-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.pb-l { font-weight: 600; }
#planSel { width: auto; min-width: 220px; max-width: 100%; background: var(--canvas); }
.pb-btns { display: flex; flex-wrap: wrap; gap: 1px; margin-left: auto; }
.pb-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--canvas); padding: 8px 12px; border: 1px solid var(--hairline); }
.pb-form input#nameIn { width: 260px; max-width: 100%; }
.input-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.editor { display: flex; flex-direction: column; overflow: hidden; }
.ph { border-bottom: 1px solid var(--hairline); }
.pb { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.pf { padding: 16px; border-top: 1px solid var(--hairline); display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; background: var(--surface-1); }
.pf .drop { flex: 1; min-width: 240px; }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: 1; border: 0; border-bottom: 2px solid var(--hairline); background: transparent; color: var(--ink-muted); padding: 0 16px; height: 48px; cursor: pointer; white-space: nowrap; text-align: left; }
.tabs button:hover { color: var(--ink); background: var(--surface-1); }
.tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--primary); }
.grp h3 { margin: 0 0 8px; font-size: 14px; color: var(--ink); font-weight: 600; display: flex; justify-content: space-between; }
.grp h3 span:last-child { font-weight: 400; color: var(--ink-muted); }
.item { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--hairline); background: var(--canvas); align-items: center; }
.item + .item { border-top: 0; }
.i-asset { grid-template-columns: minmax(0, 1fr) 160px 90px 40px; }
.i-flow { grid-template-columns: minmax(0, 1fr) 160px 40px; }
.i-flow .meta { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.basic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.del { border: 0; background: transparent; color: var(--ink-muted); cursor: pointer; font-size: 20px; height: 40px; width: 40px; }
.del:hover { color: #fff; background: var(--neg); }
.drop { border: 1px dashed var(--hairline-strong); padding: 12px; text-align: center; font-size: 14px; color: var(--primary); cursor: pointer; display: flex; align-items: center; justify-content: center; background: var(--canvas); }
.drop.over, .drop:hover { border-color: var(--primary); background: var(--info-soft); }
.live { padding: 16px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 64px; }
.live-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); }
.live-kpis div { background: var(--canvas); padding: 12px; }
.live-kpis span { display: block; font-size: 12px; letter-spacing: .32px; color: var(--ink-muted); }
.live-kpis b { font-size: 20px; font-weight: 300; color: var(--ink); }
.howto { background: var(--surface-1); padding: 16px; font-size: 14px; color: var(--ink-muted); }
.howto b { color: var(--ink); font-weight: 600; }
.howto ol { margin: 8px 0 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 4px; }

/* 흑자 배분 규칙 */
.rule-step { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-muted); padding: 12px; background: var(--surface-1); margin-bottom: 12px; }
.rule-step b { color: var(--ink); font-weight: 600; }
.tier { border-left: 3px solid var(--primary); padding-left: 12px; margin-bottom: 16px; }
.tier-h { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.i-rule { grid-template-columns: 100px minmax(0, 1fr) minmax(0, 1fr) 100px 40px; align-items: end; }
.i-rule > label:nth-of-type(2) { grid-column: 2 / 4; }
.i-rule > label:nth-of-type(4) { grid-column: 1 / 3; }
.i-rule > label:nth-of-type(5) { grid-column: 3 / -1; }
.i-rule .rule-sum { grid-column: 1 / -1; font-size: 12px; letter-spacing: .32px; color: var(--blue-60); }
.leftover { max-width: 440px; }

/* 규칙 탭 아래 설명 상자 */
.help-box { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; padding: 16px; background: var(--info-soft); border-left: 3px solid var(--primary); }
.hb-text { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 4px; }
.hb-text b { font-weight: 600; }

/* 적자 인출 순서 */
.i-wd { grid-template-columns: minmax(0, 1fr) 110px 140px 100px; align-items: end; }
.i-wd .wd-name, .i-wd .wd-amt { align-self: center; }
.i-wd .rule-sum { grid-column: 1 / -1; font-size: 12px; letter-spacing: .32px; color: var(--blue-60); }
.off-tier { border-left-color: var(--hairline-strong); }
.i-wd.off { color: var(--ink-subtle); background: var(--surface-1); }
.wd-name { display: flex; align-items: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wd-amt { text-align: right; }

/* ---------- 03 대시보드 ---------- */
.yearbox { display: flex; align-items: center; gap: 16px; padding: 12px 16px; flex-wrap: wrap; background: var(--surface-1); border: 0; }
.yearbox strong { font-size: 24px; font-weight: 300; min-width: 90px; }
.yearbox input[type=range] { width: 280px; max-width: 100%; height: 24px; accent-color: var(--primary); padding: 0; border: 0; background: transparent; outline: none; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); }
.kpis .kpi { border: 0; }
.kpi { padding: 16px; min-width: 0; }
.kpi .k { font-size: 14px; color: var(--ink-muted); }
.kpi .v { font-size: 28px; line-height: 1.29; font-weight: 300; color: var(--ink); margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .f { font-size: 12px; letter-spacing: .32px; color: var(--ink-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.kpi.net { background: var(--surface-1); box-shadow: inset 0 3px 0 var(--primary); }
.kpi.inc .v { color: var(--pos); }
.kpi.exp .v, .kpi.neg .v { color: var(--neg); }
.kpi.warn .v { color: var(--warn-ink); }
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: 0 12px; height: 40px; border-bottom: 1px solid var(--hairline); text-align: right; white-space: nowrap; }
th { font-size: 14px; color: var(--ink); font-weight: 600; background: var(--surface-2); border-bottom: 0; }
td { color: var(--ink); }
th:first-child, td:first-child { text-align: left; }
tbody tr:hover td, table tr:hover td { background: var(--surface-1); }
tr.sum td { font-weight: 600; background: var(--surface-1); }
tr.inc td { color: var(--pos); }
tr.exp td { color: var(--neg); }
tr.net td { font-weight: 600; background: var(--surface-1); box-shadow: inset 0 -2px 0 var(--primary); }
td.pos { color: var(--pos); } td.neg { color: var(--neg); } td.b { font-weight: 600; }
.sw { display: inline-block; width: 10px; height: 10px; margin-right: 8px; vertical-align: 0; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cbox { position: relative; height: 300px; }
.cbox.sm { height: 220px; }
.rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.mini-h { font-size: 14px; color: var(--ink-muted); font-weight: 400; margin: 0 0 8px; }
table.rtable { min-width: 0; }
.rtable td, .rtable th { white-space: normal; height: auto; padding: 8px 12px; }
.rtable td:nth-child(2), .rtable th:nth-child(2) { text-align: left; }
.legend-key { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12px; letter-spacing: .32px; color: var(--ink-muted); margin-top: 12px; }
.legend-key i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -2px; }

/* 진단 목록 */
.diag { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--hairline); }
.diag li { display: flex; gap: 12px; font-size: 14px; padding: 12px; background: var(--canvas); border-bottom: 1px solid var(--hairline); }
.diag li:last-child { border-bottom: 0; }
.diag b { font-weight: 600; }
.lv { flex-shrink: 0; font-size: 12px; letter-spacing: .32px; padding: 2px 8px; border-radius: 2px; height: fit-content; white-space: nowrap; }
.lv.good { background: var(--pos-soft); color: #0E6027; }
.lv.warn { background: var(--warn-soft); color: var(--warn-ink); }
.lv.bad { background: var(--neg-soft); color: #A2191F; }
.lv.info { background: var(--info-soft); color: var(--blue-80); }

/* 인라인 알림 (원금 인출 알림 등) — Carbon inline notification */
.inline-note { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 14px 16px; border-left: 3px solid var(--hairline-strong); background: var(--surface-1); font-size: 14px; line-height: 1.5; }
.inline-note > b { font-weight: 600; white-space: nowrap; }
.inline-note > span { flex: 1; min-width: 240px; }
.inline-note span b { font-weight: 600; }
.inline-note.good { border-left-color: var(--pos); background: var(--pos-soft); }
.inline-note.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.inline-note.bad { border-left-color: var(--neg); background: var(--neg-soft); }
.inline-note.sm { padding: 8px 12px; font-size: 12px; letter-spacing: .32px; }
.yr-chips { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.yr-chip { font: inherit; font-size: 12px; letter-spacing: .32px; padding: 2px 8px; border: 1px solid var(--neg); color: #A2191F; background: var(--canvas); border-radius: 2px; }
button.yr-chip { cursor: pointer; }
button.yr-chip:hover { background: var(--neg); color: #fff; }
.a4 .inline-note { padding: 8px 10px; font-size: 11px; }
.a4 .yr-chip { font-size: 10px; padding: 1px 5px; }

/* 자산형성 스튜디오 연동 */
.linkbar { padding: 16px; display: flex; flex-direction: column; gap: 12px; border-left: 3px solid var(--primary); }
.lb-row { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.lb-text { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 4px; }
.lb-text b { font-weight: 600; }
.link-confirm { display: flex; flex-direction: column; gap: 12px; }
.inline-note.info { border-left-color: var(--primary); background: var(--info-soft); }

/* ---------- 04 연도별 흐름 ---------- */
.ytable { min-width: 1120px; }
.ytable td, .ytable th { height: 36px; padding: 0 10px; }
.ytable tr[data-t] { cursor: pointer; }
.ytable tr[data-t="0"] { cursor: default; }
.ytable tr.def td { background: var(--neg-soft); }
.ytable tr.cur td { background: var(--info-soft); }
.ytable tr.sel td { box-shadow: inset 0 1px 0 var(--primary), inset 0 -1px 0 var(--primary); }
.ytable tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--primary), inset 0 1px 0 var(--primary), inset 0 -1px 0 var(--primary); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; align-items: start; }
.dtable { min-width: 540px; }

/* ---------- 05 몬테카를로 ---------- */
.mc-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.mc-settings { padding: 16px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; background: var(--surface-1); border: 0; }
.mc-settings input, .mc-settings select { background: var(--canvas); }
.mc-set { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mc-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.mc-status { font-size: 14px; margin: 0; padding: 14px 16px; background: var(--surface-1); color: var(--ink-muted); border-left: 3px solid var(--hairline-strong); }
.mc-status.ok { border-left-color: var(--pos); color: var(--ink); }
.mc-status.stale { border-left-color: var(--warn); color: var(--ink); background: var(--warn-soft); }

.mc-tabs { margin: 4px -16px 0; background: transparent; }
.mc-tabs button { height: 40px; }
.mc-pane { display: flex; flex-direction: column; gap: 12px; }
.tax-off { opacity: .45; }
.tax-row { display: grid; grid-template-columns: 52px minmax(0, 1.4fr) minmax(0, 1fr); gap: 8px; align-items: center; font-size: 14px; }
.tax-row select { height: 36px; padding: 0 8px; font-size: 13px; }
.tax-head { display: grid; grid-template-columns: 52px minmax(0, 1.4fr) minmax(0, 1fr); gap: 8px; font-size: 12px; letter-spacing: .32px; color: var(--ink-muted); }
.tax-box { background: var(--canvas); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.tax-box h4 { margin: 0; font-size: 14px; font-weight: 600; }
.span2 { grid-column: 1 / -1; }
.mc-wide { grid-column: 1 / -1; }

/* ---------- FAQ · 푸터 ---------- */
.faq { display: flex; flex-direction: column; border-top: 1px solid var(--hairline); }
.faq details { border-bottom: 1px solid var(--hairline); }
.faq summary { cursor: pointer; padding: 14px 16px; font-size: 16px; color: var(--ink); list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::after { content: "⌄"; color: var(--ink-muted); }
.faq details[open] summary::after { transform: rotate(180deg); }
.faq summary:hover { background: var(--surface-1); }
.faq details p { color: var(--ink-muted); margin: 0; padding: 0 16px 16px; max-width: 840px; font-size: 14px; }
.site-footer { background: var(--inverse-canvas); color: var(--inverse-ink-muted); margin-top: 64px; }
.footer-in { max-width: 1584px; margin: 0 auto; padding: 48px 32px 32px; display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 32px; }
.footer-brand b { display: flex; align-items: center; gap: 8px; color: var(--inverse-ink); font-size: 20px; font-weight: 300; }
.footer-brand p { margin: 12px 0 0; font-size: 14px; max-width: 360px; }
.footer-col { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.footer-col h4 { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--inverse-ink); }
.footer-col a { color: var(--inverse-ink-muted); text-decoration: none; }
.footer-col a:hover { color: var(--inverse-ink); text-decoration: underline; }
.footer-note { max-width: 1584px; margin: 0 auto; padding: 16px 32px 32px; font-size: 12px; letter-spacing: .32px; border-top: 1px solid var(--inverse-surface-1); }
.footer-note a { color: var(--inverse-ink); }

/* ---------- A4 미리보기 ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(22, 22, 22, .7); display: flex; flex-direction: column; }
.overlay-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 8px 16px; background: var(--canvas); border-bottom: 1px solid var(--hairline); }
.grow { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--hairline-strong); }
.seg button { border: 0; background: var(--canvas); padding: 0 16px; height: 32px; color: var(--ink-muted); cursor: pointer; }
.seg button.on { background: var(--ink); color: #fff; }
.a4-stage { flex: 1; overflow: auto; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 24px; }

.a4 { width: 210mm; height: 297mm; background: #fff; color: var(--ink); position: relative; overflow: hidden; flex-shrink: 0; font-size: 12px; }
.a4.landscape { width: 297mm; height: 210mm; }
.a4-inner { padding: 12mm 12mm 14mm; transform-origin: top left; display: flex; flex-direction: column; gap: 10px; }
.a4 .a4-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid var(--ink); padding-bottom: 8px; }
.a4 .a4-head h1 { font-size: 26px; font-weight: 300; }
.a4 .a4-head span { font-size: 11px; color: var(--ink-muted); }
.a4 .a4-h2 { font-size: 14px; font-weight: 600; margin: 4px 0 0; padding-left: 8px; border-left: 3px solid var(--primary); }
.a4 .kpi { padding: 8px 10px; }
.a4 .kpi .k { font-size: 11px; }
.a4 .kpi .v { font-size: 18px; margin-top: 2px; }
.a4 .kpi .f { font-size: 9.5px; letter-spacing: 0; }
.a4 .sec { padding: 10px 12px; }
.a4 .sec h2 { font-size: 13px; margin-bottom: 6px; }
/* A4 표: 칸 안에서 줄바꿈을 허용해 표가 종이 폭을 넘지 않게 한다 (금액은 '16억 4,028만'처럼 띄어쓰기에서만 접힘) */
.a4 table { min-width: 0; width: 100%; max-width: 100%; font-size: 10.5px; letter-spacing: 0; }
.a4 th, .a4 td { padding: 3px 5px; height: auto; white-space: normal; word-break: keep-all; overflow-wrap: normal; line-height: 1.3; }
.a4 th { white-space: normal; word-break: keep-all; line-height: 1.3; vertical-align: bottom; font-size: 10.5px; }
.a4 .charts { gap: 10px; }
.a4 .cbox { height: 200px; }
.a4 .diag li { font-size: 11.5px; padding: 6px 8px; }
.a4 .ytable { font-size: 9px; }
.a4 .ytable th, .a4 .ytable td { padding: 2px 3px; }
.a4 .sec { overflow: hidden; } /* 혹시 넘쳐도 칸 밖으로 그리지 않음 */
.a4 .rules { gap: 10px; }
.a4 .legend-key { margin-top: 4px; font-size: 10px; }
.a4 .a4-foot { position: absolute; left: 12mm; right: 12mm; bottom: 6mm; display: flex; justify-content: space-between; font-size: 9.5px; color: var(--ink-subtle); border-top: 1px solid var(--hairline); padding-top: 4px; }
/* A4 안은 화면 너비와 무관하게 고정 */
.a4 .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.a4 .charts, .a4 .rules { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- 반응형 (Carbon 브레이크포인트) ---------- */
@media (max-width: 1312px) {
  .input-layout, .mc-layout { grid-template-columns: minmax(0, 1fr); }
  .live, .mc-settings { position: static; max-height: none; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1056px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-title { font-size: 42px; letter-spacing: 0; }
  .charts, .rules { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step:nth-child(2) { border-right: 0; }
  .step:nth-child(-n+2) { border-bottom: 1px solid var(--hairline); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-chip { display: none; }
  .footer-in { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 672px) {
  .util-bar { display: none; }
  .wrap { padding: 16px 16px 48px; }
  .hero { margin: -16px -16px 8px; padding: 24px 16px 32px; }
  .hero-title { font-size: 32px; }
  .hero-sub { font-size: 16px; }
  .view-title { font-size: 32px; }
  .topbar-in { flex-wrap: wrap; height: auto; padding: 0 0 0 16px; gap: 0; }
  .logo { height: 48px; }
  .nav { width: 100%; margin-left: -16px; width: calc(100% + 16px); border-top: 1px solid var(--hairline); }
  .nav button { height: 48px; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .step { border-right: 0; border-bottom: 1px solid var(--hairline); min-height: 0; }
  .step:last-child { border-bottom: 0; }
  .kpi .v { font-size: 22px; }
  .i-asset { grid-template-columns: minmax(0, 1fr) 120px 40px; }
  .i-asset select[data-k="rate"] { grid-column: 1 / 3; }
  .basic-grid, .mc-set { grid-template-columns: minmax(0, 1fr); }
  .i-rule { grid-template-columns: minmax(0, 1fr) 100px 40px; }
  .i-rule > label:nth-of-type(2) { grid-column: 1 / -1; order: -1; }
  .i-rule > label:nth-of-type(4), .i-rule > label:nth-of-type(5) { grid-column: 1 / -1; }
  .i-wd { grid-template-columns: minmax(0, 1fr) 96px; } /* 이름 한 줄, 아래에 순위(넓게)·비율 */
  .i-wd .wd-name { grid-column: 1 / -1; }
  .i-wd .wd-amt { display: none; }
  .pb-btns { margin-left: 0; }
  .footer-in { grid-template-columns: minmax(0, 1fr); padding: 32px 16px; }
  .footer-note { padding: 16px; }
}
/* 터치 화면에서는 48px 탭 높이 */
@media (pointer: coarse) {
  .btn, input, select, .tabs button, .nav button { min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- 인쇄: A4 페이지만 ---------- */
@media print {
  body { background: #fff; }
  body > *:not(.overlay) { display: none !important; }
  .overlay { position: static; background: #fff; display: block; }
  .overlay-bar { display: none !important; }
  .a4-stage { padding: 0; display: block; overflow: visible; }
  .a4 { break-after: page; page-break-after: always; }
  .a4:last-child { break-after: auto; page-break-after: auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
