:root {
  --bg: #e7e8e8;
  --ink: #202124;
  --muted: #737373;
  --panel: #f8f8f7;
  --line: #e4e4e2;
  --dark: #363737;
  --dark-soft: #4c4d4d;
  --accent: #e86543;
  --accent-soft: #faebe5;
  --return: #ececec;
}

/* Order logistics phase 2 */
.order-logistics-view.logistics-enabled > :not(#orderLogisticsWorkspace) { display: none !important; }
.logistics-workspace { width: 100%; min-width: 0; color: #17191c; }
.logistics-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.logistics-header h2 { margin: 3px 0 6px; font-size: 28px; }
.logistics-header p { margin: 0; color: #666b73; }
.logistics-service-state { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 12px; color: #8a5d00; }
.logistics-service-state span { padding: 6px 9px; border-radius: 8px; background: #fff7df; border: 1px solid #f3dfaa; }
.logistics-service-state .is-ready { color: #086c45; background: #eaf8f1; border-color: #bce5d1; }
.logistics-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px; border-bottom: 1px solid #e5e7eb; scrollbar-width: thin; }
.logistics-tabs button { flex: 0 0 auto; min-height: 40px; padding: 0 14px; border: 0; border-radius: 8px 8px 0 0; background: transparent; color: #676b72; font-size: 14px; }
.logistics-tabs button[aria-selected="true"] { color: #111827; background: #f3f4f6; box-shadow: inset 0 -2px #111827; font-weight: 700; }
.logistics-message { min-height: 24px; margin: 10px 0 0; color: #296946; font-size: 13px; }
.logistics-message[data-type="error"] { color: #b42318; }
.logistics-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.logistics-kpi { min-width: 0; padding: 16px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; }
.logistics-kpi span, .logistics-kpi small { display: block; color: #717680; font-size: 12px; }
.logistics-kpi strong { display: block; margin: 8px 0 5px; font-size: 26px; line-height: 1; }
.logistics-section { margin-top: 14px; padding: 16px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; }
.logistics-section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.logistics-section-head h3 { margin: 0 0 4px; font-size: 18px; }
.logistics-section-head p { margin: 0; color: #717680; font-size: 13px; }
.logistics-actions { display: flex; gap: 8px; }
.logistics-workspace button { min-height: 40px; padding: 0 13px; border: 1px solid #d9dce1; border-radius: 8px; background: #fff; color: #24272c; cursor: pointer; }
.logistics-workspace button:hover { border-color: #9ca3af; background: #f8f9fa; }
.logistics-workspace button:focus-visible, .logistics-workspace input:focus-visible, .logistics-workspace select:focus-visible, .logistics-workspace textarea:focus-visible { outline: 3px solid rgba(17, 24, 39, .16); outline-offset: 2px; }
.logistics-workspace button:disabled { cursor: not-allowed; opacity: .45; }
.logistics-workspace .logistics-primary { color: #fff; border-color: #111827; background: #111827; }
.logistics-workspace .logistics-primary:hover { background: #30343b; }
.logistics-danger { color: #b42318 !important; border-color: #f0b8b3 !important; background: #fff5f4 !important; }
.logistics-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.logistics-toolbar input { flex: 1 1 260px; }
.logistics-toolbar select { flex: 0 1 150px; }
.logistics-toolbar input, .logistics-toolbar select, .logistics-form input, .logistics-form select, .logistics-form textarea { min-height: 42px; padding: 9px 11px; border: 1px solid #dfe1e5; border-radius: 8px; background: #fff; color: #25272b; font: inherit; }
.logistics-table-wrap { width: 100%; overflow: auto; border: 1px solid #e6e8eb; border-radius: 8px; }
.logistics-table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 13px; }
.logistics-table th { position: sticky; top: 0; z-index: 1; padding: 11px; background: #f6f7f8; color: #5e636b; text-align: left; white-space: nowrap; }
.logistics-table td { padding: 11px; border-top: 1px solid #eceef0; vertical-align: middle; }
.logistics-table td button { min-height: 32px; padding: 0 10px; }
.logistics-row-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 170px; }
.logistics-status { display: inline-flex; padding: 4px 7px; border-radius: 6px; color: #4b5563; background: #f1f2f4; font-size: 12px; }
.status-in_transit, .status-collected { color: #075985; background: #e7f5fc; }
.status-delivered { color: #087443; background: #e9f8ef; }
.status-exception, .status-rejected, .status-returned { color: #b42318; background: #fff0ef; }
.logistics-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; font-size: 13px; }
.logistics-empty { padding: 42px 18px; border: 1px dashed #d9dce1; border-radius: 8px; text-align: center; color: #747981; }
.logistics-empty strong { color: #30333a; }
.logistics-empty p { margin: 7px 0 0; }
.logistics-card-list { display: grid; gap: 10px; }
.logistics-record-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid #e5e7eb; border-radius: 8px; }
.logistics-record-card h4 { margin: 8px 0 4px; }
.logistics-record-card p { margin: 0; color: #6b7078; }
.logistics-dialog-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: rgba(15, 18, 22, .42); }
.logistics-dialog { width: min(720px, 100%); max-height: min(90vh, 850px); overflow: auto; border-radius: 8px; background: #fff; box-shadow: 0 22px 70px rgba(0, 0, 0, .22); }
.logistics-dialog > header, .logistics-dialog > footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid #e7e9ec; }
.logistics-dialog > header h3 { margin: 0; font-size: 19px; }
.logistics-dialog > header button { min-width: 38px; padding: 0; font-size: 22px; }
.logistics-dialog > div { padding: 18px; }
.logistics-dialog > footer { justify-content: flex-end; border-top: 1px solid #e7e9ec; border-bottom: 0; }
.logistics-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.logistics-form label { display: grid; gap: 6px; color: #555a62; font-size: 13px; }
.logistics-form .wide { grid-column: 1 / -1; }
.logistics-form textarea { resize: vertical; }
.logistics-confirm-row { display: flex !important; grid-template-columns: 20px 1fr; align-items: center; }
.logistics-confirm-row input { min-height: auto; }
.logistics-warning { color: #8a4b08; background: #fff8e8; border: 1px solid #f2dfb9; border-radius: 8px; padding: 10px; }
.logistics-cleanup-preview p { line-height: 1.6; }

@media (max-width: 1050px) {
  .logistics-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .logistics-header { flex-direction: column; }
  .logistics-service-state { align-items: flex-start; }
}

@media (max-width: 700px) {
  .logistics-tabs { gap: 4px; }
  .logistics-tabs button { min-height: 38px; padding: 0 10px; }
  .logistics-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .logistics-kpi { padding: 12px; }
  .logistics-kpi strong { font-size: 22px; }
  .logistics-section { padding: 12px; }
  .logistics-section-head { align-items: flex-start; flex-direction: column; }
  .logistics-actions { width: 100%; flex-wrap: wrap; }
  .logistics-toolbar input { flex-basis: 100%; }
  .logistics-toolbar select, .logistics-toolbar button { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .logistics-form { grid-template-columns: 1fr; }
  .logistics-form .wide { grid-column: auto; }
  .logistics-dialog-backdrop { align-items: end; padding: 0; }
  .logistics-dialog { width: 100%; max-height: 92vh; border-radius: 8px 8px 0 0; }
  .logistics-record-card { align-items: flex-start; flex-direction: column; }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 16px;
  padding: 24px;
}

.sidebar {
  background: var(--dark);
  color: #fff;
  border-radius: 22px;
  padding: 18px;
  min-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.brand strong { font-size: 14px; }

.bear-logo {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}
.bear-logo .ear {
  position: absolute;
  top: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #df9f30;
}
.bear-logo .ear.left { left: 7px; }
.bear-logo .ear.right { right: 7px; }
.bear-logo .face {
  position: absolute;
  left: 7px;
  top: 8px;
  width: 30px;
  height: 30px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #f5be49;
}
.bear-logo i {
  position: absolute;
  top: 10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #342b22;
}
.bear-logo i:first-child { left: 8px; }
.bear-logo i:nth-child(2) { right: 8px; }
.bear-logo b {
  position: absolute;
  left: 13px;
  top: 16px;
  width: 5px;
  height: 4px;
  border-radius: 50%;
  background: #342b22;
}
.bear-logo em {
  position: absolute;
  left: 8px;
  bottom: -1px;
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}
.bear-logo .scarf {
  position: absolute;
  left: 13px;
  bottom: 5px;
  width: 19px;
  height: 5px;
  border-radius: 999px;
  background: #c6362e;
}

.nav {
  border: 0;
  background: transparent;
  color: #d5d5d5;
  text-align: left;
  padding: 10px 12px;
  border-radius: 11px;
  cursor: pointer;
  font: inherit;
}
.nav:hover, .nav.active { background: var(--dark-soft); color: #fff; }
.side-note {
  margin-top: auto;
  padding: 16px;
  border-radius: 18px;
  background: #464747;
  color: #f3f3f3;
  font-weight: 700;
  line-height: 1.5;
}

.shell { min-width: 0; }
.topbar {
  height: 62px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
h1, h2, p { margin: 0; }
h1 { font-size: 34px; line-height: 1; }
.topbar p { color: var(--muted); margin-top: 8px; }

button, .ghost-file {
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 9px 16px;
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
}
button:hover, .ghost-file:hover { filter: brightness(0.97); }
.primary { background: var(--accent); color: #fff; }
.danger { color: #b42318; }
.ghost-file input { display: none; }
.top-actions { display: flex; gap: 10px; }

.layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 20px;
  min-height: calc(100vh - 110px);
}
.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  box-shadow: 0 18px 55px rgba(43, 43, 43, 0.08);
}
.form-panel {
  padding: 18px;
  overflow: auto;
}
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-title h2 { font-size: 18px; }
.panel-title span { color: var(--muted); font-size: 13px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  font: inherit;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 101, 67, 0.12);
}
#profit { background: #f1f1f1; }
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.table-panel { padding: 18px; min-width: 0; }
.toolbar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.toolbar input { max-width: 360px; }
.toolbar select { max-width: 140px; }
.table-wrap {
  overflow: auto;
  border-radius: 18px;
  background: #fff;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}
th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}
th {
  background: #eeeeee;
  color: #545454;
  font-weight: 700;
  position: sticky;
  top: 0;
}
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f7f7f7; }
tr.sold { background: var(--accent-soft); }
tr.returned { background: var(--return); color: #555; }
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #f2f2f2;
}
.sold .pill { background: #fff1eb; color: var(--accent); }
.returned .pill { background: #e0e0e0; color: #555; }

.stats-panel {
  padding: 20px;
  min-height: calc(100vh - 110px);
}
.summary-strip {
  background: #fff;
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 16px;
  line-height: 1.8;
}
.stats-controls {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}
.stats-controls label { width: 160px; }
.hidden { display: none !important; }

@media (max-width: 980px) {
  body { grid-template-columns: 1fr; padding: 14px; }
  .sidebar { min-height: auto; flex-direction: row; overflow: auto; border-radius: 18px; }
  .brand, .side-note { display: none; }
  .layout { grid-template-columns: 1fr; }
  .topbar { height: auto; margin-bottom: 16px; gap: 12px; flex-direction: column; }
}


.login-page {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(0,0,0,0.78), rgba(0,0,0,0.38)),
    radial-gradient(circle at 20% 20%, rgba(232,101,67,0.55), transparent 32%),
    #151515;
}
.login-shell { width: min(430px, 100%); }
.login-card {
  background: rgba(248, 248, 247, 0.95);
  border: 1px solid rgba(255,255,255,0.65);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 28px 90px rgba(0,0,0,0.32);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}
.login-logo strong { font-size: 18px; }
.login-card h1 { font-size: 32px; margin-bottom: 10px; }
.login-card p { color: var(--muted); line-height: 1.7; margin-bottom: 20px; }
.login-form {
  display: grid;
  gap: 14px;
}
.login-form button {
  margin-top: 6px;
  width: 100%;
  justify-content: center;
}
.login-hint {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.bulk-actions {
  display: grid;
  grid-template-columns: auto 150px minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin: 0 0 14px;
  padding: 10px;
  border-radius: 16px;
  background: #fff;
}
.bulk-actions span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.bulk-actions select,
.bulk-actions input {
  min-width: 0;
}
.select-head,
.select-cell {
  width: 42px;
  text-align: center;
}
.select-head input,
.select-cell input {
  width: 16px;
  height: 16px;
  padding: 0;
  cursor: pointer;
}

@media (max-width: 980px) {
  .bulk-actions {
    grid-template-columns: 1fr 1fr;
  }
  .bulk-actions span,
  .bulk-actions input {
    grid-column: 1 / -1;
  }
}

.inline-status {
  width: 96px;
  min-height: 34px;
  padding: 6px 28px 6px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #fff7f3;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}
tr:not(.sold) .inline-status {
  background: #f3f4f6;
  color: #333;
}
.stats-manual {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 16px;
  padding: 10px;
  border-radius: 16px;
  background: #fff;
}
.stats-manual input {
  width: 170px;
}
.stats-detail {
  margin-top: 18px;
}
.mini-title {
  margin-top: 8px;
}
.stats-remove-row {
  color: #b42318;
}

.choice-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.choice-field input {
  min-width: 0;
}
.choice-btn {
  height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  background: #202020;
  color: #fff;
  white-space: nowrap;
}
.choice-panel {
  position: fixed;
  z-index: 30;
  width: min(340px, calc(100vw - 28px));
  max-height: 320px;
  overflow: auto;
  padding: 14px;
  border-radius: 18px;
  background: rgba(18, 18, 18, 0.96);
  box-shadow: 0 20px 60px rgba(0,0,0,0.22);
}
.choice-title {
  color: #fff;
  font-weight: 800;
  margin-bottom: 10px;
}
.choice-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.choice-options button {
  justify-content: flex-start;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  text-align: left;
  overflow-wrap: anywhere;
}
.choice-options span {
  color: rgba(255,255,255,0.72);
}

.bulk-choice-field {
  min-width: 0;
}
.bulk-actions .choice-field {
  align-self: stretch;
}
.bulk-actions .choice-field input {
  height: 44px;
}


.sales-panel {
  padding: 20px;
  min-height: calc(100vh - 110px);
}
.sales-grid {
  display: grid;
  gap: 18px;
}
.sales-block {
  display: grid;
  gap: 12px;
}
.sales-chart {
  min-height: 180px;
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: #fff;
  overflow-x: auto;
}
.sales-bar {
  width: 54px;
  min-width: 54px;
  display: grid;
  gap: 8px;
  justify-items: center;
  align-items: end;
}
.sales-bar span {
  width: 28px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, var(--accent), #2f2f2f);
}
.sales-bar small {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
.empty-chart {
  color: var(--muted);
  margin: auto;
}


.update-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 20, 20, 0.38);
  backdrop-filter: blur(8px);
}
.update-card {
  width: min(460px, 100%);
  border-radius: 24px;
  background: rgba(248, 248, 247, 0.98);
  box-shadow: 0 30px 100px rgba(0,0,0,0.28);
  padding: 28px;
  text-align: center;
}
.update-kicker {
  color: var(--accent);
  font-weight: 800;
  margin-bottom: 8px;
}
.update-card h2 {
  font-size: 24px;
  margin-bottom: 16px;
}
.update-card ul {
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
  color: #4c4d4d;
  text-align: left;
}
.update-card li {
  position: relative;
  padding-left: 18px;
  line-height: 1.6;
}
.update-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.update-card button {
  min-width: 120px;
}


.inline-color-combo {
  width: 118px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #f3f4f6;
  color: #333;
  font-weight: 700;
}
.inline-color-combo:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 101, 67, 0.12);
  background: #fff;
}


/* 2026-05-26 layout/login/inventory polish */
.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  color: #222;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  font-weight: 700;
}

.layout.inventory-mode {
  grid-template-columns: minmax(0, 1fr);
}
.layout.inventory-mode .form-panel {
  display: none;
}
.inventory-full {
  min-height: calc(100vh - 120px);
}

.stats-tabs {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  margin: 12px 0 16px;
  border-radius: 999px;
  background: #f0f0f0;
}
.stats-tab {
  border: 0;
  min-height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  color: #555;
  background: transparent;
  font-weight: 700;
}
.stats-tab.active {
  color: #111;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}

.stock-pill {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 800;
  font-size: 12px;
}
.stock-normal { background: #e7f7ec; color: #18753b; }
.stock-watch { background: #fff1c7; color: #8a5a00; }
.stock-medium { background: #ffe2c4; color: #9a3f00; }
.stock-heavy { background: #ffd0d2; color: #a31821; }
.stock-closed { background: #e8e8e8; color: #666; }

tr.sold {
  background: #ffd8c9;
}
tr.sold:hover {
  background: #ffcdbb;
}
tr.returned {
  background: #e7e3ff;
  color: #353057;
}
tr.returned:hover {
  background: #ded8ff;
}
.sold .pill {
  background: #fff5ef;
  color: #c94d24;
}
.returned .pill {
  background: #f5f2ff;
  color: #5b48c7;
}

.bear-logo {
  width: 50px;
  height: 50px;
  flex-basis: 50px;
  filter: drop-shadow(0 9px 16px rgba(0,0,0,0.16));
}
.bear-logo .ear {
  width: 17px;
  height: 17px;
  top: 2px;
  background: linear-gradient(145deg, #ffc45d, #d98b22);
  border: 3px solid #fff4d8;
}
.bear-logo .ear.left { left: 5px; }
.bear-logo .ear.right { right: 5px; }
.bear-logo .face {
  left: 6px;
  top: 8px;
  width: 38px;
  height: 37px;
  border-radius: 44% 44% 48% 48%;
  background: linear-gradient(160deg, #ffd46f, #f1a83d);
  border: 3px solid #fff4d8;
}
.bear-logo .face::before,
.bear-logo .face::after {
  content: "";
  position: absolute;
  top: 18px;
  width: 7px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,116,105,0.48);
}
.bear-logo .face::before { left: 5px; }
.bear-logo .face::after { right: 5px; }
.bear-logo i {
  top: 10px;
  width: 5px;
  height: 7px;
  background: #2b211c;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.7);
}
.bear-logo i:first-child { left: 10px; }
.bear-logo i:nth-child(2) { right: 10px; }
.bear-logo b {
  left: 16px;
  top: 17px;
  width: 7px;
  height: 5px;
  border-radius: 50% 50% 45% 45%;
}
.bear-logo b::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 5px;
  width: 5px;
  height: 3px;
  border-bottom: 2px solid #342b22;
  border-radius: 0 0 8px 8px;
}
.bear-logo em {
  display: none;
}
.bear-logo .scarf {
  left: 12px;
  bottom: 2px;
  width: 26px;
  height: 8px;
  background: linear-gradient(90deg, #ef5e46, #c9352c);
  border-radius: 999px 999px 8px 8px;
}

.remember-row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin: 2px 0;
}
.remember-row label {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: #555;
  font-weight: 700;
}
.remember-row input {
  width: 16px;
  height: 16px;
}


/* 2026-05-26 mobile and tablet polish */
@media (max-width: 1180px) {
  body {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .sidebar {
    position: sticky;
    top: 10px;
    z-index: 40;
    min-height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 20px;
    padding: 12px;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .brand {
    flex: 0 0 auto;
    margin: 0 8px 0 0;
  }
  .brand strong {
    white-space: nowrap;
  }
  .side-note {
    display: none;
  }
  .nav {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
  }

  .topbar {
    height: auto;
    margin: 6px 0 14px;
    gap: 12px;
  }

  .layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .form-panel {
    max-height: none;
  }

  .toolbar {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 150px 190px;
    align-items: stretch;
  }
  .toolbar input,
  .toolbar select {
    max-width: none;
  }

  .bulk-actions {
    grid-column: 1 / -1;
    grid-template-columns: auto 150px minmax(220px, 1fr) auto auto;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 760px) {
  html, body {
    min-height: 100%;
  }
  body {
    display: block;
    padding: 8px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: #e9eaea;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    overflow-x: hidden;
    top: 6px;
    margin-bottom: 10px;
    gap: 8px;
    border-radius: 18px;
    padding: 10px;
  }
  .brand {
    display: flex;
    grid-column: 1;
    gap: 8px;
    margin: 0;
  }
  .brand .bear-logo {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }
  .brand strong {
    font-size: 13px;
  }
  .nav {
    min-height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 14px;
  }

  .shell {
    min-width: 0;
  }
  .topbar {
    align-items: stretch;
    flex-direction: column;
    margin: 8px 2px 12px;
  }
  h1 {
    font-size: 28px;
    line-height: 1.12;
  }
  .topbar p {
    font-size: 14px;
    line-height: 1.5;
  }
  .top-actions {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .logout-btn,
  .top-actions button,
  .top-actions .ghost-file {
    min-height: 44px;
    flex: 1 0 auto;
  }

  .panel {
    border-radius: 18px;
    box-shadow: 0 12px 32px rgba(43, 43, 43, 0.08);
  }
  .form-panel,
  .table-panel,
  .stats-panel,
  .sales-panel {
    padding: 12px;
  }
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
  }
  .panel-title h2 {
    font-size: 17px;
  }
  .panel-title span {
    line-height: 1.5;
  }

  .form-grid {
    gap: 9px;
  }
  label {
    font-size: 13px;
  }
  input,
  select,
  textarea,
  button,
  .ghost-file {
    min-height: 46px;
    font-size: 16px;
  }
  textarea {
    min-height: 88px;
  }
  .choice-field {
    grid-template-columns: minmax(0, 1fr) 76px;
    gap: 7px;
  }
  .choice-btn {
    height: 46px;
    padding: 0 10px;
    border-radius: 13px;
    font-size: 15px;
  }
  .button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
  }
  .button-row .primary,
  .button-row .danger {
    grid-column: span 1;
  }

  .toolbar {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .toolbar input,
  .toolbar select {
    width: 100%;
  }
  .bulk-actions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px;
  }
  .bulk-actions span,
  .bulk-actions .choice-field {
    grid-column: 1 / -1;
  }
  .bulk-actions button {
    padding-left: 10px;
    padding-right: 10px;
  }

  .table-wrap {
    border-radius: 14px;
    margin-left: -2px;
    margin-right: -2px;
    box-shadow: inset -16px 0 18px -20px rgba(0,0,0,0.32);
  }
  table {
    min-width: 1080px;
  }
  th,
  td {
    padding: 12px 9px;
    font-size: 13px;
  }
  th:first-child,
  td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: inherit;
  }
  th:first-child {
    z-index: 3;
    background: #eeeeee;
  }
  .select-head,
  .select-cell {
    width: 44px;
  }
  .inline-status,
  .inline-color-combo {
    min-height: 38px;
    font-size: 14px;
  }

  .stats-tabs {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    border-radius: 16px;
    scrollbar-width: none;
  }
  .stats-tabs::-webkit-scrollbar { display: none; }
  .stats-tab {
    flex: 1 0 auto;
    min-height: 42px;
    padding: 0 14px;
  }
  .summary-strip {
    border-radius: 14px;
    padding: 12px;
    font-size: 14px;
  }
  .stats-controls,
  .stats-manual {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
  }
  .stats-controls label,
  .stats-manual input {
    width: 100%;
  }

  .sales-chart {
    min-height: 150px;
    padding: 12px;
    border-radius: 14px;
  }
  .sales-bar {
    width: 46px;
    min-width: 46px;
  }

  .choice-panel {
    left: 10px !important;
    right: 10px;
    width: auto;
    max-height: 58vh;
    border-radius: 18px;
  }
  .choice-options {
    grid-template-columns: 1fr;
  }
  .choice-options button {
    min-height: 42px;
  }

  .update-modal {
    align-items: end;
    padding: 10px;
  }
  .update-card {
    border-radius: 22px;
    padding: 20px;
  }

  .login-page {
    padding: 14px;
  }
  .login-card {
    padding: 22px;
    border-radius: 22px;
  }
  .login-card h1 {
    font-size: 28px;
  }
  .remember-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 420px) {
  .button-row {
    grid-template-columns: 1fr;
  }
  .bulk-actions {
    grid-template-columns: 1fr;
  }
  .brand strong {
    display: none;
  }
  h1 {
    font-size: 25px;
  }
}

/* 2026-05-26 minimal apple-style refresh */
:root {
  --bg: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --panel: #ffffff;
  --line: rgba(0, 0, 0, 0.08);
  --dark: #ffffff;
  --dark-soft: rgba(0, 0, 0, 0.06);
  --accent: #0071e3;
  --accent-soft: #eaf4ff;
  --return: #f1edff;
}

body {
  background: #f5f5f7;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Microsoft YaHei UI", sans-serif;
}

.sidebar {
  color: var(--ink);
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.05);
}

.brand strong,
.nav {
  color: #1d1d1f;
}

.nav {
  font-weight: 700;
  color: #5f6065;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.nav:hover {
  background: rgba(0, 0, 0, 0.045);
  color: #1d1d1f;
}
.nav.active {
  background: #1d1d1f;
  color: #fff;
}

.side-note {
  color: #1d1d1f;
  background: #f5f5f7;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.topbar {
  align-items: center;
}
h1 {
  font-size: clamp(32px, 4vw, 54px);
  font-weight: 800;
  letter-spacing: 0;
}
.topbar p {
  color: #6e6e73;
  font-size: 16px;
}

.panel {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 22px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.045);
}

.panel-title h2 {
  font-weight: 800;
  color: #1d1d1f;
}
.panel-title span {
  color: #86868b;
}

input,
select,
textarea {
  border-color: rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: none;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.14);
}

button,
.ghost-file,
.logout-btn {
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: none;
  font-weight: 800;
  transition: background 150ms ease, color 150ms ease;
}
button:hover,
.ghost-file:hover,
.logout-btn:hover {
  filter: none;
  background: #f5f5f7;
  box-shadow: none;
}
.primary {
  background: #0071e3;
  color: #fff;
  border-color: #0071e3;
}
.danger {
  color: #d70015;
}

.choice-btn {
  background: #1d1d1f;
  color: #fff;
  box-shadow: none;
}
.choice-panel {
  background: rgba(28, 28, 30, 0.92);
  backdrop-filter: blur(22px) saturate(1.3);
}

.table-wrap {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.045);
}
th {
  background: rgba(245, 245, 247, 0.96);
  color: #6e6e73;
  font-weight: 800;
}
td {
  color: #1d1d1f;
}
tbody tr:hover {
  background: rgba(0, 113, 227, 0.045);
}
tr.sold {
  background: #dff0ff;
}
tr.sold:hover {
  background: #d3eaff;
}
tr.returned {
  background: #efe9ff;
  color: #372f63;
}
tr.returned:hover {
  background: #e7deff;
}

.pill,
.stock-pill,
.inline-status,
.inline-color-combo {
  border-radius: 999px;
}
.stock-normal { background: #e7f8ee; color: #0a7f3f; }
.stock-watch { background: #fff4ce; color: #886300; }
.stock-medium { background: #ffe8cc; color: #a04a00; }
.stock-heavy { background: #ffe0e3; color: #b00020; }
.stock-closed { background: #ededf0; color: #6e6e73; }

.stats-tabs {
  background: rgba(0, 0, 0, 0.055);
}
.stats-tab {
  color: #6e6e73;
}
.stats-tab.active {
  background: #fff;
  color: #1d1d1f;
}
.summary-strip,
.stats-manual,
.bulk-actions,
.sales-chart {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.045);
}

.login-page {
  background: #f5f5f7;
}
.login-card,
.update-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.08);
}
.login-card h1,
.update-card h2 {
  color: #1d1d1f;
  font-weight: 850;
}
.login-card p,
.login-hint {
  color: #6e6e73;
}

@media (max-width: 760px) {
  body {
    background: #f5f5f7;
  }
  .sidebar {
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.06);
  }
  .panel {
    border-radius: 22px;
  }
  h1 {
    font-size: 32px;
  }
}


/* 2026-05-26 clean brand text */
.brand {
  justify-content: center;
}
.topbar {
  min-height: 62px;
}


/* 2026-05-26 free browser voice input */
.voice-panel {
  position: fixed;
  left: 190px;
  right: auto;
  bottom: 24px;
  z-index: 70;
  display: grid;
  justify-items: start;
  gap: 10px;
}
.voice-toggle {
  background: #1d1d1f;
  color: #fff;
}
.voice-box {
  width: min(360px, calc(100vw - 28px));
  padding: 16px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 18px 48px rgba(0,0,0,0.14);
}
.voice-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.voice-head strong {
  font-size: 16px;
}
.voice-head button {
  width: 34px;
  height: 34px;
  padding: 0;
}
.voice-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
#voiceStatus {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.voice-preview {
  margin-top: 10px;
  min-height: 52px;
  padding: 10px;
  border-radius: 14px;
  background: #f5f5f7;
  color: #4c4c50;
  line-height: 1.5;
}
.voice-listening .voice-toggle {
  background: #d70015;
}
.voice-listening .voice-preview {
  box-shadow: inset 0 0 0 2px rgba(215,0,21,0.18);
}

@media (max-width: 760px) {
  .voice-panel {
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    justify-items: stretch;
  }
  .voice-toggle,
  .voice-box {
    width: 100%;
  }
}


.row-actions {
  text-align: right;
  white-space: nowrap;
}

.row-delete {
  border: 0;
  border-radius: 999px;
  background: #fff1f2;
  color: #c1121f;
  font-weight: 800;
  padding: 8px 14px;
  cursor: pointer;
}

.row-delete:hover {
  background: #ffe4e6;
}

/* 2026-05-29 data safety center */
.data-panel {
  padding: 20px;
  min-height: calc(100vh - 110px);
}
.data-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.data-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 190px;
  padding: 16px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.data-card strong {
  font-size: 17px;
}
.data-card p {
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}
.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.data-message {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f5f5f7;
  color: #4c4c50;
  line-height: 1.6;
}
.data-message[data-type="ok"] {
  background: #e7f8ee;
  color: #0a7f3f;
}
.data-message[data-type="error"] {
  background: #fff1f2;
  color: #b00020;
}
.data-backup-table {
  min-width: 760px;
}
.backup-key {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1180px) {
  .data-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .data-panel {
    padding: 12px;
  }
  .data-status-grid {
    grid-template-columns: 1fr;
  }
  .data-card {
    min-height: auto;
  }
}


/* 2026-06-01 shared table pagination */
.table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 4px 2px;
  color: #666;
  font-size: 13px;
}
.table-page-info {
  white-space: nowrap;
}
.table-page-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}
.table-page-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}
.table-page-btn.active {
  background: var(--dark);
  color: #fff;
  border-color: var(--dark);
}
.table-page-btn:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}
.table-page-gap {
  padding: 0 2px;
  color: #999;
  font-weight: 800;
}
@media (max-width: 760px) {
  .table-pagination {
    align-items: stretch;
    flex-direction: column;
  }
  .table-page-info {
    white-space: normal;
  }
  .table-page-buttons {
    justify-content: flex-start;
  }
}


/* 2026-06-01 update log center */
.update-log-panel {
  padding: 20px;
  min-height: calc(100vh - 110px);
}
.update-log-list {
  display: grid;
  gap: 14px;
}
.update-log-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(43, 43, 43, 0.06);
}
.update-log-card.latest {
  border-color: rgba(232, 101, 67, 0.34);
  background: linear-gradient(180deg, #fff, #fff8f5);
}
.update-log-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}
.update-log-meta div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.update-log-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--return);
  color: #4c4d4d;
  font-weight: 800;
}
.update-log-card h3 {
  margin: 0 0 10px;
  font-size: 20px;
}
.update-log-card ul {
  margin: 0;
  padding-left: 20px;
  color: #4c4d4d;
  line-height: 1.7;
}


/* 2026-06-01 voice input left placement */
@media (max-width: 1180px) {
  .voice-panel {
    left: 14px;
    right: auto;
  }
}

/* xiaolei static avatar override */
.bear-logo {
  width: 72px;
  height: 72px;
  aspect-ratio: 1 / 1;
  flex: 0 0 72px;
  border-radius: 10px;
  background-image: url("./avatar-pooh.jpg");
  background-size: cover;
  background-position: center;
  border: 3px solid rgba(255,255,255,.92);
  box-shadow: 0 18px 46px rgba(255,165,46,.20);
  animation: none;
  transform: none;
}

.bear-logo > * {
  display: none !important;
}

/* Inventory toolbar hierarchy */
.inventory-toolbar {
  --toolbar-control-height: 44px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.toolbar-primary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.toolbar-primary input,
.toolbar-primary select,
.toolbar-primary button,
.bulk-actions input,
.bulk-actions select,
.bulk-actions button {
  min-height: var(--toolbar-control-height);
  height: var(--toolbar-control-height);
  border-radius: 12px;
  font-size: 14px;
}

.toolbar-primary input,
.toolbar-primary select,
.bulk-actions input,
.bulk-actions select {
  border-color: #e5e7eb;
}

.toolbar-primary input:hover,
.toolbar-primary select:hover,
.bulk-actions input:hover,
.bulk-actions select:hover {
  border-color: #cbd5e1;
}

.toolbar-primary input:focus,
.toolbar-primary select:focus,
.bulk-actions input:focus,
.bulk-actions select:focus {
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.09);
}

.toolbar-search {
  flex: 0 1 280px;
  width: 280px;
  min-width: 180px;
  max-width: 280px;
}

.toolbar-filter {
  flex: 0 0 150px;
  width: 150px;
  max-width: 150px;
}

.bulk-mode-toggle {
  margin-left: auto;
  padding: 0 16px;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  font-weight: 750;
}

.bulk-mode-toggle:hover,
.bulk-apply:hover {
  background: #273244;
}

.bulk-mode-toggle.active {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin: 12px 0 0;
  padding: 10px 14px;
  background: #f7f8fa;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.bulk-select-all,
.bulk-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #4b5563;
  font-size: 14px;
}

.bulk-select-all {
  flex: 0 0 auto;
  padding-right: 12px;
  border-right: 1px solid #dfe3e8;
  white-space: nowrap;
}

.bulk-select-all input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  accent-color: #111827;
}

.bulk-control > span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.bulk-control > select {
  width: 150px;
}

.bulk-value-control {
  flex: 1 1 280px;
}

.bulk-value-control .choice-field {
  flex: 1 1 auto;
  min-width: 200px;
}

.bulk-actions .choice-field input {
  height: var(--toolbar-control-height);
}

.bulk-actions .choice-btn {
  padding: 0 14px;
  border-radius: 12px;
}

.bulk-apply {
  padding: 0 18px;
  background: #111827;
  color: #fff;
  font-weight: 750;
}

.bulk-delete {
  padding: 0 16px;
  border: 1px solid #fecdd3;
  background: #fff1f2;
  color: #be123c;
  font-weight: 700;
}

.bulk-delete:hover {
  border-color: #fda4af;
  background: #ffe4e6;
}

.bulk-actions :disabled {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.45;
}

.select-head,
.select-cell {
  display: none;
}

.table-panel.bulk-mode .select-head,
.table-panel.bulk-mode .select-cell {
  display: table-cell;
}

@media (max-width: 1180px) {
  .toolbar-primary {
    flex-wrap: wrap;
  }
  .toolbar-search {
    flex: 1 1 240px;
    width: auto;
    max-width: none;
  }
  .bulk-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .inventory-toolbar {
    padding: 12px;
  }
  .toolbar-primary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .toolbar-search {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }
  .toolbar-filter,
  .bulk-mode-toggle {
    width: 100%;
    max-width: none;
    min-width: 0;
  }
  .bulk-mode-toggle {
    margin-left: 0;
    padding: 0 10px;
  }
  .bulk-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
  }
  .bulk-select-all,
  .bulk-value-control {
    grid-column: 1 / -1;
  }
  .bulk-select-all {
    padding: 0 0 8px;
    border-right: 0;
    border-bottom: 1px solid #dfe3e8;
  }
  .bulk-control {
    align-items: stretch;
    flex-direction: column;
    gap: 5px;
  }
  .bulk-control > select,
  .bulk-value-control .choice-field {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) 72px;
  }
  .bulk-value-control .choice-field input {
    grid-column: auto;
  }
  .bulk-apply,
  .bulk-delete {
    width: 100%;
  }
  .bulk-value-control .choice-btn {
    width: auto;
  }
}

/* Unified statistics workspace */
.stats-workspace { --stats-border:#e5e7eb; --stats-muted:#6b7280; min-width:0; padding:22px; border-radius:18px; background:#f7f8fa; }
.stats-heading,.stats-heading-actions,.stats-period-toolbar,.stats-period-nav,.stats-quick-ranges,.stats-detail-heading,.stats-export-actions,.stats-section>header,.stats-chart-card>header { display:flex; align-items:center; gap:10px; }
.stats-heading,.stats-detail-heading,.stats-section>header { justify-content:space-between; }
.stats-heading { align-items:flex-start; margin-bottom:16px; }
.stats-heading h2 { font-size:24px; }
.stats-heading p { margin-top:5px; color:var(--stats-muted); font-size:13px; }
.stats-basis { line-height:1.6; }
.stats-alert { border:1px solid #fecaca; border-radius:10px; background:#fff; color:#6b7280; }
.stats-alert.has-anomalies { background:#fff1f2; color:#b91c1c; }
.stats-more-wrap { position:relative; }
.stats-action-menu { position:absolute; top:calc(100% + 8px); right:0; z-index:20; width:190px; padding:6px; border:1px solid var(--stats-border); border-radius:10px; background:#fff; box-shadow:0 12px 30px rgba(0,0,0,.12); }
.stats-action-menu button { width:100%; border-radius:8px; text-align:left; }
.stats-period-toolbar { flex-wrap:wrap; justify-content:space-between; margin-bottom:16px; padding:12px; border:1px solid var(--stats-border); border-radius:14px; background:#fff; }
.stats-quick-ranges { flex-wrap:wrap; }
.stats-quick-ranges button,.stats-period-nav button,.stats-export-actions button,.stats-detail-filters button { min-height:40px; padding:0 13px; border:1px solid var(--stats-border); border-radius:10px; }
.stats-quick-ranges button.active { border-color:#111827; background:#111827; color:#fff; }
.stats-period-nav label { display:flex; align-items:center; gap:6px; }
.stats-period-nav select { width:116px; height:40px; padding-block:0; }
.stats-custom-range { display:flex; flex:1 0 100%; align-items:end; gap:10px; padding-top:10px; border-top:1px solid var(--stats-border); }
.stats-custom-range label { width:180px; }
.stats-kpi-grid { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:12px; margin-bottom:16px; }
.stats-kpi { min-width:0; padding:15px; border:1px solid var(--stats-border); border-radius:8px; background:#fff; box-shadow:0 1px 2px rgba(0,0,0,.03); }
.stats-kpi span { color:var(--stats-muted); font-size:13px; }
.stats-kpi strong { display:block; margin:9px 0 7px; font-size:clamp(20px,2vw,27px); letter-spacing:0; overflow-wrap:anywhere; }
.stats-kpi small { color:var(--stats-muted); font-size:12px; }
.stats-kpi--blue strong { color:#2563eb; }
.stats-kpi--green strong { color:#15803d; }
.stats-kpi--orange strong { color:#c2410c; }
.stats-kpi--loss strong,.negative-value { color:#b91c1c; }
.stats-chart-grid { display:grid; grid-template-columns:minmax(0,2fr) minmax(280px,1fr); gap:12px; margin-bottom:16px; }
.stats-chart-card,.stats-section { min-width:0; padding:16px; border:1px solid var(--stats-border); border-radius:8px; background:#fff; }
.stats-chart-card--wide { grid-row:span 2; }
.stats-chart-card>header { justify-content:space-between; margin-bottom:10px; }
.stats-chart-card h3,.stats-section h3 { font-size:16px; }
.stats-chart-card select { width:110px; height:36px; padding-block:0; }
.stats-chart { min-height:210px; overflow-x:auto; }
.stats-chart svg { display:block; width:100%; min-width:480px; height:auto; }
.stats-chart-empty,.stats-empty-state,.stats-empty-cell { padding:26px 12px; color:var(--stats-muted); text-align:center; }
.stats-chart-axis { stroke:#d1d5db; stroke-width:1; }
.stats-chart-point circle { fill:#2563eb; stroke:#fff; stroke-width:2; }
.stats-chart-point text,.stats-chart-bar text { fill:#6b7280; font-size:10px; }
.stats-chart-bar rect { fill:#93c5fd; }
.stats-chart-point:focus circle,.stats-chart-bar:focus rect { outline:none; stroke:#111827; stroke-width:3; }
.stats-chart-legend { display:flex; gap:14px; color:var(--stats-muted); font-size:12px; }
.stats-chart-legend span { display:flex; align-items:center; gap:6px; }
.stats-chart-legend i { width:18px; height:3px; border-radius:2px; }
.stats-brand-bars { display:grid; gap:9px; padding-top:6px; }
.stats-brand-bar { display:grid; grid-template-columns:72px minmax(80px,1fr) 82px; align-items:center; gap:8px; font-size:12px; }
.stats-brand-bar>div { height:8px; overflow:hidden; border-radius:4px; background:#eef2f7; }
.stats-brand-bar i { display:block; height:100%; border-radius:inherit; background:#15803d; }
.stats-brand-bar strong { text-align:right; }
.stats-period-table { margin-bottom:16px; }
.stats-detail-table-wrap { width:100%; overflow-x:auto; border:1px solid var(--stats-border); border-radius:8px; }
.stats-detail-table-wrap table { min-width:1180px; }
.stats-analysis-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-top:12px; }
.stats-analysis-grid>article { min-width:0; padding:12px; border:1px solid #eef0f2; border-radius:8px; }
.stats-analysis-grid h4 { margin:0 0 10px; font-size:14px; }
.stats-analysis-list { display:grid; gap:4px; }
.stats-analysis-list>div { display:grid; grid-template-columns:28px minmax(0,1fr) auto; align-items:center; gap:8px; padding:8px 0; border-bottom:1px solid #f0f1f2; }
.stats-analysis-list p { min-width:0; }
.stats-analysis-list strong,.stats-analysis-list small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.stats-analysis-list small { margin-top:3px; color:var(--stats-muted); }
.stats-aging { display:flex; flex-wrap:wrap; gap:8px; }
.stats-aging span { padding:5px 8px; border-radius:6px; background:#fff7ed; color:#9a3412; font-size:12px; }
.stats-detail-section { margin-top:16px; }
.stats-detail-heading p { margin-top:4px; color:var(--stats-muted); font-size:12px; }
.stats-export-actions { flex-wrap:wrap; justify-content:flex-end; }
.stats-detail-filters { display:grid; grid-template-columns:minmax(180px,1.5fr) repeat(6,minmax(120px,1fr)); gap:9px; margin:14px 0; }
.stats-detail-filters label { min-width:0; }
.stats-detail-filters input,.stats-detail-filters select { height:40px; padding-block:0; }
.stats-filter-search { grid-column:span 2; }
.stats-detail-table th button { width:100%; padding:0; border-radius:0; background:transparent; text-align:left; font-weight:700; }
.stats-row-anomaly { padding:5px 8px; border-radius:7px; background:#fff1f2; color:#b91c1c; }
.stats-dialog { position:fixed; inset:0; z-index:90; display:grid; place-items:center; padding:20px; background:rgba(17,24,39,.42); }
.stats-dialog-card { width:min(720px,100%); max-height:min(82vh,760px); overflow:auto; padding:20px; border-radius:12px; background:#fff; box-shadow:0 28px 80px rgba(0,0,0,.22); }
.stats-dialog-card>header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.stats-dialog-card>header button { width:40px; height:40px; padding:0; font-size:22px; }
.stats-adjustment-preview { margin-top:12px; padding:12px; border:1px solid var(--stats-border); border-radius:8px; background:#f9fafb; }
.stats-adjustment-preview dl { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin:0; }
.stats-adjustment-preview dt { color:var(--stats-muted); font-size:11px; }
.stats-adjustment-preview dd { margin:4px 0 0; font-weight:700; }
.stats-safety-note,.stats-inline-warning { margin:12px 0; padding:10px; border-radius:8px; background:#fff7ed; color:#9a3412; font-size:13px; }
.stats-history-row { display:grid; grid-template-columns:90px minmax(0,1fr) auto; gap:10px; padding:10px 0; border-bottom:1px solid var(--stats-border); }
.stats-anomaly-item { display:grid; grid-template-columns:90px minmax(0,1fr) auto auto; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--stats-border); }
.stats-history-row small,.stats-anomaly-item small { color:var(--stats-muted); }
.stats-safe-repair { min-height:36px; padding:7px 11px; border-color:#bbf7d0; background:#f0fdf4; color:#166534; font-weight:700; }
.stats-repair-intro { margin:-4px 0 14px; color:var(--stats-muted); font-size:14px; }
.stats-repair-card { width:min(680px,100%); }
.stats-repair-field { display:grid; gap:7px; margin-top:14px; color:#374151; font-size:13px; font-weight:700; }
.stats-repair-field input { width:min(280px,100%); height:44px; }
.stats-field-help { margin:6px 0 0; color:var(--stats-muted); font-size:12px; }
.stats-repair-diff { margin-top:14px; padding:12px 14px; border:1px solid var(--stats-border); border-radius:10px; background:#f7f8fa; }
.stats-repair-diff p { margin:7px 0 3px; font-weight:700; }
.stats-repair-diff small { color:var(--stats-muted); }
.stats-repair-message { min-height:20px; margin:10px 0 0; font-size:13px; font-weight:700; }
.stats-repair-message[data-type="success"] { color:#047857; }
.stats-repair-message[data-type="error"],.stats-repair-message[data-type="validation"] { color:#b91c1c; }
.stats-repair-message[data-type="warning"] { color:#9a3412; }
.stats-repair-message[data-type="pending"] { color:#1d4ed8; }
.stats-repair-undo { border-color:#fca5a5; background:#fff7f7; color:#b91c1c; }
.stats-repair-actions { justify-content:flex-end; margin-top:14px; }
.stats-workspace[aria-busy="true"] .stats-kpi,.stats-workspace[aria-busy="true"] .stats-chart,.stats-workspace[aria-busy="true"] .stats-detail-table-wrap { opacity:.55; }
@media (max-width:1100px) {
  .stats-kpi-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .stats-chart-grid { grid-template-columns:1fr; }
  .stats-chart-card--wide { grid-row:auto; }
  .stats-detail-filters { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width:720px) {
  .stats-workspace { padding:12px; }
  .stats-heading,.stats-detail-heading { align-items:stretch; flex-direction:column; }
  .stats-heading-actions,.stats-export-actions { justify-content:flex-start; }
  .stats-period-toolbar { align-items:stretch; }
  .stats-quick-ranges { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); width:100%; }
  .stats-quick-ranges button { min-width:0; padding-inline:7px; }
  .stats-period-nav { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); width:100%; }
  .stats-period-nav label { grid-column:1/-1; }
  .stats-period-nav select { flex:1; width:auto; }
  .stats-custom-range { position:fixed; left:0; right:0; bottom:0; z-index:95; display:grid; padding:16px; border-radius:14px 14px 0 0; background:#fff; box-shadow:0 -12px 40px rgba(0,0,0,.18); }
  .stats-custom-range.hidden { display:none; }
  .stats-custom-range label { width:100%; }
  .stats-kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .stats-kpi { padding:11px; }
  .stats-kpi strong { font-size:20px; }
  .stats-analysis-grid { grid-template-columns:1fr; }
  .stats-detail-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .stats-filter-search { grid-column:1/-1; }
  .stats-detail-table-wrap { max-width:calc(100vw - 52px); overflow-x:auto; }
  .stats-dialog { padding:8px; }
  .stats-adjustment-preview dl { grid-template-columns:1fr 1fr; }
  .stats-history-row,.stats-anomaly-item { grid-template-columns:70px 1fr; }
  .stats-history-row small,.stats-anomaly-item small { grid-column:2; }
  .stats-anomaly-item .stats-safe-repair { grid-column:2; justify-self:start; }
  .stats-repair-actions { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .stats-repair-actions button { width:100%; }
  .stats-repair-actions .stats-repair-undo { grid-column:1 / -1; }
}

/* Phase 1: product and order-logistics business centers */
.business-center-switch {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 5px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f7f8fa;
}
.center-switch {
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 9px;
  background: transparent;
  color: #5f6065;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
  white-space: normal;
  transition: background 160ms ease, color 160ms ease;
}
.center-switch.active {
  background: #1d1d1f;
  color: #fff;
}
.center-switch--logistics:not(.active) { color: #0f7180; }
.center-switch--logistics.active {
  background: #e5f6f8;
  color: #0a6573;
}
.center-navigation {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.center-navigation-title {
  padding: 4px 11px 3px;
  color: #98989d;
  font-size: 11px;
  font-weight: 750;
}
.nav-logistics { color: #0f7180; }
.nav-logistics.active {
  background: #e5f6f8;
  color: #0a6573;
}
.topbar-center-label {
  display: block;
  margin-top: 5px;
  color: #6e6e73;
  font-size: 12px;
  font-weight: 700;
}
.order-logistics-view {
  min-height: calc(100vh - 110px);
  padding: 22px;
  border-radius: 18px;
  background: #fff;
}
.order-logistics-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e5e7eb;
}
.order-logistics-heading h2 { margin-top: 4px; font-size: 24px; }
.order-logistics-heading p:not(.center-eyebrow) {
  max-width: 760px;
  margin-top: 7px;
  color: #6e6e73;
  line-height: 1.65;
}
.center-eyebrow {
  color: #0f7180;
  font-size: 12px;
  font-weight: 800;
}
.planning-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 8px;
  background: #e5f6f8;
  color: #0a6573;
  font-size: 12px;
  font-weight: 800;
}
.order-logistics-directions,
.order-logistics-grid,
.order-logistics-flows {
  display: grid;
  gap: 12px;
}
.order-logistics-directions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}
.order-logistics-directions article,
.order-logistics-flow {
  min-width: 0;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.order-logistics-directions h3,
.order-logistics-flow h3 { margin: 0; font-size: 16px; }
.order-logistics-directions p {
  margin-top: 7px;
  color: #6e6e73;
  font-size: 13px;
  line-height: 1.55;
}
.order-logistics-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 20px;
}
.order-logistics-card {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 126px;
  padding: 15px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafbfc;
  text-align: left;
  white-space: normal;
  transition: border-color 160ms ease, background 160ms ease;
}
.order-logistics-card:hover,
.order-logistics-card:focus-visible {
  border-color: #9fcfd6;
  background: #f4fbfc;
}
.order-logistics-card strong { font-size: 15px; }
.order-logistics-card span {
  color: #6e6e73;
  font-size: 12px;
  line-height: 1.5;
}
.order-logistics-card small {
  align-self: end;
  color: #8a8a90;
  font-size: 11px;
}
.order-logistics-flows {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 20px;
}
.order-logistics-flow-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}
.order-logistics-flow-steps span {
  padding: 7px 8px;
  border-radius: 7px;
  background: #f5f6f7;
  color: #4d4e52;
  font-size: 11px;
}
.order-logistics-flow-steps i {
  color: #a3a3a8;
  font-style: normal;
}
.order-logistics-status {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 80;
  min-height: 0;
  margin: 0;
  padding: 0;
  border-radius: 10px;
  background: #1d1d1f;
  color: #fff;
  font-size: 13px;
  transform: translateX(-50%);
  transition: padding 160ms ease, min-height 160ms ease;
}
.order-logistics-status:not(:empty) {
  min-height: 40px;
  padding: 10px 14px;
}
@media (max-width: 1100px) {
  .order-logistics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-logistics-flows { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .business-center-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    flex: 0 0 100%;
    margin: 0;
  }
  .center-switch { text-align: center; }
  .center-navigation {
    display: flex;
    grid-column: 1 / -1;
    max-width: 100%;
    overflow-x: auto;
    flex: 0 0 100%;
    scrollbar-width: none;
  }
  .center-navigation.hidden { display: none; }
  .center-navigation-title { display: none; }
  .order-logistics-view { min-height: auto; padding: 14px; }
  .order-logistics-heading { flex-direction: column; }
  .order-logistics-grid { grid-template-columns: 1fr; }
  .order-logistics-directions { grid-template-columns: 1fr; }
  .order-logistics-flow-steps {
    flex-direction: column;
    align-items: stretch;
  }
  .order-logistics-flow-steps i { align-self: center; transform: rotate(90deg); }
}
@media (prefers-reduced-motion: reduce) {
  .center-switch { transition: none; }
  .order-logistics-card { transition: none; }
  .order-logistics-status { transition: none; }
}
