:root {
  color-scheme: light;
  --canvas: #f5f6f2;
  --paper: #fff;
  --ink: #192b25;
  --muted: #52665d;
  --line: #dfe7e0;
  --dark: #122f26;
  --green: #14694e;
  --green-soft: #e7f3eb;
  --accent: #d4ee97;
  --radius: 16px;
  font-family: "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.receipt-guide, .receipt-next { padding:14px 18px; border-radius:12px; background:#fff4dc; color:#69480e; line-height:1.8; }
.receipt-next p { margin:0 0 10px; overflow-wrap:anywhere; }
.receipt-pending-row { background:#fff9ec; }
.receipt-pending-row:focus-within { outline:2px solid var(--green); outline-offset:-2px; }
.receipt-new-fields { display:contents; }
.product-attributes { grid-column:1/-1; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; padding:14px; border:1px solid var(--line); border-radius:12px; background:#f7faf5; }
.product-attributes legend { padding:0 6px; color:var(--green); font-weight:650; font-size:.88rem; }
.receipt-product-info { grid-column:1/-1; display:flex; align-items:center; flex-wrap:wrap; gap:10px; padding:12px 14px; background:var(--green-soft); border-radius:12px; }
.receipt-product-info p { flex:1 1 100%; margin:0; overflow-wrap:anywhere; }
.option-field { min-width:0; }
#product { grid-template-columns:repeat(20,minmax(0,1fr)); align-items:start; gap:16px; }
#product > label,#product > .option-field { grid-column:span 4; }
#product > .product-barcode,#product > .product-name { grid-column:span 4; }
#product > .product-name + .option-field { grid-column:1/span 4; }
.product-form-actions { grid-column:1/-1; display:flex; flex-wrap:wrap; gap:10px; }
@media(max-width:1000px) { #product { grid-template-columns:repeat(2,minmax(0,1fr)); } #product > label,#product > .option-field,#product > .product-barcode,#product > .product-name,#product > .product-name + .option-field {grid-column:span 1;} }
@media(max-width:480px) { #product { grid-template-columns:1fr; } }
.option-tabs { display:flex; gap:8px; margin:14px 0; }
.option-tabs [aria-selected=true] { background:var(--green); color:white; border-color:var(--green); }
.option-tabs [aria-selected=true]:hover:not(:disabled) { background:var(--green); color:white; border-color:var(--green); }
.option-recycle { display:flex; align-items:center; gap:8px; margin:12px 0; }
.option-recycle input { width:auto; min-height:0; margin:0; }
.option-bulk { margin-top:14px; }
.option-bulk .head-actions { margin-top:10px; flex-wrap:wrap; }
textarea { font:inherit; width:100%; padding:10px; border:1px solid var(--line); border-radius:9px; resize:vertical; }
.option-dialog { width:min(520px,calc(100vw - 28px)); border:1px solid var(--line); border-radius:18px; padding:24px; color:var(--ink); background:white; }
.option-dialog::backdrop { background:#142d22b3; }
.option-dialog form { display:grid; grid-template-columns:1fr; }
.option-dialog .head-actions { margin-top:8px; }
#optionRows .badge + .badge { margin-left:6px; }
@media(max-width:660px) { .product-attributes { grid-template-columns:1fr; } }
.receipt-preview { margin:0; padding:14px 18px; border-radius:12px; background:var(--green-soft); color:var(--dark); font-weight:650; }
#receiptDraft { background:var(--paper); color:var(--ink); border-color:var(--line); }
#operationRows pre { white-space:pre-wrap; overflow-wrap:anywhere; min-width:240px; max-width:520px; max-height:360px; overflow:auto; font-size:.8rem; }
#countPreview { padding:12px; border-radius:10px; background:#edf2e4; line-height:1.7; }
.business-confirm { width:min(540px,calc(100vw - 32px)); border:1px solid var(--line); border-radius:20px; padding:28px; color:var(--ink); background:#fafbf5; box-shadow:0 20px 80px #12352140; }
.business-confirm::backdrop { background:#142d22b3; }
.business-confirm p { white-space:pre-line; line-height:1.8; overflow-wrap:anywhere; margin:18px 0 24px; }
.business-confirm button { min-height:48px; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
a { color: var(--green); text-underline-offset: 4px; }
button, input, select { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 7px 13px; border: 1px solid #ccd9d0; border-radius: 9px;
  background: var(--paper); color: var(--ink); font-weight: 650; text-decoration: none; cursor: pointer;
}
button:hover:not(:disabled), .button:hover { background: var(--green-soft); border-color: #96b5a2; }
button[type="submit"], .primary { background: var(--green); border-color: var(--green); color: white; }
button[type="submit"]:hover:not(:disabled), .primary:hover { background: #0e533d; border-color: #0e533d; }
button:disabled { opacity: .46; cursor: default; }
input, select {
  min-width: 0; width: 100%; min-height: 41px; padding: 8px 11px; border: 1px solid #cbd9cf;
  border-radius: 9px; color: var(--ink); background: white;
}
input:read-only { background: #f4f7f4; }
label { display: grid; gap: 6px; color: #40554b; font-weight: 650; font-size: .88rem; }
:focus-visible { outline: 3px solid #89b88e; outline-offset: 2px; }
form { display: grid; grid-template-columns: repeat(auto-fit,minmax(142px,1fr)); gap: 12px; align-items: end; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(1.8rem,3vw,2.65rem); line-height: 1.2; letter-spacing: -.035em; }
h2 { margin-bottom: 14px; font-size: 1.18rem; }
h3 { margin-bottom: 7px; font-size: 1rem; }
.muted, .helper { color: var(--muted); }
.helper { font-size: .88rem; }
.eyebrow { color: var(--green); font-size: .73rem; letter-spacing: .14em; font-weight: 750; margin-bottom: 8px; }
.tag, .badge {
  display: inline-flex; align-items: center; min-height: 25px; padding: 2px 9px; border-radius: 999px;
  background: var(--green-soft); color: #185b40; font-size: .76rem; font-weight: 700; white-space: nowrap;
}
.badge.warning { background: #fbefcf; color: #76521b; }
.badge.neutral { background: #edf1ed; color: #4f6559; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 1rem; font-weight: 750; color: inherit; text-decoration: none; }
.brand small { display: block; font-size: .72rem; opacity: .72; font-weight: 500; }
.brand-mark {
  display: block; width: 44px; height: 44px; flex: 0 0 44px;
}
.app-shell { display: grid; grid-template-columns: 218px minmax(0,1fr); min-height: 100vh; }
.rail {
  display: flex; flex-direction: column; min-height: 100vh; align-self: start; position: sticky; top: 0;
  padding: 24px 14px 16px; background: var(--dark); color: white;
}
.rail .brand { margin: 0 8px 30px; }
.nav-label { padding: 0 10px; margin: 16px 0 7px; color: #a5bdb1; font-size: .72rem; letter-spacing: .12em; font-weight: 700; }
.workspace-nav, .rail-links { display: grid; gap: 4px; }
.workspace-nav a, .rail-links a {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px;
  color: #e4f1e9; text-decoration: none; white-space: nowrap; font-weight: 550;
}
.workspace-nav a:hover, .rail-links a:hover { background: #234438; }
.workspace-nav a[aria-current] { background: var(--accent); color: #1d392c; font-weight: 750; }
.nav-icon { width: 19px; text-align: center; font-size: .84rem; opacity: .85; }
.rail-footer { margin-top: auto; padding: 24px 8px 4px; color: #a9c4b6; font-size: .76rem; }
.workspace { padding: 30px clamp(16px,4vw,52px) 48px; max-width: 1520px; width: 100%; margin: 0 auto; }
.workspace-head, .section-head, .topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.workspace-head { margin-bottom: 22px; }
.workspace-head p:last-child { margin-bottom: 0; }
.head-actions { display: flex; gap: 10px; align-items: center; }
.head-actions label { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.head-actions select { width: auto; }
.panel, .workspace section, .workpage section {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px clamp(14px,2.3vw,24px); margin-bottom: 14px; min-width: 0;
}
.hero {
  background: radial-gradient(ellipse at 93% 5%, #34684a 0%, transparent 54%), var(--dark) !important;
  border: 0 !important; color: white; min-height: 182px; padding: 26px !important;
}
.hero h2 { font-size: clamp(1.4rem,3vw,2.2rem); margin: 12px 0 5px; }
.hero p { max-width: 60ch; color: #d3e4d8; margin-bottom: 16px; }
.hero .tag { background: #cce99b; }
.hero .button { border: 0; background: white; color: var(--dark); }
.metrics, .quick-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
.metric, .quick-actions a {
  border: 1px solid var(--line); border-radius: 13px; background: white; padding: 15px;
}
.metric span { display: block; color: var(--muted); font-size: .82rem; }
.metric strong { display: block; font-size: 1.65rem; font-variant-numeric: tabular-nums; margin-top: 4px; }
.quick-actions a { display: block; text-decoration: none; color: var(--ink); font-weight: 700; }
.quick-actions a:hover { border-color: #92b8a1; background: #f5fbf6; }
.quick-actions small { display: block; color: var(--muted); font-weight: 500; margin-top: 4px; }
.section-head h2, .section-head p { margin-bottom: 0; }
.section-head { margin-bottom: 12px; }
.search-field { width: min(100%,300px); }
.scroll { overflow: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .88rem; }
th, td { padding: 11px 9px; border-bottom: 1px solid #e8eee9; white-space: nowrap; }
th { background: #eff4ef; color: #445a4e; font-size: .78rem; letter-spacing: .025em; }
tbody tr:hover { background: #f8fbf8; }
tbody tr:last-child td { border-bottom: 0; }
td button { min-height: 31px; padding: 4px 8px; font-size: .8rem; }
td button+button { margin-left: 5px; }
.empty { color: var(--muted); padding: 24px 10px; text-align: center; }
[role="status"] { margin: 9px 0 0; color: #2b604b; overflow-wrap: anywhere; }
[role="status"]:empty { display: none; }
.purchase-filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.sales-date-filter { display:flex; flex-wrap:wrap; gap:12px; align-items:end; }
.sales-date-filter > label { flex:0 1 240px; }
.sales-date-filter > button { min-width:100px; }
.date-range-separator { padding-bottom:10px; color:var(--muted); }
@media(max-width:660px) { .sales-date-filter > label { flex:1 1 100%; }.date-range-separator { display:none; } }
.purchase-filters label:first-child { flex: 1 1 220px; }
.order-card { border: 1px solid var(--line); padding: 14px; border-radius: 12px; margin-top: 10px; }
.order-card > p { margin: 9px 0 3px; font-size: .88rem; color: var(--muted); }
.order-card form { margin-top: 10px; padding: 12px; border-radius: 9px; background: #f3f7f3; }
.topbar { padding: 13px clamp(16px,5vw,54px); background: var(--dark); color: white; }
.topbar nav { display: flex; gap: 16px; flex-wrap: wrap; }
.topbar nav a { color: #e4f1e9; font-size: .87rem; }
.workpage { max-width: 1300px; margin: auto; padding: 26px clamp(14px,4vw,40px); }
.checkout-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(255px,.41fr); gap: 15px; align-items: start; }
.scan-fields { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 8px; width: 100%; }
.checkout-grid .total-card { position: sticky; top: 15px; background: var(--dark); color: white; border: 0; }
.total-card .helper, .total-card [role="status"] { color: #c5dbcd; }
.total-card #total { font-size: 1.35rem; font-weight: 750; overflow-wrap: anywhere; }
.total-card .primary { width: 100%; background: var(--accent); border-color: var(--accent); color: var(--dark); margin-bottom: 10px; }
.total-card .primary:hover:not(:disabled) { background: #e4f6b7; }
#orderStatus { overflow-wrap: anywhere; }
details, .record { border-top: 1px solid var(--line); padding: 12px 0; overflow-wrap: anywhere; }
details summary { cursor: pointer; font-weight: 650; }
.editor { border: 0; padding: 0; }
.editor > summary { font-size: 1.1rem; }
.editor > form { margin-top: 16px; }
details p, .record p { margin: 7px 0 0; color: var(--muted); }
.login-shell {
  min-height: 100vh; display: grid; grid-template-columns: minmax(300px,1fr) minmax(380px,.85fr); align-items: stretch;
}
.login-story {
  display: flex; flex-direction: column; justify-content: space-between; gap: 35px;
  background: radial-gradient(ellipse at 100% 95%,#3a6748,transparent 65%),var(--dark);
  color: white; padding: clamp(26px,6vw,88px);
}
.login-story h1 { font-size: clamp(2rem,5.8vw,4.2rem); max-width: 13ch; }
.login-story p { color: #d3e4d8; max-width: 34ch; margin: 10px 0 0; }
.login-side { display: grid; place-items: center; padding: 26px; }
.login-card { width: min(100%,400px); }
.login-card form { grid-template-columns: 1fr; margin: 24px 0 14px; }
.login-card h2 { font-size: 1.65rem; }
.login-note { margin: 20px 0 0; padding: 12px; background: #eaf0e8; border-radius: 10px; }
.mono { font-family: ui-monospace,Consolas,monospace; }
.login-entries { display:flex; flex-wrap:wrap; gap:10px; margin:18px 0; }
.login-entries a { flex:1; }
.login-entries [aria-current=page] { background:var(--green); color:white; }
@media (max-width: 900px) {
  .app-shell { display: block; }
  .rail { min-height: 0; position: static; padding: 12px; }
  .rail .brand { margin: 0 0 10px; }
  .rail .nav-label, .rail-footer { display: none; }
  .workspace-nav, .rail-links { display: flex; overflow-x: auto; }
  .rail-links { margin-top: 5px; }
  .workspace-nav a, .rail-links a { padding: 6px 9px; }
  .workspace { padding-top: 18px; }
}
@media (max-width: 660px) {
  .workspace-nav, .rail-links { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); overflow: visible; }
  .workspace-nav a, .rail-links a { justify-content: center; padding: 7px 3px; font-size: .85rem; }
  .rail .nav-icon { display: none; }
  .metrics, .quick-actions { grid-template-columns: 1fr; gap: 7px; }
  .metric { display: flex; justify-content: space-between; align-items: center; }
  .metric strong { margin: 0; font-size: 1.25rem; }
  .checkout-grid, .login-shell { grid-template-columns: 1fr; }
  .checkout-grid .total-card { position: static; }
  .login-story { gap: 15px; }
  .scan-fields { grid-template-columns: 1fr; }
}
