:root {
  color-scheme: light;
  color: #183526;
  background: #f2f5eb;
  font-family: system-ui, "Microsoft YaHei UI", sans-serif;
  --forest: #205239;
  --deep: #173827;
  --pale: #e8efe0;
  --border: #d8e2d5;
  --muted: #4e6758;
  --paper: #fffef9;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:where(a, button, input, [tabindex="-1"]):focus-visible { outline: 3px solid #bb781a; outline-offset: 3px; }
.wrap { width: min(1100px, 100% - 40px); margin-inline: auto; }
.site-header { background: var(--paper); border-bottom: 1px solid var(--border); }
.site-header .wrap { min-height: 60px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.site-name, .back-link { text-decoration: none; font-weight: 700; }
.back-link { color: var(--forest); font-size: .9rem; }
.mark { display: inline-grid; place-items: center; width: 30px; height: 30px; color: #f4d083; background: var(--forest); border-radius: 7px; margin-right: 9px; }
.hero { margin-block: 28px 18px; color: #fffef6; background: var(--deep); border: 1px solid #254b36; border-radius: 18px; padding: clamp(24px, 5vw, 52px); }
.owner { color: #f0ce8d; font-weight: 750; margin: 0 0 10px; font-size: .95rem; letter-spacing: .035em; }
h1, h2, p { margin-block: 0; }
h1 { font-size: clamp(2.1rem, 7vw, 3.65rem); line-height: 1.1; letter-spacing: -.035em; }
.intro { margin-top: 14px; color: #e2ecdd; max-width: 34rem; line-height: 1.65; }
h2 { font-size: 1.15rem; line-height: 1.3; }
.entry, .catalog, .summary {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: clamp(16px, 3vw, 24px);
}
.entry { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.entry p, .catalog-top p, #selected-id { margin-top: 6px; font-size: .88rem; color: var(--muted); line-height: 1.55; overflow-wrap: anywhere; }
#identity { display: flex; gap: 8px; flex: 0 1 400px; }
input { border: 1px solid #b5c7b6; border-radius: 9px; padding: 11px 12px; background: #fff; color: var(--deep); min-width: 0; width: 100%; }
.primary { border: 1px solid var(--forest); background: var(--forest); color: white; border-radius: 9px; font-weight: 750; padding: 11px 16px; white-space: nowrap; }
.primary:not(:disabled):hover { background: #306746; }
.primary:disabled { background: #ebf0e7; border-color: #d7e0d4; color: #4f6457; }
.selection { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 300px); align-items: start; gap: 16px; margin-bottom: 32px; }
.catalog-top { display: flex; align-items: start; gap: 12px; justify-content: space-between; }
.search { flex: 0 1 245px; }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-block: 15px 12px; }
.filters button, .quiet { color: var(--forest); padding: 6px 12px; border: 1px solid var(--border); background: #fff; border-radius: 8px; font-weight: 650; }
.filters [aria-pressed=true] { background: var(--pale); border-color: #b1c6b0; }
#result-count { margin-left: auto; color: var(--muted); font-size: .82rem; }
.items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 0; padding: 0; list-style: none; }
.item { width: 100%; min-height: 64px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 7px; padding: 8px; border: 1px solid var(--border); background: #fbfcf8; border-radius: 9px; color: inherit; text-align: left; }
.item:hover:not(:disabled), .item[aria-pressed=true] { background: var(--pale); border-color: #8fae91; }
.code { font-variant-numeric: tabular-nums; color: var(--forest); font-size: .77rem; font-weight: 800; }
.item-label strong, .item-label small { display: block; overflow-wrap: anywhere; }
.item-label strong { font-size: .91rem; }
.item-label small { color: var(--muted); font-size: .72rem; margin-top: 3px; }
.quantity { color: var(--deep); font-size: .79rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.choice { color: var(--forest); background: #e8efe0; padding: 4px 5px; border-radius: 5px; font-weight: 700; font-size: .71rem; white-space: nowrap; }
.item[aria-pressed=true] .choice { background: var(--forest); color: white; }
.summary { position: sticky; top: 14px; }
.summary-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#count { font-variant-numeric: tabular-nums; padding: 4px 8px; color: var(--forest); background: var(--pale); border-radius: 6px; }
#chosen { min-height: 44px; padding: 0; margin: 10px 0; list-style: none; }
#chosen li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); padding: 6px 0; }
.chosen-name { overflow-wrap: anywhere; }
.remove { border: 0; background: transparent; color: var(--forest); text-decoration: underline; padding: 6px 2px; }
#send { width: 100%; }
.notice { font-size: .88rem; line-height: 1.55; color: #783c25; overflow-wrap: anywhere; }
.notice:not(:empty) { margin-top: 12px; }
.notice.success { color: var(--forest); font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 950px) { .items { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 650px) {
  .wrap { width: calc(100% - 24px); }
  .entry, .catalog-top { flex-direction: column; align-items: stretch; }
  #identity, .search { flex: auto; }
  .selection { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .summary { position: sticky; z-index: 1; bottom: 0; top: auto; padding: 12px; border-color: #a9bcaa; }
  #chosen { min-height: 0; max-height: 96px; overflow: auto; }
  #chosen:empty { margin: 0 0 8px; }
}
@media (max-width: 650px) { .items { max-height: 54vh; overflow-y: auto; padding: 4px; } }
