* { box-sizing: border-box; }
:root {
  color-scheme: light;
  font: 15px/1.45 "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;
  color: #111827;
  background: #f6f7fa;
  --ink: #111827;
  --muted: #515e72;
  --accent: #243cd7;
  --accent-dark: #1c2caa;
  --accent-tint: #edf0ff;
  --line: #dbe1eb;
  --stage: #e4e9f2;
}
body { margin: 0; }
html { scroll-padding-bottom: 72px; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 2px solid #3654ee; outline-offset: 3px; }
.mast { background: #f9fafc; border-bottom: 1px solid var(--line); }
.mast-inner, main { max-width: 1920px; margin-inline: auto; padding-inline: clamp(18px, 2.85vw, 56px); }
.mast-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.brand { font-size: 20px; letter-spacing: -.018em; }
.mast-tools, .local { display: flex; align-items: center; gap: 16px; }
.local { gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.local i { flex: 0 0 6px; height: 6px; border-radius: 50%; background: #278360; }
.language select { margin: 0; min-height: 36px; font-size: 14px; min-width: 110px; }
main { padding-top: 12px; padding-bottom: 24px; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; min-height: 106px; padding: 4px 0 18px; }
.intro h1 { margin: 0; font-size: clamp(32px, 3vw, 46px); line-height: 1.14; letter-spacing: -.05em; }
.intro p { color: var(--muted); margin: 8px 0 0; }
.mode-switch { display: inline-flex; gap: 2px; padding: 3px; background: #f9faff; border: 1px solid var(--line); border-radius: 10px; flex-shrink: 0; }
.tab { border: 0; border-radius: 7px; padding: 7px clamp(8px, 1vw, 15px); background: transparent; color: var(--ink); font-weight: 650; }
.tab:hover:not(.active) { background: var(--accent-tint); }
.tab.active { background: var(--accent); color: white; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.78fr) minmax(315px, 1fr); align-items: start; gap: clamp(18px, 2vw, 34px); }
.card { min-width: 0; background: white; border: 1px solid var(--line); border-radius: 12px; }
.editor { min-width: 0; }
.side { display: grid; min-width: 0; gap: 14px; }
.side-card { padding: 18px 20px; }
.side-card .hint { margin: 9px 0 13px; }
.section { min-inline-size: 0; margin: 0 0 10px; padding: 14px clamp(16px, 1.55vw, 28px) 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
h2 { margin: 0 0 9px; font-size: 20px; line-height: 1.23; letter-spacing: -.026em; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.section-heading h2 { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px clamp(14px, 1.9vw, 32px); }
label { display: block; min-width: 0; font-size: 14px; font-weight: 650; }
label > span, summary > span { margin-left: 5px; color: var(--muted); font-size: 12px; font-weight: 400; }
label > .label-text { margin: 0; color: inherit; font: inherit; }
label > input + span { display: block; margin: 4px 0 0; }
input:not([type="checkbox"]), select {
  width: 100%; min-height: 35px; margin-top: 4px; padding: 5px 10px;
  border: 1px solid #c9d1df; border-radius: 7px; background: #fbfcfe; color: var(--ink);
}
input[type="checkbox"] { accent-color: var(--accent); }
input::placeholder { color: #677389; }
.store-type-field, .store-type-control { position: relative; min-width: 0; }
.store-type-control input { padding-right: 45px; }
#store-type-toggle { position: absolute; inset: 5px 1px 1px auto; display: grid; place-items: center; width: 38px; border: 0; border-left: 1px solid var(--line); border-radius: 0 6px 6px 0; background: #f6f8fc; color: var(--muted); }
#store-type-toggle::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid; border-bottom: 1.5px solid; transform: translateY(-2px) rotate(45deg); }
#store-type-toggle:hover, #store-type-toggle[aria-expanded="true"] { background: var(--accent-tint); color: var(--accent-dark); }
.store-type-options { position: absolute; z-index: 3; inset: calc(100% + 4px) 0 auto; max-height: min(46vh, 320px); overflow: auto; overscroll-behavior: contain; margin: 0; padding: 4px; list-style: none; border: 1px solid #c9d1df; border-radius: 8px; background: white; box-shadow: 0 8px 24px #18284b25; }
.store-type-options li { padding: 7px 9px; border-radius: 5px; overflow-wrap: anywhere; }
.store-type-options [role="option"] { cursor: pointer; font-size: 14px; font-weight: 600; }
.store-type-options [role="option"] small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.store-type-options [aria-selected="true"] { color: var(--accent-dark); }
.store-type-options [role="option"]:hover, .store-type-options [data-active] { background: var(--accent-tint); color: var(--accent-dark); }
fieldset#transaction { border: 0; padding: 0; margin: 13px 0 0; }
.check { align-self: end; display: flex; align-items: center; gap: 5px; min-height: 40px; }
.check > span { font-size: 13px; font-weight: 600; color: inherit; }
.store-logo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 16px; margin-top: 8px; }
.store-logo-check { align-self: center; min-height: 31px; }
.store-logo-preview { display: flex; align-items: center; gap: 6px; padding: 1px 8px 1px 2px; border-radius: 6px; background: #f1f4fc; color: var(--muted); font-size: 12px; }
.store-logo-preview img { display: block; }
.item { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.16fr) minmax(93px,.7fr) max-content; align-items: end; gap: 9px; padding: 7px 0; }
.item + .item { border-top: 1px solid var(--line); }
.entry-mode { max-width: 250px; margin-bottom: 4px; }
.quantity-mode .item { grid-template-columns: minmax(0,1fr) minmax(0,1fr) max-content; }
.quantity-mode .item label:nth-child(4) { grid-column: 1; }
.quantity-mode .item label:nth-child(5) { grid-column: 2; }
.quantity-mode .item label:nth-child(6) { grid-column: 1/3; }
.quantity-mode .item .remove { grid-column: 3; grid-row: 2/4; }
.payment-hint { grid-column: 1/-1; }
.payment-hint-note { font-size: 13px; margin-top: 6px; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.amount-check { margin-top: 14px; padding: 13px; border-radius: 9px; background: #f2f5fb; }
.preview-values { display: grid; grid-template-columns: minmax(100px,.8fr) minmax(0,1.2fr); gap: 6px 12px; margin: 12px 0 8px; font-size: 14px; }
.preview-values dt { color: var(--muted); }
.preview-values dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.actions { position: sticky; bottom: 0; z-index: 1; display: flex; justify-content: flex-end; margin: 0; padding-block: 10px; box-shadow: 0 -3px 18px #15294c12; }
.soft, .quiet, .primary { border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 650; }
.soft { border: 1px solid #cdd5e3; background: #fafbff; color: var(--accent); }
.soft:hover:not(:disabled) { background: var(--accent-tint); }
.primary { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding-inline: 19px; border: 1px solid transparent; background: var(--accent); color: white; text-decoration: none; }
.primary:hover:not(:disabled) { background: var(--accent-dark); color: white; }
.quiet { border: 0; background: transparent; color: var(--muted); }
.quiet:hover:not(:disabled) { color: var(--accent); text-decoration: underline; }
details { margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); }
summary { cursor: pointer; font-size: 14px; font-weight: 650; }
details .grid { margin-top: 12px; }
.file-box { display: block; margin-top: 14px; padding: 14px; border: 1px dashed #a4b4d2; border-radius: 9px; background: #f4f6fe; }
.file-box input { margin-top: 8px; min-width: 0; }
input::file-selector-button { border: 0; border-radius: 5px; background: var(--accent-tint); color: var(--accent-dark); padding: 5px 8px; margin: 0 8px 0 0; font: inherit; cursor: pointer; }
.batch-options { margin-top: 18px; }
.batch-downloads { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 12px 0 9px; }
.batch-downloads .soft { text-decoration: none; }
.layout-summary { margin: 9px 0 0; font-size: 13px; color: var(--muted); }
.layout-summary a { font-weight: 650; }
.library-heading, .library-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.library-heading h2 { margin: 0; }
.library-heading a, .template-download { font-size: 13px; font-weight: 650; }
.library-tools { margin-top: 13px; flex-wrap: wrap; }
.paper-filter select { min-height: 36px; margin-top: 0; font-size: 13px; }
.layouts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; max-height: 220px; overflow-y: auto; scrollbar-width: thin; margin-top: 10px; padding: 3px; }
.layout-card { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); text-align: left; }
.layout-card strong { font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.layout-card:hover { background: #f3f6fe; }
.layout-card small { flex-shrink: 0; color: var(--muted); font-size: 10px; }
.layout-card[aria-pressed="true"], .auto-layout[aria-pressed="true"] { border-color: #7081df; color: var(--accent-dark); background: var(--accent-tint); }
.side-card .import-note { margin: 10px 0; }
#import-result p { font-size: 13px; margin: 10px 0 0; overflow-wrap: anywhere; }
#layout-error a { color: inherit; }
.review-card { min-width: 0; border: 0; background: transparent; }
.review-heading { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px; min-height: 106px; padding: 4px 0 18px; scroll-margin-top: 12px; }
.library-jump { display: inline-block; flex-shrink: 0; align-self: flex-end; padding: 7px 1px; border-bottom: 2px solid var(--accent); font-weight: 700; text-decoration: none; }
.review-heading h2:focus { outline: none; }
.review-heading .review-controls { min-height: 38px; margin: 0; }
.footer-note-field { display: block; margin-top: 10px; }
.paper-background { margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.paper-background summary { width: fit-content; cursor: pointer; font-weight: 650; }
.paper-background .hint { margin: 0 0 8px; }
.paper-options { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 16px; padding: 8px 0 0; }
.paper-color, .paper-upload { display: grid; gap: 4px; min-width: 0; }
.paper-color input[type="color"] { width: 54px; height: 34px; min-height: 0; padding: 3px; cursor: pointer; }
.paper-upload { flex: 1 1 190px; }
.paper-upload input { min-width: 0; max-width: 100%; font-size: .8rem; }
.paper-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.review-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 13px; min-height: 207px; padding: 20px; background: var(--stage); border-radius: 10px; }
.review-empty p { max-width: 30ch; }
.review-status, .review-meta { margin: 0 0 8px; font-size: 13px; overflow-wrap: anywhere; }
.review-meta { margin-top: 8px; color: var(--muted); }
.review-picker { display: block; margin: 10px 0; }
.document-stage { position: relative; overflow: auto; max-height: min(82vh, 910px); min-height: 130px; padding: clamp(24px, 3vw, 48px) clamp(16px, 2.5vw, 46px) clamp(22px, 2.5vw, 38px); border-radius: 11px; background: var(--stage); }
.proof-canvas { display: flex; align-items: flex-start; min-width: 0; }
.document-stage img { max-width: 100%; max-height: min(64vh, 740px); object-fit: contain; display: block; margin-inline: auto; background: white; box-shadow: 0 5px 16px #23344e26; }
.sample-stage img { max-height: min(70vh, 790px); }
.document-stage[data-zoom="75"] img { max-width: 75%; max-height: min(48vh, 555px); }
.document-stage[data-zoom="125"] img { width: 125%; max-width: none; max-height: none; flex: 0 0 auto; }
.document-stage[data-zoom="150"] img { width: 150%; max-width: none; max-height: none; flex: 0 0 auto; }
.document-stage[data-zoom="200"] img { width: 200%; max-width: none; max-height: none; flex: 0 0 auto; }
.sample-badge { position: absolute; top: 13px; left: clamp(10px, 1.5vw, 25px); padding: 3px 9px; border-radius: 6px; background: #3958df; color: #fff; font-size: 13px; font-weight: 650; }
.document-stage .hint, .document-stage .error { margin: 16px auto; text-align: center; }
.review-controls, .review-download { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.review-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; font-size: 12px; font-variant-numeric: tabular-nums; }
.review-controls .soft { padding: 5px 8px; }
.page-chip, .review-pager span { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.zoom-controls { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 7px; min-height: 35px; background: #fbfcff; }
.zoom-controls .soft { min-width: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font-size: 16px; }
.zoom-controls select { width: auto; min-height: 33px; margin: 0; padding: 2px 3px; border-block: 0; border-radius: 0; color: var(--ink); font-size: 13px; }
.result-errors { overflow-wrap: anywhere; }
.result-report { display: inline-block; margin-top: 8px; font-size: 13px; }
.error { color: #9b3027; }
.success { color: #155747; font-weight: 650; }
footer { display: flex; justify-content: flex-end; margin-top: 11px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 860px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .side { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .review-card { grid-column: 1/-1; }
  .review-heading { min-height: 0; padding: 3px 0 10px; }
  .document-stage { max-height: 75vh; }
}
@media (max-width: 540px) {
  .mast-tools { gap: 7px; }
  .local { display: none; }
  .intro { align-items: flex-start; flex-direction: column; gap: 11px; padding-block: 14px 13px; }
  .intro p { margin-top: 5px; font-size: 14px; }
  .grid, .side { grid-template-columns: 1fr; }
  .review-heading { align-items: flex-start; }
  .review-controls { gap: 5px; }
  .document-stage { padding-top: 42px; }
  .item, .quantity-mode .item { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .item label:first-child, .item label:nth-child(2) { grid-column: 1/-1; }
  .quantity-mode .item label:nth-child(6) { grid-column: 1; }
  .quantity-mode .item .remove { grid-column: 2; grid-row: auto; }
  .remove { justify-self: end; }
  .preview-values { grid-template-columns: .8fr 1.2fr; }
}
