:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d8dee8;
  --blue: #1254ff;
  --red: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.topActions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.navLink {
  display: inline-flex;
  height: 36px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
}

.navLink.active {
  border-color: var(--blue);
  background: #eef4ff;
  color: #174ea6;
}

.accountBadge {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #b7c8ff;
  border-radius: 6px;
  background: #f4f7ff;
  color: #174ea6;
  font-weight: 700;
}

.adminOnly.hidden {
  display: none !important;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 21px;
  font-weight: 700;
}

h2 {
  font-size: 16px;
}

.topbar p,
.muted,
.label,
.subMeta,
.productMeta {
  color: var(--muted);
}

.layout {
  width: 100%;
  max-width: none;
  padding: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.shopBar {
  max-width: 420px;
}

.settings details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.settings summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 650;
}

.authGrid {
  margin-top: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
button {
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font: inherit;
}

input,
select {
  min-width: 0;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
}

button {
  padding: 0 14px;
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

button:disabled {
  opacity: 0.65;
  cursor: default;
}

button.ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.buttonLink {
  display: inline-flex;
  height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

button.small {
  height: 32px;
  padding: 0 10px;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.actions.end {
  justify-content: flex-end;
}

.sectionHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.sectionHead.compact {
  margin-bottom: 10px;
}

.ordersHeadActions,
.selectAll,
.linkLabeledToggle {
  display: flex;
  align-items: center;
}

.ordersHeadActions {
  gap: 12px;
}

.selectAll {
  height: 28px;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
}

.linkLabeledToggle {
  height: 32px;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid #b7dfca;
  border-radius: 6px;
  background: #eefaf4;
  color: #087443;
  font-weight: 650;
}

.linkLabeledToggle input {
  width: 16px;
  height: 16px;
}

.selectAll input {
  width: 16px;
  height: 16px;
}

.filters {
  display: grid;
  grid-template-columns: 170px 180px 130px 220px 220px auto;
  gap: 12px;
  align-items: end;
}

.paginationControls {
  display: grid;
  grid-template-columns: 120px 140px auto minmax(220px, 1fr) minmax(280px, 0.8fr);
  gap: 12px;
  align-items: end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.paginationControls input,
.paginationControls select {
  width: 100%;
}

.pageActions {
  height: 36px;
}

.pageActions button {
  min-width: 78px;
}

#pageInfo {
  align-self: center;
  white-space: nowrap;
}

.searchControls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.searchControls input {
  width: 100%;
}

.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  height: 36px;
  color: var(--text);
}

.check input {
  width: 16px;
  height: 16px;
}

.ordersPanel {
  padding: 12px;
}

.ordersList {
  display: grid;
  gap: 10px;
}

.orderRow {
  display: grid;
  grid-template-columns: 34px 76px minmax(240px, 1.25fr) 180px 118px minmax(150px, 0.7fr) minmax(120px, 0.55fr) minmax(230px, 0.8fr) 168px;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.orderRow.searchHit {
  border-color: #ffb020;
  background: #fff8e6;
  box-shadow: 0 0 0 2px rgba(255, 176, 32, 0.25);
}

.labeledList {
  display: grid;
  gap: 10px;
}

.labeledRow {
  display: grid;
  grid-template-columns: 76px minmax(260px, 1.35fr) minmax(160px, 0.8fr) minmax(180px, 0.9fr) minmax(130px, 0.7fr) minmax(180px, 0.8fr);
  gap: 12px;
  align-items: center;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.labeledMeta {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.labeledMeta strong {
  overflow: hidden;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selectCell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.selectCell input {
  width: 16px;
  height: 16px;
}

.imageCell {
  position: relative;
}

.mainCell,
.timeCell,
.warehouseCell,
.shopCell,
.trackingCell {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.orderTitle {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeCell strong,
.warehouseCell strong {
  font-weight: 650;
}

.warehouseCell span {
  color: var(--muted);
}

.shopCell strong {
  overflow: hidden;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trackingCell {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.localTrackingInput {
  height: 32px;
}

.actionCell {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.autoPrintToggle {
  display: inline-flex;
  height: 32px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: 650;
}

.autoPrintToggle input {
  width: 16px;
  height: 16px;
}

.labelPreview {
  position: relative;
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid #b7dfca;
  border-radius: 6px;
  background: #eefaf4;
  color: #087443;
  cursor: default;
  font-size: 20px;
  line-height: 1;
}

.printerMark {
  transform: translateY(-1px);
}

.labelPreviewPane {
  position: absolute;
  right: 0;
  top: 42px;
  display: none;
  width: min(420px, calc(100vw - 36px));
  height: min(560px, calc(100vh - 90px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.24);
  z-index: 35;
}

.labelPreview:hover .labelPreviewPane {
  display: block;
}

.labelPreviewPane iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.status {
  display: inline-block;
  max-width: 100%;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef4ff;
  color: #174ea6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.readyTag {
  display: inline-flex;
  height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid #b7dfca;
  border-radius: 999px;
  background: #eefaf4;
  color: #087443;
  font-weight: 650;
}

.empty {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.hidden {
  display: none !important;
}

.thumbWrap {
  position: relative;
  display: inline-flex;
  width: 64px;
  height: 64px;
  align-items: center;
  justify-content: center;
}

.thumb {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.thumbZoom {
  position: fixed;
  width: 256px;
  height: 256px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translate(72px, -96px) scale(0.98);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 30;
}

.thumbWrap:hover .thumbZoom {
  opacity: 1;
  transform: translate(72px, -96px) scale(1);
}

.emptyThumb {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  background: #f8fafc;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(560px, calc(100vw - 36px));
  padding: 12px 14px;
  background: var(--text);
  color: #fff;
  border-radius: 7px;
  box-shadow: 0 12px 32px rgba(17, 24, 39, 0.22);
  z-index: 40;
}

.toast.error {
  background: var(--red);
}

.loginPage {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 18%, rgba(18, 84, 255, 0.16), transparent 30%),
    linear-gradient(135deg, #e8efff 0%, #f7f9fc 48%, #eaf7f1 100%);
}

.loginShell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.loginPanel {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(17, 24, 39, 0.12);
}

.loginPanel h1 {
  margin-bottom: 8px;
}

.loginSlogan {
  margin-bottom: 22px;
  color: #174ea6;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

.loginTabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.loginTabs button {
  width: 100%;
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.loginTabs button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.loginForm {
  display: grid;
  gap: 14px;
}

.passwordField {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
  align-items: center;
}

.passwordField input {
  min-width: 0;
}

.loginForm .passwordToggle {
  width: 72px;
  min-height: 42px;
  margin-top: 0;
  padding: 0 10px;
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.loginForm .passwordToggle:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.rememberLogin {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.rememberLogin input {
  width: 16px;
  height: 16px;
}

.loginForm button {
  width: 100%;
  margin-top: 4px;
}

.loginError {
  min-height: 20px;
  color: var(--red);
}

@media (max-width: 1180px) {
  .grid.two,
  .filters,
  .paginationControls,
  .orderRow,
  .labeledRow {
    grid-template-columns: 1fr;
  }

  .orderRow,
  .labeledRow {
    align-items: stretch;
  }

  .trackingCell {
    grid-template-columns: 1fr auto;
  }

  .topbar,
  .sectionHead {
    align-items: flex-start;
    flex-direction: column;
  }
}
