:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-raised: rgba(255, 255, 255, 0.96);
  --soft: #f0f2f5;
  --soft-2: #e9edf2;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --muted-2: #8e8e93;
  --line: rgba(60, 60, 67, 0.16);
  --line-strong: rgba(60, 60, 67, 0.28);
  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, 0.12);
  --green: #34c759;
  --green-soft: rgba(52, 199, 89, 0.14);
  --amber: #ff9500;
  --amber-soft: rgba(255, 149, 0, 0.14);
  --pink: #ff2d55;
  --pink-soft: rgba(255, 45, 85, 0.12);
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 8px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1014;
  --surface: rgba(28, 28, 32, 0.82);
  --surface-solid: #1c1c20;
  --surface-raised: rgba(38, 38, 42, 0.96);
  --soft: #24252a;
  --soft-2: #2e3036;
  --ink: #f5f5f7;
  --muted: #a1a1a6;
  --muted-2: #7d7d84;
  --line: rgba(235, 235, 245, 0.14);
  --line-strong: rgba(235, 235, 245, 0.25);
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, 0.18);
  --green: #30d158;
  --green-soft: rgba(48, 209, 88, 0.16);
  --amber: #ff9f0a;
  --amber-soft: rgba(255, 159, 10, 0.18);
  --pink: #ff375f;
  --pink-soft: rgba(255, 55, 95, 0.16);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  letter-spacing: 0;
  transition:
    background 180ms ease,
    color 180ms ease;
}

button,
input,
select {
  font: inherit;
}

button,
label,
select,
input {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.file-button:focus-within,
.theme-switch:focus-within {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.app-frame {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 34%),
    #171b18;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(245, 245, 247, 0.92);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}

.side-brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 11px;
  min-height: 56px;
  margin-bottom: 4px;
  padding: 0 8px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(10, 132, 255, 0.18);
  color: #6bb7ff;
  border: 1px solid rgba(10, 132, 255, 0.42);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
}

.side-brand span:not(.brand-mark) {
  display: block;
  color: rgba(245, 245, 247, 0.46);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.side-brand strong {
  display: block;
  margin-top: 2px;
  color: rgba(245, 245, 247, 0.94);
  font-size: 17px;
  line-height: 1.2;
}

.nav-toggle {
  width: 32px;
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(245, 245, 247, 0.78);
  box-shadow: none;
  padding: 0;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  transform: none;
}

.nav-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 160ms ease;
}

.app-frame.nav-collapsed {
  grid-template-columns: 78px minmax(0, 1fr);
}

.app-frame.nav-collapsed .side-nav {
  padding: 18px 10px;
  overflow-x: hidden;
}

.app-frame.nav-collapsed .side-brand {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 10px;
  padding: 0;
}

.app-frame.nav-collapsed .side-brand div {
  display: none;
}

.app-frame.nav-collapsed .nav-toggle svg {
  transform: rotate(180deg);
}

.app-frame.nav-collapsed .tabs button {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 0;
  padding: 0;
}

.app-frame.nav-collapsed .tabs button > span:not(.nav-icon) {
  display: none;
}

.app-frame.nav-collapsed .tabs button.active::before {
  left: 50%;
  top: auto;
  bottom: 4px;
  width: 18px;
  height: 3px;
  transform: translateX(-50%);
}

.side-tools {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.side-file {
  min-height: 76px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 11px;
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
}

.side-file span,
.side-file small {
  color: rgba(245, 245, 247, 0.48);
  font-size: 12px;
  font-weight: 750;
}

.side-file strong {
  color: rgba(245, 245, 247, 0.92);
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-file small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-upload,
.side-action {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  background: rgba(10, 132, 255, 0.92);
  color: #ffffff;
  box-shadow: none;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  justify-items: start;
  gap: 9px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}

.side-upload:hover,
.side-action:hover {
  transform: none;
  background: #0a84ff;
}

.side-upload input {
  display: none;
}

.side-upload .nav-icon,
.side-action .nav-icon {
  color: currentColor;
}

.side-action {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(245, 245, 247, 0.84);
}

.side-action:hover {
  background: rgba(255, 255, 255, 0.12);
}

.settings-panel {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  padding: 10px;
  display: grid;
  gap: 9px;
}

.settings-row,
.settings-check {
  min-height: 34px;
  display: grid;
  align-items: center;
  color: rgba(245, 245, 247, 0.82);
  font-size: 13px;
  font-weight: 750;
}

.settings-row {
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 10px;
}

.settings-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.settings-row i {
  width: 44px;
  height: 25px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  position: relative;
}

.settings-row i::before {
  content: "";
  position: absolute;
  width: 19px;
  height: 19px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: rgba(245, 245, 247, 0.92);
  transition: transform 160ms ease;
}

.settings-row input:checked + i {
  background: var(--green);
}

.settings-row input:checked + i::before {
  transform: translateX(19px);
}

.settings-check {
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
}

.settings-check input {
  accent-color: var(--accent);
}

.settings-store {
  display: grid;
  gap: 6px;
  color: rgba(245, 245, 247, 0.82);
  font-size: 12px;
  font-weight: 750;
}

.settings-store select {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(245, 245, 247, 0.9);
  padding: 0 9px;
  font-weight: 800;
}

.settings-store option {
  background: #1c1c1e;
  color: #f5f5f7;
}

.settings-export {
  min-height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(245, 245, 247, 0.86);
  box-shadow: none;
  font-size: 13px;
  font-weight: 850;
}

.settings-export:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: none;
}

.settings-backup {
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  display: grid;
  gap: 7px;
}

.settings-backup > span,
.settings-backup small {
  color: rgba(245, 245, 247, 0.55);
  font-size: 11px;
  font-weight: 750;
}

.settings-backup > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.settings-backup button,
.settings-backup label {
  min-width: 0;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(245, 245, 247, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  box-shadow: none;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}

.settings-backup button:hover,
.settings-backup label:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: none;
}

.settings-backup input {
  display: none;
}

.settings-backup small {
  line-height: 1.4;
}

.app-frame.nav-collapsed .side-tools {
  justify-items: center;
}

.app-frame.nav-collapsed .side-file {
  display: none;
}

.app-frame.nav-collapsed .side-upload,
.app-frame.nav-collapsed .side-action {
  width: 46px;
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0;
}

.app-frame.nav-collapsed .side-upload > span:not(.nav-icon),
.app-frame.nav-collapsed .side-action > span:not(.nav-icon),
.app-frame.nav-collapsed .settings-panel {
  display: none;
}

.shell {
  width: 100%;
  max-width: 1760px;
  margin: 0 auto;
  padding: 14px 18px 36px;
}

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

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 800;
}

.file-button,
button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

.file-button:hover,
button:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.file-button {
  border-color: transparent;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.file-button input {
  display: none;
}

.theme-switch {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 12px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  white-space: nowrap;
}

.theme-switch span {
  font-size: 13px;
  font-weight: 700;
}

.theme-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.theme-switch i {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--soft-2);
  border: 1px solid var(--line);
  position: relative;
  transition: background 160ms ease;
}

.theme-switch i::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: var(--surface-solid);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.18);
  transition: transform 180ms ease;
}

.theme-switch input:checked + i {
  background: var(--green);
  border-color: transparent;
}

.theme-switch input:checked + i::before {
  transform: translateX(18px);
}

.dropzone {
  min-height: 58px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.dropzone.drag {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.dropzone div {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  text-align: center;
}

.dropzone strong {
  font-size: 15px;
  font-weight: 800;
  max-width: min(520px, 54vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone span {
  color: var(--muted);
  font-size: 12px;
}

.app-frame:not([data-tab="board"]) .board-only {
  display: none;
}

.time-strip {
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.time-card,
.stats div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 72px;
  padding: 12px 14px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.time-card.primary {
  background: var(--accent-soft);
  border-color: rgba(0, 122, 255, 0.22);
}

:root[data-theme="dark"] .time-card.primary {
  border-color: rgba(10, 132, 255, 0.34);
}

.time-card span,
.stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}

.time-card strong {
  display: block;
  font-size: 15px;
  line-height: 1.25;
}

.time-card small {
  display: block;
  margin-top: 5px;
  color: var(--accent);
  font-size: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.stats strong {
  display: block;
  font-size: 27px;
  line-height: 1;
  font-weight: 850;
}

.controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 156px 148px 148px 148px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.search input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--ink);
  padding: 0 12px;
  box-shadow: var(--shadow-soft);
}

.search input::placeholder {
  color: var(--muted-2);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 16px,
    calc(100% - 11px) 16px;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.check {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--muted);
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
}

.check input {
  accent-color: var(--accent);
}

.tabs {
  display: grid;
  gap: 7px;
}

.tabs button {
  position: relative;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(245, 245, 247, 0.78);
  box-shadow: none;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  justify-content: stretch;
  justify-items: start;
  gap: 11px;
  padding: 0 12px;
  font-size: 16px;
  font-weight: 750;
  text-align: left;
}

.tabs button:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.tabs button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.18);
}

.tabs button.active::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  width: 4px;
  height: 20px;
  border-radius: 999px;
  background: #0a84ff;
  transform: translateY(-50%);
}

.tabs button.active .nav-icon {
  color: #0a84ff;
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(245, 245, 247, 0.82);
}

.nav-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 238px;
  gap: 10px;
  align-items: start;
}

.board-panel {
  display: grid;
  gap: 10px;
}

.board-subgrid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 10px;
  align-items: start;
}

.board-table {
  max-height: 430px;
}

.board-table-head {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}

.board-table-head span {
  font-size: 14px;
  font-weight: 900;
}

.board-table-head small {
  color: var(--muted);
  font-size: 12px;
}

.matrix-wrap,
.table-wrap,
.rank-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.matrix-wrap,
.table-wrap {
  overflow: auto;
}

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

.matrix {
  min-width: 1120px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

td {
  font-size: 14px;
  background: rgba(255, 255, 255, 0.7);
}

:root[data-theme="dark"] td {
  background: rgba(28, 28, 32, 0.74);
}

tbody tr:hover td {
  background: var(--accent-soft);
}

.matrix .pin {
  position: sticky;
  z-index: 2;
  background: inherit;
}

.matrix th.pin {
  z-index: 4;
  background: var(--soft-2);
}

.pin-1 {
  left: 0;
  min-width: 96px;
  box-shadow: 1px 0 0 var(--line-strong);
}

.pin-2 {
  left: 0;
  min-width: 0;
}

.style-head {
  min-width: 122px;
  text-align: center;
  background: var(--soft);
  border-left: 1px solid var(--line-strong);
}

.style-head strong {
  display: block;
  font-size: 13px;
}

.style-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.total-head {
  background: var(--amber-soft);
}

.num {
  text-align: right;
}

.group {
  font-weight: 850;
  color: var(--accent);
}

.sku {
  font-family: "Segoe UI", Arial, sans-serif;
  font-weight: 700;
}

.color-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 850;
  gap: 7px;
  background: var(--surface-raised);
  color: var(--ink);
  border: 1px solid var(--line);
}

.color-badge i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  flex: 0 0 auto;
}

.color-badge.black i {
  background: #111111;
  border-color: #111111;
}

.color-badge.gray i {
  background: #a1a1a6;
  border-color: #a1a1a6;
}

.row-total {
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 900;
}

.size-cell {
  font-weight: 900;
  color: var(--ink);
}

.count {
  min-width: 118px;
  text-align: center;
  padding: 6px 8px;
}

.count.hit {
  background: var(--green-soft);
  color: #087a36;
  font-weight: 900;
}

:root[data-theme="dark"] .count.hit {
  color: #98f5ad;
}

.count.zero {
  color: var(--muted-2);
}

.pair-count {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pair-pill {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 5px;
  min-width: 42px;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  line-height: 1;
}

.pair-pill b {
  font-weight: 900;
}

.pair-pill em {
  font-style: normal;
  font-size: 14px;
  font-weight: 900;
}

.pair-pill.male {
  background: var(--accent-soft);
  color: var(--accent);
}

.pair-pill.female {
  background: var(--pink-soft);
  color: var(--pink);
}

.rank-panel {
  overflow: hidden;
}

.rank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: var(--soft);
  color: var(--ink);
  font-weight: 900;
}

.rank-head span {
  font-size: 14px;
}

.rank-head strong {
  font-size: 22px;
}

.rank-list {
  display: grid;
}

.rank-row {
  display: grid;
  grid-template-columns: 26px 1fr 40px;
  align-items: center;
  gap: 9px;
  min-height: 43px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
}

:root[data-theme="dark"] .rank-row {
  background: rgba(28, 28, 32, 0.72);
}

.rank-row strong {
  display: block;
  font-size: 13px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-row span:last-child {
  display: block;
  height: 6px;
  margin-top: 5px;
  background: var(--soft-2);
  border-radius: 999px;
  overflow: hidden;
}

.rank-row i {
  display: block;
  height: 100%;
  background: var(--green);
}

.rank-index {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--soft-2);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
}

.rank-row b {
  text-align: right;
  font-size: 15px;
}

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

.analysis-panel {
  display: grid;
  gap: 10px;
}

.product-panel {
  display: grid;
  gap: 10px;
}

.product-toolbar {
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px 10px 14px;
}

.product-toolbar span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.product-toolbar strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

.product-toolbar select {
  width: min(240px, 44vw);
  flex: 0 0 auto;
}

.product-info-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.purchase-image-status {
  max-width: 260px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-info-actions button,
.product-info-row button,
.product-icon-upload {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.product-info-actions button:first-child {
  border-color: rgba(0, 122, 255, 0.34);
  background: var(--accent);
  color: #ffffff;
}

#exportProductOrderDetails {
  padding-inline: 16px;
  border-color: rgba(0, 122, 255, 0.34);
  background: var(--accent);
  color: #ffffff;
  white-space: nowrap;
}

#exportProductOrderDetails:disabled {
  opacity: 0.45;
  cursor: default;
}

.product-info-card {
  min-height: 360px;
}

.accessory-card {
  min-height: 0;
}

.accessory-cost-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding: 12px;
}

.accessory-cost-form label {
  display: grid;
  gap: 6px;
}

.accessory-cost-form span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.accessory-cost-form input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--ink);
  padding: 0 11px;
  font-weight: 800;
}

.product-info-list {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.product-info-row {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr) 76px;
  align-items: stretch;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.48);
}

:root[data-theme="dark"] .product-info-row {
  background: rgba(255, 255, 255, 0.04);
}

.product-info-row label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.product-info-row label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.product-info-row input,
.product-info-row textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--ink);
  font-weight: 800;
}

.product-info-row input {
  min-height: 38px;
  padding: 0 11px;
}

.product-info-row textarea {
  min-height: 82px;
  resize: vertical;
  padding: 9px 11px;
  line-height: 1.45;
}

.product-icon-box {
  display: grid;
  align-content: start;
  gap: 8px;
}

.product-icon-preview {
  width: 82px;
  height: 82px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
}

.product-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-icon-upload {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  font-size: 12px;
}

.product-icon-upload input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.product-icon-clear {
  min-height: 32px;
  color: var(--muted);
  font-size: 12px;
}

.product-info-main {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.product-info-fields {
  display: grid;
  grid-template-columns: minmax(96px, 0.7fr) minmax(180px, 1.3fr) minmax(140px, 1fr) repeat(3, minmax(92px, 0.72fr));
  gap: 10px;
}

.product-info-notes {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1fr);
  gap: 10px;
}

.size-chart-upload {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.size-chart-upload > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.size-chart-preview {
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.size-chart-preview img {
  width: 100%;
  height: 100%;
  max-height: 260px;
  object-fit: contain;
  display: block;
}

.size-chart-preview em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
  font-weight: 800;
}

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

.size-chart-actions .product-icon-upload,
.size-chart-actions .product-icon-clear {
  flex: 1;
}

.product-info-side {
  display: grid;
  align-content: space-between;
  gap: 10px;
}

.product-info-side small {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.product-info-row.detected {
  border-color: rgba(0, 122, 255, 0.24);
  background: var(--accent-soft);
}

.product-info-row button {
  color: var(--pink);
}

.analysis-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.analysis-kpis div,
.analysis-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.analysis-kpis div {
  min-height: 82px;
  padding: 13px 14px;
}

.analysis-kpis span,
.analysis-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.analysis-kpis span {
  margin-bottom: 7px;
}

.analysis-kpis strong {
  display: block;
  font-size: 24px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 850;
}

.analysis-kpis small {
  display: block;
  margin-top: 4px;
  color: var(--accent);
  font-size: 12px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.product-analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(360px, 0.85fr);
  grid-template-areas:
    "trend size"
    "trend color"
    "rank rank";
  gap: 10px;
  align-items: stretch;
}

.style-analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.store-analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.product-trend-card {
  grid-area: trend;
}

.product-size-card {
  grid-area: size;
}

.product-color-card {
  grid-area: color;
}

.product-rank-card {
  grid-area: rank;
  min-height: 220px;
}

.style-trend-card {
  min-height: 620px;
}

.store-trend-card {
  min-height: 420px;
}

.store-detail-card {
  min-height: 420px;
}

.store-expense-card {
  min-height: 0;
}

.store-expense-form {
  display: grid;
  grid-template-columns: 140px 130px minmax(180px, 1fr) 130px minmax(200px, 1.4fr) 110px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.store-expense-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.store-expense-form label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.store-expense-form input,
.store-expense-form select,
.store-expense-form button {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--ink);
  padding: 0 10px;
  font-weight: 800;
}

.store-expense-form button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.store-expense-list {
  display: grid;
  max-height: 224px;
  overflow: auto;
}

.store-expense-row {
  display: grid;
  grid-template-columns: 92px 72px minmax(150px, 1fr) 96px minmax(160px, 1.4fr) 58px;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

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

.store-expense-row > * {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-expense-row b {
  color: var(--pink);
  text-align: right;
}

.store-expense-row small {
  color: var(--muted);
}

.store-expense-platform {
  color: var(--accent);
  font-weight: 900;
}

.store-expense-platform.pdd {
  color: var(--green);
}

.store-expense-row button {
  border: 0;
  background: transparent;
  color: var(--pink);
  font-weight: 850;
  cursor: pointer;
}

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

.analysis-card {
  min-height: 260px;
  overflow: hidden;
}

.analysis-card.wide {
  grid-column: span 2;
}

.analysis-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}

.analysis-card header span {
  font-size: 14px;
  font-weight: 900;
}

.bar-list {
  display: grid;
  padding: 8px 10px 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 28px minmax(82px, 1fr) minmax(90px, 1.8fr) 44px;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  border-bottom: 1px solid var(--line);
}

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

.bar-index {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--soft-2);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
}

.bar-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.bar-track {
  height: 9px;
  border-radius: 999px;
  background: var(--soft-2);
  overflow: hidden;
}

.bar-track i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.bar-row b {
  text-align: right;
  font-size: 14px;
}

.analysis-empty {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.size-breakdown {
  display: grid;
  padding: 9px 10px 11px;
}

.size-row {
  display: grid;
  grid-template-columns: 46px minmax(90px, 1fr) 44px 34px 34px;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border-bottom: 1px solid var(--line);
}

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

.size-head {
  min-height: 30px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.size-head span:nth-child(4) {
  color: var(--accent);
}

.size-head span:nth-child(5) {
  color: var(--pink);
}

.size-row strong {
  font-size: 15px;
  font-weight: 900;
}

.size-row b,
.size-row em {
  font-style: normal;
  text-align: right;
  font-weight: 900;
}

.size-row em {
  color: var(--muted);
  font-size: 13px;
}

.size-row em:first-of-type {
  color: var(--accent);
}

.size-row em:last-of-type {
  color: var(--pink);
}

.size-meter {
  height: 12px;
  border-radius: 999px;
  background: var(--soft-2);
  overflow: hidden;
}

.size-meter-fill {
  display: flex;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
}

.size-meter i {
  display: block;
  height: 100%;
  min-width: 0;
}

.size-meter i.male {
  background: var(--accent);
}

.size-meter i.female {
  background: var(--pink);
}

.trend-board {
  min-width: 760px;
  padding: 12px;
  overflow-x: auto;
  display: grid;
  gap: 10px;
}

.trend-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  padding: 0 2px 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trend-note b {
  color: var(--ink);
}

.trend-card {
  display: grid;
  grid-template-columns: 172px minmax(420px, 1fr);
  gap: 14px;
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.48);
  padding: 12px 12px 10px;
  position: relative;
  overflow: visible;
}

:root[data-theme="dark"] .trend-card {
  background: rgba(28, 28, 32, 0.72);
}

.trend-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  min-width: 0;
}

.trend-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.trend-info span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.trend-info span b {
  color: var(--trend-color);
  font-size: 22px;
  font-weight: 900;
}

.trend-info small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.trend-info .refund-summary {
  color: var(--pink);
}

.trend-plot {
  position: relative;
  display: grid;
  grid-template-rows: minmax(88px, 1fr) 16px;
  gap: 5px;
  min-height: 112px;
}

.trend-graph {
  position: relative;
  min-height: 88px;
}

.trend-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.trend-svg line {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.trend-area {
  fill: color-mix(in srgb, var(--trend-color) 18%, transparent);
}

.trend-line {
  fill: none;
  stroke: var(--trend-color);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.trend-refunds {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.trend-refunds i {
  position: absolute;
  bottom: 4%;
  width: 6px;
  min-height: 0;
  border-radius: 999px 999px 2px 2px;
  background: var(--pink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pink) 16%, transparent);
  opacity: 0.82;
  transform: translateX(-50%);
  pointer-events: auto;
}

.trend-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface-solid);
  border: 2px solid var(--trend-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--trend-color) 16%, transparent);
  transform: translate(-50%, -50%);
  cursor: crosshair;
  z-index: 2;
}

.store-trend-board {
  padding: 14px;
  min-height: 370px;
  display: grid;
  grid-template-rows: auto minmax(250px, 1fr) 18px;
  gap: 12px;
}

.store-trend-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.store-trend-summary span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
}

.store-trend-summary i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.store-trend-summary .sales {
  background: #0a84ff;
}

.store-trend-summary .net {
  background: #64d2ff;
}

.store-trend-summary .cost {
  background: var(--green);
}

.store-trend-summary .accessory {
  background: #64d2ff;
}

.store-trend-summary .shipping {
  background: #5e5ce6;
}

.store-trend-summary .orders {
  background: #bf5af2;
}

.store-trend-summary .promo {
  background: #ff9f0a;
}

.store-trend-summary .refund-only {
  background: #bf5af2;
}

.store-trend-summary .return-refund {
  background: var(--pink);
}

.store-trend-summary .alipay {
  background: #ffd60a;
}

.store-trend-summary .manual-expense {
  background: #ff453a;
}

.store-chart {
  position: relative;
  min-height: 250px;
}

.store-order-bars {
  position: absolute;
  inset: auto 0 9% 0;
  height: 34%;
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  align-items: end;
  gap: 3px;
  z-index: 0;
  pointer-events: auto;
}

.store-order-bars i {
  display: block;
  min-height: 0;
  border-radius: 6px 6px 0 0;
  background: color-mix(in srgb, #bf5af2 30%, transparent);
  border: 1px solid color-mix(in srgb, #bf5af2 36%, transparent);
}

.store-chart-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.store-chart-svg line {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.store-area.sales {
  fill: color-mix(in srgb, #0a84ff 13%, transparent);
}

.store-line {
  fill: none;
  stroke-width: 3.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.store-line.sales {
  stroke: #0a84ff;
}

.store-line.net {
  stroke: #64d2ff;
}

.store-line.cost {
  stroke: var(--green);
}

.store-line.promo {
  stroke: #ff9f0a;
}

.store-line.refund-only {
  stroke: #bf5af2;
}

.store-line.return-refund {
  stroke: var(--pink);
}

.store-line.alipay {
  stroke: #ffd60a;
}

.store-point {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface-solid);
  border: 2px solid #0a84ff;
  box-shadow: 0 0 0 4px color-mix(in srgb, #0a84ff 14%, transparent);
  transform: translate(-50%, -50%);
  cursor: crosshair;
}

.store-point::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  min-width: 230px;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 10;
}

.store-point:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.store-daily-list {
  padding: 0;
  overflow-x: auto;
}

.store-detail-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.store-detail-card > header > div {
  display: grid;
  gap: 3px;
}

.store-export-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.store-export-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.store-export-button:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  color: var(--accent);
}

.store-export-button:disabled {
  opacity: 0.42;
  cursor: default;
}

.store-day-table {
  min-width: 2460px;
  padding: 8px 10px 10px;
}

.store-day-row {
  display: grid;
  grid-template-columns: 96px repeat(24, minmax(84px, 1fr)) minmax(118px, 1.2fr);
  gap: 8px;
  align-items: center;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.store-day-row.head {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 34px;
  color: var(--muted);
  font-weight: 900;
  background: var(--surface);
}

.store-day-row.summary {
  min-height: 56px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  margin: 6px 0;
  font-weight: 900;
}

.store-day-row.summary strong,
.store-day-row.summary span {
  color: var(--ink);
}

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

.store-day-row strong {
  color: var(--ink);
  font-size: 12px;
}

.store-day-row span {
  color: var(--muted);
  white-space: nowrap;
}

.store-day-row em {
  display: block;
  margin-top: 2px;
  color: var(--pink);
  font-style: normal;
  font-size: 11px;
}

.store-day-row .promotion-budget-marker {
  color: var(--accent);
}

.store-day-row .ratio-cell {
  line-height: 1.45;
  white-space: normal;
}

.store-day-row .profit-cell {
  color: var(--green);
  font-weight: 900;
}

.store-day-row .profit-cell.negative {
  color: var(--pink);
}

.inventory-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "form"
    "table"
    "records";
  gap: 10px;
  align-items: start;
}

.inventory-table-card {
  grid-area: table;
  min-height: 0;
}

.inventory-table-card.collapsed {
  min-height: 0;
}

.inventory-table-card.collapsed .inventory-toolbar,
.inventory-table-card.collapsed .inventory-list {
  display: none;
}

.inventory-table-card.collapsed header {
  border-bottom: 0;
}

.inventory-collapse-toggle {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-raised);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.inventory-collapse-toggle:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
}

.inventory-form-card {
  grid-area: form;
  min-height: 360px;
  min-width: 0;
  overflow: hidden;
}

.inventory-purchase-card {
  grid-area: records;
  min-height: 300px;
}

.inventory-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 148px;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.inventory-toolbar input,
.inventory-toolbar select,
.inventory-form input,
.inventory-batch-meta input,
.inventory-batch-meta select,
.inventory-batch-cell input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--ink);
  padding: 0 11px;
  font-weight: 800;
}

.inventory-toolbar input,
.inventory-toolbar select {
  min-height: 34px;
}

.inventory-batch-form {
  display: grid;
  min-height: 0;
}

.inventory-batch-meta {
  display: grid;
  grid-template-columns: 140px minmax(170px, 1fr) 96px minmax(150px, 0.85fr) minmax(220px, 1.1fr) 136px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.inventory-batch-meta label,
.inventory-batch-cell {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.inventory-batch-meta span,
.inventory-batch-cell span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.inventory-batch-meta button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 900;
  cursor: pointer;
}

.inventory-batch-matrix {
  min-height: 210px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.inventory-batch-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.inventory-batch-note strong {
  color: var(--ink);
  font-size: 14px;
}

.inventory-batch-board {
  display: grid;
  gap: 0;
  min-width: 0;
  max-width: 100%;
  padding: 10px 10px 14px;
  overflow-x: scroll;
  overflow-y: hidden;
  justify-content: start;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 56%, var(--line)) var(--surface-raised);
}

.inventory-batch-board::-webkit-scrollbar {
  height: 12px;
}

.inventory-batch-board::-webkit-scrollbar-track {
  background: var(--surface-raised);
  border-radius: 999px;
}

.inventory-batch-board::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--accent) 56%, var(--line));
  border: 3px solid var(--surface-raised);
  border-radius: 999px;
}

.inventory-batch-color-head,
.inventory-batch-size-head {
  width: max-content;
  display: grid;
  grid-template-columns: 150px repeat(var(--batch-columns, 12), 58px);
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--surface-raised);
}

.inventory-batch-size-head {
  background: color-mix(in srgb, var(--surface-raised) 84%, var(--surface));
}

.inventory-batch-color-head span,
.inventory-batch-size-head span {
  min-height: 26px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
}

.inventory-batch-color-head span:first-child,
.inventory-batch-size-head span:first-child {
  justify-items: start;
  padding: 0 10px;
}

.inventory-batch-color-head span:not(:first-child) {
  color: var(--ink);
  font-size: 11px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.inventory-batch-color-head span:last-child,
.inventory-batch-size-head span:last-child {
  border-right: 0;
}

.inventory-batch-group {
  width: max-content;
  min-width: 0;
  display: grid;
  grid-template-columns: 150px repeat(var(--batch-columns, 12), 58px);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.inventory-batch-title {
  min-height: 48px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 6px 8px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  border-right: 1px solid var(--line);
}

.inventory-batch-title div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.inventory-batch-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.inventory-batch-title em {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  min-height: 18px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  background: var(--surface);
}

.inventory-batch-title span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  white-space: nowrap;
}

.inventory-batch-sizes {
  display: grid;
  grid-template-columns: repeat(var(--batch-columns, 12), 58px);
  grid-column: 2 / -1;
  gap: 0;
  padding: 0;
}

.inventory-batch-cell {
  min-width: 0;
  align-content: center;
  gap: 3px;
  padding: 5px 3px 4px;
  border-right: 1px solid var(--line);
  background: transparent;
}

.inventory-batch-cell span {
  color: var(--ink);
  text-align: center;
  font-size: 13px;
}

.inventory-batch-cell input {
  width: 40px;
  min-height: 24px;
  padding: 0 4px;
  margin: 0 auto;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
  border-radius: 8px;
  appearance: textfield;
}

.inventory-batch-cell input::-webkit-outer-spin-button,
.inventory-batch-cell input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.inventory-batch-cell small {
  color: var(--muted);
  font-size: 8px;
  text-align: center;
  white-space: nowrap;
}

.inventory-list {
  padding: 0;
  overflow-x: auto;
}

.inventory-stock-matrix {
  display: grid;
  width: max-content;
  min-width: 100%;
  padding: 0 8px 8px;
}

.inventory-stock-color-head,
.inventory-stock-size-head,
.inventory-stock-product-row {
  display: grid;
  grid-template-columns: 150px repeat(var(--stock-columns), 68px);
  width: max-content;
  min-width: 100%;
}

.inventory-stock-color-head,
.inventory-stock-size-head {
  color: var(--muted);
  background: var(--surface);
  font-size: 10px;
  font-weight: 900;
}

.inventory-stock-color-head > span,
.inventory-stock-size-head > span {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.inventory-stock-color-head > span {
  min-height: 28px;
  background: color-mix(in srgb, var(--surface-raised) 84%, var(--surface));
}

.inventory-stock-color-head > span:first-child,
.inventory-stock-size-head > span:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  justify-content: flex-start;
  padding-left: 10px;
  background: var(--surface-raised);
}

.inventory-stock-size-head > span {
  min-height: 24px;
}

.inventory-stock-product-row {
  min-height: 54px;
  border-bottom: 1px solid var(--line);
}

.inventory-stock-product-title {
  position: sticky;
  left: 0;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
  padding: 5px 10px;
  border-right: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--surface-raised) 90%, var(--surface));
}

.inventory-stock-product-title strong,
.inventory-stock-product-title span,
.inventory-stock-product-title small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-stock-product-title strong {
  color: var(--ink);
  font-size: 12px;
}

.inventory-stock-product-title span,
.inventory-stock-product-title small {
  color: var(--muted);
  font-size: 9px;
}

.inventory-stock-cell {
  display: grid;
  grid-template-rows: 28px 14px;
  align-content: center;
  justify-items: center;
  min-width: 0;
  padding: 4px 5px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.inventory-stock-cell small {
  color: var(--muted);
  font-size: 8px;
  white-space: nowrap;
}

.inventory-stock-cell.low {
  background: color-mix(in srgb, var(--amber) 9%, var(--surface));
}

.inventory-stock-cell.out:not(.empty) {
  background: color-mix(in srgb, var(--pink) 10%, var(--surface));
}

.inventory-stock-cell.empty {
  opacity: 0.72;
}

.inventory-stock-input {
  width: 54px;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-raised);
  color: var(--ink);
  padding: 0 6px;
  font-weight: 900;
  font-size: 12px;
}

.inventory-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.inventory-form label {
  display: grid;
  gap: 6px;
}

.inventory-form label.wide,
.inventory-form button {
  grid-column: 1 / -1;
}

.inventory-form span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.inventory-form button,
.inventory-purchase-row button,
.inventory-purchase-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 900;
  cursor: pointer;
}

.inventory-purchase-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.inventory-purchase-order {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-raised) 82%, transparent);
}

.inventory-purchase-order-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, auto) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.inventory-purchase-order-head strong,
.inventory-purchase-order-head span,
.inventory-purchase-order-head small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-purchase-order-head strong {
  font-size: 14px;
}

.inventory-purchase-order-head span,
.inventory-purchase-order-head small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.inventory-purchase-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inventory-purchase-money {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 8px;
  align-items: center;
  justify-content: end;
}

.inventory-purchase-money span,
.inventory-purchase-money label {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.inventory-purchase-money b {
  color: var(--ink);
  font-size: 12px;
}

.inventory-shipping-input {
  width: 64px;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-raised);
  color: var(--ink);
  padding: 0 6px;
  font-weight: 900;
}

.inventory-purchase-actions button {
  min-width: 76px;
  min-height: 34px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
}

.inventory-purchase-actions button:last-child {
  color: var(--pink);
}

.inventory-purchase-lines {
  display: grid;
  overflow-x: auto;
}

.inventory-purchase-line {
  display: grid;
  grid-template-columns: 112px 96px 56px 240px minmax(12px, 1fr) 56px 64px 92px;
  gap: 8px;
  align-items: center;
  min-width: 780px;
  min-height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.inventory-purchase-line:last-child {
  border-bottom: 0;
}

.inventory-purchase-line.head {
  min-height: 30px;
  color: var(--muted);
  font-weight: 900;
  background: color-mix(in srgb, var(--surface-raised) 76%, var(--surface));
}

.inventory-purchase-line strong,
.inventory-purchase-line span,
.inventory-purchase-line b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-purchase-line span {
  color: var(--muted);
}

.inventory-purchase-line b {
  color: var(--accent);
  text-align: right;
}

.inventory-purchase-spacer {
  min-width: 0;
}

.inventory-purchase-number-head {
  justify-self: stretch;
  text-align: right;
}

.inventory-purchase-size-detail {
  display: grid;
  grid-template-columns: repeat(6, 40px);
  width: 240px;
  align-items: stretch;
}

.inventory-purchase-size-detail > span {
  display: grid;
  width: 40px;
  grid-template-rows: 16px 18px;
  align-items: center;
  justify-items: center;
  border-right: 1px solid var(--line);
  overflow: visible;
}

.inventory-purchase-size-detail > span:last-child {
  border-right: 0;
}

.inventory-purchase-size-detail small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.inventory-purchase-size-detail > span b {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.inventory-purchase-size-detail.without-size-head > span {
  grid-template-rows: 34px;
}

.inventory-purchase-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 10px;
  align-items: center;
  min-height: 74px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-raised) 82%, transparent);
}

.inventory-purchase-row strong,
.inventory-purchase-row span,
.inventory-purchase-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-purchase-row strong {
  font-size: 13px;
}

.inventory-purchase-row span,
.inventory-purchase-row small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.inventory-purchase-row button {
  background: var(--surface-raised);
  color: var(--pink);
}

.refund-compare-head {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 10px;
  padding: 3px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  border-bottom: 1px solid var(--line);
}

.refund-diagnostic {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--pink) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--pink) 28%, transparent);
  color: var(--pink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.refund-compare-row {
  display: grid;
  grid-template-columns: 26px minmax(86px, 0.85fr) minmax(120px, 1.6fr) 44px minmax(140px, 0.9fr);
  align-items: center;
  gap: 9px;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
}

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

.refund-compare-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.refund-track {
  height: 10px;
  border-radius: 999px;
  background: var(--soft-2);
  overflow: hidden;
}

.refund-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--pink);
}

.refund-compare-row b {
  color: var(--pink);
  text-align: right;
  font-size: 15px;
}

.refund-compare-row small {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.trend-dot::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 64px;
  transform: translate(-50%, -50%);
}

.trend-dot::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  min-width: 142px;
  max-width: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--accent);
  box-shadow: var(--shadow);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 120ms ease,
    transform 120ms ease;
  z-index: 10;
}

.trend-dot:hover,
.trend-dot:focus-visible {
  width: 13px;
  height: 13px;
  background: var(--trend-color);
  outline: none;
}

.trend-dot:hover::after,
.trend-dot:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.trend-dates {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.qty {
  color: var(--accent);
  font-weight: 900;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.chip.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

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

.hidden {
  display: none;
}

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

button:disabled {
  color: var(--muted-2);
  cursor: not-allowed;
  background: var(--soft);
  transform: none;
  box-shadow: none;
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid var(--bg);
  border-radius: 999px;
}

.order-query-panel {
  display: grid;
  gap: 12px;
}

.order-query-panel.hidden {
  display: none;
}

.order-query-toolbar {
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.order-query-toolbar > div:first-child span,
.order-query-toolbar > div:first-child small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.order-query-toolbar > div:first-child strong {
  display: block;
  margin: 3px 0;
  font-size: 19px;
}

.order-query-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(620px, 56vw);
}

.order-query-search {
  min-width: 240px;
  flex: 1;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-query-search svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.order-query-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

#exportOrderQuery {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid rgba(0, 122, 255, 0.35);
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

#exportOrderQuery:disabled {
  opacity: 0.44;
  cursor: default;
}

.order-status-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.order-status-tabs button {
  min-width: 0;
  min-height: 52px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}

.order-status-tabs button:hover {
  background: var(--surface);
  color: var(--ink);
}

.order-status-tabs button.active {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.order-status-tabs button span {
  min-width: 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.order-status-tabs button small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.order-status-tabs button b {
  min-width: 28px;
  color: var(--accent);
  font-size: 18px;
  text-align: right;
}

.order-query-filters {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  display: grid;
  grid-template-columns: minmax(300px, 1.25fr) minmax(145px, 0.6fr) minmax(175px, 0.8fr) minmax(120px, 0.5fr) auto;
  align-items: end;
  gap: 8px;
}

.order-filter-field {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.order-filter-field > span {
  padding-left: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.order-filter-field input,
.order-filter-field select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  background: var(--surface-raised);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

.order-filter-field input:focus,
.order-filter-field select:focus {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.order-filter-dates {
  grid-template-columns: minmax(115px, 1fr) auto minmax(115px, 1fr);
  align-items: center;
}

.order-filter-dates > span {
  grid-column: 1 / -1;
}

.order-filter-dates i {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.order-filter-reset {
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.order-filter-reset svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.order-filter-reset:not(:disabled):hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.order-filter-reset:disabled {
  opacity: 0.4;
  cursor: default;
}

.order-query-table-wrap {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.order-query-table-head,
.order-query-pagination {
  min-height: 46px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-query-table-head {
  border-bottom: 1px solid var(--line);
}

.order-query-table-head strong {
  font-size: 14px;
}

.order-query-table-head small,
.order-query-pagination span {
  color: var(--muted);
  font-size: 12px;
}

.order-query-scroll {
  max-height: calc(100vh - 330px);
  min-height: 420px;
  overflow: auto;
}

.order-query-table {
  width: 100%;
  min-width: 1713px;
  border-collapse: collapse;
  table-layout: fixed;
}

.order-query-table th,
.order-query-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 12px;
}

.order-query-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  height: 38px;
  background: var(--surface-solid);
  color: var(--muted);
  font-weight: 800;
}

.order-query-table tbody tr:hover {
  background: var(--accent-soft);
}

.order-number,
.order-time,
.order-product-id,
.order-refund,
.order-logistics,
.order-note {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-number {
  color: var(--ink);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.order-time,
.order-product-id,
.order-logistics {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.order-product-id {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.order-column-resizer {
  position: absolute;
  z-index: 4;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.order-column-resizer::after {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 3px;
  width: 1px;
  background: transparent;
}

.order-query-table th:hover .order-column-resizer::after,
body.order-column-resizing .order-column-resizer::after {
  background: var(--accent);
}

body.order-column-resizing {
  cursor: col-resize;
  user-select: none;
}

.order-product strong,
.order-product small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-product small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.order-pattern-list {
  display: grid;
  gap: 7px;
}

.order-pattern-group + .order-pattern-group {
  padding-top: 7px;
  border-top: 1px dashed var(--line);
}

.order-pattern-name {
  margin-bottom: 3px;
  font-size: 13px;
}

.order-item-variants {
  display: grid;
  gap: 2px;
}

.order-item-variant {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(70px, 145px);
  align-items: center;
  gap: 8px;
}

.order-item-variant small {
  min-width: 0;
  margin: 0;
  font-size: 10px;
  line-height: 1.4;
}

.order-item-variant code {
  max-width: 145px;
  flex: 0 1 auto;
  color: var(--muted-2);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 600;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-store,
.order-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.order-store.taobao {
  background: var(--amber-soft);
  color: var(--amber);
}

.order-store.pdd,
.order-status.after-sales {
  background: var(--pink-soft);
  color: var(--pink);
}

.order-status.unpaid {
  background: var(--amber-soft);
  color: var(--amber);
}

.order-status.pending-shipment {
  background: var(--accent-soft);
  color: var(--accent);
}

.order-status.pending-receipt,
.order-status.complete {
  background: var(--green-soft);
  color: var(--green);
}

.order-status.cancelled {
  background: var(--soft-2);
  color: var(--muted);
}

.order-query-pagination {
  border-top: 1px solid var(--line);
}

.order-query-pagination > div {
  display: flex;
  gap: 6px;
}

.order-query-pagination button {
  width: 34px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.order-query-pagination button:disabled {
  opacity: 0.35;
  cursor: default;
}

@media (max-width: 1180px) {
  .order-query-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .order-query-actions {
    width: 100%;
    min-width: 0;
  }

  .order-status-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .order-query-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-filter-dates,
  .order-filter-note {
    grid-column: span 2;
  }

  .app-frame {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .app-frame.nav-collapsed {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .side-nav {
    padding: 16px 10px;
  }

  .side-brand {
    grid-template-columns: 36px minmax(0, 1fr) 32px;
    gap: 9px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .tabs button {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 9px;
    font-size: 15px;
  }

  .time-strip {
    grid-template-columns: 1fr 1fr;
  }

  .board-layout {
    grid-template-columns: 1fr;
  }

  .board-subgrid {
    grid-template-columns: 1fr;
  }

  .rank-panel {
    order: -1;
  }

  .analysis-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .product-analysis-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "trend"
      "size"
      "color"
      "rank";
  }

  .store-analysis-grid {
    grid-template-columns: 1fr;
  }

  .inventory-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "form"
      "table"
      "records";
  }
}

@media (max-width: 920px) {
  .app-frame {
    display: block;
  }

  .app-frame.nav-collapsed {
    display: block;
  }

  .side-nav {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: auto;
  }

  .side-brand {
    display: none;
  }

  .side-tools {
    display: none;
  }

  .nav-toggle {
    display: none;
  }

  .tabs {
    display: flex;
    gap: 8px;
    min-width: max-content;
  }

  .tabs button {
    width: auto;
    min-height: 40px;
    grid-template-columns: 24px auto;
    gap: 7px;
    border-radius: 999px;
    padding: 0 13px 0 10px;
    font-size: 14px;
  }

  .app-frame.nav-collapsed .tabs button {
    width: auto;
    grid-template-columns: 24px auto;
    gap: 7px;
    padding: 0 13px 0 10px;
  }

  .app-frame.nav-collapsed .tabs button > span:not(.nav-icon) {
    display: inline;
  }

  .tabs button.active::before {
    left: 50%;
    top: auto;
    bottom: 4px;
    width: 18px;
    height: 3px;
    transform: translateX(-50%);
  }

  .nav-icon {
    width: 23px;
    height: 23px;
  }

  .nav-icon svg {
    width: 21px;
    height: 21px;
  }

  .shell {
    width: min(100vw - 20px, 760px);
    padding: 14px 0 30px;
  }

  h1 {
    font-size: 24px;
  }

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

  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .search {
    grid-column: 1 / -1;
  }

  .analysis-kpis,
  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .product-analysis-grid {
    grid-template-columns: 1fr;
  }

  .store-analysis-grid {
    grid-template-columns: 1fr;
  }

  .analysis-card.wide {
    grid-column: auto;
  }

  .product-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .product-toolbar select {
    width: 100%;
  }

  .product-info-actions {
    width: 100%;
  }

  .product-info-actions button {
    flex: 1;
  }

  .product-info-row {
    grid-template-columns: 1fr;
  }

  .product-info-fields,
  .product-info-notes,
  .accessory-cost-form {
    grid-template-columns: 1fr;
  }

  .product-info-side {
    align-content: start;
  }

  .trend-board {
    min-width: 620px;
  }

  .trend-card {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .trend-plot {
    min-height: 120px;
  }
}

@media (max-width: 580px) {
  .order-query-actions {
    flex-direction: column;
  }

  .order-query-search,
  #exportOrderQuery {
    width: 100%;
    min-width: 0;
  }

  .order-status-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-query-filters {
    grid-template-columns: 1fr;
  }

  .order-filter-dates,
  .order-filter-note {
    grid-column: auto;
  }

  .order-filter-dates {
    grid-template-columns: 1fr;
  }

  .order-filter-dates i {
    display: none;
  }

  .order-query-scroll {
    max-height: calc(100vh - 300px);
    min-height: 360px;
  }

  .time-strip,
  .stats,
  .controls {
    grid-template-columns: 1fr;
  }

  .tabs {
    width: max-content;
  }

  .dropzone {
    min-height: 66px;
  }

  .dropzone div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .dropzone strong {
    max-width: calc(100vw - 48px);
  }

  .bar-row {
    grid-template-columns: 24px minmax(70px, 1fr) 72px 34px;
    gap: 7px;
  }

  .size-row {
    grid-template-columns: 48px minmax(82px, 1fr) 38px 34px 34px;
    gap: 7px;
  }

  .trend-board {
    min-width: 560px;
  }

  .trend-note {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .trend-info strong {
    font-size: 15px;
  }

  .inventory-form,
  .inventory-toolbar,
  .inventory-batch-meta {
    grid-template-columns: 1fr;
  }

  .store-expense-form {
    grid-template-columns: 1fr;
  }

  .store-expense-list {
    overflow-x: auto;
  }

  .store-expense-row {
    min-width: 680px;
  }

  .trend-dot::after {
    left: auto;
    right: 0;
    transform: translateY(4px);
  }

  .trend-dot:hover::after,
  .trend-dot:focus-visible::after {
    transform: translateY(0);
  }
}

@media (min-width: 581px) and (max-width: 1200px) {
  .store-expense-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .store-expense-note {
    grid-column: span 2;
  }
}
