:root { --bg:#f6efe2; --surface:#fffaf1; --line:#dfcfb4; --divider:#eadcc4; --ink:#222222; --muted:#6f6254; --accent:#2f4f63; --active:#efe4cf; --summary-bg:#f1eadc; --error:#a4312a; }
* { box-sizing:border-box; letter-spacing:0; }
html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
body { margin:0; background:var(--bg); color:var(--ink); font-family:Arial,"Noto Sans KR",sans-serif; font-size:16px; line-height:1.5; }
.page { width:min(1040px, calc(100% - 32px)); margin:0 auto; padding:32px 0; }
h1 { text-align:center; font-size:26px; font-weight:800; margin:0 0 40px; line-height:34px; overflow-wrap:anywhere; }
h2 { font-size:18px; margin:0; line-height:1.4; }
h3 { font-size:18px; margin:0; }
button, input, select { font:inherit; color:inherit; }
button, .button, summary { -webkit-tap-highlight-color:transparent; }
button, .button { border:1px solid var(--line); border-radius:6px; background:var(--surface); padding:0 14px; min-height:44px; font-size:14px; font-weight:700; cursor:pointer; }
button:hover, .button:hover { background:var(--active); }
button:disabled { cursor:default; opacity:.55; }
button:focus-visible, a:focus-visible, summary:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
.button { text-decoration:none; display:inline-flex; align-items:center; color:var(--accent); }
.icon-button { display:inline-flex; justify-content:center; align-items:center; flex:0 0 42px; width:42px; height:42px; padding:0; font-size:22px; color:var(--accent); }
.icon-button svg { width:21px; height:21px; }
.danger { color:var(--error); }
.workspace { display:grid; grid-template-columns:minmax(320px,420px) minmax(0,1fr); gap:16px; align-items:start; }
.input-column, .result-column, .set-body, .calculator-body, .calculator-heading { min-width:0; }
.toolbar { display:flex; justify-content:space-between; align-items:center; gap:8px; margin:0 0 6px 2px; }
.toolbar .button { height:34px; min-height:34px; padding:0 12px; border-color:#c5ad7d; color:#1f3442; font-size:13px; }
summary::-webkit-details-marker { display:none; }
.set { margin:0 0 18px; border:1px solid var(--line); border-radius:8px; background:var(--surface); box-shadow:0 10px 24px rgba(40,30,15,.08); }
.set-header { display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:18px 20px 12px; background:#f1eadc; border-bottom:1px solid var(--divider); border-radius:8px 8px 0 0; }
.set-heading { flex:1 1 180px; min-width:0; }
.set-name { font-size:18px; font-weight:700; min-width:0; overflow-wrap:anywhere; }
.set-number { display:block; margin-bottom:4px; color:var(--muted); font-size:12px; font-weight:400; line-height:1.4; font-variant-numeric:tabular-nums; }
.summary-tabs button:has(.set-number) { padding-top:8px; padding-bottom:8px; }
.set-actions { display:flex; align-items:center; gap:8px; margin-left:auto; }
.set-actions [data-action^="move-set-"] { font-size:18px; line-height:1; }
.set .icon-button { min-height:34px; height:34px; width:34px; flex-basis:34px; }
.calculator-fold { display:inline-flex; align-items:center; justify-content:center; gap:6px; width:84px; min-height:44px; border:1px solid #c5ad7d; border-radius:6px; background:var(--surface); color:var(--accent); font-size:14px; font-weight:700; white-space:nowrap; }
.calculator-fold::before { content:'▾'; }
.fold-close { display:none; }
.calculator[open] > summary .fold-open { display:none; }
.calculator[open] > summary .fold-close { display:inline; }
.calculator[open] > summary .calculator-fold::before { content:'▴'; }
.calculator { border-bottom:1px solid var(--divider); }
.calculators:not(:empty) { margin-top:16px; border-top:1px solid var(--divider); }
.calculator > summary { display:grid; grid-template-columns:minmax(0,1fr) 34px 34px; align-items:center; gap:8px; list-style:none; cursor:pointer; padding:16px 20px; background:var(--surface); }
.calculator > summary > [data-action="rename-calculator"] { grid-column:2; }
.calculator[open] > summary { background:var(--active); }
.calculator-heading { grid-column:1; min-width:0; }
.calculator-name { font-size:18px; font-weight:700; overflow-wrap:anywhere; }
.calculator-subtitle { grid-column:1 / -1; color:var(--muted); font-size:14px; overflow-wrap:anywhere; }
.calculator-input-summary { grid-column:1 / -1; display:grid; grid-template-columns:minmax(0,1fr) 84px; align-items:center; gap:8px; }
.calculator-preview-group { min-width:0; }
.calculator-status { display:block; font-size:14px; color:var(--muted); font-weight:400; }
.calculator-preview { display:block; font-size:14px; color:var(--muted); font-weight:400; overflow-wrap:anywhere; }
.calculator-body { padding:18px 20px 20px; background:var(--surface); }
.recovery-notice { margin-bottom:16px; padding:12px; border:1px solid #c5ad7d; border-radius:6px; background:var(--active); }
.recovery-message, .calculator-error { white-space:pre-line; overflow-wrap:anywhere; }
.recovery-message { margin:0 0 10px; }
.recovery-notice button { margin:4px 0; }
.adjustment { border-bottom:1px solid var(--divider); }
.adjustment > summary { display:grid; grid-template-columns:minmax(0,1fr) 34px 34px; gap:8px; align-items:center; padding:16px 20px; list-style:none; cursor:pointer; }
.adjustment-status { grid-column:1; color:var(--muted); font-size:13px; overflow-wrap:anywhere; }
.adjustment > summary .calculator-fold { grid-column:2 / 4; justify-self:end; }
.adjustment[open] > summary { background:var(--active); }
.adjustment[open] .fold-open { display:none; }
.adjustment[open] .fold-close { display:inline; }
.adjustment[open] .calculator-fold::before { content:'▴'; }
.adjustment-body { padding:18px 20px 20px; }
.adjustment-enabled { display:flex; align-items:center; gap:8px; min-height:44px; padding:0 12px; color:#4f463b; background:#fffaf1; border:1px solid #dfcfb4; border-radius:6px; font-size:14px; font-weight:700; cursor:pointer; }
.adjustment-enabled input { width:auto; height:auto; margin:0; flex:none; }
.adjustment-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr) 34px; gap:16px 8px; padding:18px 0; border-bottom:1px solid var(--divider); }
.adjustment-name, .adjustment-amount-label label, .adjustment-mode { min-width:0; color:#4f463b; font-size:15px; font-weight:700; }
.adjustment-name { display:grid; gap:7px; }
.adjustment-row input, .adjustment-row select { min-width:0; width:100%; height:44px; padding:0 12px; color:#222222; background:#fffdf7; border:1px solid #d6c5a8; border-radius:6px; font-size:15px; font-weight:400; }
.adjustment-row input:focus, .adjustment-row select:focus { outline:2px solid #d8c59c; border-color:#8c6f3d; }
.adjustment-row input[inputmode="numeric"] { text-align:right; }
.adjustment-row .adjustment-name { grid-column:1 / 3; }
.adjustment-row > button { align-self:end; }
.adjustment-row .adjustment-value { grid-column:1 / -1; }
.adjustment-mode { display:grid; gap:7px; margin:0; }
.adjustment-modes { grid-column:1 / -1; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.adjustment-amount-label { display:flex; align-items:baseline; justify-content:space-between; gap:10px; margin-bottom:7px; }
.adjustment-money { min-width:0; font-size:14px; font-weight:700; color:#6f6254; text-align:right; overflow-wrap:anywhere; }
.adjustment-rows { margin-bottom:12px; }
.adjusted-amounts { font-weight:700; color:var(--accent); }
.calculator-body label { display:block; color:#4f463b; font-size:15px; font-weight:700; margin:0 0 7px; }
.calculator-body select, .calculator-add-row select { width:100%; min-width:0; height:44px; padding:0 12px; border:1px solid #d6c5a8; border-radius:6px; background:#fffdf7; font-size:15px; }
.calculator-meta { color:var(--muted); margin:8px 0 16px; overflow-wrap:anywhere; font-size:13px; }
.calculator-meta a { color:var(--accent); }
.calculator-frame { display:block; width:100%; height:160px; max-height:none; border:0; overflow:hidden; }
.frame-state { color:var(--muted); margin:12px 0; }
.error { color:var(--error); overflow-wrap:anywhere; }
.calculator-error { margin:12px 0 0; }
.add-button { display:block; width:100%; border:1px dashed #c5ad7d; color:var(--accent); padding:10px 14px; font-size:16px; margin-top:16px; }
.add-button b { font-size:22px; padding-right:6px; }
.calculator-add-row { display:grid; grid-template-columns:minmax(0,1fr) 44px; gap:8px; margin:16px 20px 0; }
.calculator-add-symbol { display:grid; place-items:center; width:44px; height:44px; border:1px solid var(--line); border-radius:6px; background:var(--surface); color:var(--accent); opacity:.55; font-size:24px; font-weight:700; pointer-events:none; }
.set-footer { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:12px; padding:16px 20px 20px; }
.set-breakdown { grid-column:1 / -1; display:flex; flex-wrap:wrap; gap:4px 6px; margin:0; color:var(--muted); font-size:14px; word-break:keep-all; overflow-wrap:anywhere; }
.set-breakdown-item { min-width:0; max-width:100%; }
.set-total { min-width:0; font-size:16px; font-weight:700; overflow-wrap:anywhere; }
.primary-button { color:var(--surface); background:var(--accent); border-color:#1f3442; }
.primary-button:hover { background:#233d4b; }
.run-area { border-top:1px solid var(--line); margin-top:30px; padding-top:18px; }
#calculateAll { width:100%; font-size:14px; }
#runStatus { color:var(--muted); margin:0 0 12px; }
.disclaimer { color:#9a8d7b; font-size:12px; line-height:1.5; margin:8px 0 0; }
.result-column { display:grid; gap:0; }
.result-column > .result-section + .result-section { margin-top:16px; }
.result-toolbar { display:flex; flex-wrap:wrap; justify-content:flex-start; gap:8px; padding:0 21px; margin-bottom:6px; }
.result-toolbar .print-action { height:34px; min-height:34px; padding:0 12px; color:#1f3442; background:#fffaf1; border:1px solid #c5ad7d; border-radius:6px; font-size:13px; font-weight:700; }
.result-toolbar .print-action:disabled { opacity:.45; cursor:not-allowed; }
.print-report { display:none; }
@media print {
  @page { size:A4 portrait; margin:14mm; }
  body { background:#fff; color:#222; }
  body > .page { display:none !important; }
  .print-report { display:block; font-size:11px; line-height:1.6; }
  .print-report .report-chapter + .report-chapter { break-before:page; }
  .print-report header { break-after:avoid; }
  .print-report h1 { margin:4px 0 10px; font-size:22px; text-align:left; }
  .print-report h2 { margin:0 0 18px; font-size:18px; }
  .print-report h3 { margin:16px 0 8px; font-size:14px; break-after:avoid; overflow-wrap:anywhere; }
  .print-report h4 { margin:8px 0; font-size:12px; break-after:avoid; overflow-wrap:anywhere; }
  .print-report p { white-space:pre-line; overflow-wrap:anywhere; margin:6px 0; orphans:3; widows:3; }
  .print-report article { border-bottom:1px solid #ddd; padding:8px 0 14px; break-inside:avoid; }
  .print-report .report-meta, .print-report .report-note { font-size:10px; color:#555; }
  .print-report .report-total { font-size:14px; font-weight:700; }
  .print-report table { width:100%; table-layout:fixed; border-collapse:collapse; margin:10px 0 18px; }
  .print-report th, .print-report td { position:static; padding:8px; border:1px solid #ccc; white-space:pre-line; overflow-wrap:anywhere; font-size:11px; text-align:right; vertical-align:top; }
  .print-report th { background:#f2f2f2; }
  .print-report th:first-child { text-align:left; width:28%; }
  .print-report thead { display:table-header-group; }
  .print-report tr { break-inside:avoid; }
  .print-report .report-table-group + .report-table-group { break-before:page; }
}
.result-section { min-width:0; background:var(--surface); border:1px solid var(--line); border-radius:8px; box-shadow:0 10px 24px rgba(40,30,15,.08); }
.result-section > summary { display:flex; align-items:center; gap:12px; list-style:none; cursor:pointer; padding:18px 20px 12px; }
.result-section[open] > summary { border-bottom:1px solid var(--divider); }
.result-section > summary h2 { flex:1; min-width:0; overflow-wrap:anywhere; }
.result-fold { flex:none; color:var(--accent); font-size:13px; font-weight:700; }
.result-fold::before { content:'▾'; margin-right:4px; }
.result-section[open] > summary .result-fold::before { content:'▴'; }
.result-section[open] > summary .fold-open { display:none; }
.result-section[open] > summary .fold-close { display:inline; }
.result-body { min-width:0; padding:18px 20px 20px; }
.total-row { display:grid; grid-template-columns:minmax(0,1fr) fit-content(50%); align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); }
.total-row:first-child { padding-top:0; }
.total-row:last-child { padding-bottom:0; border-bottom:0; }
.total-label { display:grid; gap:4px; min-width:0; overflow-wrap:anywhere; font-weight:700; }
.total-row strong { justify-self:end; min-width:0; max-width:100%; color:var(--ink); font-size:18px; font-weight:800; line-height:1.4; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; text-align:right; }
.total-row strong:not(.pending) { padding:6px 8px; background:var(--summary-bg); border:1px solid #d2bd95; border-radius:6px; }
.total-row .pending { color:var(--muted); font-size:16px; }
.total-tax-types { color:var(--muted); font-size:14px; font-weight:400; line-height:1.5; overflow-wrap:anywhere; }
.scope-note { color:var(--muted); font-size:14px; }
.narrative { margin:0 0 10px; padding:12px 14px; background:#f1eadc; border:1px solid #d2bd95; border-radius:6px; color:#7b5d2a; font-weight:700; line-height:1.5; overflow-wrap:anywhere; }
.narrative:last-child { margin-bottom:0; }
.narrative { white-space:pre-line; }
.table-scroll { overflow-x:auto; }
.comparison-navigation { display:flex; align-items:center; justify-content:flex-end; gap:8px; margin-bottom:10px; }
.comparison-position { margin-right:auto; color:var(--muted); font-size:13px; font-variant-numeric:tabular-nums; }
.comparison-navigation .icon-button { width:44px; height:44px; flex-basis:44px; }
.comparison-frame { position:relative; }
.comparison-frame::before, .comparison-frame::after { content:''; position:absolute; top:0; bottom:0; width:10px; z-index:1; pointer-events:none; opacity:0; }
.comparison-frame::before { left:0; box-shadow:inset 7px 0 7px -7px var(--accent); }
.comparison-frame::after { right:0; box-shadow:inset -7px 0 7px -7px var(--accent); }
.comparison-frame.has-previous::before, .comparison-frame.has-next::after { opacity:1; }
table { border-collapse:collapse; width:100%; color:#4f463b; font-size:14px; }
th, td { border-bottom:1px solid var(--divider); padding:12px 10px; text-align:right; min-width:145px; overflow-wrap:anywhere; }
thead { background:var(--active); }
th:first-child { min-width:95px; text-align:left; }
thead th { font-weight:700; }
.set-comparison { table-layout:fixed; width:calc(95px + var(--set-count) * 145px); min-width:100%; border-collapse:separate; border-spacing:0; }
.comparison-label-column { width:95px; }
.asset-comparison { table-layout:fixed; width:555px; min-width:100%; border-collapse:separate; border-spacing:0; }
.asset-name-column { width:120px; }
.asset-comparison th, .asset-comparison td { min-width:0; word-break:keep-all; }
.asset-comparison th:first-child { position:sticky; left:0; z-index:1; background:var(--surface); }
.asset-comparison thead th, .asset-comparison thead th:first-child { background:var(--active); }
.asset-comparison td:last-child { font-weight:700; color:var(--accent); }
.set-comparison th, .set-comparison td { min-width:0; word-break:keep-all; }
.set-comparison th:first-child { position:sticky; left:0; z-index:1; background:var(--surface); }
.set-comparison thead th, .set-comparison thead th:first-child { background:var(--active); }
.set-comparison .comparison-repeat-header th { background:var(--active); font-weight:700; }
@media print { .comparison-repeat-header { display:none; } }
.set-comparison .comparison-basis td { font-size:13px; vertical-align:top; }
.comparison-note { display:block; margin-top:8px; color:var(--muted); font-size:13px; font-weight:400; white-space:pre-line; overflow-wrap:anywhere; }
.comparison-footnote { position:sticky; left:0; margin-bottom:0; }
.comparison-group-start > * { border-top:1px solid var(--line); }
.set-comparison .comparison-total > * { background:var(--active); color:var(--accent); font-weight:800; border-top:2px solid var(--accent); }
.set-comparison .comparison-total > th:first-child { background:var(--active); }
tfoot { font-weight:700; color:var(--accent); border-top:2px solid var(--accent); }
.summary-tabs { display:flex; gap:6px; overflow-x:auto; border-bottom:1px solid var(--line); padding:4px 4px 0; }
.summary-tabs button { flex:0 0 150px; width:150px; min-height:64px; border-radius:6px 6px 0 0; background:var(--surface); text-align:left; font-size:14px; overflow-wrap:anywhere; }
.summary-tabs button[aria-selected="true"] { border-top:3px solid var(--accent); background:var(--summary-bg); color:var(--accent); }
.summary-tabs button span { display:block; }
.summary-panel { min-width:0; padding:14px; background:var(--summary-bg); }
.summary-panel > .calculator-meta { margin:0 0 10px; }
.summary-panel > .scope-note { margin:0 0 14px; }
.summary-panel > .summary-text + .scope-note { margin:14px 0 0; }
.set-summary-panel { min-width:0; padding:14px; background:var(--summary-bg); }
.set-summary-panel .total-row { padding:0 0 14px; }
.set-net-amounts { grid-column:1 / -1; display:flex; flex-wrap:wrap; justify-content:flex-end; gap:4px 16px; min-width:0; color:var(--muted); font-size:14px; line-height:1.5; text-align:right; }
.set-net-amounts > span { max-width:100%; word-break:keep-all; overflow-wrap:anywhere; }
@media (max-width:640px) { .set-net-amounts { flex-direction:column; align-items:flex-end; } }
.set-summary-panel .narrative { margin:14px 0 0; padding:0; border:0; border-radius:0; background:transparent; }
.summary-panel p { overflow-wrap:anywhere; white-space:pre-line; }
.summary-text { margin:0; background:var(--summary-bg); border:0; color:#7b5d2a; padding:0; line-height:1.5; font-weight:700; }
.empty { color:var(--muted); padding:14px 0; }
[hidden] { display:none!important; }
.guide { padding:34px 0; }
.guide-header { margin-bottom:20px; }
.guide h1 { margin:0 0 16px; word-break:keep-all; }
.guide-actions { display:flex; align-items:center; gap:10px; margin-bottom:16px; }
.guide-actions .button { height:34px; min-height:34px; padding:0 12px; border-color:#c5ad7d; color:#1f3442; font-size:13px; }
.guide-card { margin-bottom:14px; background:var(--surface); border:1px solid var(--line); border-radius:8px; box-shadow:0 10px 24px rgba(40,30,15,.08); }
.guide-card-header { padding:18px 20px 12px; border-bottom:1px solid var(--divider); }
.guide-card-body { padding:18px 20px 20px; line-height:1.6; overflow-wrap:anywhere; }
.guide-card-body > :first-child { margin-top:0; }
.guide-card-body > :last-child { margin-bottom:0; }
.guide li { margin-bottom:8px; line-height:1.6; }
@media (max-width:640px) { .guide h1 { font-size:24px; } }
@media (max-width:820px) { .workspace { grid-template-columns:minmax(0,1fr); } }
