:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --panel-soft: #eef4f1;
  --ink: #1f2a2e;
  --muted: #6b777b;
  --line: #dde5e2;
  --brand: #21745b;
  --brand-dark: #15543f;
  --accent: #d9872b;
  --danger: #b43b3b;
  --shadow: 0 12px 28px rgba(32, 45, 49, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
}

body.auth-locked {
  overflow: auto;
}

body.auth-checking {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body.auth-locked .app-shell,
body.auth-checking .app-shell {
  display: none;
}

.auth-overlay {
  display: none;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 28% 16%, rgba(33, 116, 91, 0.18), transparent 30%),
    linear-gradient(135deg, #eef5f2 0%, #f8faf9 48%, #edf3f7 100%);
}

.auth-overlay.show {
  display: grid;
}

body.auth-checking .auth-card {
  width: min(360px, 100%);
}

body.auth-checking .auth-form {
  display: none;
}

body.auth-checking .auth-copy {
  text-align: center;
}

body.auth-checking .auth-copy h2 {
  display: none;
}

#authMessage.error {
  color: var(--danger);
  font-weight: 700;
}

.auth-card {
  display: grid;
  gap: 20px;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(31, 42, 46, 0.14);
}

.auth-copy h2,
.auth-copy p {
  margin: 0;
}

.auth-eyebrow {
  margin-bottom: 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-copy h2 {
  font-size: 28px;
  line-height: 1.15;
}

.auth-copy p:last-child {
  margin-top: 10px;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.sidebar-logout {
  width: 100%;
  margin-top: 12px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 0;
  padding: 24px 18px;
  color: #f8fbfa;
  background: #18352e;
  overflow-y: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3 {
  margin: 0;
}

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

.brand p {
  margin-top: 4px;
  color: #b9c9c4;
  font-size: 13px;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  color: #dce8e4;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
}

.nav-tab:hover,
.nav-tab.active {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-panel span,
.sidebar-panel strong {
  display: block;
}

.sidebar-panel span {
  color: #b9c9c4;
  font-size: 12px;
}

.sidebar-panel strong {
  margin-top: 6px;
  font-size: 14px;
}

.main {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  height: 100dvh;
  padding: 28px;
  overflow-y: auto;
}

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

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar h2 {
  margin-top: 4px;
  font-size: 28px;
}

.topbar-actions,
.form-actions,
.modal-actions,
.panel-header.with-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.fishing-rod-filter-header {
  justify-content: flex-end;
}

.fishing-rod-tools {
  flex: 1;
  flex-wrap: nowrap;
  justify-content: flex-end;
  --fishing-rod-control-height: 38px;
}

.fishing-rod-tools .order-tab-search {
  flex: 1 1 260px;
  width: auto;
  min-width: 180px;
  height: var(--fishing-rod-control-height);
  min-height: var(--fishing-rod-control-height);
  line-height: var(--fishing-rod-control-height);
}

.fishing-rod-tools .inline-filter-label {
  flex: 0 1 190px;
  height: var(--fishing-rod-control-height);
}

.fishing-rod-tools select,
.fishing-rod-tools .select-shell,
.fishing-rod-tools .primary-button {
  height: var(--fishing-rod-control-height);
  min-height: var(--fishing-rod-control-height);
  border-radius: 8px;
}

.fishing-rod-tools .select-shell {
  flex: 1;
  min-width: 0;
}

.fishing-rod-tools .primary-button {
  padding: 0 16px;
}

.fishing-rod-table-wrap {
  max-height: none;
}

.fishing-rod-table td {
  vertical-align: middle;
}

.fishing-rod-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.fishing-rod-summary-main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
}

.fishing-rod-summary-main strong {
  font-size: 14px;
  line-height: 1.2;
}

.fishing-rod-summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fishing-rod-meta {
  color: var(--muted);
  font-size: 12px;
}

.fishing-rod-attachments {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 64px;
}

.fishing-rod-image-button,
.image-thumb-button.fishing-rod-image-button {
  width: 56px;
  height: 56px;
}

.fishing-rod-thumb,
.image-thumb-button .fishing-rod-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
}

.fishing-rod-attachment {
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.fishing-rod-tag-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 120px;
}

.fishing-rod-tag {
  display: inline-flex;
  align-items: center;
  max-width: 140px;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid color-mix(in srgb, var(--tag-color) 18%, transparent);
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-color);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.fishing-rod-table .row-actions {
  align-items: center;
  justify-content: flex-start;
}

.fishing-rod-note {
  max-width: 280px;
  color: var(--muted);
  white-space: normal;
}

.fishing-rod-link {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-action-buttons .primary-button,
.stock-action-buttons .secondary-button {
  width: 72px;
  height: 38px;
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
  line-height: 1;
}

.inline-filter-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.inline-filter-label .select-shell {
  min-width: 150px;
}

.primary-button,
.secondary-button,
.danger-button,
.table-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
}

.primary-button {
  padding: 0 16px;
  color: #fff;
  background: var(--brand);
}

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button,
.table-button,
.icon-button {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}

.danger-button {
  color: #fff;
  background: var(--danger);
}

.table-button,
.danger-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 18px;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

#categoriesView {
  min-height: calc(100vh - 164px);
}

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

.stat-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

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

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

.dashboard-tabs {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 0;
}

.dashboard-tab-list {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.dashboard-tab {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.dashboard-tab:hover {
  color: var(--brand-dark);
  border-color: #b8d4c9;
  background: #f2f7f5;
}

.dashboard-tab.active {
  color: #ffffff;
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: none;
}

.dashboard-tab-panel {
  display: none;
  min-width: 0;
}

.dashboard-tab-panel.active {
  display: block;
}

.shipment-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.shipment-summary,
.shipment-board {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.shipment-summary {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  padding: 18px 18px 0;
}

.shipment-board {
  grid-template-rows: auto auto;
  min-height: 0;
  padding: 0 18px 18px;
}

.shipment-board-section {
  display: grid;
  grid-template-rows: auto minmax(0, auto);
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  box-shadow: none;
}

.shipment-board-section h2 {
  display: flex;
  align-items: center;
  min-height: 34px;
  margin: 0;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
  color: var(--brand-dark);
  background: transparent;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: none;
}

.shipment-card-grid {
  display: grid;
  gap: 10px;
  align-items: stretch;
}

.channel-grid {
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  grid-auto-rows: 86px;
}

.product-grid {
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  grid-auto-rows: 86px;
  align-content: start;
}

.shipment-metric-card,
.shipment-card {
  --card-accent: var(--brand);
  --card-soft: #f5faf8;
  --card-ink: var(--brand-dark);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--card-accent);
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.shipment-metric-card:hover,
.shipment-card:hover {
  transform: translateY(-2px);
  border-color: rgba(33, 116, 91, 0.28);
  box-shadow: 0 10px 20px rgba(32, 45, 49, 0.08);
}

.shipment-metric-card:focus-visible,
.shipment-card:focus-visible {
  outline: 3px solid rgba(33, 116, 91, 0.24);
  outline-offset: 3px;
}

.shipment-metric-card {
  min-height: 0;
}

.shipment-metric-card span,
.shipment-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.shipment-metric-card strong,
.shipment-card strong {
  margin-top: 14px;
  color: var(--card-accent);
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
}

.shipment-metric-card strong {
  font-size: 34px;
}

.shipment-metric-card.teal {
  --card-accent: var(--brand);
  --card-soft: #eef8f4;
}

.shipment-metric-card.green {
  --card-accent: var(--accent);
  --card-soft: #fff7ed;
}

.shipment-metric-card.orange {
  --card-accent: #ea580c;
  --card-soft: #fff7ed;
}

.shipment-card.channel-xiaohongshu {
  --card-accent: #e11d48;
  --card-soft: #fff1f2;
}

.shipment-card.channel-douyin {
  --card-accent: #0891b2;
  --card-soft: #ecfeff;
}

.shipment-card.channel-taobao {
  --card-accent: #f97316;
  --card-soft: #fff7ed;
}

.shipment-card.channel-pinduoduo {
  --card-accent: #ef4444;
  --card-soft: #fef2f2;
}

.shipment-card.channel-xianyu {
  --card-accent: #ca8a04;
  --card-soft: #fefce8;
}

.shipment-card.channel-wechat {
  --card-accent: #16a34a;
  --card-soft: #f0fdf4;
}

.shipment-card.channel-other {
  --card-accent: #64748b;
  --card-soft: #f8fafc;
}

.shipment-card.product-card.tone-1 {
  --card-accent: var(--brand);
  --card-soft: #eef8f4;
}

.shipment-card.product-card.tone-2 {
  --card-accent: #3b82f6;
  --card-soft: #eff6ff;
}

.shipment-card.product-card.tone-3 {
  --card-accent: #14b8a6;
  --card-soft: #f0fdfa;
}

.shipment-card.product-card.tone-4 {
  --card-accent: #8b5cf6;
  --card-soft: #f5f3ff;
}

.shipment-card.product-card.tone-5 {
  --card-accent: #e11d48;
  --card-soft: #fff1f2;
}

.shipment-card.product-card.tone-6,
.shipment-card.empty {
  --card-accent: #64748b;
  --card-soft: #f8fafc;
}

.month-dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
  min-height: calc(100vh - 228px);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
}

.previous-month-dashboard {
  margin-top: 18px;
}

.year-dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
  min-height: calc(100vh - 228px);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
}

.year-chart-card,
.year-kpi-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.year-chart-card {
  padding: 16px 12px 12px;
}

.year-chart-card h3 {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
}

.year-chart {
  width: 100%;
  height: 290px;
}

.year-channel-sales-card,
.year-channel-order-card {
  grid-column: span 2;
}

.year-finance-card {
  grid-column: 1 / -1;
}

.year-finance-card .year-chart {
  height: 360px;
}

.year-kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 150px;
  padding: 20px;
}

.year-kpi-card span {
  color: var(--muted);
  font-size: 16px;
  font-weight: 900;
}

.year-kpi-card strong {
  margin-top: 10px;
  color: var(--brand-dark);
  font-size: clamp(38px, 5vw, 72px);
  line-height: 0.95;
  letter-spacing: 0;
}

.year-kpi-card.expense span,
.year-kpi-card.expense strong {
  color: #dc2626;
}

.year-kpi-card.net span,
.year-kpi-card.net strong {
  color: #15803d;
}

.month-title-card,
.month-metric-card,
.month-progress-card,
.month-chart-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.month-title-card {
  display: grid;
  grid-column: 1 / -1;
  place-items: center start;
  min-height: 76px;
  padding: 18px 22px;
  background: linear-gradient(135deg, #ffffff 0%, #f2f8f5 100%);
}

.month-title-card h3 {
  margin: 0;
  color: var(--brand-dark);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
}

.month-metric-card,
.month-progress-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 132px;
  padding: 18px;
}

.month-metric-card span,
.month-progress-card span,
.month-chart-card h3 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.month-metric-card strong {
  margin-top: 16px;
  color: var(--brand-dark);
  font-size: 38px;
  line-height: 1;
}

.month-finance-card {
  grid-row: span 2;
  gap: 10px;
}

.month-finance-breakdown {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

.month-finance-breakdown small {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.month-finance-breakdown b {
  color: var(--ink);
  font-size: 16px;
}

.month-progress-card strong {
  margin: 14px 0 10px;
  color: var(--brand-dark);
  font-size: 32px;
  line-height: 1;
}

.month-progress-card small {
  margin-top: 10px;
  color: var(--muted);
  font-weight: 800;
}

.month-progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-soft);
}

.month-progress i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent), var(--danger));
}

.month-progress.return-progress i {
  background: linear-gradient(90deg, #2563eb, #7c3aed, var(--danger));
}

.month-channel-card {
  display: grid;
  grid-row: span 2;
  grid-column: span 2;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-height: 300px;
  padding: 18px;
}

.month-channel-pies {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.month-channel-pie-panel {
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto;
  gap: 8px;
  min-width: 0;
}

.month-channel-pie-panel h4 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.month-pie {
  width: 100%;
  min-height: 180px;
  place-self: center;
}

.month-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.month-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.month-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.month-product-card,
.month-daily-card {
  grid-column: span 2;
  min-height: 320px;
  padding: 18px;
}

.month-product-chart {
  min-height: 260px;
  margin-top: 16px;
}

.month-product-row {
  display: grid;
  grid-template-rows: 150px auto 34px;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.month-product-row span {
  align-self: start;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
}

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

.month-bars i,
.month-day i {
  display: block;
  width: 18px;
  border-radius: 6px 6px 2px 2px;
}

.month-bars .quantity {
  background: linear-gradient(180deg, #2f8f70, var(--brand-dark));
}

.month-bars .amount {
  background: linear-gradient(180deg, #f0a64a, var(--accent));
}

.month-daily-chart {
  min-height: 270px;
  margin-top: 16px;
}

.month-day {
  display: grid;
  grid-template-rows: 20px 160px 26px;
  align-items: end;
  justify-items: center;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.month-day span {
  color: var(--brand);
}

.month-day i {
  width: min(18px, 80%);
  background: linear-gradient(180deg, #2f8f70, var(--brand-dark));
}

.month-day b {
  align-self: start;
  min-width: 32px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
  white-space: nowrap;
  transform: rotate(-35deg);
  transform-origin: top center;
}

.month-day.muted-tick b {
  visibility: hidden;
}

.month-empty-text {
  display: grid;
  min-height: 160px;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.category-admin-grid {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  min-height: auto;
  align-items: start;
}

.category-admin-grid > .panel:not(.parent-category-panel) {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.parent-category-panel {
  align-self: start;
  height: auto;
}

.parent-category-panel .compact-table-wrap {
  height: auto;
  max-height: min(520px, calc(100vh - 260px));
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.narrow-panel {
  max-width: 720px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h3 {
  font-size: 16px;
}

.panel-header span {
  color: var(--muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  padding: 18px;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(140px, 1fr)) auto;
  gap: 14px;
  align-items: end;
  padding: 18px;
}

.three-filter-grid {
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.6fr) auto;
}

.picking-filter-grid {
  grid-template-columns: minmax(280px, 1.5fr) minmax(150px, 0.7fr) minmax(220px, 1fr) auto;
}

.reshipment-filter-grid {
  grid-template-columns: minmax(150px, 0.7fr) minmax(260px, 1.4fr) auto;
}

.filter-actions {
  display: flex;
  align-items: end;
  min-height: 40px;
}

.filter-actions button {
  width: 100%;
}

.filter-panel .panel-header {
  background: #fbfcfb;
}

.order-category-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfb;
}

.order-category-tabs {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.order-tab-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  --tab-control-height: 34px;
}

.order-tab-search {
  width: 260px;
  min-width: 220px;
  height: var(--tab-control-height);
  min-height: var(--tab-control-height);
  padding: 0 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  line-height: var(--tab-control-height);
}

.order-tab-actions .primary-button,
.order-tab-actions .secondary-button {
  height: var(--tab-control-height);
  min-height: var(--tab-control-height);
  padding: 0 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.order-tab-actions .batch-ship-button {
  color: #ffffff;
  border-color: #2f855a;
  background: #2f855a;
}

.order-tab-actions .batch-ship-button:hover {
  background: #276f4c;
}

.product-status-filter .select-shell,
.tab-select-filter .select-shell {
  min-width: 118px;
}

.product-status-filter .custom-select-button,
.tab-select-filter .custom-select-button {
  height: var(--tab-control-height);
  min-height: var(--tab-control-height);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  line-height: var(--tab-control-height);
}

.order-category-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.order-category-tab:hover {
  border-color: #b8d4c9;
  background: #f2f7f5;
}

.order-category-tab.active {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.order-category-tab-count {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(33, 116, 91, 0.12);
  color: var(--brand);
  font-size: 12px;
  line-height: 1;
}

.order-category-tab.active .order-category-tab-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.modal-form {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  max-height: none;
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
}

.order-form {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.modal-form.order-form {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px 14px;
  padding: 14px;
}

.modal-form:not(.order-form) .wide {
  grid-column: auto;
}

.modal-form.order-form .wide,
.modal-form.order-form label:has(#orderNote) {
  grid-column: 1 / -1;
}

.modal-form.order-form label:has(#orderChannelOrderNo) {
  grid-column: 1 / -1;
}

.modal-form.fishing-rod-form {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px 14px;
  padding: 14px;
}

.modal-form.fishing-rod-form .wide,
.fishing-rod-image-row {
  grid-column: 1 / -1;
}

.fishing-rod-image-row {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(300px, 1.1fr);
  gap: 22px;
  align-items: stretch;
}

.fishing-rod-media-fields {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  min-width: 0;
}

.fishing-rod-paste-field input {
  min-height: 40px;
}

.fishing-rod-note-field textarea {
  min-height: 108px;
  resize: vertical;
}

.fishing-rod-image-row .image-uploader {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
  column-gap: 14px;
  row-gap: 10px;
  min-width: 0;
}

.fishing-rod-image-row .image-uploader .field-label {
  align-self: center;
}

.fishing-rod-image-row .image-uploader .secondary-button {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  min-height: 32px;
  padding: 5px 10px;
  white-space: nowrap;
}

.fishing-rod-image-row .image-preview {
  grid-column: 1 / -1;
  min-height: 184px;
  width: 100%;
}

.fishing-rod-image-row .image-preview img {
  max-height: 184px;
}

.fishing-rod-basic-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 0 16px 16px;
}

.fishing-rod-basic-brand-panel,
.fishing-rod-basic-series-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.fishing-rod-basic-column-header,
.fishing-rod-basic-series-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.fishing-rod-basic-column-header h3,
.fishing-rod-basic-series-header h3 {
  margin: 0;
}

.fishing-rod-basic-column-header span,
.fishing-rod-basic-series-header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.fishing-rod-basic-brand-list {
  display: grid;
  max-height: min(700px, calc(100vh - 260px));
  overflow-y: auto;
}

.fishing-rod-basic-brand {
  display: block;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 9px 14px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.fishing-rod-basic-brand:last-child {
  border-bottom: 0;
}

.fishing-rod-basic-brand.active {
  background: #eef6f2;
  box-shadow: inset 3px 0 0 var(--green);
}

.fishing-rod-basic-brand strong,
.fishing-rod-basic-brand span {
  display: block;
}

.fishing-rod-basic-brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.fishing-rod-basic-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.order-modal:not([data-mode="view"]) .modal-form.order-form label:has(#orderStatus),
.order-modal:not([data-mode="view"]) .modal-form.order-form label:has(#orderWaitDaysDisplay) {
  display: none;
}

.modal-form.order-form label {
  gap: 5px;
  font-size: 12px;
}

.modal-form.order-form input,
.modal-form.order-form select,
.modal-form.order-form textarea,
.modal-form.order-form .custom-select-button {
  min-height: 36px;
}

.modal-form.order-form textarea#orderNote {
  min-height: 92px;
  line-height: 1.5;
  resize: vertical;
}

.modal-form.order-form .select-shell .native-select {
  height: 36px;
}

.product-form {
  gap: 12px;
}

.product-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.product-form-row > label,
.product-preview-panel {
  min-width: 0;
}

.product-field-stack {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.product-price-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

.product-preview-panel {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.product-form .barcode-preview {
  min-height: 86px;
}

.product-form .image-uploader {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.product-form .image-uploader .field-label {
  grid-column: 1 / -1;
}

.product-form .image-uploader .secondary-button {
  min-height: 34px;
  padding: 0 14px;
}

.wide {
  grid-column: span 2;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(33, 116, 91, 0.12);
}

textarea {
  min-height: 92px;
  padding-top: 10px;
  padding-bottom: 10px;
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

.select-shell {
  position: relative;
  width: 100%;
}

.select-shell::after {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-60%) rotate(45deg);
  transition: transform 0.16s ease;
  pointer-events: none;
  content: "";
}

.select-shell.open::after {
  transform: translateY(-20%) rotate(225deg);
}

.select-shell .native-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 40px;
  opacity: 0;
  pointer-events: none;
}

.custom-select-button {
  position: relative;
  width: 100%;
  min-height: 40px;
  padding: 0 58px 0 11px;
  color: #111827;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  line-height: 40px;
  outline: none;
}

.select-shell.open .custom-select-button {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(33, 116, 91, 0.12);
}

.custom-select-button.placeholder {
  color: var(--muted);
}

.custom-select-button::placeholder {
  color: var(--muted);
  opacity: 1;
}

.custom-select-clear {
  position: absolute;
  top: 50%;
  right: 30px;
  z-index: 2;
  display: none;
  width: 16px;
  height: 16px;
  padding: 0;
  color: #fff;
  border: 0;
  border-radius: 999px;
  background: #c5ced3;
  font-size: 13px;
  line-height: 16px;
  cursor: pointer;
  transform: translateY(-50%);
}

.select-shell.has-value .custom-select-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.custom-select-clear:hover {
  background: #94a3ad;
}

.custom-select-menu {
  position: fixed;
  z-index: 80;
  display: none;
  max-height: 260px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(18, 29, 32, 0.16);
}

.custom-select-menu.open {
  display: grid;
  gap: 4px;
}

.custom-select-option {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  color: #111827;
  border: 0;
  border-radius: 6px;
  background: #fff;
  text-align: left;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
  background: #eef4f1;
  outline: none;
}

.custom-select-option.selected {
  color: #111827;
  background: #e5f0eb;
  font-weight: 800;
}

.custom-select-option:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.64;
}

.custom-select-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.form-actions {
  justify-content: flex-end;
  align-self: end;
}

.modal-actions {
  align-items: center;
  flex-shrink: 0;
  justify-content: flex-end;
  min-height: 58px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.search-input {
  max-width: 260px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.order-table-wrap {
  position: relative;
}

.order-table {
  min-width: 1300px;
}

.order-table th:nth-child(8),
.order-table td.order-note-column {
  width: 300px;
  min-width: 300px;
  max-width: 300px;
}

.order-note-cell {
  width: 300px;
  max-width: 300px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.55;
}

.picking-table {
  min-width: 860px;
}

.picking-table th:first-child,
.picking-table td:first-child {
  min-width: 160px;
}

.picking-table th:nth-child(2),
.picking-table td:nth-child(2) {
  min-width: 110px;
}

.picking-draft-table {
  min-width: 100%;
}

.picking-draft-quantity {
  width: 92px;
}

.picking-item-actions {
  display: flex;
  justify-content: flex-end;
}

.picking-item-list {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.picking-item-list-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.picking-detail-page {
  margin-top: 0;
}

.picking-workbench {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfa;
}

.picking-workbench label {
  max-width: 620px;
}

.picking-scan-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.picking-scan-label strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.picking-scan-label strong.empty {
  color: var(--muted);
}

.picking-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 18px;
}

.picking-detail-summary span {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.picking-detail-summary b {
  color: var(--muted);
  font-size: 12px;
}

.picking-detail-summary strong {
  font-size: 20px;
}

.picking-detail-table {
  min-width: 860px;
}

.picking-order-summary {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.picking-order-summary-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.picking-order-summary-item strong,
.picking-order-summary-item span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picking-order-summary-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.picking-order-summary-image {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.picking-order-summary-image.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #f4f6f5;
}

.cell-subline {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.order-table th:first-child,
.order-table td:first-child {
  min-width: 56px;
  width: 56px;
  font-weight: 700;
  text-align: center;
}

.order-table .order-pick-checkbox {
  position: relative;
  display: inline-block;
  box-sizing: border-box;
  flex: 0 0 13px;
  width: 13px;
  min-width: 13px;
  max-width: 13px;
  height: 13px;
  min-height: 13px;
  max-height: 13px;
  padding: 0;
  margin: 0;
  aspect-ratio: 1 / 1;
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid #9fb5ad;
  border-radius: 0;
  background: #ffffff;
  cursor: pointer;
  line-height: 0;
  vertical-align: middle;
}

.order-table .order-pick-checkbox:checked {
  border-color: var(--brand);
  background: var(--brand);
}

.order-table .order-pick-checkbox:checked::after {
  position: absolute;
  top: 1px;
  left: 3px;
  width: 3px;
  height: 7px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  content: "";
  transform: rotate(45deg);
}

.order-table .order-pick-checkbox:focus {
  outline: none;
}

.order-table .order-pick-checkbox:focus-visible {
  outline: 1px solid var(--brand);
  outline-offset: 1px;
}

.order-table .order-pick-checkbox:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.order-table th:last-child,
.order-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 170px;
  width: 170px;
  max-width: 170px;
  padding-right: 10px;
  padding-left: 10px;
  background: var(--panel);
  box-shadow: -6px 0 12px rgba(31, 42, 46, 0.05);
}

.order-table th:last-child::before,
.order-table td:last-child::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: var(--line);
  content: "";
}

.order-table th:last-child {
  z-index: 3;
  background: #f7faf8;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
}

.pagination-bar span {
  min-width: 96px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.pagination-bar button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.table-wrap.compact {
  max-height: 280px;
  overflow-y: auto;
}

.compact-table-wrap {
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

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

.category-admin-table {
  min-width: 100%;
}

.category-admin-table th,
.category-admin-table td {
  white-space: normal;
  vertical-align: middle;
}

th,
td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #f8faf9;
}

td {
  font-size: 14px;
}

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

.order-table .row-actions {
  display: flex;
  flex-wrap: nowrap;
  align-content: center;
  justify-content: flex-start;
  gap: 6px 5px;
  width: 150px;
  margin-right: auto;
}

.order-table .row-actions .table-button,
.order-table .row-actions .danger-button {
  min-height: 28px;
  padding: 0 8px;
  white-space: nowrap;
}

.order-table .image-thumb-button,
.order-table .product-thumb {
  width: 50px;
  height: 50px;
}

.reshipment-row-actions {
  flex-wrap: nowrap;
  justify-content: flex-start;
  min-width: 132px;
}

.reshipment-row-actions .table-button,
.reshipment-row-actions .danger-button {
  min-height: 30px;
  padding: 0 8px;
  white-space: nowrap;
}

.reshipment-product-cell {
  min-width: 330px;
  gap: 14px;
}

.reshipment-image-button,
.image-thumb-button .reshipment-product-thumb,
.reshipment-product-thumb {
  width: 60px;
  height: 60px;
}

.reshipment-product-info {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.reshipment-product-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.reshipment-product-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reshipment-product-title .spec-tag {
  flex: 0 0 auto;
}

.reshipment-product-code-line {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.reshipment-note-cell {
  width: 400px;
  max-width: 400px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.55;
}

.reshipment-tracking-cell {
  min-width: 150px;
  max-width: 190px;
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.45;
}

.reshipment-spec-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.product-cell .reshipment-spec-row .spec-tag {
  display: inline-flex;
  margin-top: 0;
  color: var(--spec-fg, #4f46a0);
  font-size: 12px;
}

.reshipment-order-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.reshipment-order-search label {
  min-width: 0;
}

.reshipment-order-search button {
  min-width: 92px;
  min-height: 40px;
}

#reshipmentOrderSnapshot {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 0;
  padding: 14px 16px 14px 22px;
}

.reshipment-order-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.reshipment-modal-image-button,
.image-thumb-button .reshipment-modal-product-thumb,
.reshipment-modal-product-thumb {
  width: 58px;
  height: 58px;
}

.reshipment-order-main {
  min-width: 0;
}

.reshipment-order-main strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.reshipment-order-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.reshipment-product-code {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  color: var(--muted);
}

.reshipment-order-meta .spec-tag {
  min-height: 24px;
  color: var(--spec-fg, #4f46a0);
}

.reshipment-order-fields {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

.reshipment-order-fields strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #15543f;
  font-weight: 800;
}

.order-no-cell {
  display: grid;
  gap: 7px;
  min-width: 210px;
}

.order-no-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.order-no-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  color: #245b4f;
  background: transparent;
  font: inherit;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.order-no-link:hover {
  color: var(--brand-dark);
  text-decoration: none;
}

.order-no-copy {
  display: inline-flex;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: 1px solid #d6e1dc;
  border-radius: 6px;
  color: #47645b;
  background: #fff;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background 0.15s ease;
}

.order-no-copy svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.order-no-copy:hover {
  border-color: rgba(33, 116, 91, 0.32);
  color: var(--brand);
  background: #f3faf7;
}

.order-no-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.order-no-cell > span,
.order-no-link {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-tag,
.spec-tag,
.order-status-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.channel-tag.taobao {
  color: #b64200;
  background: #ffe7d1;
}

.channel-tag.xiaohongshu {
  color: #a10f1a;
  background: #ffe0e4;
}

.channel-tag.douyin {
  color: #075985;
  background: #dff7fb;
}

.channel-tag.pinduoduo {
  color: #a11f1f;
  background: #ffe1e1;
}

.channel-tag.xianyu {
  color: #7a4a00;
  background: #fff1b8;
}

.channel-tag.wechat {
  color: #136c36;
  background: #dcf8df;
}

.channel-tag.other {
  color: #475569;
  background: #e8eef4;
}

.channel-tag.clickable {
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.channel-tag.clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(31, 42, 46, 0.12);
}

.channel-tag.clickable:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.spec-tag {
  color: var(--spec-fg, #4f46a0);
  background: var(--spec-bg, #eceafe);
}

.order-status-tag.pending-shipment {
  color: #8b3d18;
  background: #faead7;
}

.order-status-tag.completed {
  color: #15543f;
  background: #ddf1e7;
}

.order-status-tag.cancelled {
  color: #64748b;
  background: #edf2f7;
}

.order-status-tag.returned {
  color: #982f2f;
  background: #fae1e1;
}

.order-status-tag.other {
  color: #475569;
  background: #e8eef4;
}

.table-button.ship-button {
  color: #ffffff;
  background: #2f855a;
}

.table-button.ship-button:hover {
  background: #276f4c;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
}

.product-cell strong,
.product-cell span {
  display: block;
}

.order-product-code-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 4px;
}

.order-product-code-line span {
  min-width: 0;
  margin-top: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-cell .order-product-code-line .spec-tag {
  display: inline-flex;
  flex: 0 0 auto;
  margin-top: 0;
}

.product-cell span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.product-thumb {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f6f5;
}

.image-thumb-button {
  display: inline-flex;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.image-thumb-button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.image-thumb-button .product-thumb {
  width: 100%;
  height: 100%;
}

.reshipment-image-button,
.image-thumb-button.reshipment-image-button,
.reshipment-image-button .reshipment-product-thumb,
.image-thumb-button .reshipment-product-thumb,
.reshipment-product-thumb {
  width: 50px;
  height: 50px;
}

.reshipment-row-actions .reshipment-complete-button {
  color: #ffffff;
  border-color: #2f855a;
  background: #2f855a;
}

.reshipment-row-actions .reshipment-complete-button:hover {
  border-color: #276f4c;
  background: #276f4c;
}

.finance-filter-panel {
  display: grid;
  gap: 18px;
}

.finance-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 4px;
}

.finance-summary-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.finance-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.finance-summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  font-weight: 900;
}

.finance-summary-card.income strong,
.amount-cell.positive {
  color: #15543f;
}

.finance-summary-card.expense strong,
.amount-cell.negative,
.finance-summary-card.balance strong.negative {
  color: #982f2f;
}

.finance-filter-grid {
  grid-template-columns: minmax(130px, 0.8fr) repeat(2, minmax(150px, 1fr)) minmax(220px, 1.5fr) auto;
}

.finance-table {
  min-width: 920px;
}

.amount-cell {
  font-weight: 900;
  white-space: nowrap;
}

.finance-note-cell {
  max-width: 360px;
  white-space: normal;
  word-break: break-word;
}

.finance-row-actions {
  flex-wrap: nowrap;
}

.finance-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.finance-form-grid .wide {
  grid-column: 1 / -1;
}

.finance-extra-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.finance-image-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.95fr) minmax(260px, 1fr);
  gap: 14px;
  align-items: start;
  width: 100%;
}

.finance-image-input {
  align-self: start;
  min-width: 0;
  width: 100%;
}

.finance-image-panel {
  display: grid;
  gap: 8px;
  align-content: start;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
}

.finance-image-panel .field-label {
  grid-column: 1 / -1;
}

.finance-image-panel .image-preview {
  min-height: 112px;
  max-height: 132px;
}

.finance-image-panel .image-preview img {
  max-height: 130px;
}

.finance-image-panel .secondary-button {
  align-self: end;
  min-height: 38px;
  padding: 0 14px;
}

.finance-note-field textarea {
  width: 100%;
  min-height: 120px;
}

.finance-note-field {
  width: 100%;
}

.finance-image-button,
.finance-image-button .product-thumb {
  width: 46px;
  height: 46px;
}

.product-cell .reshipment-product-title .spec-tag,
.reshipment-product-title .spec-tag {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  padding: 0 9px;
  color: var(--spec-fg, #4f46a0);
  line-height: 1;
}

.product-thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.image-uploader {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.order-product-snapshot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  min-height: 74px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.order-product-snapshot.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.snapshot-product,
.snapshot-barcode {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.snapshot-barcode {
  justify-content: flex-end;
  min-height: 52px;
}

.snapshot-stock {
  display: grid;
  min-width: 82px;
  gap: 3px;
  padding: 7px 9px;
  border: 1px solid #c8e1d5;
  border-radius: 6px;
  background: #edf8f2;
  color: #15543f;
  text-align: center;
}

.snapshot-stock span {
  font-size: 12px;
}

.snapshot-stock strong {
  font-size: 17px;
  line-height: 1.1;
}

.order-product-snapshot .product-thumb {
  width: 52px;
  height: 52px;
}

.reshipment-order-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
}

.reshipment-order-actions span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.reshipment-order-actions span.error {
  color: #b42318;
}

.snapshot-product strong,
.snapshot-product span,
.snapshot-barcode span {
  display: block;
}

.snapshot-product span,
.snapshot-barcode span,
.snapshot-muted {
  color: var(--muted);
  font-size: 12px;
}

.order-barcode-thumb {
  width: 190px;
  max-width: 32vw;
  height: 52px;
  max-height: 52px;
  object-fit: contain;
  padding: 3px 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.stock-product-preview {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.stock-product-preview.empty {
  display: grid;
  place-items: center;
  grid-template-columns: 1fr;
  color: var(--muted);
  font-size: 13px;
}

.stock-product-image-button {
  display: inline-grid;
  width: 76px;
  height: 76px;
  place-items: center;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stock-product-image-button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.stock-product-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.stock-product-image.placeholder {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stock-product-meta {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.stock-product-meta strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

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

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

.stock-product-meta small {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.recommended-location {
  display: grid;
  gap: 4px;
  min-width: 140px;
}

.recommended-location strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  white-space: normal;
}

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

.table-link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.table-link-button:hover {
  text-decoration: underline;
}

.table-danger-button {
  min-height: 30px;
  padding: 0 9px;
}

.movement-product-cell,
.movement-detail-product {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.movement-product-cell strong,
.movement-product-cell span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

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

.movement-product-thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #f4f6f5;
}

.movement-detail {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.movement-detail-product {
  grid-template-columns: 76px minmax(0, 1fr);
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

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

.movement-detail-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.movement-detail-item strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

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

.location-detail-summary span {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfa;
  color: var(--muted);
  font-size: 12px;
}

.location-detail-summary strong {
  color: var(--text);
  font-size: 16px;
}

.location-detail-table {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}

.location-detail-table th:nth-child(1),
.location-detail-table td:nth-child(1) {
  width: auto;
}

.location-detail-table th:nth-child(2),
.location-detail-table td:nth-child(2) {
  width: 24%;
}

.location-detail-table th:nth-child(3),
.location-detail-table td:nth-child(3) {
  width: 96px;
  text-align: right;
  white-space: nowrap;
}

.location-detail-product-cell {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.location-detail-product-cell strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.location-detail-product-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.location-detail-product-text span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-detail-image-button,
.location-detail-image {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.location-detail-image-button {
  padding: 0;
  cursor: pointer;
}

.location-detail-image-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.location-detail-image-button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.spec-editor {
  display: grid;
  gap: 10px;
}

.spec-editor-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.spec-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.spec-chip-list.empty {
  color: var(--muted);
  font-size: 13px;
}

.spec-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #d8e6df;
  border-radius: 999px;
  background: #eef6f2;
}

.spec-chip button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.spec-chip button:hover {
  background: rgba(21, 84, 63, 0.08);
  color: var(--brand-dark);
}

.image-preview {
  display: grid;
  min-height: 144px;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.image-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.image-preview.empty {
  font-size: 13px;
}

.barcode-preview {
  display: grid;
  min-height: 96px;
  place-items: center;
  overflow: hidden;
  padding: 10px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.barcode-preview img {
  width: 100%;
  max-height: 120px;
  object-fit: contain;
}

.barcode-preview.empty {
  font-size: 13px;
}

.barcode-cell {
  display: flex;
  align-items: center;
  min-width: 150px;
}

.product-code-barcode {
  display: grid;
  gap: 5px;
  align-items: start;
}

.product-code-barcode > span {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.barcode-image-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.barcode-image-button:focus-visible {
  outline: 3px solid rgba(33, 116, 91, 0.22);
  outline-offset: 3px;
}

.barcode-cell img {
  width: 150px;
  height: 44px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.barcode-modal {
  width: min(860px, 100%);
}

.modal.confirm-modal {
  width: min(360px, calc(100vw - 32px));
}

.modal.confirm-modal .modal-header {
  display: block;
  padding: 18px 18px 14px;
}

.modal.confirm-modal .modal-header > div {
  min-width: 0;
}

.modal.confirm-modal .modal-header span {
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.modal.confirm-modal .modal-actions {
  min-height: 54px;
  padding: 10px 14px 14px;
}

.barcode-large-preview {
  display: grid;
  min-height: min(560px, calc(100vh - 190px));
  place-items: center;
  padding: 18px;
  background: #fff;
}

.barcode-large-preview img {
  width: 100%;
  max-height: min(640px, calc(100vh - 220px));
  object-fit: contain;
}

.shipment-detail-body {
  min-height: 220px;
  padding: 14px;
  overflow-y: auto;
  background: #f6f8fb;
}

.shipment-detail-list {
  display: grid;
  gap: 10px;
}

.shipment-detail-item {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.5fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.shipment-detail-product {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.shipment-detail-product strong,
.shipment-detail-product span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shipment-detail-product span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.shipment-detail-image,
.shipment-detail-image .product-thumb {
  width: 48px;
  height: 48px;
}

.shipment-detail-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 10px;
  align-items: center;
  color: #334155;
  font-size: 13px;
}

.shipment-detail-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shipment-detail-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge.active,
.badge.purchase,
.badge.in {
  color: #15543f;
  background: #ddf1e7;
}

.badge.inactive,
.badge.sale,
.badge.out,
.badge.warning {
  color: #8b3d18;
  background: #faead7;
}

.badge.cancelled {
  color: #475569;
  background: #e8eef4;
}

.badge.low {
  color: #982f2f;
  background: #fae1e1;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(160px, 1fr) minmax(220px, 1.2fr) auto;
  gap: 10px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.field-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.required-label::after {
  content: "*";
  color: var(--danger);
  font-weight: 900;
}

.list {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.list-item strong {
  font-size: 14px;
}

.list-item .badge {
  margin-left: 8px;
}

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

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

.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  z-index: 70;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 14px;
  color: #fff;
  border-radius: 8px;
  background: #21745b;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, -12px);
  transition: 180ms ease;
  pointer-events: none;
}

.toast.success {
  background: #21745b;
}

.toast.error {
  background: #b42318;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(20, 31, 34, 0.48);
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(960px, 100%);
  max-height: calc(100vh - 44px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(18, 29, 32, 0.24);
}

.compact-modal {
  width: min(760px, 100%);
}

.location-detail-modal {
  width: min(840px, 100%);
}

.shipment-detail-modal {
  width: min(980px, 100%);
}

.order-modal {
  width: min(700px, 100%);
}

.modal:has(#pickingForm) {
  width: min(860px, 100%);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfb;
}

.modal-header h3 {
  margin: 0;
  font-size: 17px;
}

.modal-header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100vh;
  }

  .sidebar {
    z-index: 10;
    gap: 14px;
    max-height: 220px;
  }

  .nav-tabs {
    grid-template-columns: repeat(7, minmax(100px, 1fr));
    overflow-x: auto;
  }

  .sidebar-panel {
    display: none;
  }

  .main {
    height: auto;
  }

  .stats-grid,
  .content-grid,
  .shipment-dashboard {
    grid-template-columns: 1fr 1fr;
    min-height: auto;
  }

  .month-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: auto;
  }

  .month-title-card,
  .month-finance-card,
  .month-channel-card,
  .month-product-card,
  .month-daily-card {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .shipment-summary {
    grid-template-rows: none;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .channel-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .shipment-board-section h2 {
    min-height: 64px;
    font-size: 22px;
  }

  .shipment-metric-card,
  .shipment-card {
    min-height: 132px;
    height: auto;
  }

  .shipment-metric-card strong {
    font-size: 72px;
  }

  .shipment-detail-item,
  .shipment-detail-meta,
  .picking-detail-summary {
    grid-template-columns: 1fr 1fr;
  }

  .category-admin-grid {
    grid-template-columns: 1fr;
  }

  #categoriesView {
    min-height: auto;
  }

  .category-admin-grid > .panel:not(.parent-category-panel),
  .compact-table-wrap,
  .parent-category-panel .compact-table-wrap {
    height: auto;
    max-height: none;
  }

  .form-grid,
  .order-form,
  .filter-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .modal-form,
  .modal-form.order-form {
    grid-template-columns: 1fr;
  }

  .product-form-row,
  .product-price-grid,
  .product-form .image-uploader {
    grid-template-columns: 1fr;
  }

  .product-form .image-uploader .secondary-button {
    justify-self: flex-start;
  }

  .three-filter-grid,
  .picking-filter-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .filter-actions {
    align-items: stretch;
  }

  .order-category-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .order-tab-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .panel-header.with-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-tools {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .order-tab-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .order-tab-search {
    width: 100%;
    min-width: 0;
  }

  .stats-grid,
  .content-grid,
  .shipment-dashboard,
  .channel-grid,
  .form-grid,
  .order-form,
  .filter-grid,
  .three-filter-grid,
  .picking-filter-grid,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

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

  .topbar-actions .primary-button {
    flex: 1;
  }

  .image-uploader {
    grid-template-columns: 1fr;
  }

  .shipment-dashboard {
    min-height: auto;
    padding: 10px;
  }

  .month-dashboard {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .month-metric-card strong {
    font-size: 48px;
  }

  .month-product-card,
  .month-daily-card {
    padding: 16px;
  }

  .dashboard-tabs {
    min-height: auto;
  }

  .shipment-summary {
    grid-template-columns: 1fr;
  }

  .shipment-board-section h2 {
    font-size: 20px;
  }

  .shipment-metric-card strong {
    font-size: 58px;
  }

  .shipment-card strong {
    font-size: 54px;
  }

  .shipment-detail-item,
  .shipment-detail-meta,
  .picking-detail-summary {
    grid-template-columns: 1fr;
  }

  .spec-editor-inputs {
    grid-template-columns: 1fr;
  }

  .movement-detail-grid {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    align-items: stretch;
    padding: 12px;
  }

  .modal {
    max-height: calc(100vh - 24px);
  }
}

@media (max-width: 760px) {
  body {
    overflow: hidden;
    background: #eef3f1;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
    max-height: 154px;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: #18352e;
  }

  .brand {
    min-width: 0;
    gap: 10px;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .brand h1 {
    font-size: 16px;
    line-height: 1.15;
  }

  .brand p {
    margin-top: 2px;
    font-size: 12px;
  }

  .nav-tabs {
    display: flex;
    gap: 8px;
    padding-bottom: 2px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tab {
    flex: 0 0 auto;
    width: auto;
    min-height: 38px;
    padding: 0 13px;
    border-radius: 999px;
    font-size: 13px;
    white-space: nowrap;
  }

  .sidebar-panel {
    display: none;
  }

  .main {
    height: auto;
    min-height: 0;
    padding: 14px 12px calc(18px + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    margin: -14px -12px 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: rgba(245, 247, 248, 0.94);
    backdrop-filter: blur(12px);
  }

  .eyebrow {
    display: none;
  }

  .topbar h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
  }

  .view.active {
    gap: 12px;
  }

  .panel,
  .shipment-dashboard,
  .month-dashboard {
    box-shadow: 0 8px 20px rgba(32, 45, 49, 0.08);
  }

  .panel-header {
    min-height: 0;
    padding: 13px 14px;
  }

  .panel-header h3 {
    font-size: 15px;
  }

  .panel-header span {
    font-size: 12px;
  }

  .panel-header.with-tools,
  .panel-tools,
  .topbar-actions,
  .modal-actions,
  .order-tab-actions {
    width: 100%;
  }

  .panel-header.with-tools,
  .panel-tools,
  .topbar-actions {
    align-items: stretch;
  }

  .panel-tools,
  .topbar-actions,
  .stock-action-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button,
  .danger-button {
    min-height: 42px;
  }

  .stock-action-buttons .primary-button,
  .stock-action-buttons .secondary-button,
  .order-tab-actions .primary-button,
  .order-tab-actions .secondary-button {
    width: 100%;
    height: 42px;
    min-height: 42px;
  }

  .dashboard-tab-list {
    gap: 6px;
    padding: 5px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .dashboard-tab-list::-webkit-scrollbar {
    display: none;
  }

  .dashboard-tab {
    flex: 1 0 max-content;
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
  }

  .shipment-dashboard,
  .month-dashboard {
    border-radius: 8px;
  }

  .shipment-board {
    gap: 12px;
  }

  .shipment-board-section {
    gap: 10px;
  }

  .shipment-board-section h2 {
    min-height: 50px;
    padding: 10px;
  }

  .channel-grid,
  .product-grid {
    grid-auto-rows: 112px;
  }

  .shipment-metric-card,
  .shipment-card {
    padding: 16px;
  }

  .shipment-metric-card span,
  .shipment-card span {
    font-size: 16px;
  }

  .shipment-metric-card strong,
  .shipment-card strong {
    margin-top: 10px;
  }

  .month-title-card {
    min-height: 92px;
  }

  .month-title-card h3 {
    font-size: 24px;
  }

  .month-metric-card,
  .month-progress-card {
    min-height: 108px;
    padding: 16px;
  }

  .month-channel-card,
  .month-product-card,
  .month-daily-card {
    min-height: 260px;
    padding: 16px;
  }

  .month-pie,
  .month-product-chart,
  .month-daily-chart {
    min-height: 220px;
  }

  .order-category-bar {
    gap: 10px;
    padding: 10px 12px;
  }

  .order-category-tabs {
    flex-wrap: nowrap;
    margin: 0 -12px;
    padding: 0 12px 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .order-category-tabs::-webkit-scrollbar {
    display: none;
  }

  .order-category-tab {
    flex: 0 0 auto;
    min-height: 36px;
  }

  .order-tab-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .inline-filter-label {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    white-space: normal;
  }

  .inline-filter-label .select-shell,
  .product-status-filter .select-shell,
  .tab-select-filter .select-shell {
    min-width: 0;
  }

  .order-tab-search {
    height: 42px;
    min-height: 42px;
    line-height: 42px;
  }

  .filter-grid,
  .three-filter-grid,
  .picking-filter-grid,
  .reshipment-filter-grid,
  .form-grid,
  .modal-form,
  .modal-form.order-form {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .product-form-row,
  .product-price-grid,
  .product-form .image-uploader,
  .reshipment-order-search,
  .order-product-snapshot,
  #reshipmentOrderSnapshot,
  .stock-product-preview {
    grid-template-columns: 1fr;
  }

  .reshipment-order-search button,
  .product-form .image-uploader .secondary-button {
    width: 100%;
  }

  input,
  select,
  textarea,
  .custom-select-button {
    min-height: 44px;
    font-size: 16px;
  }

  .select-shell .native-select {
    height: 44px;
  }

  .custom-select-button {
    line-height: 44px;
  }

  .table-wrap {
    margin: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap::after {
    display: block;
    padding: 8px 12px 10px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
    content: "左右滑动查看更多";
  }

  table {
    min-width: 760px;
  }

  .order-table {
    min-width: 1180px;
  }

  th,
  td {
    padding: 11px 12px;
    font-size: 13px;
  }

  .table-button,
  .danger-button,
  .table-danger-button {
    min-height: 34px;
    padding: 0 10px;
  }

  .row-actions,
  .order-table .row-actions,
  .reshipment-row-actions {
    gap: 6px;
  }

  .order-table th:last-child,
  .order-table td:last-child {
    min-width: 150px;
    width: 150px;
    max-width: 150px;
  }

  .order-table th:nth-child(8),
  .order-table td.order-note-column,
  .order-note-cell,
  .reshipment-note-cell {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
  }

  .pagination-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    padding: 10px 12px 12px;
  }

  .pagination-bar span {
    min-width: 72px;
    align-self: center;
    font-size: 12px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
    background: rgba(17, 24, 39, 0.42);
  }

  .modal,
  .compact-modal,
  .order-modal,
  .shipment-detail-modal,
  .location-detail-modal,
  .barcode-modal {
    width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top) - 10px);
    border-radius: 14px 14px 0 0;
  }

  .modal-header {
    min-height: 0;
    padding: 14px;
  }

  .modal-header h3 {
    font-size: 17px;
  }

  .modal-header span {
    font-size: 12px;
  }

  .modal-form {
    max-height: calc(100dvh - 150px - env(safe-area-inset-bottom));
    padding-bottom: 18px;
  }

  .modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    min-height: 0;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }

  .modal-actions button {
    width: 100%;
  }

  .modal.confirm-modal .modal-actions {
    grid-template-columns: 1fr 1fr;
  }

  .toast {
    right: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    left: 12px;
    max-width: none;
  }
}

@media (max-width: 390px) {
  .sidebar {
    max-height: 148px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .main {
    padding-right: 10px;
    padding-left: 10px;
  }

  .topbar {
    margin-right: -10px;
    margin-left: -10px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .shipment-metric-card strong {
    font-size: 50px;
  }

  .shipment-card strong {
    font-size: 46px;
  }

  .month-metric-card strong {
    font-size: 40px;
  }

  .pagination-bar {
    grid-template-columns: 1fr;
  }

  .pagination-bar span {
    order: -1;
  }
}

.shipment-dashboard {
  grid-template-columns: minmax(0, 1fr);
}

.shipment-board-section h2 {
  min-height: 34px;
  padding: 0 0 12px;
  font-size: 16px;
}

.channel-grid,
.product-grid {
  grid-auto-rows: 86px;
}

.shipment-metric-card,
.shipment-card {
  min-height: 0;
}

.shipment-metric-card strong {
  font-size: 34px;
}

.shipment-card strong {
  font-size: 28px;
}

@media (max-width: 760px) {
  .shipment-summary {
    grid-template-columns: 1fr;
  }

  .month-channel-pies {
    grid-template-columns: 1fr;
  }

  .shipment-dashboard,
  .shipment-board,
  .shipment-summary {
    gap: 12px;
  }

  .shipment-summary,
  .shipment-board {
    padding-right: 12px;
    padding-left: 12px;
  }
}

@media (max-width: 1180px) {
  .year-dashboard {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .year-finance-card,
  .year-channel-sales-card,
  .year-channel-order-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .year-dashboard {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .year-chart-card,
  .year-kpi-card {
    grid-column: 1 / -1;
  }

  .year-chart,
  .year-finance-card .year-chart {
    height: 300px;
  }
}
