:root {
  color-scheme: light;
  --ink: #142f29;
  --primary: #174b3e;
  --deep: #10392f;
  --muted: #536b62;
  --cream: #f5f4ec;
  --paper: #fffefa;
  --rule: #d9dfd2;
  --accent: #bc653b;
  --danger: #943b31;
  font-family:
    "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.55;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-width: 280px;
}
a {
  color: var(--action-text, var(--primary));
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
:focus-visible {
  outline: 3px solid var(--focus, #c57a41);
  outline-offset: 3px;
}
button,
input,
select,
textarea {
  border-radius: 5px;
}
button {
  color: var(--action-text, var(--primary));
  background: var(--paper);
  border: 1px solid var(--control-border, #b9c8bc);
  padding: 0.54rem 0.85rem;
  font-weight: 650;
}
button:where(:not([aria-current="page"])):hover:not(:disabled) {
  background: var(--hover, #eaf0e6);
}
button.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
button.primary:hover:not(:disabled) {
  background: var(--primary-hover, #0d392f);
}
button.danger {
  color: var(--danger);
  border-color: #d9b5ae;
}
button.text-button {
  color: var(--action-text, var(--primary));
  background: transparent;
  border: 0;
  padding: 4px 0;
}
.skip-link {
  position: fixed;
  left: 8px;
  top: -80px;
  z-index: 20;
  padding: 8px 16px;
  background: white;
}
.skip-link:focus {
  top: 8px;
}
.auth-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  background-color: var(--login-bg, var(--deep));
}
.auth-panel {
  width: min(100%, 415px);
  padding: 40px;
  background: var(--paper);
  border-top: 5px solid var(--login-rule, #c97d4b);
  box-shadow: 0 18px 60px var(--panel-shadow, #051c172b);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--brand-light, #fff5d7);
}
.brand strong {
  font-family: "Noto Serif CJK SC", "Songti SC", "SimSun", serif;
  display: block;
  font-size: 1.45rem;
  letter-spacing: 0.08em;
  line-height: 1.25;
}
.brand small {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  display: block;
  margin-top: 4px;
}
.seal {
  font:
    700 26px/41px "Songti SC",
    "SimSun",
    serif;
  text-align: center;
  border: 1px solid currentColor;
  display: block;
  flex: 0 0 44px;
  width: 44px;
  line-height: 42px;
}
.auth-brand {
  color: var(--action-text, var(--primary));
  margin-bottom: 40px;
}
.brand-mark {
  display: block;
  flex: none;
  width: 44px;
  height: 44px;
}
.auth-panel h1 {
  font-size: 1.55rem;
  margin: 0 0 22px;
}
.auth-panel form,
.form-stack {
  display: grid;
  gap: 15px;
}
.privacy-link {
  margin: 18px 0 0;
  font-size: 0.83rem;
  text-align: center;
}
label {
  display: grid;
  gap: 5px;
  font-weight: 650;
  font-size: 0.89rem;
}
input:not([type="checkbox"]),
textarea,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--control-border, #b9c8bc);
  padding: 0.62rem 0.7rem;
  background: white;
  color: var(--ink);
}
input[readonly] {
  background: var(--readonly-bg, #f6f7f2);
}
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--action-text, var(--primary));
}
label.check {
  display: flex;
  align-items: center;
  gap: 8px;
}
textarea {
  min-height: 5.5rem;
  resize: vertical;
}
.app-shell {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 225px minmax(0, 1fr);
}
aside {
  background: var(--deep);
  color: var(--side-text, #f3f6e9);
  padding: 34px 18px 18px;
  position: sticky;
  height: 100svh;
  top: 0;
}
aside .brand {
  padding: 0 5px 30px;
  border-bottom: 1px solid var(--side-rule, #396052);
}
#side-menu {
  height: calc(100% - 75px);
  display: flex;
  flex-direction: column;
}
nav {
  display: grid;
  gap: 4px;
  padding: 24px 0;
}
nav button {
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--nav-text, #d8e4d6);
  padding: 12px 14px;
  font-size: 0.94rem;
  line-height: 1.35;
}
nav button::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border: 1px solid var(--nav-marker, #99b5a1);
  border-radius: 2px;
  flex: none;
}
nav button[aria-current="page"] {
  background: var(--nav-selected, #285547);
  color: var(--nav-selected-text, #fff8dd);
}
nav button[aria-current="page"]::before {
  background: var(--nav-selected-marker, #e8b77e);
  border-color: var(--nav-selected-marker, #e8b77e);
}
nav button:hover:not(:disabled):not([aria-current="page"]) {
  background: var(--nav-hover, #244d40);
}
.nav-badge {
  margin-left: auto;
  border-radius: 20px;
  background: var(--badge-bg, #f2ddad);
  color: var(--badge-text, #203d32);
  font: 700 0.73rem/1.55 system-ui;
  padding: 0 7px;
}
.account {
  margin-top: auto;
  border-top: 1px solid var(--account-rule, #3a604f);
  padding: 14px 10px;
}
.account strong {
  display: block;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
.account .text-button {
  color: var(--account-text, #c5d8c9);
  font-size: 0.82rem;
}
.mobile-nav {
  display: none;
}
main {
  padding: clamp(24px, 4vw, 58px);
  min-width: 0;
  max-width: 1770px;
  width: 100%;
  margin: 0 auto;
}
.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 26px;
}
.eyebrow {
  font-size: 0.79rem;
  color: var(--muted);
  margin: 0 0 5px;
  font-variant-numeric: tabular-nums;
}
.page-header h1 {
  font:
    700 clamp(1.8rem, 3vw, 2.55rem)/1.22 "Noto Serif CJK SC",
    "Songti SC",
    "SimSun",
    serif;
  margin: 0;
}
#content {
  display: grid;
  gap: 20px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--paper);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--metric-rule, var(--primary));
}
.metric {
  padding: 18px clamp(12px, 2.3vw, 30px);
  border-right: 1px solid var(--rule);
}
.metric:last-child {
  border-right: 0;
}
.metric span,
.muted {
  color: var(--muted);
}
.metric strong {
  display: block;
  font:
    650 clamp(1.5rem, 2.8vw, 2.25rem)/1.3 "Segoe UI",
    Arial,
    sans-serif;
  letter-spacing: -0.035em;
  margin-top: 5px;
  overflow-wrap: anywhere;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(230px, 0.8fr);
  gap: 20px;
  align-items: start;
}
.panel {
  border: 1px solid var(--rule);
  background: var(--paper);
  min-width: 0;
}
.panel-head,
.line,
.section-note,
.list-row {
  padding: 14px 20px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--rule);
}
h2 {
  font-size: 1.12rem;
  margin: 0;
}
h3 {
  font-size: 1rem;
  margin: 0;
}
p {
  overflow-wrap: anywhere;
}
.panel-head .text-button {
  font-size: 0.83rem;
  white-space: nowrap;
}
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--rule);
}
.list-row:last-child {
  border-bottom: 0;
}
.list-row strong,
.list-row small {
  display: block;
  overflow-wrap: anywhere;
}
.list-row small,
.detail-label,
.section-note,
time {
  color: var(--muted);
  font-size: 0.86rem;
}
.section-note {
  margin: 0;
}
.table-wrap {
  min-width: 0;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font-size: 0.9rem;
}
th,
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  overflow-wrap: anywhere;
  vertical-align: middle;
}
th {
  font-size: 0.76rem;
  color: var(--muted);
  background: var(--table-head, #f4f6ee);
  font-weight: 650;
}
td button {
  padding: 0.38rem 0.67rem;
}
tr:last-child td {
  border-bottom: 0;
}
.tag {
  display: inline-block;
  white-space: normal;
  padding: 2px 8px;
  font-size: 0.78rem;
  background: var(--tag-bg, #e7eee3);
  border: 1px solid var(--tag-rule, #c8d7c4);
  color: var(--tag-text, #32583c);
  border-radius: 3px;
}
.tag.warn {
  background: var(--warn-bg, #fbefda);
  border-color: var(--warn-rule, #e5cca2);
  color: var(--warn-text, #794b12);
}
.tag.bad {
  background: #f8e8e4;
  border-color: #e5c7bf;
  color: #7c3b31;
}
.tag.quiet {
  background: var(--quiet-bg, #edf0ea);
  border-color: var(--quiet-rule, #d7ddd2);
  color: var(--quiet-text, #526254);
}
.search-bar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}
.search-bar label:first-child {
  flex: 1 1 190px;
  max-width: 430px;
}
.search-bar label {
  flex: 0 1 180px;
}
.form-pair,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.detail-grid > .full {
  grid-column: 1/-1;
}
.detail-grid p {
  margin: 0;
}
.detail-grid b {
  display: block;
  font-weight: 600;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.dialog-section {
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  margin-top: 16px;
}
.dialog-section h3 {
  margin-bottom: 10px;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.actions.end {
  justify-content: flex-end;
}
#connection {
  padding: 12px 15px;
  border: 1px solid #dcb782;
  background: var(--warn-bg, #fbefda);
  color: #704117;
  margin-bottom: 18px;
}
#connection button {
  margin-left: 10px;
}
.feedback {
  font-size: 0.9rem;
  color: var(--danger);
  margin: 0;
}
.feedback:empty {
  display: none;
}
dialog {
  width: min(600px, calc(100vw - 24px));
  max-height: calc(100svh - 28px);
  overflow: auto;
  overscroll-behavior: contain;
  margin: auto;
  border: 1px solid var(--dialog-rule, #a1b5a5);
  padding: 22px 24px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 16px 70px var(--dialog-shadow, #0e292539);
  border-radius: 5px;
}
dialog::backdrop {
  background: var(--backdrop, #0b211cd1);
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
}
.close {
  background: transparent;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  padding: 6px 8px;
}
#dialog-error:not(:empty) {
  margin-top: 12px;
}
.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  max-width: min(410px, calc(100vw - 24px));
  padding: 12px 16px;
  background: var(--deep);
  color: white;
  box-shadow: 0 4px 16px var(--toast-shadow, #062f2226);
  border-radius: 4px;
  z-index: 4;
}
.token {
  display: block;
  width: 100%;
  font: 500 0.88rem/1.5 monospace;
  overflow-wrap: anywhere;
}
.qr {
  width: min(260px, 100%);
  height: auto;
  display: block;
  margin: 14px auto;
  background: white;
}
.line {
  display: grid;
  gap: 10px;
}
.line p {
  margin: 0;
}
@media (max-width: 1060px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .app-shell {
    grid-template-columns: 195px minmax(0, 1fr);
  }
  main {
    padding: 28px;
  }
}
@media (max-width: 760px) {
  .app-shell {
    display: block;
  }
  aside {
    position: relative;
    height: auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  aside .brand {
    padding: 0;
    border: 0;
  }
  aside .brand strong {
    font-size: 1.14rem;
  }
  aside .brand small {
    font-size: 0.48rem;
  }
  aside .seal {
    flex-basis: 35px;
    line-height: 33px;
    font-size: 22px;
  }
  aside .brand-mark {
    width: 35px;
    height: 35px;
  }
  .mobile-nav {
    display: block;
    color: white;
    background: transparent;
    border-color: var(--menu-rule, #63806e);
    font-size: 0.83rem;
  }
  .mobile-nav:hover:not(:disabled) {
    background: var(--nav-hover, #244d40);
  }
  #side-menu {
    display: none;
    width: 100%;
    height: auto;
  }
  #side-menu.open {
    display: block;
  }
  nav {
    padding: 12px 0;
    grid-template-columns: 1fr 1fr;
  }
  .account {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
  }
  main {
    padding: 22px 14px;
  }
  .page-header {
    margin-bottom: 18px;
  }
  .page-header h1 {
    font-size: 1.7rem;
  }
  .metric {
    padding: 12px 9px;
  }
  .metric span {
    font-size: 0.78rem;
  }
  .metric strong {
    font-size: 1.22rem;
  }
  .dashboard-grid,
  #content {
    gap: 14px;
  }
  .panel-head,
  .list-row,
  .line,
  .section-note {
    padding: 12px;
  }
  .search-bar {
    gap: 8px;
  }
  .search-bar label {
    flex: 1 1 100px;
  }
  .search-bar label:first-child {
    max-width: none;
  }
  .responsive thead {
    position: absolute;
    clip: rect(0, 0, 0, 0);
    width: 1px;
    height: 1px;
    overflow: hidden;
  }
  .responsive tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    padding: 12px;
    border-bottom: 1px solid var(--rule);
  }
  .responsive tr:last-child {
    border-bottom: 0;
  }
  .responsive td {
    display: block;
    border: 0;
    padding: 0;
  }
  .responsive td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.73rem;
  }
  .responsive td:last-child {
    align-self: end;
  }
  .responsive td[data-label="操作"]::before {
    display: none;
  }
}
@media (max-width: 420px) {
  .auth-panel {
    padding: 24px;
  }
  .form-pair {
    grid-template-columns: 1fr;
  }
  dialog {
    padding: 16px;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
  }
  .metric:nth-child(2) {
    border: 0;
  }
  .metric:last-child {
    grid-column: 1/-1;
    border-top: 1px solid var(--rule);
  }
  .toast {
    right: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
.inventory-product {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.thumbnail-slot {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--cream);
}
.thumbnail-slot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-photo {
  margin: 0;
  padding: 12px;
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.product-photo legend {
  padding: 0 4px;
  font-size: 0.9rem;
  font-weight: 650;
}
.photo-edit-layout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
#product-image-preview {
  width: 100px;
  max-width: 100%;
  height: 100px;
  object-fit: contain;
  background: var(--cream);
  border: 1px solid var(--rule);
}
.photo-controls {
  display: grid;
  gap: 6px;
  min-width: 0;
  flex: 1 1 180px;
}
.photo-controls input {
  max-width: 100%;
  font-size: 0.87rem;
}
.photo-controls small,
#product-image-status {
  font-size: 0.82rem;
  color: var(--muted);
}
.photo-controls input[aria-invalid="true"] ~ #product-image-status {
  color: var(--danger);
}
@media (max-width: 420px) {
  .thumbnail-slot {
    flex-basis: 32px;
    width: 32px;
    height: 32px;
  }
  #product-image-preview {
    width: 76px;
    height: 76px;
  }
}

.privacy-page {
  max-width: 42rem;
  margin: 3rem auto;
  padding: 0 1rem;
  font: 1.05rem/1.75 system-ui;
}
