:root {
  color-scheme: light;
  --ink: #192d35;
  --muted: #50666d;
  --accent: #0b5e60;
  --accent-dark: #074b4d;
  --line: #d6e1e1;
  --bg: #f3f6f4;
  --surface: #fff;
  font-family: "Inter", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); line-height: 1.55; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.25; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
a { color: var(--accent); }
button, .button, input, textarea, select { font: inherit; }
button, .button { display: inline-flex; align-items: center; justify-content: center; background: white; border: 1px solid #b8cecd; color: var(--accent-dark); border-radius: 7px; padding: 7px 12px; font-weight: 650; font-size: 13px; text-decoration: none; white-space: nowrap; cursor: pointer; min-height: 36px; }
button:hover, .button:hover { background: #e9f4f1; }
.primary { background: var(--accent); border-color: var(--accent); color: white; }
.primary:hover { background: var(--accent-dark); }
button:disabled, select:disabled { opacity: .6; cursor: not-allowed; }
:focus-visible, .upload:focus-within { outline: 2px solid #148286; outline-offset: 2px; }
.quiet { border-color: transparent; }
label { display: block; color: #344e53; font-size: 13px; font-weight: 600; min-width: 0; }
input:not([type=checkbox]), textarea, select { display: block; width: 100%; min-width: 0; border: 1px solid #c5d5d4; border-radius: 7px; padding: 8px 10px; margin-top: 5px; background: #fff; color: var(--ink); min-height: 39px; font-weight: 450; }
input::placeholder, textarea::placeholder { color: #60777d; }
textarea { resize: vertical; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 20px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 15px; }
.wide { grid-column: 1 / -1; }
.flow { display: grid; gap: 15px; align-content: start; }
.flow section h2 { margin-bottom: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13px; }
.brand-mark { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; background: #d9eeea; border: 1px solid #c9e2de; color: #094e52; border-radius: 9px; font: 750 19px/1 system-ui; letter-spacing: -.05em; }
.shell { width: min(1050px, 100% - 32px); margin: 34px auto; display: grid; gap: 16px; }
.shell.narrow { max-width: 690px; }
.page-heading { display: flex; gap: 12px; align-items: center; }
.page-heading p { color: var(--muted); font-size: 13px; }
.trailing { margin-left: auto; }
.steps { display: flex; gap: 10px; flex-wrap: wrap; padding: 10px 0; color: var(--muted); font-size: 14px; }
.steps span { padding: 5px 9px; border-radius: 6px; }
.steps .current { color: var(--accent-dark); font-weight: bold; background: #dfefea; }
.check-list { padding: 0; list-style: none; }
.check-list li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 9px 0; }
.success { color: #176443; }
.failure { color: #a12d22; }
.database-fields { margin-top: 12px; }
.flash { background: #e4f3ec; border: 1px solid #b8dacf; color: #174d3b; padding: 10px 13px; border-radius: 7px; overflow-wrap: anywhere; }
.flash.error, .status.error { background: #fff0ed; border-color: #e8b8b1; color: #8e3025; }
.admin-top, .section-heading, .editor-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; align-items: start; }
.check { display: flex; align-items: center; gap: 7px; }
.metrics { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 10px; }
.metrics div { padding: 10px 12px; background: var(--bg); border-radius: 7px; }
.metrics span, .totals span { display: block; color: var(--muted); font-size: 12px; }
.metrics strong { font-size: clamp(15px, 2.1vw, 24px); overflow-wrap: anywhere; }
.stats { width: 100%; text-align: left; border-collapse: collapse; }
.stats td, .stats th { padding: 7px; border-bottom: 1px solid var(--line); }
.app-header { background: #14353c; color: white; }
.app-header-inner { max-width: 1600px; margin: auto; padding: 13px clamp(14px, 3vw, 38px); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.identity { display: flex; align-items: center; gap: 11px; }
.identity h1 { font-size: 19px; overflow-wrap: anywhere; }
.identity p { color: #cee0df; font-size: 12px; }
.admin-link { color: #e1eeee; font-size: 13px; white-space: nowrap; text-underline-offset: 3px; }
.workspace { margin: auto; max-width: 1600px; padding: 20px clamp(12px, 3vw, 38px); }
.notice { margin-bottom: 15px; }
.work-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 18px; align-items: start; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 13px; min-width: 0; }
.editor-top { padding: 0 2px; }
.editor-top p { font-size: 13px; color: var(--muted); }
.editor-section h3 { margin-bottom: 12px; }
.section-heading { margin-bottom: 10px; }
.section-heading h3 { margin: 0; }
.table-wrap { position: relative; overflow-x: auto; }
.items { width: 100%; min-width: 555px; border-collapse: collapse; text-align: left; }
.items th { background: #eef4f3; color: #344e53; font-size: 12px; }
.items th, .items td { border-bottom: 1px solid var(--line); padding: 7px 4px; }
.items td:first-child { min-width: 127px; }
.items td:nth-child(2) { min-width: 88px; }
.items td:nth-child(3) { width: 69px; }
.items td:nth-child(4) { width: 93px; }
.items td input:not([type=file]) { margin: 0; padding: 5px; min-height: 33px; font-size: 13px; }
.line-amount { white-space: nowrap; font-size: 13px; font-variant-numeric: tabular-nums; }
.product-image { display: grid; justify-items: start; gap: 3px; }
.upload { position: relative; min-height: 31px; padding: 3px 7px; }
.upload input[type=file] { position: absolute; inset: 0; opacity: 0; width: 100%; margin: 0; padding: 0; cursor: pointer; }
.product-image img, #stamp-image { width: 52px; height: 39px; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; }
.delete-row, .clear-image { padding: 3px 6px; min-height: 29px; color: #812e27; }
.totals { margin-top: 13px; display: flex; justify-content: space-between; align-items: end; gap: 10px; }
.totals label { max-width: 170px; }
.totals div { text-align: right; }
.totals output { color: var(--accent-dark); font-size: clamp(16px, 2vw, 23px); font-weight: 750; }
.stamp-control { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; }
.preview-area { min-width: 0; position: sticky; top: 14px; }
.preview-panel { padding: 0; overflow: hidden; }
.preview-tools { padding: 17px; display: grid; gap: 9px; }
.output-tools { display: flex; align-items: end; gap: 8px; }
.output-tools label { flex: 1; }
.output-tools button { min-height: 39px; }
.export-tools { display: flex; gap: 8px; }
.export-tools button { flex: 1; }
.privacy { font-size: 12px; }
.status:empty { display: none; }
.status { color: var(--accent-dark); font-size: 13px; padding: 5px 8px; border-radius: 4px; overflow-wrap: anywhere; }
.preview { padding: 13px; background: #e8eeee; display: grid; gap: 12px; max-height: 67vh; min-height: 300px; overflow: auto; }
.preview canvas { width: 100%; height: auto; display: block; box-shadow: 0 2px 6px #192d3524; background: white; }
.empty { text-align: center; padding: 55px 9px 45px; color: var(--muted); align-self: center; font-size: 14px; }
.paper-icon { display: block; width: 44px; height: 56px; margin: 0 auto 11px; border: 2px solid #789899; border-radius: 5px; background: repeating-linear-gradient(to bottom, transparent 0 7px, #b1c9c8 7px 9px) center / 24px 29px no-repeat; }
.site-footer { margin-top: 16px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.visually-hidden { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
@media (max-width: 950px) {
  .work-grid { grid-template-columns: minmax(0, 1fr); }
  .preview-area { position: static; }
  .preview { max-height: none; }
  .preview canvas { max-width: 794px; margin: auto; }
}
@media (max-width: 530px) {
  .grid, .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 13px; }
  .preview-panel { padding: 0; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics div:last-child { grid-column: 1 / -1; }
}

