:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #6d7788;
  --line: #b9c6db;
  --brand: #1677ff;
  --danger: #d93026;
  --warn: #c77700;
  --ok: #16833a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 40px;
  background: linear-gradient(135deg, #14213d, #0b5ed7);
  color: #fff;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
}

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

.notif-badge {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 11px;
  text-align: center;
  margin-left: 6px;
  padding: 0 5px;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, 90vw);
  max-height: 70vh;
  overflow: auto;
  background: #fff;
  border: 1px solid #a5b5cf;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(20, 28, 46, .14);
  padding: 10px;
  z-index: 100;
}

.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 4px 8px;
  font-size: 13px;
  color: #7b8ba3;
}

.notif-panel-head button {
  min-width: 0;
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.notif-item {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #c6d1e3;
  margin-bottom: 8px;
  font-size: 13px;
  color: #344054;
}

.notif-item.unread {
  background: #eef4ff;
  border-color: #9db8e0;
}

.notif-item strong {
  display: block;
  margin-bottom: 4px;
}

.notif-item p {
  margin: 0 0 4px;
}

.notif-item small {
  color: #98a2b3;
}

.notif-item button {
  margin-top: 8px;
  padding: 6px 14px;
  font-size: 12px;
}

.notif-item .notif-state {
  margin-top: 8px;
  color: #12a150;
  font-size: 12px;
  font-weight: 600;
}

.sale-item {
  padding: 0;
  overflow: hidden;
}

.sale-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}

.sale-head:hover {
  background: #f6f9ff;
}

.sale-summary {
  flex: 1;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-toggle {
  color: #2563eb;
  font-size: 13px;
  white-space: nowrap;
}

.row-toggle {
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
}

.sale-toggle.row-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #a5b5cf;
  color: #2563eb;
}

.sale-detail {
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}

.app-footer {
  text-align: center;
  padding: 18px 20px 26px;
  color: #7b8ba3;
  font-size: 13px;
  border-top: 1px solid #c6d1e3;
  margin-top: 8px;
}

.app-footer a {
  color: #2563eb;
  text-decoration: none;
}

.app-footer .footer-logo {
  height: 26px;
  width: auto;
  vertical-align: middle;
  margin-right: 8px;
  border-radius: 8px;
  background: #f4f6fa;
  padding: 3px;
}

.transfer-products-row > td {
  background: #f8fafc;
}

.transfer-products {
  min-width: 0;
  width: 100%;
}

.transfer-products th,
.transfer-products td {
  padding: 8px 10px;
  font-size: 13px;
}

.product-info-modal .info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 20px;
}

.product-info-modal .info-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed #c6d1e3;
  font-size: 13px;
}

.product-info-modal .info-label {
  color: #7b8ba3;
  white-space: nowrap;
}

.product-info-modal .info-value {
  color: #344054;
  text-align: right;
  word-break: break-all;
}

.topbar p {
  margin: 8px 0 0;
  opacity: .82;
}

.top-company-name {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 26px;
}

/* 左侧菜单布局 */
.app-main {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.side-menu {
  flex: 0 0 190px;
  position: sticky;
  top: 20px;
  background: #fff;
  border: 1px solid #5d7298;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 6px 18px rgba(20, 28, 46, .06);
}

.side-menu-title {
  font-size: 14px;
  font-weight: 700;
  color: #14213d;
  padding: 6px 10px 10px;
  border-bottom: 1px solid #b9c6db;
  margin-bottom: 4px;
}

.side-menu-item {
  text-align: left;
  border: 0;
  border-radius: 9px;
  padding: 11px 14px;
  background: transparent;
  color: #344054;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.side-menu-item:hover {
  background: #eef3fb;
}

.side-menu-item.active {
  background: #0b5ed7;
  color: #fff;
}

.side-submenu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 0 4px 10px;
}

.side-sub-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-sub-brand-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.side-sub-toggle {
  width: 22px;
  height: 22px;
  min-width: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #a5b5cf;
  color: #2563eb;
  background: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.side-sub-brand-name {
  flex: 1;
  text-align: left;
  border: 0;
  background: transparent;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 8px;
}

.side-sub-brand-name:hover {
  background: #f5f7fa;
  color: #344054;
}

.side-sub-brand-name:focus,
.side-sub-brand-name:active {
  outline: none;
  background: transparent;
  color: inherit;
}

.side-sub-count {
  color: #7b8ba3;
  font-size: 11px;
  white-space: nowrap;
}

.side-sub-models {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 16px;
}

.side-sub-model {
  text-align: left;
  border: 0;
  background: transparent;
  color: #55657f;
  font-size: 12px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 8px;
}

.side-sub-model:hover {
  background: #f5f7fa;
  color: #55657f;
}

.side-sub-model:focus,
.side-sub-model:active {
  outline: none;
  background: transparent;
  color: inherit;
}

.side-sub-toggle:focus {
  outline: none;
}

.side-sub-brand-name.side-sub-selected,
.side-sub-model.side-sub-selected {
  background: #0b5ed7 !important;
  color: #fff !important;
  font-weight: 600;
}

.app-content {
  flex: 1;
  min-width: 0;
}

/* 单功能整页显示时，隐藏其他面板 */
.app-content .panel,
.app-content .two-col {
  display: none;
}

.app-content .panel.show-panel {
  display: block;
}

.app-content .two-col.show-panel {
  display: block;
}

.app-content .two-col.show-panel > .panel {
  display: none;
}

.app-content .two-col.show-panel > .panel.show-panel {
  display: block;
}


button {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 650;
}

button:hover {
  filter: brightness(.95);
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  outline: none;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  outline: none;
  background: #fff;
}

.grid-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  line-height: 1.6;
  outline: none;
  resize: vertical;
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, .12);
}

input[readonly] {
  background: #eef1f4;
  color: #555;
  cursor: not-allowed;
  border-style: dashed;
}

input[readonly]:focus {
  border-color: var(--line);
  box-shadow: none;
}

.grid-form textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, .12);
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}

.stat-card strong {
  display: block;
  font-size: 26px;
}

.stat-card span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.panel {
  background: var(--card);
  border: 1px solid #5d7298;
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(20, 28, 46, .08);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(135deg, #ffffff, #edf5ff);
  border-color: #a7c3ea;
}

.hero h2 {
  margin: 5px 0 8px;
  font-size: 28px;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.dark-btn {
  background: #14213d;
}

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-title h2 {
  margin: 0;
  font-size: 20px;
}

.panel-title span,
.hint {
  color: var(--muted);
}

.panel-title .scan-count {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 13px;
  align-items: end;
}

.grid-form label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
}

.lan-detect-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lan-detect-row input {
  flex: 1;
  min-width: 0;
}

.lan-detect-row button {
  white-space: nowrap;
}

.product-detail-row > td {
  background: #f8fafc;
  padding: 14px 16px;
}

.product-detail-grid {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.product-detail-block {
  flex: 1;
  min-width: 220px;
  font-size: 13px;
  color: #344054;
  line-height: 1.8;
}

.product-qr-block .qr {
  width: 130px;
  height: 130px;
  object-fit: contain;
}

.grid-form .full-span {
  grid-column: span 2;
}

.grid-form .mode-span {
  grid-column: span 4;
}

.grid-form .port-span {
  grid-column: span 2;
}

.grid-form .port-span input {
  width: 120px;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.product-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px 170px auto auto;
}

.sale-toolbar {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 150px 150px auto auto;
}

.warehouse-toolbar {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 140px 150px 150px auto auto;
}

.warranty-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 150px auto auto;
}

.batch-actions {
  align-items: center;
  flex-wrap: wrap;
}

.warehouse-batch-actions {
  align-items: center;
  flex-wrap: wrap;
}

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

.selected-count {
  color: var(--muted);
  font-weight: 700;
  margin-right: auto;
  cursor: pointer;
  user-select: none;
}

.scan-toolbar input {
  width: 150px;
  padding: 8px 10px;
  font-size: 13px;
}

.product-filters input,
.warehouse-toolbar input {
  width: 220px;
  padding: 8px 10px;
  font-size: 13px;
}

.product-filters select,
.warehouse-toolbar select {
  width: 150px;
  padding: 8px 10px;
  font-size: 13px;
}

.product-filters button {
  padding: 8px 14px;
  font-size: 13px;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  box-shadow: none;
}

.table-wrap {
  overflow: auto;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.pagination span {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.inventory-tabs {
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.inventory-tabs button {
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: #344054;
  cursor: pointer;
}

.inventory-tabs button.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.inventory-tab {
  display: none;
}

.inventory-tab.active {
  display: block;
}

.warehouse-brand-row td {
  background: #eef2f7;
  font-size: 15px;
  padding: 10px 12px;
}

.warehouse-model-row td {
  background: #f7f9fc;
  color: #666;
  font-size: 13px;
  padding: 6px 12px 6px 26px;
}

.brand-toggle {
  margin-right: 8px;
  vertical-align: -6px;
}

.brand-count {
  color: #777;
  font-size: 13px;
  font-weight: normal;
  margin-left: 8px;
}

.brand-group-title {
  background: #eef2f7;
  border-radius: 10px;
  padding: 8px 12px;
  margin: 14px 0 8px;
  font-size: 15px;
}

table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  word-break: break-all;
}

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  background: #eef4ff;
  color: #175cd3;
}

.model-count {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #0b5ed7;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.status.sold {
  background: #e7f8ee;
  color: var(--ok);
}

.status.void {
  background: #fff0f0;
  color: var(--danger);
}

.product-detail.collapsed {
  display: none;
}

.qr {
  width: 82px;
  height: 82px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions button,
.mini-btn {
  padding: 8px 10px;
  font-size: 12px;
}

.danger-btn {
  background: var(--danger);
}

.ghost-btn {
  background: #eef2f7;
  color: #172033;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 18, 32, .44);
  z-index: 10;
}

.modal-card {
  width: min(760px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .25);
}

.modal-card.system-settings-modal {
  width: min(1120px, 96vw);
  max-width: 1120px;
  min-width: 760px;
  min-height: 480px;
  max-height: 95vh;
  overflow: auto;
  position: relative;
}

#sysResizeHandle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  cursor: se-resize;
  z-index: 5;
}

#sysResizeHandle::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 10px;
  height: 10px;
  border-right: 2px solid #9aa3b2;
  border-bottom: 2px solid #9aa3b2;
}

.system-settings-modal .system-tab {
  font-size: 14px;
  padding: 10px 18px;
}

.system-settings-modal .system-table th,
.system-settings-modal .system-table td {
  font-size: 14px;
  padding: 12px 14px;
}

.system-settings-modal .system-log-item {
  padding: 14px 16px;
  font-size: 14px;
}

.system-settings-modal .table-wrap {
  overflow: visible;
}

.system-settings-modal .system-table {
  min-width: 0;
  width: 100%;
}

.system-settings-modal input,
.system-settings-modal select {
  font-size: 14px;
  padding: 10px 12px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 0;
}

.edit-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.edit-form label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
}

.edit-form .full {
  grid-column: 1 / -1;
}

.qr-large {
  display: block;
  width: 280px;
  height: 280px;
  margin: 0 auto 16px;
}

.print-preview-card {
  width: min(980px, 100%);
}

.print-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.print-label {
  border: 1px solid #222;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  background: #fff;
}

.print-brand {
  display: block;
  font-size: 17px;
  font-weight: 900;
  margin-bottom: 8px;
}

.print-label img {
  width: 132px;
  height: 132px;
}

.print-label strong,
.print-label small {
  display: block;
  word-break: break-all;
}

.print-label small {
  margin-top: 4px;
  color: #333;
  font-size: 11px;
}

.print-label-45 {
  width: 40mm;
  height: 55mm;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.print-label-45 img {
  width: 40mm;
  height: 55mm;
  object-fit: contain;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.qr-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(20, 28, 46, .05);
}

.qr-card img {
  display: block;
  width: 160px;
  height: 160px;
  margin: 0 auto 10px;
}

.qr-actions {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.qr-actions button {
  flex: 1;
  min-width: 0;
  padding: 0 10px;
  font-size: 12px;
}

.qr-card strong,
.qr-card small {
  display: block;
}

.qr-card small {
  color: var(--muted);
  word-break: break-all;
  line-height: 1.5;
}

.system-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e8edf4;
}

.system-settings-top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  color: #6b7280;
}

.system-settings-top select {
  padding: 7px 12px;
  border: 1px solid #a5b5cf;
  border-radius: 999px;
  background: #fff;
  color: #344054;
  font-size: 13px;
  cursor: pointer;
}

.system-tab {
  border: 1px solid #a5b5cf;
  background: #fff;
  color: #4b5563;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s ease;
}

.system-tab:hover {
  border-color: #1677ff;
  color: #1677ff;
}

.system-tab.active {
  background: #1677ff;
  border-color: #1677ff;
  color: #fff;
}

.system-table {
  width: 100%;
  border-collapse: collapse;
}

.system-table th,
.system-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #c6d1e3;
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

.system-table th {
  background: #f8fafc;
  color: #6b7280;
  font-weight: 600;
}

.system-log-item {
  border: 1px solid #c6d1e3;
  border-radius: 12px;
  padding: 11px 14px;
  margin-bottom: 8px;
  background: #fff;
}

.system-log-item small {
  display: block;
  color: #6b7280;
  margin-top: 4px;
  font-size: 12px;
}

.system-info-card {
  border: 1px solid #c6d1e3;
  border-radius: 14px;
  padding: 6px 16px;
  background: #fff;
}

.system-card {
  border: 1px solid #c6d1e3;
  border-radius: 14px;
  padding: 16px;
  background: #fff;
  margin-bottom: 14px;
}

.system-card h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.system-config-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.system-config-form .full-span {
  grid-column: 1 / -1;
}

.system-user-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.system-user-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #344054;
}

.system-user-form .full {
  grid-column: 1 / -1;
}

.role-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  background: #eef4ff;
  color: #175cd3;
}

.status-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.on {
  background: #e7f8ee;
  color: #15803d;
}

.status-badge.off {
  background: #fff0f0;
  color: #b42318;
}

.rows {
  display: flex;
  flex-direction: column;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #c6d1e3;
  font-size: 14px;
}

.row:last-child {
  border-bottom: 0;
}

.label {
  color: #6b7280;
  flex: 0 0 100px;
}

.value {
  text-align: right;
  word-break: break-all;
  font-weight: 600;
}

#printArea {
  display: none;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.list {
  display: grid;
  gap: 10px;
  max-height: 480px;
  overflow: auto;
}

.item {
  border: 1px solid #8299b8;
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fff;
}

.item strong {
  display: block;
  margin-bottom: 4px;
}

.item small {
  color: var(--muted);
}

.risk-high {
  color: var(--danger);
}

.risk-medium {
  color: var(--warn);
}

.risk-low {
  color: var(--ok);
}

.export-progress-card {
  width: min(520px, 100%);
  text-align: center;
}

.export-progress-card .modal-head {
  text-align: left;
}

.export-progress-card p {
  margin: 10px 0 4px;
}

.progress-track {
  height: 14px;
  margin: 18px 0 12px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width .2s ease;
}

#toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  padding: 13px 16px;
  border-radius: 12px;
  background: rgba(23, 32, 51, .94);
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: .2s ease;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1000px) {
  .stats,
  .grid-form,
  .two-col,
  .product-filters,
  .sale-toolbar,
  .warehouse-toolbar,
  .warranty-toolbar,
  .edit-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 22px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-main {
    flex-direction: column;
  }

  .side-menu {
    flex: none;
    width: 100%;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .side-menu-title {
    width: 100%;
  }
}

/* 手机端适配 */
.mobile-menu-btn,
.mobile-menu-overlay {
  display: none;
}

@media (max-width: 640px) {
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 10px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 20px;
    line-height: 1;
  }

  .mobile-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(10, 18, 32, .45);
  }
  .mobile-menu-overlay.show {
    display: block;
  }

  body {
    background: #eef2f7;
  }

  main {
    padding: 10px 10px 24px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 10px 12px;
    gap: 10px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: 0 2px 10px rgba(20, 28, 46, .12);
  }

  .topbar h1 {
    font-size: 18px;
  }

  .topbar p {
    font-size: 11px;
    margin: 3px 0 0;
  }

  .topbar-actions {
    gap: 6px;
    flex-wrap: wrap;
  }

  .topbar-actions button {
    font-size: 12px;
    padding: 7px 10px;
  }

  .top-company-name {
    font-size: 12px;
    margin-top: 8px;
    padding: 4px 10px;
  }

  .app-main {
    flex-direction: column;
    gap: 10px;
  }

  .side-menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 82vw);
    margin: 0;
    border-radius: 0 18px 18px 0;
    padding: 14px 12px;
    flex-direction: column;
    flex-wrap: nowrap;
    transform: translateX(-105%);
    transition: transform .25s ease;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 12px 40px rgba(20, 28, 46, .2);
  }

  .side-menu.open {
    transform: translateX(0);
  }

  .side-menu-title {
    font-size: 14px;
    padding: 8px 10px 12px;
  }

  .side-menu-item {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
  }

  .side-submenu {
    padding-left: 8px;
  }

  .panel {
    padding: 14px;
    border-radius: 16px;
    margin-bottom: 12px;
  }

  .panel-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 10px;
  }

  .panel-title h2 {
    font-size: 17px;
  }

  .panel-title span,
  .panel-title .scan-count {
    font-size: 12px;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
  }

  .stat-card {
    padding: 12px;
    border-radius: 14px;
  }

  .stat-card strong {
    font-size: 20px;
  }

  .stat-card span {
    font-size: 12px;
  }

  .hero h2 {
    font-size: 20px;
  }

  .product-filters,
  .sale-toolbar,
  .warehouse-toolbar,
  .warranty-toolbar,
  .grid-form,
  .edit-form {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .product-filters input,
  .product-filters select,
  .sale-toolbar input,
  .sale-toolbar select,
  .warehouse-toolbar input,
  .warehouse-toolbar select,
  .warranty-toolbar input,
  .warranty-toolbar select,
  .grid-form label,
  .edit-form label,
  .grid-form input,
  .grid-form select,
  .edit-form input,
  .edit-form select,
  .edit-form textarea {
    width: 100% !important;
    min-width: 0 !important;
    grid-column: auto !important;
  }

  .lan-detect-row {
    flex-wrap: wrap;
  }

  .lan-detect-row input {
    flex: 1 1 100% !important;
    width: 100% !important;
  }

  .lan-detect-row button {
    flex: 1 1 auto;
  }

  #settingsForm .actions {
    flex-wrap: wrap !important;
    grid-column: auto !important;
    gap: 8px;
  }

  .toolbar,
  .batch-actions {
    flex-wrap: wrap;
  }

  .batch-actions button {
    flex: 1 1 auto;
  }

  .actions {
    gap: 6px;
  }

  .actions button {
    padding: 8px 10px;
    font-size: 12px;
  }

  .table-wrap {
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    -webkit-overflow-scrolling: touch;
  }

  th,
  td {
    padding: 8px 10px;
    font-size: 12px;
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
  }

  .modal-card.system-settings-modal {
    width: 100%;
    min-width: 0;
    min-height: 0;
  }
}

@media print {
  body > *:not(#printArea) {
    display: none !important;
  }

  #printArea {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12mm;
    padding: 10mm;
  }

  .print-label {
    break-inside: avoid;
    border: 1px solid #222;
    border-radius: 0;
    padding: 6mm;
    text-align: center;
    font-family: "Microsoft YaHei", sans-serif;
  }

  .print-brand {
    display: block;
    font-size: 14pt;
    font-weight: 900;
    margin-bottom: 3mm;
  }

  .print-label img {
    width: 36mm;
    height: 36mm;
  }

  .print-label-45 {
    width: 40mm;
    height: 55mm;
    padding: 0;
  }

  .print-label-45 img {
    width: 40mm;
    height: 55mm;
  }

  .print-label strong,
  .print-label small {
    display: block;
    word-break: break-all;
  }
}

/* ===== 按钮统一排列：一行、尺寸一致 ===== */
button {
  height: 40px;
  min-width: 88px;
  padding: 0 18px;
  border-radius: 10px;
  white-space: nowrap;
}

.toolbar,
.batch-actions,
.batch-inline-actions,
.actions-row {
  flex-wrap: nowrap;
  overflow-x: auto;
}

/* 操作区按钮：宽度不足时自动换行，保证全部完整显示 */
.actions {
  flex-wrap: wrap;
  overflow: visible;
}

/* 防伪页面广告管理 */
.video-box {
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid #e6ebf2;
  border-radius: 12px;
  background: #fafbfd;
}

.video-box-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.video-preview {
  margin-top: 10px;
}

.video-preview video {
  width: 100%;
  max-width: 360px;
  border-radius: 10px;
  background: #000;
  display: block;
}

.video-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid #e6ebf2;
  border-radius: 10px;
  background: #fff;
}

.video-row video {
  width: 180px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #000;
  display: block;
}

.video-row .video-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.video-row .video-name {
  font-size: 13px;
  color: #3d4655;
  word-break: break-all;
}

.video-preview .video-name {
  margin-top: 6px;
  font-size: 12.5px;
  color: #5b6473;
  word-break: break-all;
}

.video-empty {
  font-size: 12.5px;
  color: #8b93a1;
}

.ads-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0 14px;
}

.ads-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.ads-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.ads-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #e6ebf2;
  border-radius: 12px;
  background: #fafbfd;
  overflow: hidden;
}

.ads-card .ads-thumb {
  position: relative;
  background: #fff;
}

.ads-card .ads-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 26px;
  min-width: 0;
  padding: 0 11px;
  line-height: 26px;
  border: 0;
  border-radius: 999px;
  background: rgba(198, 40, 40, .94);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .22);
}

.ads-card .ads-remove:hover {
  background: #b3261e;
}

.ads-card img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: contain;
  background: #fff;
}

.ads-card .ads-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: #5b6473;
}

.ads-card .ads-name {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ads-card .ads-actions {
  display: flex;
  gap: 6px;
  padding: 0 10px 10px;
}

.ads-card .ads-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 10px 10px;
}

.ads-card .ads-fields input,
.ads-card .ads-fields textarea {
  width: 100%;
  font-size: 13px;
  font-family: inherit;
  padding: 7px 8px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  resize: vertical;
}

.ads-card .ads-fields .ads-save-btn {
  padding: 7px 0;
  font-size: 12.5px;
  border: 0;
  border-radius: 8px;
  background: #6b1420;
  color: #fff;
  cursor: pointer;
}

.ads-card .ads-actions button {
  flex: 1;
  padding: 6px 0;
  font-size: 12px;
}

.ads-empty {
  grid-column: 1 / -1;
  padding: 26px;
  text-align: center;
  color: #8b93a1;
  border: 1px dashed #dfe5ee;
  border-radius: 12px;
}
