:root {
  --bg: #f7f8fa;
  --text: #111827;
  --muted: #667085;
  --line: #e4e7ec;
  --panel: #ffffff;
  --panel-2: #f2f4f7;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --warn: #a16207;
  --warn-bg: #fefce8;
  --bad: #b42318;
  --bad-bg: #fef3f2;
  --disabled: #667085;
  --disabled-bg: #f2f4f7;
  --unknown: #475467;
  --unknown-bg: #f2f4f7;
  --accent: #0f766e;
  --accent-strong: #0b4f4a;
  --shadow: 0 16px 42px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: linear-gradient(90deg, #fff 0, #fff 276px, var(--bg) 276px);
}

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  height: 100vh;
  min-height: 0;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.brand {
  position: relative;
  display: inline-block;
  padding: 0 8px;
}

.brand-title {
  color: var(--text);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.brand.is-prod .brand-title {
  color: #db2777;
}

.brand-runtime-version {
  position: absolute;
  right: 2px;
  bottom: -12px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.62;
  pointer-events: none;
}

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

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.1;
}

h2 {
  font-size: 30px;
  line-height: 1.12;
}

h3 {
  font-size: 18px;
  line-height: 1.2;
}

.subtle,
.updated,
.metric-label,
.nav-meta,
.empty {
  color: var(--muted);
}

.nav-list {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 0;
  overflow: auto;
}

.nav-item,
.summary-row,
.cron-row,
.secondary {
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.danger {
  min-height: 40px;
  padding: 0 14px;
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
  font-weight: 750;
}

.danger:hover {
  background: #fecaca;
  border-color: #dc2626;
}

.nav-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 9px 8px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #f8fafc;
  border-color: #eaecf0;
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.nav-label {
  font-weight: 800;
}

.nav-meta {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-state {
  font-size: 12px;
  font-weight: 800;
}

.sidebar-foot {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--line);
}

.sidebar-foot .updated {
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.user-menu-wrap {
  position: relative;
}

.user-menu-button {
  display: grid;
  width: 100%;
  gap: 4px;
  min-height: 54px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.user-menu-button:disabled {
  cursor: default;
}

.user-menu-button:not(:disabled)::after {
  content: "管理";
  width: fit-content;
  margin-top: 4px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  background: #f0fdfa;
}

.user-name {
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
}

.user-role {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.user-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 15;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.user-menu[hidden] {
  display: none;
}

.user-menu button {
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.user-menu button:hover {
  background: #f8fafc;
}

.workspace {
  position: relative;
  min-width: 0;
  height: 100vh;
  overflow: auto;
  padding: 30px 34px 44px;
}

.workspace.codex-workspace-shell {
  overflow: hidden;
}

.workspace-view {
  display: grid;
  gap: 22px;
  animation: enter 220ms ease both;
}

.top-tools {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  justify-content: flex-end;
  min-height: 0;
  pointer-events: none;
}

.top-tools[hidden] {
  display: none;
}

.top-tool-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--accent-strong);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.07);
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  pointer-events: auto;
}

.top-tool-button:hover {
  background: #f0fdfa;
  border-color: rgba(15, 118, 110, 0.24);
}

.top-tool-button[hidden] {
  display: none;
}

.workspace-view.codex-workspace {
  grid-template-rows: auto auto auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.workspace-view.codex-workspace-detail {
  grid-template-rows: auto minmax(0, 1fr);
}

.login-panel {
  display: grid;
  gap: 22px;
  width: min(460px, 100%);
  margin: 8vh auto 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(21, 25, 28, 0.08);
}

.auth-page {
  height: auto;
  min-height: 100vh;
  overflow: auto;
  background: #111316;
}

.auth-page .app-shell {
  display: block;
  height: auto;
  min-height: 100vh;
  overflow: visible;
  background: #111316;
}

.auth-page .sidebar {
  display: none;
}

.auth-page .workspace {
  min-height: 100vh;
  padding: 0;
}

.auth-page .workspace-view {
  display: grid;
  min-height: 100vh;
  gap: 0;
  animation: enter 260ms ease both;
}

.auth-page .login-panel {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  align-items: center;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: clamp(28px, 7vw, 86px);
  border: 0;
  border-radius: 0;
  background: linear-gradient(90deg, #111316, #18201f);
  color: #f8fafc;
  box-shadow: none;
}

.auth-page .login-panel > div {
  max-width: 620px;
}

.auth-page .login-panel .eyebrow {
  color: #5eead4;
}

.auth-page .login-panel h2 {
  max-width: 540px;
  color: #fff;
  font-size: 56px;
  line-height: 0.98;
}

.auth-page .login-panel .subtle {
  max-width: 430px;
  margin-top: 18px;
  color: #cbd5e1;
  font-size: 15px;
}

.auth-page .login-form {
  align-self: center;
  gap: 16px;
  padding: 26px;
  border: 1px solid rgba(226, 232, 240, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: 0 28px 80px rgba(2, 6, 23, 0.34);
}

.auth-page .login-form .empty {
  margin: 0;
  padding: 0;
  color: var(--bad);
}

.auth-page .login-form .secondary {
  width: 100%;
  color: #fff;
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.login-panel h2 {
  font-size: 30px;
}

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

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

.login-form input {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.login-form input:focus {
  outline: 2px solid rgba(15, 118, 110, 0.22);
  border-color: var(--accent);
}

.view-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.view-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.view-refresh-time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
  opacity: 0.62;
  white-space: nowrap;
}

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

.health-standard-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}

.dxm-reminder-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dxm-urgent-order-button {
  min-width: 136px;
  border-color: #fecaca;
  color: #991b1b;
  background: #fef2f2;
  font-weight: 900;
}

.dxm-urgent-order-button:hover,
.dxm-urgent-order-button:focus-visible {
  border-color: #fca5a5;
  background: #fee2e2;
}

.cs-reminder-toolbar,
.cs-conversation-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.cs-reminder-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 136px;
  min-height: 38px;
  font-weight: 900;
}

.cs-reminder-button strong {
  font-size: 15px;
  line-height: 1;
}

.cs-reminder-button.normal {
  border-color: #fde68a;
  color: #854d0e;
  background: #fefce8;
}

.cs-reminder-button.normal:hover,
.cs-reminder-button.normal:focus-visible {
  border-color: #facc15;
  background: #fef9c3;
}

.cs-reminder-button.urgent {
  border-color: #fecaca;
  color: #991b1b;
  background: #fef2f2;
}

.cs-reminder-button.urgent:hover,
.cs-reminder-button.urgent:focus-visible {
  border-color: #fca5a5;
  background: #fee2e2;
}

.cs-reminder-warning {
  margin: 8px 0 0;
}

.dxm-package-reason-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 10px;
}

.reason-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: #fff;
  font-size: 12px;
  font-weight: 900;
}

.reason-filter-chip span {
  color: var(--muted);
  font-weight: 800;
}

.reason-filter-chip.active {
  border-color: #fca5a5;
  color: #991b1b;
  background: #fef2f2;
}

.reason-filter-chip.active span {
  color: #991b1b;
}

.view-head .subtle {
  margin: 10px 0 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.ok {
  color: var(--ok);
  background: var(--ok-bg);
}

.warn {
  color: var(--warn);
  background: var(--warn-bg);
}

.bad {
  color: var(--bad);
  background: var(--bad-bg);
}

.disabled {
  color: var(--disabled);
  background: var(--disabled-bg);
}

.unknown {
  color: var(--unknown);
  background: var(--unknown-bg);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--unknown);
}

.status-dot.large {
  width: 14px;
  height: 14px;
}

.status-dot.ok {
  background: var(--ok);
}

.status-dot.warn {
  background: var(--warn);
}

.status-dot.bad {
  background: var(--bad);
}

.status-dot.disabled {
  background: var(--disabled);
}

/* Shopify-admin-style order list + sync health */
.sh-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.6;
}
.sh-badge.sh-ok { color: var(--ok); background: var(--ok-bg); }
.sh-badge.sh-warn { color: var(--warn); background: var(--warn-bg); }
.sh-badge.sh-bad { color: var(--bad); background: var(--bad-bg); }
.sh-badge.sh-muted { color: var(--disabled); background: var(--disabled-bg); }

.sh-order-no { font-weight: 800; }

.sh-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.sh-tag {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--disabled-bg);
  color: var(--disabled);
}

table.sh-orders-table td { vertical-align: middle; }

.sh-health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
}
.sh-health-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.sh-health-k { color: var(--muted, #6b7280); min-width: 84px; font-size: 13px; }
.sh-health-err { grid-column: 1 / -1; color: var(--bad); }

.overview-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.overview-strip > .metric-card {
  padding: 12px 14px;
  border-right: 0;
}

.overview-strip > .metric-card:last-child {
  border-right: 0;
}

.metric-card {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
}

.metric-action {
  appearance: none;
  font: inherit;
  background: #f0fdfa;
  border-color: #99f6e4;
  color: inherit;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(15, 118, 110, 0.08);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.metric-readonly {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
}

.metric-action:hover {
  background: #ccfbf1;
  border-color: #5eead4;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.12);
  transform: translateY(-1px);
}

.metric-action:hover .metric-value,
.metric-action:focus-visible .metric-value {
  color: var(--accent-strong);
}

.metric-action:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.24);
  outline-offset: 4px;
}

.metric-value {
  display: block;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.metric-label {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

.issue-line {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

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

.cron-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  overflow: visible;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.cron-tab {
  appearance: none;
  flex: 0 0 auto;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.cron-tab-label {
  display: inline-block;
  min-width: 0;
}

.cron-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.cron-tab:hover {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.cron-tab.active {
  color: var(--accent-strong);
  background: #f0fdfa;
  border-color: #99f6e4;
}

.cron-tab.active .cron-tab-count {
  background: #ccfbf1;
  color: var(--accent-strong);
}

.summary-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  min-height: 76px;
  padding: 14px 16px;
  background: #fff;
  border-color: var(--line);
  text-align: left;
}

.cron-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 15px 16px;
  border-color: var(--line);
  background: var(--panel);
  cursor: default;
}

.cron-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.cron-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.cron-parent {
  width: fit-content;
  margin: 0;
  padding: 3px 8px;
  color: var(--muted);
  font-size: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.summary-row:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

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

.summary-title {
  font-size: 18px;
  font-weight: 900;
}

.summary-sub {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.summary-metrics {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.summary-metrics strong {
  display: block;
  color: var(--text);
  font-size: 18px;
}

.secondary {
  min-height: 40px;
  padding: 0 14px;
  background: #fff;
  border-color: var(--line);
  font-weight: 750;
}

.secondary.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.secondary:hover {
  border-color: var(--accent);
}

.secondary:disabled,
.login-form input:disabled {
  opacity: 0.68;
}

.secondary:disabled {
  cursor: default;
}

.secondary.is-loading,
.danger.is-loading,
.metric-action.is-loading {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  cursor: wait;
}

.secondary.is-loading::before,
.danger.is-loading::before,
.metric-action.is-loading::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.login-form input:disabled {
  cursor: wait;
}

.secondary.active {
  color: var(--accent);
  background: var(--panel-2);
  border-color: var(--accent);
}

.inline-action {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 850;
  cursor: pointer;
}

.inline-action:hover {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pending-action {
  cursor: default;
}

.pending-action:hover {
  border-color: var(--line);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(21, 25, 28, 0.42);
}

.modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1080px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(21, 25, 28, 0.22);
}

.modal-wide {
  width: min(1440px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
}

.modal-codex-settings {
  width: min(860px, calc(100vw - 32px));
}

.modal-narrow {
  width: min(520px, 100%);
}

.modal-batch-import {
  width: min(1180px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
}

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

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

.modal-body {
  display: grid;
  gap: 18px;
  min-height: 0;
  padding: 18px;
  overflow: auto;
}

.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.modal-foot[hidden] {
  display: none;
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 40;
  width: min(720px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  transform: translateX(-50%);
}

.toast[hidden] {
  display: none;
}

.toast.warn {
  border-color: #facc15;
  background: var(--warn-bg);
  color: var(--warn);
}

.toast.bad {
  border-color: #fda29b;
  background: var(--bad-bg);
  color: var(--bad);
}

.toast.ok {
  border-color: #75e0a7;
  background: var(--ok-bg);
  color: var(--ok);
}

.tiktok-order-list {
  display: grid;
  gap: 10px;
}

.tiktok-order-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tiktok-order-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.tiktok-order-card header > div,
.tiktok-order-grid > div,
.tiktok-product-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.tiktok-order-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(5, minmax(130px, 1fr));
  gap: 12px;
  align-items: start;
}

.tiktok-order-grid span,
.tiktok-order-grid strong,
.tiktok-product-cell span {
  overflow-wrap: anywhere;
}

.tiktok-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(15, 118, 110, 0.08);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.config-form,
.config-block {
  display: grid;
  gap: 14px;
}

.config-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.config-form input,
.config-form select,
.config-form textarea {
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.config-form textarea {
  resize: vertical;
  line-height: 1.5;
}

.config-form input:disabled,
.config-form select:disabled,
.config-form textarea:disabled {
  color: var(--muted);
  background: var(--panel-2);
}

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

.setting-meta span {
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.procurement-enum-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.procurement-enum-add {
  min-height: 28px;
  padding: 3px 9px;
  font-size: 12px;
}

.procurement-enum-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.procurement-enum-create[hidden] {
  display: none;
}

.procurement-enum-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.procurement-enum-action {
  min-height: 28px;
  padding: 3px 8px;
  font-size: 12px;
}

.procurement-matchable-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.procurement-matchable-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ok);
}

.procurement-matchable-toggle input:not(:checked) + span {
  color: var(--muted);
}

.procurement-stats-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin: 0 0 12px;
}

.procurement-stats-filter label {
  display: grid;
  gap: 4px;
}

.procurement-stats-filter input {
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
}

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

.config-table td:nth-child(3) {
  width: 110px;
}

.shippable-rule-table {
  min-width: 1080px;
}

.shippable-rule-table td:nth-child(1),
.shippable-rule-table td:nth-child(2),
.shippable-rule-table td:nth-child(3) {
  width: 190px;
}

.shippable-rule-table td:nth-child(4) {
  min-width: 300px;
}

.settings-tabs {
  margin-bottom: 2px;
}

.live-settings-shell {
  display: grid;
  gap: 14px;
  min-height: 0;
}

.live-settings-tabs {
  margin-bottom: 0;
}

.live-settings-panel {
  display: grid;
  gap: 14px;
  min-height: 0;
}

.live-settings-panel[hidden],
.live-settings-panel:not(.active) {
  display: none;
}

.live-settings-grid {
  align-items: end;
}

.live-settings-moderator-list textarea {
  min-height: 118px;
}

.live-settings-prompt-stack {
  gap: 16px;
}

.live-settings-prompt-stack textarea {
  min-height: min(360px, 42vh);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
}

.live-settings-fastcheck-prompt,
.live-fastcheck-prompt-layout,
.live-fastcheck-account-panels,
.live-fastcheck-account-panel,
.live-fastcheck-supplement-section {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.live-fastcheck-account-tabs {
  padding-bottom: 6px;
}

.live-fastcheck-account-panel[hidden],
.live-fastcheck-account-panel:not(.active) {
  display: none;
}

.live-fastcheck-account-head,
.live-fastcheck-section-head,
.live-fastcheck-supplement-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.live-fastcheck-account-head h3,
.live-fastcheck-section-head h3 {
  margin: 0;
  font-size: 15px;
}

.live-fastcheck-template-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.live-fastcheck-template-editor summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.live-fastcheck-template-editor summary::-webkit-details-marker {
  display: none;
}

.live-fastcheck-template-editor summary::after {
  content: "›";
  grid-column: 2;
  grid-row: 1 / span 2;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  transition: transform 0.15s ease;
}

.live-fastcheck-template-editor[open] summary::after {
  transform: rotate(90deg);
}

.live-fastcheck-template-title {
  grid-column: 1;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.live-fastcheck-template-preview {
  grid-column: 1;
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.live-fastcheck-template-head,
.live-fastcheck-template-tail,
.live-fastcheck-template-empty {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-fastcheck-template-tail::before {
  content: "尾部：";
  color: var(--muted);
  font-weight: 800;
}

.live-fastcheck-template-editor[open] summary {
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.live-fastcheck-template-editor .live-settings-prompt-stack {
  padding: 12px;
}

.live-fastcheck-frozen-prompt {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.live-fastcheck-frozen-prompt summary {
  padding: 9px 11px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.live-fastcheck-frozen-prompt pre {
  max-height: 240px;
  margin: 0;
  padding: 0 11px 11px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}

.live-fastcheck-supplement-list {
  display: grid;
  gap: 8px;
}

.live-fastcheck-supplement-item {
  display: grid;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.live-fastcheck-supplement-item p {
  margin: 0;
  white-space: pre-wrap;
}

.live-fastcheck-supplement-new {
  display: grid;
  gap: 6px;
}

.live-fastcheck-supplement-new textarea {
  min-height: 96px;
  font-family: inherit;
}

.notification-settings {
  display: grid;
  gap: 14px;
}

.notification-channel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.notification-channel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.notification-current {
  display: grid;
  gap: 6px;
}

.notification-current-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.notification-empty-target {
  color: var(--warn);
  background: var(--warn-bg);
}

.notification-target-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.notification-target-picker {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.notification-target-picker summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
}

.notification-target-picker summary::-webkit-details-marker {
  display: none;
}

.notification-target-picker summary strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-target-menu {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}

.notification-target-option {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 6px;
  border-radius: 7px;
  color: var(--text) !important;
}

.notification-target-option:hover {
  background: #fff;
}

.notification-target-option input {
  width: 16px;
  min-height: auto;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.compact-check {
  display: inline-flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 7px;
  color: var(--text) !important;
  white-space: nowrap;
}

.compact-check input {
  width: auto;
  min-height: auto;
}

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

.batch-import-result {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.batch-result-table-wrap table {
  white-space: nowrap;
}

.batch-result-summary-table {
  min-width: 420px;
}

.batch-result-group-table {
  min-width: 980px;
}

.batch-result-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.batch-result-head .updated {
  text-align: right;
}

.batch-result-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
}

.batch-result-metric {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.batch-result-metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.batch-result-metric strong {
  color: var(--text);
  font-size: 22px;
  line-height: 1.12;
}

.batch-result-metric.strong {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.batch-result-metric.strong strong {
  color: var(--accent-strong);
}

.batch-result-groups {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.batch-result-group {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.batch-result-group strong {
  overflow-wrap: anywhere;
}

.batch-result-group div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dxm-merge-panel,
.dxm-bulk-merge-panel,
.merge-group {
  display: grid;
  gap: 14px;
}

.dxm-bulk-merge-switcher {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: end;
}

.dxm-bulk-merge-switcher label {
  display: grid;
  gap: 6px;
  min-width: min(420px, 100%);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dxm-bulk-merge-switcher select {
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.dxm-bulk-merge-meta {
  display: grid;
  gap: 4px;
  min-width: 240px;
  text-align: right;
}

.merge-group {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.merge-group:last-child {
  border-bottom: 0;
}

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

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

.merge-table td:nth-child(5) {
  min-width: 220px;
  max-width: 360px;
}

.merge-status-orders {
  margin: 6px 0 6px 18px;
  padding: 0;
}

.merge-status-orders li {
  margin: 2px 0;
}

.merge-status-logs {
  margin: 6px 0 0 0;
  padding: 0 0 0 18px;
  list-style: disc;
  max-height: 220px;
  overflow-y: auto;
}

.ship-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.merge-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

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

.merge-status-body {
  display: grid;
  gap: 8px;
}

.dxm-buyer-counts {
  display: grid;
  gap: 2px;
}

.dxm-buyer-counts .subtle {
  font-size: 12px;
}

.dxm-buyer-accounts {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.dxm-buyer-accounts b {
  color: var(--text);
  font-weight: 600;
}

.dxm-merge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dxm-merge-actions .last-merge-success {
  color: var(--ok);
}

.dxm-merge-actions .last-merge-failed {
  color: var(--bad);
}

.dxm-duplicate-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.dxm-bulk-merge-check {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.dxm-bulk-merge-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.dxm-bulk-merge-check input:disabled {
  cursor: not-allowed;
}

.dxm-bulk-merge-check span {
  max-width: 220px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
}

.config-form label.config-toggle {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.config-form .config-toggle input[type="checkbox"] {
  flex: 0 0 18px;
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
}

.config-toggle span {
  flex: 1;
  font-size: 13px;
  color: var(--muted, #555);
  line-height: 1.4;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.inline-link {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.inline-link:hover {
  text-decoration: underline;
}

.detail-grid {
  display: grid;
  gap: 22px;
}

.detail-tabs-shell {
  display: grid;
  gap: 18px;
}

.codex-detail-tabs-shell {
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.detail-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.detail-tab {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.detail-tab:hover {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.detail-tab.active {
  color: var(--accent-strong);
  background: #f0fdfa;
  border-color: #99f6e4;
}

.detail-tab-panel {
  min-width: 0;
}

.codex-detail-tabs-shell .detail-tab-panel,
.codex-detail-tabs-shell .detail-grid,
.codex-detail-tabs-shell .codex-sessions-panel {
  min-height: 0;
}

.codex-detail-tabs-shell .detail-tab-panel,
.codex-detail-tabs-shell .detail-grid {
  display: grid;
}

.codex-detail-tabs-shell .detail-grid,
.codex-detail-tabs-shell .codex-sessions-panel {
  grid-template-rows: minmax(0, 1fr);
}

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

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

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

.bandwidth-overview .metric-value {
  font-size: 26px;
}

.bandwidth-table {
  min-width: 900px;
  table-layout: fixed;
}

.bandwidth-table th:nth-child(1),
.bandwidth-table td:nth-child(1) {
  width: 34%;
}

.bandwidth-table th:nth-child(2),
.bandwidth-table td:nth-child(2) {
  width: 22%;
}

.bandwidth-table th:nth-child(3),
.bandwidth-table td:nth-child(3) {
  width: 18%;
}

.bandwidth-table th:nth-child(4),
.bandwidth-table td:nth-child(4) {
  width: 18%;
}

.bandwidth-table th:nth-child(5),
.bandwidth-table td:nth-child(5) {
  width: 8%;
}

.bandwidth-process-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.bandwidth-process-main strong {
  overflow-wrap: anywhere;
}

.bandwidth-process-main .subtle {
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.bandwidth-runtime-pill {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: var(--accent-strong);
}

.bandwidth-rate-cell {
  display: grid;
  gap: 6px;
}

.bandwidth-bar {
  position: relative;
  display: block;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.bandwidth-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.bandwidth-bar-up span {
  background: #2563eb;
}

tfoot td {
  background: #f8fafc;
  border-top: 1px solid var(--line);
  font-weight: 800;
}

.procurement-table {
  min-width: 1080px;
  table-layout: fixed;
}

.procurement-table th:nth-child(1),
.procurement-table td:nth-child(1) {
  width: 104px;
}

.procurement-table th:nth-child(2),
.procurement-table td:nth-child(2) {
  width: 88px;
}

.procurement-table th:nth-child(3),
.procurement-table td:nth-child(3) {
  width: 108px;
  max-width: 108px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.procurement-table th:nth-child(4),
.procurement-table td:nth-child(4) {
  width: 88px;
}

.procurement-table th:nth-child(5),
.procurement-table td:nth-child(5) {
  width: 150px;
}

.procurement-table th:nth-child(6),
.procurement-table td:nth-child(6) {
  width: 112px;
}

.procurement-table th:nth-child(7),
.procurement-table td:nth-child(7) {
  width: 160px;
}

.procurement-table th:nth-child(8),
.procurement-table td:nth-child(8) {
  width: 280px;
}

.procurement-table th:last-child,
.procurement-table td:last-child {
  width: 64px;
  position: sticky;
  right: 0;
  z-index: 2;
  background: #fff;
  box-shadow: -1px 0 0 var(--line);
}

.procurement-table th:last-child {
  z-index: 3;
}

.logistics-table {
  width: 100%;
  min-width: 1240px;
  table-layout: fixed;
}

.logistics-table th:nth-child(1),
.logistics-table td:nth-child(1) {
  width: 112px;
  max-width: 112px;
}

.logistics-table th:nth-child(2),
.logistics-table td:nth-child(2) {
  width: 88px;
  max-width: 88px;
}

.logistics-table th:nth-child(3),
.logistics-table td:nth-child(3) {
  width: 76px;
  max-width: 76px;
}

.logistics-table th:nth-child(4),
.logistics-table td:nth-child(4) {
  width: 76px;
  max-width: 76px;
}

.logistics-table th:nth-child(5),
.logistics-table td:nth-child(5) {
  width: 76px;
  max-width: 76px;
}

.logistics-table th:nth-child(6),
.logistics-table td:nth-child(6) {
  width: 150px;
  max-width: 150px;
}

.logistics-table th:nth-child(7),
.logistics-table td:nth-child(7) {
  width: 212px;
  max-width: 212px;
}

.logistics-table th:nth-child(8),
.logistics-table td:nth-child(8) {
  width: 118px;
  max-width: 118px;
}

.logistics-table th:nth-child(9),
.logistics-table td:nth-child(9) {
  width: auto;
  max-width: none;
}

.logistics-table th:last-child,
.logistics-table td:last-child {
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  position: sticky;
  right: 0;
  z-index: 2;
  background: #fff;
  box-shadow: -1px 0 0 var(--line);
}

.logistics-table th:last-child {
  z-index: 3;
}

.logistics-table th:nth-child(1),
.logistics-table td:nth-child(1),
.logistics-table th:nth-child(3),
.logistics-table td:nth-child(3),
.logistics-table th:nth-child(4),
.logistics-table td:nth-child(4),
.logistics-table th:nth-child(5),
.logistics-table td:nth-child(5) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logistics-table th:nth-child(2),
.logistics-table td:nth-child(2),
.logistics-table th:nth-child(6),
.logistics-table td:nth-child(6),
.logistics-table th:nth-child(7),
.logistics-table td:nth-child(7),
.logistics-table th:nth-child(8),
.logistics-table td:nth-child(8),
.logistics-table th:nth-child(9),
.logistics-table td:nth-child(9) {
  overflow-wrap: anywhere;
  white-space: normal;
}

.logistics-table .row-actions {
  flex-wrap: nowrap;
}

.logistics-linked-package {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.logistics-linked-package-suffix {
  color: var(--ok);
}

.logistics-linked-package-fuzzy {
  color: var(--warn);
}

.logistics-cost-detail-link {
  display: grid;
  gap: 2px;
  max-width: 100%;
  padding: 0;
  line-height: 1.25;
}

.logistics-cost-detail-link span:not(:first-child) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.logistics-cost-detail-link.is-unexpected {
  color: var(--warn);
}

.logistics-cost-detail {
  display: grid;
  gap: 14px;
}

.logistics-cost-detail pre {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text);
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.logistics-linked-orders {
  display: grid;
  gap: 3px;
  overflow-wrap: anywhere;
}

.linked-package-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.linked-package-summary > div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.linked-package-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.procurement-session-button {
  display: block;
  width: 100%;
  min-height: 28px;
  overflow: hidden;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 800;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.procurement-session-button:hover,
.procurement-session-button:focus-visible {
  border-color: #99f6e4;
  background: #f0fdfa;
  outline: none;
}

.procurement-session-button.is-empty {
  color: var(--muted);
  font-weight: 700;
  opacity: 0.62;
}

.procurement-session-button.is-empty:hover,
.procurement-session-button.is-empty:focus-visible {
  color: var(--accent-strong);
  opacity: 1;
}

.procurement-session-form {
  gap: 16px;
}

.procurement-delete-button {
  min-height: 28px;
  padding: 3px 8px;
  font-size: 12px;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

.product-table {
  min-width: 1360px;
}

.product-thumb-link {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  cursor: pointer;
  overflow: hidden;
}

.product-thumb-link:hover {
  border-color: var(--accent);
}

.product-thumb-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.product-image-modal {
  width: min(1180px, calc(100vw - 32px));
}

.product-image-preview {
  display: grid;
  place-items: center;
  min-height: min(620px, calc(100vh - 190px));
  border-radius: 6px;
  background: #0f172a;
  overflow: auto;
}

.product-image-preview img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 220px);
  object-fit: contain;
}

.product-name-cell,
.product-source-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.product-linked-orders {
  display: grid;
  gap: 4px;
  min-width: 220px;
}

.product-linked-order {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.product-linked-order-suffix {
  color: var(--ok);
}

.product-linked-order-fuzzy {
  color: var(--warn);
}

.product-linked-order-dialog,
.product-linked-order-section {
  display: grid;
  gap: 12px;
}

.product-linked-order-section h3 {
  margin: 0;
}

.product-risk-button {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  max-width: 100%;
  white-space: nowrap;
}

.product-ip-risk-detail {
  display: grid;
  gap: 14px;
}

.product-ip-risk-head {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.product-ip-risk-image {
  display: grid;
  place-items: center;
  width: min(360px, 100%);
  min-height: 220px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  overflow: hidden;
  cursor: zoom-in;
}

.product-ip-risk-image:hover {
  border-color: var(--accent);
}

.product-ip-risk-image:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.product-ip-risk-image img {
  display: block;
  width: 100%;
  max-height: min(420px, 52vh);
  object-fit: contain;
}

.product-ip-risk-detail dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.product-ip-risk-detail dl > div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.product-ip-risk-detail dt {
  color: var(--muted);
  font-weight: 700;
}

.product-ip-risk-detail dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.product-order-link {
  display: grid;
  gap: 2px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.product-order-link strong,
.product-order-link small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-order-link small {
  color: var(--muted);
}

.product-order-link-missing {
  color: var(--muted);
  background: #fff;
}

.product-name-cell strong,
.product-source-cell span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.multiline-cell {
  max-height: 84px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.45;
}

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

.product-listing {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.product-listing-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}

.product-listing-summary > div {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
}

.product-listing-summary > div:last-child {
  border-right: 0;
}

.product-listing-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.product-listing-summary strong {
  font-size: 20px;
}

.product-listing-code-table {
  min-width: 1180px;
}

.product-listing-batch-table {
  min-width: 980px;
}

.listing-product-id,
.product-listing-batch-table td:nth-child(5) {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.listing-code-actions {
  flex-wrap: nowrap;
}

.listing-error,
.listing-result-text {
  display: block;
  max-width: 320px;
  overflow-wrap: anywhere;
}

.product-listing-code-form textarea {
  overflow-wrap: anywhere;
}

.listing-platform-fields {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.listing-platform-fields legend {
  padding: 0 5px;
  font-size: 13px;
  font-weight: 800;
}

.listing-platform-template,
.listing-platform-results {
  display: grid;
  gap: 5px;
  min-width: 260px;
}

.listing-platform-results > div {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.product-group-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(220px, 1.4fr) minmax(120px, 0.8fr) auto auto auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.product-order-ocr-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 7px;
  background: #f8fafc;
}

.product-order-ocr-panel[hidden] {
  display: none;
}

.product-order-ocr-head,
.product-order-ocr-grid {
  display: grid;
  gap: 10px;
}

.product-order-ocr-head {
  grid-template-columns: repeat(2, minmax(160px, 1fr));
}

.product-order-ocr-grid {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.product-order-ocr-panel .config-toggle,
.product-order-ocr-failure-toggle {
  margin-top: 0;
}

.config-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.dxm-package-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 2px 0 10px;
}

.dxm-package-page-actions {
  display: flex;
  gap: 8px;
}

.record-search {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 1 1 auto;
  min-width: 220px;
  justify-content: center;
}

.record-search-field {
  padding: 5px 8px;
  border: 1px solid #d6dcdc;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}

.record-search-term {
  flex: 0 1 240px;
  min-width: 120px;
  padding: 5px 10px;
  border: 1px solid #d6dcdc;
  border-radius: 6px;
  font-size: 13px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf0f0;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

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

tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: #f8fbfa;
}

.empty {
  padding: 16px 0;
}

.live-core {
  display: grid;
  gap: 12px;
}

.live-core-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 12px 0;
}

.live-core-summary > div {
  min-width: 120px;
}

.live-table-wrap {
  border-color: #cfd8d7;
}

.live-table {
  min-width: 1040px;
}

.live-table th {
  background: #f3f6f5;
}

.live-row.ongoing {
  background: #fbfffd;
}

.live-row.ended {
  background: #fff;
}

.live-row.ongoing:hover {
  background: #f0faf5;
}

.live-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.live-status.ongoing {
  color: #067647;
  background: #dcfae6;
  border-color: #abefc6;
}

.live-status.ended {
  color: #475467;
  background: #f2f4f7;
  border-color: #d0d5dd;
}

.live-info-cell,
.live-time-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.live-info-cell strong {
  max-width: 360px;
  overflow-wrap: anywhere;
}

.live-info-cell span,
.live-time-cell span:nth-child(2) {
  color: var(--muted);
  font-size: 12px;
}

.live-performance {
  display: grid;
  gap: 12px;
}

.live-performance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
}

.live-performance-summary > div {
  padding: 10px 12px;
  border: 1px solid #d7dddf;
  border-radius: 8px;
  background: #fbfcfc;
}

.live-performance-summary .metric-value {
  font-size: 22px;
  line-height: 1.15;
  overflow-wrap: normal;
  white-space: nowrap;
}

.live-performance-note {
  color: var(--muted);
  font-size: 12px;
}

.live-performance-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.live-performance-table th,
.live-performance-table td {
  padding-left: 8px;
  padding-right: 8px;
  overflow-wrap: anywhere;
}

.live-performance-table th:nth-child(1),
.live-performance-table td:nth-child(1) {
  width: 92px;
}

.live-performance-table th:nth-child(2),
.live-performance-table td:nth-child(2) {
  width: 20%;
}

.live-performance-table th:nth-child(3),
.live-performance-table td:nth-child(3) {
  width: 112px;
}

.live-performance-table .live-info-cell strong {
  max-width: none;
}

.live-performance-table tbody tr[data-live-performance-detail],
.live-performance-table tbody tr[data-live-performance-account-toggle] {
  cursor: pointer;
}

.live-performance-table tbody tr[data-live-performance-detail]:hover,
.live-performance-table tbody tr[data-live-performance-detail]:focus-visible,
.live-performance-table tbody tr[data-live-performance-account-toggle]:hover,
.live-performance-table tbody tr[data-live-performance-account-toggle]:focus-visible {
  background: #f8fafc;
}

.live-performance-table tbody tr[data-live-performance-detail]:focus-visible,
.live-performance-table tbody tr[data-live-performance-account-toggle]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.live-performance-account-row {
  background: #f9fafb;
}

.live-performance-account-row td {
  border-top: 1px solid var(--border);
  font-weight: 650;
}

.live-performance-account-row.expanded td {
  border-bottom: 1px solid var(--border);
}

.live-performance-session-row td:first-child {
  padding-left: 22px;
}

.live-performance-session-row .live-info-cell {
  padding-left: 16px;
  border-left: 2px solid #dbeafe;
}

.live-performance-account-cell strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-performance-account-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: #334155;
  background: #fff;
  font-weight: 800;
  line-height: 1;
}

.live-performance-business-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.live-performance-warning-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  border-radius: 999px;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  cursor: help;
  vertical-align: text-bottom;
}

.live-performance-warning-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 40;
  width: max-content;
  max-width: 320px;
  padding: 7px 9px;
  border-radius: 6px;
  color: #fff;
  background: #111827;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: normal;
  text-align: left;
  transform: translate(-50%, 4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 80ms ease, transform 80ms ease, visibility 80ms ease;
}

.live-performance-warning-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  z-index: 41;
  width: 8px;
  height: 8px;
  background: #111827;
  transform: translate(-50%, 4px) rotate(45deg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 80ms ease, transform 80ms ease, visibility 80ms ease;
}

.live-performance-warning-icon:hover::after,
.live-performance-warning-icon:focus-visible::after,
.live-performance-warning-icon:hover::before,
.live-performance-warning-icon:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.live-performance-detail {
  display: grid;
  gap: 14px;
}

.live-performance-detail-summary {
  margin: 0;
}

.live-performance-order-table {
  width: 100%;
  min-width: 1040px;
  table-layout: fixed;
}

.live-performance-order-table th,
.live-performance-order-table td {
  overflow-wrap: anywhere;
}

.live-performance-order-table th:nth-child(1),
.live-performance-order-table td:nth-child(1) {
  width: 15%;
}

.live-performance-order-table th:nth-child(2),
.live-performance-order-table td:nth-child(2) {
  width: 10%;
}

.live-performance-order-table th:nth-child(3),
.live-performance-order-table td:nth-child(3) {
  width: 13%;
}

.live-performance-order-table th:nth-child(4),
.live-performance-order-table td:nth-child(4),
.live-performance-order-table th:nth-child(5),
.live-performance-order-table td:nth-child(5) {
  width: 10%;
}

.live-performance-order-table th:nth-child(6),
.live-performance-order-table td:nth-child(6),
.live-performance-order-table th:nth-child(8),
.live-performance-order-table td:nth-child(8) {
  width: 9%;
}

.live-performance-order-table th:nth-child(7),
.live-performance-order-table td:nth-child(7) {
  width: 24%;
}

.live-performance-order-table td code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.live-performance-order-table .replay-order-items {
  min-width: 0;
  max-width: none;
}

.live-performance-order-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.live-performance-filter-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  color: #374151;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.live-performance-filter-button strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  color: #111827;
  background: #f3f4f6;
  font-size: 11px;
}

.live-performance-filter-button:hover,
.live-performance-filter-button:focus-visible {
  border-color: #9ca3af;
  background: #f9fafb;
}

.live-performance-filter-button.active {
  border-color: var(--primary);
  color: var(--primary);
  background: #eff6ff;
}

.live-performance-filter-button.active strong {
  color: #111827;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.live-performance-filter-button.live.active {
  border-color: #059669;
  color: #047857;
  background: #ecfdf5;
}

.live-performance-filter-button.live.active strong {
  color: #047857;
  background: #fff;
}

.live-performance-filter-button.live-refund.active {
  border-color: #dc2626;
  color: #b91c1c;
  background: #fef2f2;
}

.live-performance-filter-button.live-refund.active strong {
  color: #b91c1c;
  background: #fff;
}

.live-performance-filter-button.product-card.active {
  border-color: #2563eb;
  color: #1d4ed8;
  background: #eff6ff;
}

.live-performance-filter-button.product-card.active strong {
  color: #1d4ed8;
  background: #fff;
}

.live-performance-filter-button.shopify.active {
  border-color: #0f766e;
  color: #0f766e;
  background: #f0fdfa;
}

.live-performance-filter-button.shopify.active strong {
  color: #0f766e;
  background: #fff;
}

.live-performance-amount-cell {
  display: grid;
  gap: 3px;
  min-width: 96px;
}

.live-performance-amount-cell strong {
  color: #111827;
}

.live-performance-amount-cell .refund {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--bad);
  font-size: 11px;
}

.live-performance-amount-cell em {
  color: #6b7280;
  font-size: 11px;
  font-style: normal;
}

.dxm-duplicate-table {
  min-width: 880px;
}

.dxm-buyer-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dxm-buyer-cell strong,
.dxm-buyer-cell span {
  overflow-wrap: anywhere;
}

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

.dxm-logistics-cell {
  display: grid;
  gap: 3px;
  max-width: 180px;
  overflow-wrap: anywhere;
}

.package-urgent-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.package-urgent-reasons span {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 1px 7px;
  border: 1px solid #fecaca;
  border-radius: 999px;
  color: #991b1b;
  background: #fef2f2;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.list-count {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.list-pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.dxm-order-work-wrap {
  border: 1px solid var(--line);
}

.dxm-order-work-table {
  min-width: 1500px;
}

.dxm-order-work-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.cs-conversation-toolbar {
  justify-content: space-between;
  margin: 2px 0 10px;
}

.cs-conversation-warning {
  margin: 0 0 10px;
}

.cs-conversation-table {
  min-width: 1120px;
}

.cs-conversation-row.urgent {
  background: #fffafa;
}

.cs-conversation-row.normal {
  background: #fffefa;
}

.cs-conversation-buyer,
.cs-reminder-info,
.cs-message-cell,
.cs-order-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.cs-conversation-buyer span,
.cs-reminder-info span,
.cs-message-cell span,
.cs-order-cell span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.cs-conversation-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cs-conversation-tags span,
.cs-reminder-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 20px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.cs-conversation-tags span {
  color: #475467;
  background: #f8fafc;
}

.cs-reminder-pill.normal {
  color: #854d0e;
  background: #fefce8;
  border-color: #fde68a;
}

.cs-reminder-pill.urgent {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.dxm-package-table {
  table-layout: fixed;
}

.package-deadline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  line-height: 1.3;
}

.package-deadline.overdue strong,
.package-deadline.overdue span:last-child {
  color: var(--danger, #d63031);
}

.dxm-package-col-equal {
  width: 14%;
}

.dxm-package-col-recipient {
  width: 26%;
}

.dxm-package-col-total {
  width: 9%;
}

.dxm-package-col-shipped {
  width: 8%;
}

.dxm-package-col-event {
  width: 21%;
}

.dxm-package-recipients > div {
  display: grid;
  gap: 2px;
  overflow-wrap: anywhere;
}

.dxm-package-recipients > div + div {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(15, 23, 42, 0.08);
}

.dxm-package-recipients > div > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.dxm-package-replacement {
  display: block;
  margin-top: 2px;
  color: #92400e;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.package-event-headline {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}

.package-scope-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 1px 8px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(15, 118, 110, 0.08);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.dxm-product-cell,
.dxm-order-id-cell,
.dxm-time-cell,
.dxm-status-cell,
.package-event-cell {
  display: grid;
  gap: 3px;
  overflow-wrap: anywhere;
}

.dxm-product-cell {
  min-width: 220px;
  max-width: 360px;
}

.dxm-order-id-cell {
  min-width: 160px;
}

.dxm-time-cell {
  min-width: 150px;
  color: #334155;
  font-size: 12px;
}

.package-time-cell {
  display: grid;
  gap: 3px;
  min-width: 88px;
  overflow-wrap: anywhere;
}

.codex-session-list {
  display: grid;
  align-content: start;
  gap: 16px;
  max-height: calc(100vh - 260px);
  min-height: 360px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px 8px 18px 0;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.codex-panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.codex-panel-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.codex-workspace .codex-session-list {
  height: 100%;
  max-height: none;
  min-height: 0;
}

.codex-session-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 8px;
  border-bottom: 1px solid var(--line);
}

.codex-session-tabs button {
  display: grid;
  gap: 3px;
  min-width: 160px;
  max-width: 240px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.codex-session-tabs button.active {
  border-color: var(--accent);
  background: #eef6ff;
}

.codex-session-tabs span,
.codex-session-tabs small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-session-tabs span {
  font-weight: 800;
}

.codex-session-tabs small {
  color: var(--muted);
}

.codex-session {
  min-height: 0;
}

.codex-workspace .codex-sessions-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-height: 0;
}

.codex-settings-form {
  gap: 16px;
}

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

.codex-runtime-settings {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.codex-runtime-settings .table-wrap {
  margin: 0;
}

.codex-runtime-settings table {
  min-width: 0;
}

.codex-session-title > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.codex-session-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.codex-session-title h3,
.codex-session-title .updated {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-session-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 12px;
}

.codex-error {
  color: var(--bad);
}

.codex-timeline {
  display: grid;
  gap: 10px;
  align-items: start;
  min-height: 320px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.codex-item {
  display: grid;
  justify-self: start;
  width: fit-content;
  max-width: min(78%, 760px);
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.04);
}

.codex-item-user {
  justify-self: end;
  background: #e8f1ff;
  border-color: #bfdbfe;
}

.codex-item-assistant {
  justify-self: start;
  background: #fff;
  border-color: #d8e2ee;
}

.codex-item-activity {
  justify-self: start;
  max-width: min(86%, 920px);
  background: #fff;
  border-color: #d8e2ee;
  color: var(--text);
  border-radius: 14px;
}

.codex-item-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.codex-item-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.codex-item-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
}

.codex-item-role {
  flex: 0 0 auto;
  padding-top: 1px;
  color: #344054;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.55;
  white-space: nowrap;
}

.codex-item-meta,
.codex-item-foot {
  color: var(--muted);
  font-size: 12px;
}

.codex-item-text,
.codex-item-detail {
  margin: 0;
  min-width: 0;
  overflow: visible;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.codex-item-detail {
  max-height: none;
  overflow: visible;
  padding: 10px;
  border-radius: 6px;
  background: #111827;
  color: #f9fafb;
  font-size: 12px;
}

.codex-item-output {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f1f5f9;
  overflow: hidden;
}

.codex-item-output-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 6px 10px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
}

.codex-item-output-toggle::-webkit-details-marker {
  display: none;
}

.codex-item-output-icon::before {
  content: '▸';
  display: inline-block;
  transition: transform 0.15s ease;
}

.codex-item-output[open] .codex-item-output-icon::before {
  transform: rotate(90deg);
}

.codex-item-output-preview {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.codex-item-output[open] .codex-item-output-preview {
  color: var(--text);
}

.codex-item-output .codex-item-detail {
  margin: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 920px) {
  body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
    background: var(--bg);
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .workspace {
    height: auto;
    overflow: visible;
    padding: 20px 16px 36px;
  }

  .workspace.codex-workspace-shell {
    overflow: visible;
  }

  .workspace-view.codex-workspace {
    height: auto;
  }

  .codex-workspace .codex-session-list {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .codex-settings-grid {
    grid-template-columns: 1fr;
  }

  .notification-target-grid {
    grid-template-columns: 1fr;
  }

  .auth-page .login-panel {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 34px;
    padding: 42px 22px;
  }

  .auth-page .login-panel h2 {
    font-size: 42px;
  }

  .auth-page .login-form {
    width: min(420px, 100%);
  }

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

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

@media (max-width: 640px) {
  .nav-list,
  .overview-strip {
    grid-template-columns: 1fr;
  }

  .view-head,
  .dxm-bulk-merge-switcher,
  .summary-row {
    display: grid;
  }

  .dxm-bulk-merge-meta {
    text-align: left;
  }

  .summary-metrics {
    justify-content: space-between;
  }

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

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

  h2 {
    font-size: 28px;
  }

  .auth-page .login-panel h2 {
    font-size: 36px;
  }

  .auth-page .login-panel .subtle {
    font-size: 14px;
  }
}

/* Replay collect button states */
.replay-button {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.replay-button:disabled { cursor: not-allowed; opacity: 0.6; }
.replay-button.replay-idle { background: #2563eb; color: #fff; border-color: #1d4ed8; }
.replay-button.replay-idle:hover:not(:disabled) { background: #1d4ed8; }
.replay-button.replay-running { background: #fef3c7; color: #92400e; border-color: #f59e0b; animation: replayPulse 1.6s ease-in-out infinite; }
.replay-button.replay-done { background: #d1fae5; color: #065f46; border-color: #10b981; }
.replay-button.replay-partial { background: #ffedd5; color: #9a3412; border-color: #f97316; }
.replay-button.replay-failed { background: #fee2e2; color: #991b1b; border-color: #ef4444; }
.replay-button.replay-ongoing { background: #e5e7eb; color: #6b7280; border-color: #d1d5db; }
@keyframes replayPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.65; } }

/* Replay detail modal */
.replay-detail .replay-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.replay-detail .replay-meta > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f9fafb;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}
.replay-phase-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 13px;
}
.replay-phase-table th,
.replay-phase-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}
.replay-phase-table th { background: #f3f4f6; font-weight: 600; }
.replay-phase-table td.phase-error { color: #b91c1c; font-family: ui-monospace, monospace; font-size: 11px; word-break: break-all; }
.phase-pending { color: #6b7280; }
.phase-done { color: #047857; font-weight: 600; }
.phase-running { color: #b45309; font-weight: 600; }
.phase-failed { color: #b91c1c; font-weight: 600; }
.overall-done { color: #047857; font-weight: 600; }
.overall-running { color: #b45309; font-weight: 600; }
.overall-failed { color: #b91c1c; font-weight: 600; }
.overall-partial { color: #c2410c; font-weight: 600; }
.replay-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
/* Unified capture detail: realtime + replay sections */
.capture-detail { display: flex; flex-direction: column; gap: 18px; }
.capture-section { border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px 16px; background: #fff; }
.capture-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.capture-section-head h4 { margin: 0; font-size: 14px; font-weight: 600; }
.capture-section-realtime { background: #f8fafc; }
.capture-rt-preview-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.replay-button.replay-realtime-active,
.live-capture-active { position: relative; }
.replay-button.live-capture-active { background: #dcfce7; color: #166534; border-color: #22c55e; }

.replay-log-block { margin-top: 12px; }
.replay-log-header {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
  word-break: break-all;
}
.replay-log-tail {
  background: #111827;
  color: #d1d5db;
  padding: 12px;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.4;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Core lives table client-side pagination toolbar */
.live-core-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
  font-size: 12px;
  color: #6b7280;
}
.live-core-page-actions { display: flex; gap: 8px; }
.live-replay-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 160px;
}
.replay-metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  white-space: nowrap;
}
.replay-metric-pill strong { color: #111827; }
.replay-metric-pill.product-card { background: #dbeafe; color: #1d4ed8; }
.replay-metric-pill.refund { background: #fee2e2; color: #991b1b; }
.replay-metric-pill.doll { background: #fce7f3; color: #9d174d; }
.replay-metric-pill.diy { background: #dcfce7; color: #166534; }
.replay-metric-pill.jewelry { background: #e0f2fe; color: #075985; }
.replay-metric-pill.other { background: #f3f4f6; color: #374151; }

/* Replay phase view sub-pages */
.replay-view-button { font-size: 12px; padding: 4px 10px; }
.replay-phase-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}
.replay-phase-title { font-weight: 600; color: #111827; }
.replay-public-warn {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid #ef4444;
  font-weight: 600;
  margin: 12px 0;
}
.replay-audio-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.replay-audio-meta > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f9fafb;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}
.replay-audio-path {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  word-break: break-all;
}
.replay-audio-player {
  width: 100%;
  margin: 12px 0;
}
.replay-order-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}
.replay-order-summary-grid > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f9fafb;
}
.replay-order-summary-grid strong { color: #111827; font-size: 14px; }
.replay-sub-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  font-size: 12px;
  color: #6b7280;
  flex-wrap: wrap;
}
.replay-sub-toolbar > div { display: flex; gap: 8px; }
.replay-search {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
}
.replay-orders-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}
.replay-orders-summary > span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f9fafb;
}
.replay-orders-summary strong { color: #111827; }
.replay-orders-summary em { color: #6b7280; font-style: normal; }
.competitor-scroll { max-height: 360px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 6px; padding: 8px; background: #fafafa; }
.competitor-comment, .competitor-transcript { padding: 3px 0; line-height: 1.5; border-bottom: 1px solid #f0f0f0; }
.competitor-comment .metric-label, .competitor-transcript .metric-label { color: #9ca3af; margin-right: 6px; font-variant-numeric: tabular-nums; }
.competitor-monitor .clickable-row { cursor: pointer; }
.competitor-monitor .clickable-row:hover { background: #f3f4f6; }
.launch-cdp-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.launch-cdp-row .subtle { margin: 0; }
.feature-health-section { margin-bottom: 18px; }
.feature-health-section > h3 { margin: 0 0 2px; font-size: 14px; }
.feature-health-section > .subtle { margin: 0 0 8px; }
.replay-sub-table-wrap {
  width: 100%;
  overflow-x: auto;
}
.replay-sub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.replay-sub-table th,
.replay-sub-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}
.replay-sub-table th { background: #f3f4f6; font-weight: 600; position: sticky; top: 0; }
.replay-sub-table td code { font-size: 11px; }
.rt-stats-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
  align-items: stretch;
}
.rt-stats-chart-card {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  min-width: 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.rt-stats-chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.rt-stats-chart-head h4 {
  margin: 0;
  color: #111827;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rt-stats-chart-head strong {
  flex: 0 0 auto;
  color: #111827;
  font-size: 13px;
}
.rt-stats-chart-body {
  position: relative;
  min-height: 178px;
}
.rt-stats-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 178px;
  touch-action: none;
  overflow: visible;
}
.rt-stats-chart-gridline,
.rt-stats-chart-axis {
  stroke: #e5e7eb;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.rt-stats-chart-axis { stroke: #cbd5e1; }
.rt-stats-chart-area {
  opacity: 0.12;
}
.rt-stats-chart-line {
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.rt-stats-chart-latest {
  stroke: #fff;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.rt-stats-chart-y-label,
.rt-stats-chart-x-label {
  fill: #6b7280;
  font-size: 11px;
}
.rt-stats-chart-crosshair {
  position: absolute;
  top: 8%;
  bottom: 15%;
  width: 1px;
  background: rgba(17, 24, 39, 0.34);
  pointer-events: none;
}
.rt-stats-chart-tooltip {
  position: absolute;
  z-index: 5;
  display: grid;
  gap: 2px;
  width: max-content;
  max-width: 220px;
  padding: 7px 9px;
  border-radius: 6px;
  color: #fff;
  background: #111827;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.2);
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
  transform: translate(-50%, -100%);
}
.rt-stats-chart-tooltip-single {
  position: fixed;
  z-index: 60;
}
.rt-stats-chart-tooltip-single[data-placement="below"] {
  transform: translate(-50%, 0);
}
.rt-stats-chart-tooltip strong {
  font-size: 12px;
  white-space: nowrap;
}
.rt-stats-chart-tooltip span {
  color: #d1d5db;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .rt-stats-chart-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .rt-stats-chart-card {
    padding: 10px;
  }
  .rt-stats-chart-y-label,
  .rt-stats-chart-x-label {
    font-size: 10px;
  }
}
.replay-order-id-cell {
  display: grid;
  gap: 5px;
  justify-items: start;
}
.replay-order-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.replay-order-status.cancelled {
  color: var(--bad);
  background: var(--bad-bg);
}
.replay-order-status.product-card {
  color: #1d4ed8;
  background: #dbeafe;
}
.replay-order-status.live {
  color: #047857;
  background: #d1fae5;
}
.replay-order-status.live-refund {
  color: #b91c1c;
  background: #fee2e2;
}
.replay-order-status.video {
  color: #7c2d12;
  background: #ffedd5;
}
.replay-order-status.shopify {
  color: #065f46;
  background: #ccfbf1;
}
.replay-order-status.business.doll {
  color: #9d174d;
  background: #fce7f3;
}
.replay-order-status.business.diy {
  color: #166534;
  background: #dcfce7;
}
.replay-order-status.business.jewelry {
  color: #075985;
  background: #e0f2fe;
}
.replay-order-status.business.diy-market {
  color: #6d28d9;
  background: #ede9fe;
}
.replay-order-status.business.other {
  color: #475569;
  background: #e2e8f0;
}
.replay-order-cancelled {
  background: #fff7f7;
}
.replay-order-items {
  min-width: 220px;
  max-width: 420px;
  overflow-wrap: anywhere;
}
.replay-business-cell,
.replay-refund-cell {
  display: grid;
  gap: 4px;
  min-width: 90px;
}
.replay-business-cell .subtle,
.replay-refund-cell span {
  max-width: 180px;
  overflow-wrap: anywhere;
}
.replay-stt-preview { color: #4b5563; max-width: 480px; word-break: break-word; }
.replay-stt-full-text {
  width: 100%;
  min-height: 360px;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
}
.nested-modal-backdrop { z-index: 60; }

/* ════════════════════════════════════════════════════════════════════════════
   PHONE ADAPTATION (≤640px)
   Additive, last-in-cascade so these overrides win without touching desktop
   rules. Priority surface: 直播 (live) feature. Pairs with the off-canvas nav
   drawer markup in index.html and the drawer JS in app.js.
   ════════════════════════════════════════════════════════════════════════════ */

/* Drawer affordance is desktop-hidden by default; revealed only at the phone
   breakpoint below. */
.mobile-titlebar { display: none; }
.sidebar-scrim { display: none; }

@media (max-width: 640px) {
  /* ── Off-canvas drawer navigation ──────────────────────────────────────── */
  /* Classic AppTitleBar: [☰] [feature title] … [⋮]. Fixed, above the drawer so
     the close (✕) affordance stays tappable while the drawer is open. */
  .mobile-titlebar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 50px;
    padding: 0 8px 0 4px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: saturate(1.4) blur(6px);
    backdrop-filter: saturate(1.4) blur(6px);
    color: var(--text);
  }
  .mobile-nav-toggle {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
  }
  /* Prod gets the same pink wordmark cue as the desktop brand. */
  .app-shell:has(.brand.is-prod) .mobile-nav-title { color: #db2777; }
  .mobile-nav-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 17px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-titlebar-actions {
    flex: 0 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .mobile-nav-burger {
    position: relative;
    flex: 0 0 auto;
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
  }
  .mobile-nav-burger::before,
  .mobile-nav-burger::after {
    content: "";
    position: absolute;
    left: 0;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform 200ms ease, top 200ms ease;
  }
  .mobile-nav-burger::before { top: -6px; }
  .mobile-nav-burger::after { top: 6px; }
  .mobile-nav-toggle[aria-expanded="true"] .mobile-nav-burger { background: transparent; }
  .mobile-nav-toggle[aria-expanded="true"] .mobile-nav-burger::before { top: 0; transform: rotate(45deg); }
  .mobile-nav-toggle[aria-expanded="true"] .mobile-nav-burger::after { top: 0; transform: rotate(-45deg); }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: block;
    background: rgba(16, 24, 40, 0.44);
    animation: enter 160ms ease both;
  }
  .sidebar-scrim[hidden] { display: none; }

  /* Sidebar becomes a left drawer; overrides the ≤920px static-top treatment. */
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(86vw, 320px);
    height: 100vh;
    grid-template-rows: auto 1fr auto;
    gap: 16px;
    padding: 62px 14px 22px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    overflow-y: auto;
    background: #fff;
    box-shadow: 0 24px 70px rgba(16, 24, 40, 0.28);
    transform: translateX(-100%);
    transition: transform 240ms ease;
  }
  .sidebar.open { transform: none; }
  .nav-list { grid-template-columns: 1fr; overflow: visible; }
  body.nav-drawer-open { overflow: hidden; }

  /* Hide the titlebar on the login screen (no nav there). */
  .auth-page .mobile-titlebar,
  .auth-page .sidebar-scrim { display: none; }

  /* Content sits below the fixed title bar; reclaim horizontal space. The
     feature title + actions now live in the title bar, so the in-content task
     header is hidden on phones. */
  .app-shell { grid-template-columns: 1fr; }
  .workspace { padding: 64px 12px 30px; }
  .task-view-head { display: none; }
  .top-tools { top: 56px; }

  /* ── Modals / dialogs: full-bleed with tighter chrome ──────────────────── */
  /* Lift dialogs above the fixed bar (60) and drawer (50). */
  .modal-backdrop { z-index: 80; padding: 8px; }
  .nested-modal-backdrop { z-index: 90; }
  .toast { top: 60px; z-index: 95; width: calc(100vw - 16px); }
  .modal,
  .modal-wide,
  .modal-codex-settings,
  .modal-narrow,
  .modal-batch-import {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }
  .modal-head { padding: 12px 14px; flex-wrap: wrap; }
  .modal-head h3 { font-size: 18px; }
  .modal-head-actions { justify-content: flex-end; }
  .modal-body { padding: 14px; gap: 14px; }
  .modal-foot { padding: 10px 14px; }

  /* ── Touch targets: comfortable tap sizes on phones ────────────────────── */
  .secondary,
  .secondary.small,
  .detail-tab,
  .live-performance-filter-button,
  .top-tool-button { min-height: 42px; }
  .detail-tabs { gap: 8px; scrollbar-width: thin; }

  /* ════ 直播 feature — mobile tuning ════════════════════════════════════ */

  /* 历史/进行中直播 table: drop the fixed layout that crushes columns to a few
     px; instead give it a real min-width and let .table-wrap swipe-scroll it. */
  .live-performance-table {
    min-width: 660px;
    table-layout: auto;
  }
  .live-performance-table th:nth-child(1),
  .live-performance-table td:nth-child(1),
  .live-performance-table th:nth-child(2),
  .live-performance-table td:nth-child(2),
  .live-performance-table th:nth-child(3),
  .live-performance-table td:nth-child(3) { width: auto; }
  .live-performance-table th,
  .live-performance-table td { padding-top: 6px; padding-bottom: 6px; }

  /* Summary cards: keep 2-up (glanceable) instead of a single tall stack. */
  .live-performance-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .live-performance-summary > div { padding: 8px 10px; }
  .live-performance-summary .metric-value { font-size: 18px; white-space: normal; }
  .live-core-summary { gap: 12px; }
  .live-core-summary > div { min-width: 96px; }

  /* Live info cell: let the room/account name use full width. */
  .live-info-cell strong { max-width: 100%; }

  /* Dialog order-table filters: tighter pills. */
  .live-performance-order-filters { gap: 6px; }
  .live-performance-filter-button { padding: 6px 10px; }

  /* Competitor monitor: shorter nested-scroll panes to cut scroll fatigue. */
  .competitor-scroll { max-height: 240px; }
}

/* Narrow phones: step down oversized headings and surface gaps. */
@media (max-width: 420px) {
  h1 { font-size: 20px; }
  h2 { font-size: 22px; }
  h3 { font-size: 16px; }
  .workspace-view { gap: 16px; }
  .live-performance-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ════════════════════════════════════════════════════════════════════════════
   PHONE: collapse PC-style chrome into mobile affordances
   - 直播 业绩总览 button (collapses the 6 summary cards + note into a dialog)
   - feature header ⋮ overflow menu (collapses head-actions buttons)
   Desktop is inert: the new wrappers use display:contents and the new triggers
   use display:none, so PC layout is byte-identical.
   ════════════════════════════════════════════════════════════════════════════ */
.live-performance-overview { display: contents; }
.live-performance-overview-toggle { display: none; }
.head-actions-buttons { display: contents; }
.head-actions-more { display: none; }
.live-detail-overview { display: contents; }
.live-detail-overview-toggle { display: none; }
/* Dialog page-stack back button (top-left of the modal head) — PC + mobile. */
.modal-back { flex: 0 0 auto; min-height: 32px; padding: 0 12px; font-size: 16px; line-height: 1; }
.modal-head h3 { margin-right: auto; }
.live-detail-snapshot-btn { justify-self: start; }

@media (max-width: 640px) {
  /* 业绩总览: hide the inline cards+note, show a single button that opens them. */
  .live-performance-overview { display: none; }
  .live-performance-overview-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    text-align: left;
  }
  .live-performance-overview-toggle-label { font-weight: 800; }
  .live-performance-overview-toggle-value {
    margin-left: auto;
    color: var(--muted);
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .live-performance-overview-toggle-caret { flex: 0 0 auto; color: var(--muted); font-size: 18px; }
  .live-performance-overview-dialog { display: grid; gap: 14px; }

  /* ⋮ overflow menu for feature header actions. */
  .head-actions { position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
  .head-actions-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
  }
  .head-actions-buttons {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 25;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    min-width: 188px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow);
  }
  .head-actions-buttons.open { display: flex; }
  .head-actions-buttons > button,
  .head-actions-buttons > .secondary {
    width: 100%;
    justify-content: flex-start;
    min-height: 42px;
  }

  /* 直播 RecyclerView-style session-card feed (replaces the table on phones). */
  .live-performance-cards { display: grid; gap: 10px; }
  .live-performance-card {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
  }
  .live-performance-card:active { background: #f8fafc; }
  .live-performance-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
  }
  .live-performance-card-title { display: grid; gap: 3px; min-width: 0; }
  .live-performance-card-title strong { font-size: 15px; overflow-wrap: anywhere; }
  .live-performance-card-title .subtle { font-size: 12px; }
  .live-performance-card-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .live-performance-card-metrics > div { display: grid; gap: 2px; }
  .live-performance-card-metrics .metric-label { color: var(--muted); font-size: 11px; }
  .live-performance-card-metrics .metric-value { font-size: 15px; font-weight: 800; white-space: nowrap; }
  .live-performance-cards-end { text-align: center; padding: 12px 0 4px; }

  /* 直播详情 dialog: collapse the dense meta/summary/coverage blocks behind a
     本场概览 toggle so the order list is the focus. */
  .live-detail-overview { display: none; }
  .live-detail-overview.open { display: grid; gap: 14px; }
  .live-detail-overview-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .live-detail-overview-caret { color: var(--muted); font-size: 18px; transition: transform 180ms ease; }
  .live-detail-overview-toggle[aria-expanded="true"] .live-detail-overview-caret { transform: rotate(90deg); }
  .live-detail-snapshot-btn { justify-self: stretch; width: 100%; justify-content: center; }

  /* 直播详情 orders as concise cards (no horizontal table scroll on phones). */
  .live-order-cards { display: grid; gap: 10px; }
  .live-order-card {
    display: grid;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
  }
  .live-order-card.replay-order-cancelled { background: #fff7f7; }
  .live-order-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .live-order-card-status { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-weight: 700; }
  .live-order-card .live-performance-amount-cell { flex-direction: row; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .live-order-card .live-performance-amount-cell strong { font-size: 16px; }
  .live-order-card-fields { display: grid; gap: 6px; margin: 0; }
  .live-order-card-fields > div { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 8px; align-items: start; }
  .live-order-card-fields dt { margin: 0; color: var(--muted); font-size: 12px; }
  .live-order-card-fields dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
  .live-order-card-fields code { font-size: 12px; word-break: break-all; }

  .product-listing-summary {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }

  .product-listing-summary > div {
    border-bottom: 1px solid var(--line);
  }

  .product-group-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .product-order-ocr-head,
  .product-order-ocr-grid {
    grid-template-columns: 1fr;
  }

  .config-section-head {
    display: grid;
  }
}

/* 直播实时督导 feed (fast-check runs) */
.fastcheck-feed { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.fastcheck-run { border: 1px solid var(--border, #e5e7eb); border-radius: 8px; padding: 8px 10px; background: var(--card-bg, #fff); }
.fastcheck-run-alert { border-left: 3px solid #e23744; background: #fff7f7; }
.fastcheck-run-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.fastcheck-run-body { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.5; }
.fastcheck-sev { color: #e23744; font-weight: 600; }
