@font-face {
  font-family: "Receipt Nanum";
  src: url("./fonts/NanumGothic.woff") format("woff");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
:root {
  color-scheme: light;
  --ink: #202926;
  --secondary: #4f5a55;
  --accent: #205344;
  --accent-hover: #153e32;
  --line: #d7d8d5;
  --field-edge: #737773;
  --desk: #eae6df;
  --surface: #f2f5f3;
  --error: #972f27;
  font-family: "NanumGothic", "나눔고딕", "Receipt Nanum", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-synthesis: weight;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 1rem; }
body { margin: 0; background: white; color: var(--ink); font-size: 1.125rem; line-height: 1.6; overflow-wrap: anywhere; }
@media screen {
  body {
    min-height: 100vh;
    background: linear-gradient(135deg, #e3eff9 0%, #f1f7fb 55%, #e7f1f8 100%);
  }
}
h1, h2, p, ol, fieldset { margin: 0; }
h1, h2, .brand { font-weight: 700; letter-spacing: -.018em; line-height: 1.4; }
h1 { font-size: 2rem; }
h2 { font-size: 1.375rem; }
a { color: var(--accent); text-underline-offset: .22em; }
button, input { color: inherit; font: inherit; }
button, summary { cursor: pointer; }
button {
  min-height: 3rem; padding: .55rem .95rem; background: white; border: 1px solid var(--field-edge);
  border-radius: .3rem; font-weight: 400; line-height: 1.5;
}
button:hover { background: var(--surface); }
:focus-visible { outline: .2rem solid #34708a; outline-offset: .15rem; }
[hidden], .symbols { display: none !important; }
svg { width: 1.22rem; height: 1.22rem; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.skip { position: absolute; left: 1rem; top: -15rem; padding: 1rem; background: white; z-index: 1; }
.skip:focus { top: .5rem; }
.wrap { width: min(74rem, calc(100% - 4rem)); margin-inline: auto; }
.mast { border-bottom: 1px solid var(--line); }
.mast-inner, nav, .brand, .panel-title, .form-end, .actions button, .notice, footer { display: flex; align-items: center; }
.mast-inner { gap: 2.75rem; flex-wrap: wrap; padding-block: .55rem; }
.brand { gap: .45rem; font-size: 1.35rem; }
.brand-mark { width: 1.7rem; height: 1.7rem; color: var(--accent); stroke-width: 2; }
nav { gap: .5rem 1.4rem; flex-wrap: wrap; }
nav a, .minor, .form-end a { display: inline-flex; align-items: center; min-height: 3rem; font-size: 1rem; }
nav a { min-inline-size: 3rem; justify-content: center; color: var(--secondary); }
nav a[aria-current="page"] { color: var(--ink); font-weight: 700; text-decoration: none; }
.quiet { margin-left: auto; font-size: 1rem; }
.quiet span { margin-left: .25em; font-variant-numeric: tabular-nums; color: var(--secondary); }
.workspace { display: grid; grid-template-columns: minmax(0, .89fr) minmax(0, 1.11fr); gap: clamp(2rem, 4vw, 4rem); align-items: start; padding-top: 2rem; }
.panel { min-width: 0; }
.panel-title { justify-content: space-between; flex-wrap: wrap; gap: .5rem; min-height: 3.5rem; padding-bottom: .5rem; }
.view-button { padding-inline: .35rem; border-color: transparent; background: transparent; color: var(--accent); font-size: 1rem; text-decoration: underline; text-underline-offset: .22em; }
.minor, .paper-size, .hint, .form-end, .notice, footer, .guide details p, #draft-status, #result { font-size: 1rem; }
.paper-size, .hint { color: var(--secondary); }
#fields { container-type: inline-size; }
#fields > label:first-of-type { margin-top: .65rem; }
label, legend { display: block; margin-bottom: .38rem; font-weight: 600; }
#fields > label, fieldset, .people { margin-top: 1.2rem; }
input {
  width: 100%; min-width: 0; min-height: 3.1rem; display: block; padding: .52rem .85rem;
  border: 1px solid var(--field-edge); border-radius: .3rem; background: white;
  font-size: 1.125rem; font-variant-numeric: tabular-nums;
}
@media (hover: hover) { input:hover { border-color: #506d7b; } }
input:not([type=radio]):focus {
  border-color: #35738c; background: #f7fbfd; caret-color: #215e75;
  box-shadow: 0 0 .45rem rgb(44 94 113 / 14%);
}
:root[data-focus-input="pointer"] input:not([type=radio]):focus {
  outline: .2rem solid rgb(65 137 164 / 9%); outline-offset: 0;
}
@media (forced-colors: active) {
  :root[data-focus-input="pointer"] input:not([type=radio]):focus { outline-color: Highlight; }
}
input[aria-invalid=true], input[aria-invalid=true]:focus { border: 2px solid var(--error); }
input:not([type=radio])[aria-invalid=true]:focus { border-color: var(--error); box-shadow: 0 0 .45rem rgb(151 47 39 / 12%); }
.with-unit { position: relative; }
.with-unit input { min-height: 3.5rem; padding-inline-end: 2.35rem; text-align: right; font-size: 1.65rem; font-weight: 700; }
.with-unit span { position: absolute; right: .85rem; top: 50%; transform: translateY(-50%); color: var(--ink); pointer-events: none; }
input::placeholder { color: #66736d; opacity: 1; }
.hint { margin-top: .38rem; }
fieldset { min-width: 0; padding: 0; border: 0; }
legend { padding: 0; }
.dates, .people, .actions { display: grid; gap: .75rem; }
.dates { grid-template-columns: minmax(0, 7.5rem) repeat(2, minmax(0, 5rem)); }
.dates label { margin: 0; color: var(--secondary); font-size: 1rem; font-weight: 400; }
.dates input { margin-top: .22rem; color: var(--ink); }
.people, .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.people { padding-top: 1rem; border-top: 1px solid var(--line); gap: 1.15rem; }
.people label { font-weight: 500; }
.people label span { color: var(--secondary); font-size: 1rem; white-space: nowrap; }
.people strong { font-weight: 750; }
.remember-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 1rem; }
.remember-actions button { font-size: 1rem; }
.remember-actions button:first-child { color: var(--accent); border-color: var(--accent); }
.remember-status:not(:empty) { margin-top: .5rem; font-size: 1rem; }
.notice { align-items: flex-start; gap: .45rem; color: var(--secondary); }
#fields .notice { margin: 1.2rem 0 .7rem; }
.notice svg { margin-top: .23rem; width: 1.05rem; height: 1.05rem; }
.form-end { justify-content: space-between; flex-wrap: wrap; gap: .5rem; border-top: 1px solid var(--line); padding-top: .25rem; }
.text-button { background: none; border-color: transparent; font-size: 1rem; color: var(--secondary); text-decoration: underline; text-underline-offset: .22em; }
.desk { padding: clamp(.85rem, 2.5vw, 2.2rem); background: var(--desk); }
#paper, .example-paper { background: white; border: 1px solid #c9c7c1; }
@media screen {
  /* 15 mm margins as a fraction of a 210 mm A4 sheet. */
  #paper.a4-layout { aspect-ratio: 210 / 297; padding: 7.142857%; }
}
.receipt-drawing { display: block; width: 100%; height: auto; stroke: none; }
.outputs { padding-top: 1rem; }
.output-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.output-actions button, .share-area button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  width: min(100%, 11.8rem); min-height: 3.5rem; padding-inline: .45rem; font-size: 1rem;
}
.share-area { max-width: 100%; }
.share-area button { color: var(--accent); }
#share-result:not(:empty), #share-fallback:not(:empty) { margin-block-start: .5rem; }
.actions { grid-auto-rows: 1fr; }
.actions button { width: 100%; min-height: 3.5rem; justify-content: center; gap: .5rem; font-size: 1rem; }
.primary { background: var(--accent); border-color: var(--accent); color: white; font-weight: 700; }
.primary:hover { background: var(--accent-hover); }
.outputs > .hint { margin-top: .7rem; }
#error:not(:empty), #result:not(:empty), #draft-status:not(:empty), #inapp:not([hidden]) { padding: .65rem 0; }
#error, .field-error { color: var(--error); font-weight: 600; }
.field-error { font-size: 1rem; }
#fallback img { display: block; width: 100%; margin-top: 1rem; }
#fallback input { margin-top: .5rem; }
.example-paper { margin-top: 1rem; }
.example-values { display: none; }
main { padding-bottom: 2rem; }
footer { border-top: 1px solid var(--line); padding-block: 1rem; justify-content: space-between; flex-wrap: wrap; gap: .5rem; color: var(--secondary); }
dialog { width: min(28rem, 92%); max-height: 95%; padding: 1.5rem; color: var(--ink); background: white; border: 1px solid var(--field-edge); border-radius: .3rem; }
dialog p { margin: .9rem 0 1.25rem; }
.history-dialog { width: min(42rem, 94%); }
.customer-label { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem .5rem; margin-top: .65rem; }
.customer-label label { margin: 0; }
.customer-options { list-style: none; padding: 0; margin: .75rem 0 0; display: grid; gap: .5rem; }
.customer-options button { width: 100%; text-align: start; overflow-wrap: anywhere; }
.history-filter { display: flex; align-items: center; gap: .6rem; min-height: 3rem; margin-top: .5rem; cursor: pointer; }
.history-filter input { width: 1.25rem; height: 1.25rem; min-height: 0; padding: 0; flex: none; accent-color: var(--accent); }
.history-dialog .panel-title { margin-bottom: .75rem; }
.history-list { margin: .8rem 0 0; }
.history-customer h3 { display: flex; align-items: baseline; gap: .5rem 1rem; flex-wrap: wrap; margin: 1.25rem 0 0; padding: .5rem .7rem; background: #e9f1f5; border-bottom: 1px solid #acbdc5; font-size: 1.25rem; }
.history-customer h3 small { font-weight: 400; font-size: 1rem; }
.history-trade { padding: .8rem .2rem; border-bottom: 1px solid var(--line); }
.history-trade h4 { display: flex; align-items: baseline; flex-wrap: wrap; gap: .25rem .7rem; font-size: 1.125rem; margin: 0; }
.history-trade h4 small { font-size: 1rem; font-weight: 400; color: var(--secondary); }
.history-trade dl { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,9rem),1fr)); gap: .5rem 1rem; margin: .5rem 0; }
.history-trade dt { font-size: 1rem; color: var(--secondary); }
.history-trade dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 34rem) {
  .history-trade dl { grid-template-columns: 1fr; padding-block: .5rem; border-block: 1px solid var(--line); }
  .history-trade dl > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .15rem .6rem; }
}
.history-trade summary { padding-block: .6rem; min-height: 3rem; color: var(--accent); }
.history-trade ul { list-style: none; margin: 0; padding: 0 .6rem; background: #f5f7f6; }
.history-list li { padding: .7rem 0; }
.history-list li + li { border-top: 1px solid var(--line); }
.trade-actions { margin-top: .5rem; }
.history-backup { margin-top: .75rem; border-bottom: 1px solid var(--line); }
.history-backup summary, .history-receipt summary { padding-block: .6rem; min-height: 3rem; color: var(--accent); }
.history-backup p { margin: .5rem 0; font-size: 1rem; }
.history-receipt details, .history-receipt .actions { margin-top: .8rem; }
.history-list p { margin: .25rem 0 .5rem; color: var(--secondary); font-size: 1rem; }
.history-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.history-actions button { font-size: 1rem; }
#receipt-to-balance { width: 100%; margin-top: 1rem; min-height: 3.5rem; color: var(--accent); }
#send-app[hidden] + #send-save { grid-column: 1 / -1; }
#send-dialog form { margin-top: .5rem; text-align: right; }
dialog::backdrop { background: #15201b70; }
@media screen and (prefers-reduced-motion: no-preference) {
  button { transition: background-color 120ms ease-out, border-color 120ms ease-out, transform 90ms ease-out; }
  button:active { transform: translateY(1px); }
  input { transition: border-color 140ms ease-out, background-color 140ms ease-out, box-shadow 140ms ease-out; }
  dialog[open] {
    animation: reveal-content 130ms ease-out;
  }
  .extra summary { transition: background-color 120ms ease-out; }
  .extra summary::after { transition: transform 140ms ease-out; }
}
@media screen {
  #paper, #sheets > svg { box-shadow: 0 .12rem .4rem rgb(37 45 48 / 12%); }
}
@media screen and (prefers-reduced-motion: no-preference) {
  @supports (interpolate-size: allow-keywords) and (transition-behavior: allow-discrete) {
    :is(.extra, .item-editor)::details-content {
      interpolate-size: allow-keywords;
      block-size: 0; overflow: clip; opacity: 0;
      transition: block-size 190ms ease-in-out, opacity 150ms ease-out, content-visibility 190ms allow-discrete;
    }
    :is(.extra, .item-editor)[open]::details-content { block-size: auto; opacity: 1; }
    #example-paper {
      interpolate-size: allow-keywords;
      block-size: auto; overflow: clip; opacity: 1;
      transition: block-size 190ms ease-in-out, opacity 150ms ease-out, padding-block 190ms ease-in-out,
        margin-block-start 190ms ease-in-out, display 190ms allow-discrete;
    }
    #example-paper[hidden] { block-size: 0; opacity: 0; padding-block: 0; margin-block-start: 0; }
    @starting-style {
      #example-paper:not([hidden]) { block-size: 0; opacity: 0; padding-block: 0; margin-block-start: 0; }
    }
  }
}
@keyframes reveal-content { from { opacity: .65; } to { opacity: 1; } }
@container (max-width: 26rem) { .people { grid-template-columns: 1fr; } }
@container (max-width: 17rem) { .dates { grid-template-columns: 1fr; } }
@media (max-width: 57rem) {
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; }
  .wrap { max-width: 44rem; }
  .example-paper > svg { display: none; }
  .example-paper { container-type: inline-size; background: #f6f5f1; padding: .8rem 1rem; border: 0; border-left: .2rem solid #b2a48e; }
  .example-values { display: grid; grid-template-columns: auto minmax(0,1fr); gap: .4rem .85rem; margin: 0; }
  .example-values dt { color: var(--secondary); }
  .example-values dd { margin: 0; font-weight: 600; }
}
@media (max-width: 40rem) {
  .wrap { width: calc(100% - 2rem); }
  .mast-inner { gap: .15rem .65rem; }
  .mast-inner nav { order: 3; width: 100%; }
  .workspace { padding-top: 1.15rem; }
  .actions { grid-template-columns: 1fr; }
  .output-actions button, .share-area, .share-area button { width: 100%; }
}
@container (max-width: 17rem) {
  .example-values { grid-template-columns: minmax(0,1fr); gap: 0; }
  .example-values dd + dt { margin-block-start: .7rem; }
}
@page { size: A4 portrait; margin: 0; }
@media print {
  html, body, main.wrap, .workspace, #preview, .desk, #paper { display: block !important; margin: 0 !important; padding: 0 !important; width: 100% !important; max-width: none !important; background: white !important; border: 0 !important; }
  body > :not(main), main > :not(.workspace), .workspace > :not(#preview), #preview > :not(.desk) { display: none !important; }
  #paper { padding: 15mm !important; break-inside: avoid; }
}
