:root {
  --ink: #13241f;
  --muted: #4a5f58;
  --teal: #0f6b5c;
  --teal-ink: #084539;
  --amber: #b86c12;
  --line: rgba(19, 36, 31, 0.12);
  --paper: rgba(255, 252, 247, 0.78);
  --font-d: "Bricolage Grotesque", Georgia, serif;
  --font-b: "Figtree", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-b);
  background:
    radial-gradient(900px 420px at 0% 0%, rgba(15,107,92,.16), transparent 60%),
    radial-gradient(700px 380px at 100% 8%, rgba(184,108,18,.12), transparent 55%),
    linear-gradient(160deg, #eef3ef, #f7f4ee 45%, #eef1f0);
  line-height: 1.5;
  /* 去掉移动端点击 300ms 延迟，按钮立即响应 */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.ambient {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .28;
  background-image:
    linear-gradient(rgba(19,36,31,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19,36,31,.035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(#000, transparent 88%);
}

.topbar, main, .drawer { position: relative; z-index: 1; }

.app-chrome {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(244, 247, 243, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .9rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: transparent;
  position: relative; z-index: 1;
}
.brand-name {
  font-family: var(--font-d); font-weight: 800; font-size: 1.25rem;
  letter-spacing: -.03em; color: var(--teal-ink);
}
.brand-line { margin-left: .55rem; color: var(--muted); font-size: .85rem; font-weight: 600; }
.shop-chip {
  margin: 0; font-size: .82rem; font-weight: 600; color: var(--amber);
}
.shop-switch { margin-left: auto; }
.shop-switch-label {
  display: flex; align-items: center; gap: .4rem;
  font-size: .82rem; font-weight: 600; color: var(--muted);
}
.shop-switch select {
  font: inherit; font-weight: 600; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  padding: .35rem .55rem; background: rgba(255,255,255,.75);
  max-width: 220px;
}
.user-chip {
  display: flex; align-items: center; gap: .35rem;
  font-size: .82rem; font-weight: 600; color: var(--muted);
  white-space: nowrap;
}
.topbar-actions { margin-left: .25rem; }

.login-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background:
    radial-gradient(700px 360px at 20% 20%, rgba(15,107,92,.22), transparent 60%),
    rgba(19, 36, 31, .55);
  backdrop-filter: blur(8px);
}
.login-overlay[hidden] { display: none; }
.login-card {
  width: min(420px, 92vw);
  padding: 1.6rem 1.5rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 252, 247, .94);
  box-shadow: 0 18px 50px rgba(19, 36, 31, .18);
  display: grid; gap: .75rem;
}
.login-brand {
  margin: 0; font-family: var(--font-d); font-weight: 800;
  font-size: 1.35rem; color: var(--teal-ink); letter-spacing: -.03em;
}
.login-card h1 {
  margin: 0; font-family: var(--font-d); font-size: 1.55rem;
  letter-spacing: -.03em; color: var(--ink);
}
.login-card label {
  display: grid; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--muted);
}
.login-card input {
  font: inherit; font-weight: 500; color: var(--ink);
  padding: .55rem .65rem; border-radius: 8px;
  border: 1px solid var(--line); background: #fff;
}
.users-create { align-items: end; }
.users-edit-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem .85rem;
  margin-top: .35rem;
}
.users-edit-form label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
}
.local-job-edit-panel {
  width: min(560px, 94vw);
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.local-job-edit-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1.15rem .85rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}
.local-job-edit-kicker {
  margin: 0 0 .2rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #64748b;
}
.local-job-edit-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}
.local-job-edit-form {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  padding: .95rem 1.15rem 1.1rem;
  overflow: auto;
}
.local-job-edit-section {
  margin: 0;
  padding: .85rem .9rem;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 12px;
  background: #fff;
}
.local-job-edit-section h4 {
  margin: 0 0 .65rem;
  font-size: .78rem;
  font-weight: 700;
  color: #475569;
  letter-spacing: .02em;
}
.local-job-edit-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .65rem;
}
.local-job-edit-section-head h4 { margin: 0; }
.local-job-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem .75rem;
}
.local-job-edit-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.local-job-edit-form label {
  display: flex;
  flex-direction: column;
  gap: .28rem;
  margin: 0;
  font-size: .78rem;
  font-weight: 600;
  color: #64748b;
}
.local-job-edit-form label.span-2 {
  grid-column: 1 / -1;
}
.local-job-edit-form label input,
.local-job-edit-form label select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 8px;
  padding: .55rem .65rem;
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  color: #0f172a;
  background: #f8fafc;
}
.local-job-edit-form label input:focus,
.local-job-edit-form label select:focus {
  outline: none;
  border-color: rgba(13, 148, 136, .55);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .12);
}
.local-job-edit-hint {
  margin: .55rem 0 0;
  font-size: .75rem;
  color: #94a3b8;
}
.local-job-edit-footer {
  display: flex;
  justify-content: flex-end;
  gap: .55rem;
  padding-top: .15rem;
}
.local-job-recipients {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-height: 220px;
  overflow: auto;
}
.local-recipient-item {
  position: relative;
  display: grid;
  grid-template-columns: 1.15rem 1.85rem minmax(0, 1fr);
  align-items: center;
  column-gap: .7rem;
  margin: 0;
  padding: .65rem .8rem;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.local-recipient-item:hover {
  border-color: rgba(37, 99, 235, .28);
  box-shadow: 0 4px 14px rgba(37, 99, 235, .08);
}
.local-recipient-item:has(.local-recipient-check:checked) {
  border-color: rgba(13, 148, 136, .45);
  background: linear-gradient(180deg, #f0fdfa 0%, #ecfeff 100%);
  box-shadow: 0 0 0 1px rgba(13, 148, 136, .12), 0 4px 14px rgba(13, 148, 136, .08);
}
.local-recipient-check {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  pointer-events: none;
}
.local-recipient-ui {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 6px;
  border: 1.5px solid rgba(15, 23, 42, .22);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s ease, border-color .15s ease;
}
.local-recipient-tick {
  width: .42rem;
  height: .7rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  margin-top: -1px;
  transition: transform .12s ease;
}
.local-recipient-item:has(.local-recipient-check:checked) .local-recipient-ui {
  background: #0d9488;
  border-color: #0d9488;
}
.local-recipient-item:has(.local-recipient-check:checked) .local-recipient-tick {
  transform: rotate(45deg) scale(1);
}
.local-recipient-avatar {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, #67e8f9 0%, #818cf8 100%);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.local-recipient-name {
  min-width: 0;
  font-size: .92rem;
  font-weight: 650;
  color: #0f172a;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .local-job-edit-grid,
  .local-job-edit-grid.cols-3 {
    grid-template-columns: 1fr;
  }
}
.users-edit-form label.check-inline {
  flex-direction: row;
  align-items: center;
  gap: .45rem;
  align-self: end;
}
.users-edit-form input,
.users-edit-form select {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: .45rem .55rem;
  font: inherit;
  background: rgba(255,255,255,.85);
  color: var(--ink);
}
.users-edit-form .hint {
  grid-column: 1 / -1;
  margin: 0;
}
.users-edit-form .product-modal-footer {
  grid-column: 1 / -1;
  margin-top: .25rem;
}
@media (max-width: 640px) {
  .users-edit-form { grid-template-columns: 1fr; }
}
.nav-acl-fieldset {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .65rem .75rem .75rem;
  margin: 0;
  background: rgba(255,255,255,.55);
}
.users-create .nav-acl-fieldset {
  align-self: stretch;
}
.nav-acl-fieldset legend {
  font-size: .78rem;
  font-weight: 700;
  padding: 0 .35rem;
}
.nav-acl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: .35rem .65rem;
  margin-top: .55rem;
}
.nav-acl-grid[disabled] {
  opacity: .45;
  pointer-events: none;
}
.nav-acl-grid label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  font-weight: 500;
  color: var(--ink);
  margin: 0;
}
.nav-acl-fieldset .hint {
  margin: .5rem 0 0;
}
.creator-tags-field {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .65rem .75rem .8rem;
  margin: 0;
}
.creator-tags-field legend {
  padding: 0 .35rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
}
.creator-tag-checks {
  display: flex; flex-wrap: wrap; gap: .45rem .7rem;
  margin-bottom: .65rem;
}
.creator-tag-checks label.tag-option-row {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .88rem; font-weight: 500; color: var(--ink);
}
.creator-tag-checks .tag-del {
  padding: 0 .15rem;
  font-size: .75rem;
  line-height: 1;
}
.creator-tag-create {
  display: flex; gap: .45rem; align-items: center;
}
.creator-tag-create input {
  flex: 1; font: inherit; padding: .4rem .55rem;
  border: 1px solid var(--line); border-radius: 8px;
}
.tag-chip {
  display: inline-block;
  margin: 0 .2rem .2rem 0;
  padding: .1rem .45rem;
  border-radius: 999px;
  background: rgba(15,107,92,.12);
  color: var(--teal-ink);
  font-size: .78rem;
  font-weight: 600;
}
body.role-bd-locked-tags #creator-tag-create-row { display: none !important; }
body.role-bd-locked-tags #creator-tags-field .hint { display: none; }

.heavy-job-banner {
  margin: 0.35rem 1rem 0;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  font-size: 0.9rem;
}
.heavy-job-banner[hidden] { display: none !important; }

.tabs {
  display: flex; gap: .15rem; overflow-x: auto;
  padding: .55rem 1.2rem 0;
  border-bottom: 0;
  background: transparent;
  position: relative;
  z-index: 1;
}
.tab {
  border: 0; background: transparent; cursor: pointer;
  padding: .7rem .95rem; font: inherit; font-weight: 600; font-size: .9rem;
  color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: color .08s ease, border-color .08s ease, background-color .08s ease;
}
.tab:hover { color: var(--teal); }
.tab:active:not(:disabled),
.tab.is-pressing:not(:disabled) {
  color: var(--teal-ink);
  background: rgba(15, 107, 92, 0.08);
}
.tab.active { color: var(--teal-ink); border-bottom-color: var(--teal); }

main { padding: 1.25rem 1.5rem 3rem; max-width: 1440px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; }

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem 1.75rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.hero h1 {
  margin: 0; font-family: var(--font-d); font-size: clamp(2.6rem, 6vw, 4.4rem);
  letter-spacing: -.04em; line-height: .95; color: var(--teal-ink);
}
.lead { max-width: 36ch; color: var(--muted); margin: .9rem 0 0; font-size: 1.05rem; }
.overview-data-freshness {
  flex: 0 1 22rem;
  min-width: min(100%, 16rem);
  margin-left: auto;
  padding: .7rem .85rem .8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}
.odf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .45rem;
}
.odf-head strong {
  font-size: .82rem;
  letter-spacing: .02em;
  color: var(--ink);
}
.odf-jump {
  padding: 0;
  font-size: .78rem;
  min-height: auto;
}
.odf-list {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .22rem .75rem;
  font-size: .78rem;
  line-height: 1.35;
}
.odf-list .odf-label { color: var(--muted); }
.odf-list .odf-date {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink);
  font-weight: 600;
}
.odf-list .odf-date.is-empty {
  color: var(--muted);
  font-weight: 500;
}
.odf-list .odf-err {
  grid-column: 1 / -1;
  color: #b45309;
}
.hero-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.4rem; }
.metric { border-top: 2px solid var(--ink); padding-top: .55rem; }
.metric .l { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.metric .v { font-family: var(--font-d); font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; }

.split { display: grid; grid-template-columns: 1.1fr .9fr; gap: 1.75rem; }
.split h2, .panel-head h2 {
  margin: 0; font-family: var(--font-d); font-size: 1.35rem; letter-spacing: -.02em;
}
.panel-head p, .split p { margin: .3rem 0 0; color: var(--muted); font-size: .9rem; }
.panel-head { /* layout below */ }

.ops-funnel-block {
  margin-top: 1.25rem;
  padding-top: .35rem;
  border-top: 1px solid var(--line);
}
.gmv-target-plan-block {
  margin: 1.6rem 0 1.25rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line, rgba(19,36,31,.12));
}

.product-perf-block {
  margin: 1.6rem 0 1.25rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line, rgba(19,36,31,.12));
}
.product-perf-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1rem;
  margin-bottom: .85rem;
}
.product-perf-filters {
  flex: 1 1 20rem;
  margin: 0;
}
.product-perf-search input {
  min-width: 12rem;
  max-width: 18rem;
}
.product-perf-table-wrap {
  overflow: auto;
  max-height: min(70vh, 40rem);
}
.product-perf-table {
  table-layout: fixed;
  width: max-content;
  min-width: 100%;
}
.product-perf-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8faf9;
  white-space: nowrap;
  cursor: grab;
  user-select: none;
  overflow: visible;
  box-sizing: border-box;
}
.product-perf-table thead th[data-pp-sort] {
  cursor: pointer;
}
.product-perf-table thead th.pp-col-product {
  cursor: grab;
}
.product-perf-table tbody td {
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}
.product-perf-table .col-resize-handle {
  width: 12px;
  right: -4px;
  background: transparent;
}
.product-perf-table .col-resize-handle:hover,
.product-perf-table th.col-resizing .col-resize-handle {
  background: rgba(15, 107, 92, 0.35);
}
/* 产品列默认≈缩略图+「ID + 19位PID」略宽一点，避免吃掉多余横向空间 */
.product-perf-table th[data-col-key="product"],
.product-perf-table td[data-col-key="product"] {
  width: 15rem;
  min-width: 15rem;
  max-width: 15rem;
}
/* Excel 式冻结：左侧连续列 sticky（left 由 JS 按列宽累加）— 全业务表共用 */
.grid.is-freeze-cols th.is-frozen-col,
.grid.is-freeze-cols td.is-frozen-col {
  position: sticky;
  z-index: 3;
  background: #fff;
}
.grid.is-freeze-cols thead th.is-frozen-col {
  z-index: 5;
  background: #f8faf9;
}
.grid.is-freeze-cols .is-frozen-edge {
  box-shadow: 3px 0 6px -2px rgba(15, 23, 42, 0.12);
}
.grid.is-freeze-cols tbody tr:hover td.is-frozen-col {
  background: #eef6f4;
}
.grid.is-freeze-cols th.col-select.is-frozen-col,
.grid.is-freeze-cols td.col-select.is-frozen-col {
  z-index: 4;
  background: #fff;
}
.grid.is-freeze-cols thead th.col-select.is-frozen-col {
  z-index: 6;
  background: #f8faf9;
}
.table-freeze,
.product-perf-freeze {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.86rem;
  color: var(--muted, #64748b);
  user-select: none;
  white-space: nowrap;
  margin-right: 0.35rem;
}
.table-freeze select,
.product-perf-freeze select {
  max-width: 14rem;
  min-width: 7.5rem;
  font: inherit;
  font-size: 0.86rem;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--line, #d5ddd9);
  border-radius: 4px;
  background: #fff;
  color: var(--ink, #0f172a);
}
.product-perf-table th.is-sorted::after {
  content: attr(data-sort-mark);
  margin-left: .25rem;
  color: #0f766e;
  font-size: .75em;
}
.pp-product-cell {
  display: flex;
  gap: .55rem;
  align-items: flex-start;
  min-width: 0;
  max-width: 100%;
}
.pp-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: #eef2f1;
  flex-shrink: 0;
}
.pp-thumb.is-empty {
  display: grid;
  place-items: center;
  color: #94a3b8;
  font-size: .7rem;
}
.pp-product-meta {
  min-width: 0;
}
.pp-product-name {
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-width: 0;
}
.pp-product-name-row {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
}
.pp-product-name-row .pp-gmv-q {
  flex: 0 0 auto;
  margin-top: 0.05rem;
  font-size: 0.78rem;
  line-height: 1;
  padding: 0 0.15rem;
  border: 0;
  background: transparent;
  color: #0f766e;
  cursor: help;
}
.pp-product-name-row .pp-gmv-q:hover { color: #115e59; }
.pp-thumb-btn {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  flex-shrink: 0;
  border-radius: 8px;
  line-height: 0;
}
.pp-thumb-btn .pp-thumb { display: block; }
.pp-gmv-chart-tip { z-index: 80; }
.pp-product-ids {
  margin-top: .2rem;
  font-size: .78rem;
  color: var(--muted, #64748b);
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .55rem;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-perf-table .pp-product-ids span {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.pp-status {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-top: .25rem;
  font-size: .78rem;
  color: #15803d;
}
.pp-status::before {
  content: "";
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
  background: currentColor;
}
.pp-metric-cell {
  white-space: nowrap;
  vertical-align: middle;
}
.pp-metric-top {
  display: flex;
  align-items: baseline;
  gap: .45rem;
  font-variant-numeric: tabular-nums;
}
.pp-share {
  color: #64748b;
  font-size: .85rem;
}
.pp-share + .pp-value::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: .85em;
  background: #cbd5e1;
  margin-right: .45rem;
  vertical-align: -0.1em;
}
.pp-value { font-weight: 600; }
.pp-change {
  margin-top: .15rem;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}
.pp-change.cmp-up { color: #15803d; }
.pp-change.cmp-down { color: #b91c1c; }
.pp-change.cmp-flat { color: #64748b; }
.product-perf-pager {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-top: .65rem;
}
.product-perf-metrics-panel {
  width: min(720px, 94vw);
  max-height: min(86vh, 40rem);
  display: flex;
  flex-direction: column;
}
.product-perf-metrics-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .45rem .75rem;
  margin: .35rem 0 .6rem;
  background: #f1f5f4;
  border-radius: 8px;
  font-size: .9rem;
}
.product-perf-metrics-body {
  overflow: auto;
  flex: 1;
  padding-right: .25rem;
}
.pp-metric-group {
  margin-bottom: .9rem;
}
.pp-metric-group h4 {
  margin: 0 0 .45rem;
  font-size: .92rem;
  font-weight: 650;
}
.pp-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .35rem .75rem;
}
.pp-metric-grid label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .88rem;
  cursor: pointer;
}
@media (max-width: 720px) {
  .pp-metric-grid { grid-template-columns: 1fr; }
  .product-perf-toolbar { flex-direction: column; align-items: stretch; }
}
.gmv-target-plan-block .filters {
  margin-bottom: .85rem;
}
.gmv-target-plan-block .field-stretch {
  display: inline-block;
  vertical-align: top;
  resize: horizontal;
  overflow: hidden;
  min-width: 9.5rem;
  width: 11rem;
  max-width: min(40rem, 92vw);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
}
.gmv-target-plan-block .field-stretch input[type="number"] {
  display: block;
  width: 100%;
  min-width: 0 !important;
  max-width: none !important;
  border: 0 !important;
  border-radius: 8px;
  background: transparent;
  box-sizing: border-box;
}
.gmv-target-plan-block label.gmv-plan-ratio .field-stretch {
  min-width: 8rem;
  width: 9.5rem;
}
.gmv-target-plan-block .field-stretch--drp {
  width: 16rem;
  min-width: 12rem;
  overflow: hidden;
}
.gmv-target-plan-block .field-stretch--drp .drp-trigger {
  width: 100%;
  box-sizing: border-box;
}
.gmv-target-plan-caliber-hint {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.82rem;
  line-height: 1.45;
}
.gmv-target-plan-alloc-hint {
  margin: -0.2rem 0 0.85rem;
  font-size: 0.88rem;
  color: #0f766e;
}
.gmv-target-plan-alloc-hint.is-warn {
  color: #b45309;
  font-weight: 600;
}
.gmv-plan-share {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.gmv-plan-share input {
  width: 5.2rem;
  padding: 0.25rem 0.35rem;
  border: 1px solid var(--line, #d1d5db);
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.gmv-target-plan-summary {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: .35rem 0 1rem;
}
.gmv-target-plan-summary[hidden] { display: none !important; }
.gmv-target-plan-table-wrap {
  max-height: min(52vh, 560px);
  margin-bottom: .35rem;
  overflow: auto;
}
#table-gmv-target-plan {
  table-layout: fixed;
  width: max-content;
  min-width: 100%;
}
#table-gmv-target-plan thead th {
  position: sticky;
  top: 0;
  overflow: visible;
  box-sizing: border-box;
}
#table-gmv-target-plan tbody td {
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}
#table-gmv-target-plan .col-resize-handle {
  width: 12px;
  right: -4px;
  background: transparent;
}
#table-gmv-target-plan .col-resize-handle:hover,
#table-gmv-target-plan th.col-resizing .col-resize-handle {
  background: rgba(15, 107, 92, 0.35);
}
#table-gmv-target-plan th[data-col-key="product"] { min-width: 10rem; }
#table-gmv-target-plan th[data-col-key="notes"] { min-width: 8rem; }
#table-gmv-target-plan th[data-col-key="progress"],
#table-gmv-target-plan td[data-col-key="progress"] {
  min-width: 9.5rem;
  max-width: 11rem;
  white-space: normal;
  vertical-align: middle;
}
.gmv-plan-pg {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-size: 0.72rem;
  line-height: 1.2;
}
.gmv-plan-pg-row {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) 2.6rem;
  gap: 0.28rem;
  align-items: center;
}
.gmv-plan-pg-row .lab { color: var(--muted, #64748b); }
.gmv-plan-pg-row .pct {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 600;
}
.gmv-plan-pg-row .track {
  height: 0.42rem;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.gmv-plan-pg-row .track > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #0f766e;
  max-width: 100%;
}
.gmv-plan-pg-row.is-over .track > i { background: #b45309; }
.gmv-plan-pg-row.is-done .track > i { background: #15803d; }
.gmv-plan-pg-row.is-empty .pct { color: #94a3b8; font-weight: 500; }
#gmv-plan-record-banner {
  margin: 0.25rem 0 0.5rem;
}
.gmv-plan-records-body {
  max-height: min(50vh, 28rem);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.25rem 0;
}
.gmv-plan-record-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 0.75rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  background: #fff;
}
.gmv-plan-record-card .title { font-weight: 600; }
.gmv-plan-record-card .meta { font-size: 0.78rem; color: var(--muted); }
.gmv-plan-record-card .actions { display: flex; gap: 0.35rem; }
#table-gmv-target-plan td.muted {
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ops-volume-bars-wrap {
  margin-top: .85rem;
}
.ops-volume-bars-wrap .trends-subhead {
  margin-bottom: .15rem;
}
.ops-volume-bars-filters {
  margin: .35rem 0 .15rem;
}
.ops-volume-bars-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem;
  margin: .75rem 0 .35rem;
}
.ops-volume-bars-summary .stat {
  padding: .55rem .7rem;
  border-radius: 10px;
  background: #f7faf9;
  border: 1px solid #e6eeeb;
}
.ops-volume-bars-summary .stat span {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
}
.ops-volume-bars-summary .stat strong {
  font-family: var(--font-d);
  font-size: 1.25rem;
}
.ops-volume-bars-chart {
  width: 100%;
  height: auto;
  max-height: 300px;
  margin-top: .35rem;
  display: block;
}
.ops-bar { transition: opacity .15s ease; }
.ops-bar:hover { opacity: .88; }
.ops-bar-label { font-size: 12px; fill: var(--muted); font-weight: 600; }
.ops-bar-value {
  font-size: 13px;
  font-weight: 700;
  fill: #17352f;
  font-family: var(--font-d);
}
.funnel { display: grid; grid-template-columns: repeat(5, 1fr); gap: .55rem; margin-top: .9rem; }
.funnel-step {
  padding: .85rem .7rem; border-left: 3px solid var(--teal);
  background: linear-gradient(180deg, rgba(15,107,92,.1), rgba(15,107,92,.02));
  min-height: 5.5rem; display: flex; flex-direction: column; justify-content: flex-end;
  opacity: calc(1 - var(--funnel-i, 0) * 0.08);
}
.funnel-step .n { font-family: var(--font-d); font-size: 1.45rem; font-weight: 700; }
.funnel-step .l { font-size: .8rem; color: var(--muted); font-weight: 600; }
.funnel-step .funnel-rate {
  margin-top: .35rem;
  font-size: .72rem;
  font-weight: 700;
  color: var(--teal);
}

.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem 1rem; margin-top: .7rem; }
.kv { padding: .65rem 0; border-bottom: 1px solid var(--line); }
.kv .k { font-size: .78rem; color: var(--muted); }
.kv .v { font-family: var(--font-d); font-size: 1.2rem; font-weight: 700; }
.kv .t { font-size: .68rem; font-weight: 700; color: var(--teal); letter-spacing: .04em; }

.filters {
  display: flex; flex-wrap: wrap; gap: .7rem .85rem; align-items: end;
  padding: .9rem 0 1rem; border-bottom: 1px solid var(--line); margin-bottom: .75rem;
}
.filters label {
  display: flex; flex-direction: column; gap: .25rem;
  font-size: .72rem; font-weight: 600; color: var(--muted);
}
.filters input, .filters select {
  min-width: 8.5rem; border: 1px solid var(--line); border-radius: 3px;
  padding: .45rem .55rem; font: inherit; background: rgba(255,255,255,.7); color: var(--ink);
}
.filter-actions { display: flex; gap: .45rem; }

.btn {
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  font: inherit; font-weight: 600; padding: .48rem .85rem; border-radius: 3px; cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0s, filter 0s, background-color .08s ease, border-color .08s ease, opacity .08s ease, color .08s ease;
  will-change: transform;
}
.btn.solid { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.solid:hover { background: var(--teal-ink); }
.btn.danger {
  background: #fff;
  border-color: #f3b4ae;
  color: #b42318;
}
.btn.danger:hover { background: #fef3f2; border-color: #f04438; }
.btn.link { border: 0; color: var(--teal); padding: 0; background: none; text-decoration: underline; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:active:not(:disabled),
.btn.is-pressing:not(:disabled),
button:active:not(:disabled),
button.is-pressing:not(:disabled),
input[type="submit"]:active:not(:disabled),
input[type="button"]:active:not(:disabled),
input[type="submit"].is-pressing:not(:disabled),
input[type="button"].is-pressing:not(:disabled) {
  transform: translateY(1px) scale(0.98);
  filter: brightness(0.94);
}
.btn.is-busy,
button.is-busy,
input[type="submit"].is-busy,
input[type="button"].is-busy {
  position: relative;
  opacity: 0.78;
}
.btn.is-busy::after,
button.is-busy:not(.btn.link)::after {
  content: "";
  display: inline-block;
  width: .7em;
  height: .7em;
  margin-left: .4em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: btn-spin .55s linear infinite;
}
.btn.link.is-busy::after { margin-left: .25em; }
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}
.table-shell.is-loading {
  position: relative;
  min-height: 4.5rem;
}
.table-shell.is-loading::after {
  content: attr(data-loading-text);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 252, 247, 0.72);
  color: var(--muted);
  font-weight: 600;
  font-size: .9rem;
  pointer-events: none;
  z-index: 2;
}

.table-shell {
  overflow: auto;
  max-width: 100%;
  max-height: min(70vh, 720px);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}
.grid {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: .84rem;
}
.grid th, .grid td {
  padding: .55rem .65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}
.grid th {
  position: sticky; top: 0; z-index: 2;
  background: #eef4f1;
  font-size: .72rem; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
}
.grid td { vertical-align: top; }
.grid tbody tr:hover { background: rgba(15,107,92,.06); }
.grid th.dragging { opacity: .45; }
.grid th.drag-over { box-shadow: inset 3px 0 0 var(--teal); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; }
.video-url-cell {
  max-width: 14rem;
  width: 14rem;
  overflow: hidden;
}
.video-url-link {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0f766e;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.video-url-link:hover { color: #115e59; }
.grid th[data-col-key="video_url"],
.grid th[data-col-key="fulfillment_video_url"] {
  max-width: 14rem;
  width: 14rem;
}
.num { font-variant-numeric: tabular-nums; text-align: right; }
.stock-neg { color: #b42318; font-weight: 600; }
.clamp { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cell-fulltip {
  position: fixed;
  z-index: 12000;
  box-sizing: border-box;
  width: max-content;
  max-width: min(36rem, calc(100vw - 1.5rem));
  max-height: min(50vh, 22rem);
  overflow: auto;
  padding: 0.55rem 0.75rem;
  margin: 0;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 6px;
  background: #fffef9;
  color: #1f2937;
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
  pointer-events: none;
}
#cell-fulltip[hidden] { display: none !important; }
.col-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 3;
}
.col-resize-handle:hover,
.grid th.col-resizing .col-resize-handle {
  background: rgba(15, 107, 92, 0.35);
}
body.col-resizing-active {
  cursor: col-resize !important;
  user-select: none !important;
}
body.col-resizing-active * {
  cursor: col-resize !important;
}
.sku-thumb {
  width: 2.6rem; height: 2.6rem; object-fit: cover;
  border-radius: 4px; border: 1px solid var(--line); background: #fff; display: block;
  cursor: zoom-in;
}
.sku-thumb-btn {
  display: inline-block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  line-height: 0;
}
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-lightbox[hidden] { display: none !important; }
.img-lightbox-mask {
  position: absolute;
  inset: 0;
  background: rgba(12, 18, 16, 0.72);
}
.img-lightbox-panel {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 1100px);
  max-height: 94vh;
  padding: .5rem .75rem .75rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0,0,0,.28);
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.img-lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding-right: 2.2rem;
}
.img-lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  max-height: calc(94vh - 4.5rem);
  min-height: 12rem;
  background: #f6f8f7;
  border-radius: 6px;
}
.img-lightbox-panel img {
  display: block;
  max-width: min(88vw, 1000px);
  max-height: calc(94vh - 5.5rem);
  object-fit: contain;
  background: #f6f8f7;
  transform-origin: center center;
  transition: transform 0.15s ease;
}
.img-lightbox-close {
  position: absolute;
  top: .35rem;
  right: .45rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(15,107,92,.92);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.score-breakdown {
  min-width: 12rem; max-width: 28rem; white-space: normal; vertical-align: top;
  padding-top: .65rem !important; padding-bottom: .65rem !important;
}
.score-head { display: flex; align-items: center; gap: .45rem; margin-bottom: .35rem; flex-wrap: wrap; }
.score-total { font-family: var(--font-d); font-size: 1.05rem; color: var(--teal-ink); }
.score-total-unit { font-size: .78rem; color: var(--muted); font-weight: 600; }
.score-fallback { margin: 0; font-size: .82rem; color: var(--muted); }
.score-details { margin: 0; }
.score-details > summary {
  cursor: pointer; font-size: .78rem; color: var(--teal-ink); font-weight: 600;
  list-style: none; user-select: none;
}
.score-details > summary::-webkit-details-marker { display: none; }
.score-details > summary::before { content: "▸ "; }
.score-details[open] > summary::before { content: "▾ "; }
.score-details[open] > summary { margin-bottom: .35rem; }
.score-reason-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  max-width: 22rem;
  color: var(--ink);
  font-weight: 500;
}
.score-details[open] > .score-reason-summary {
  -webkit-line-clamp: unset;
  overflow: visible;
}
.score-lazy-body { margin-top: .2rem; }
.score-reason-plain {
  display: inline-block; max-width: 22rem; white-space: normal; word-break: break-word;
  font-size: .82rem;
}
.score-lines {
  list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .28rem;
}
.score-line {
  display: grid; grid-template-columns: 5.5rem 2.2rem 1fr; gap: .35rem .5rem;
  align-items: baseline; font-size: .78rem; line-height: 1.35;
}
.score-line-zero { opacity: .55; }
.score-lbl { font-weight: 600; color: var(--ink); }
.score-pts {
  font-variant-numeric: tabular-nums; font-weight: 700; text-align: right;
  color: var(--teal-ink);
}
.score-line-zero .score-pts { color: var(--muted); font-weight: 600; }
.score-note { color: var(--muted); white-space: normal; word-break: break-word; }
.badge {
  display: inline-block; padding: .12rem .4rem; font-size: .7rem; font-weight: 700; border-radius: 2px;
}
.badge-ok { background: rgba(15,107,92,.14); color: var(--teal-ink); }
.badge-warn { background: rgba(37,99,235,.12); color: #1e4a8c; }
.badge-no { background: rgba(184,108,18,.16); color: #7a4508; }
.badge-mute { background: rgba(19,36,31,.08); color: var(--muted); }
.empty { padding: 1.6rem .4rem; color: var(--muted); }
.muted { color: var(--muted); }
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  margin-bottom: .85rem;
}
.panel-head h2 { margin: 0 0 .25rem; font-family: var(--font-d); }
.panel-head p { margin: 0; color: var(--muted); font-size: .9rem; }
.panel-head-actions { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.btn.link.danger { color: #b42318; }
.btn.link.danger:hover { color: #8a1a12; }
.thumb-cell { width: 3.2rem; }
.product-modal-panel { width: min(560px, 94vw); }
.product-form {
  display: grid; grid-template-columns: 1fr 1fr; gap: .55rem .75rem;
  overflow: auto; max-height: 58vh; padding-right: .2rem;
}
.product-form label {
  display: flex; flex-direction: column; gap: .25rem;
  font-size: .82rem; color: var(--ink);
}
.product-form label input,
.product-form label select {
  border: 1px solid var(--line); border-radius: 3px;
  padding: .4rem .5rem; font: inherit; background: #fff;
}
.product-form label.check-inline {
  grid-column: 1 / -1; flex-direction: row; align-items: center; gap: .45rem;
}
.product-form label.logistics-form-span2 { grid-column: 1 / -1; }

.shipment-lines-block {
  margin: 0.75rem 1rem 0;
}
.shipment-lines-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}
.shipment-lines-wrap {
  max-height: 14rem;
  overflow: auto;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
}
.shipment-lines-grid {
  margin: 0;
  font-size: 0.85rem;
}
.shipment-lines-grid th,
.shipment-lines-grid td {
  padding: 0.25rem 0.35rem;
  white-space: nowrap;
}
.shipment-lines-grid input {
  width: 100%;
  min-width: 4.5rem;
  box-sizing: border-box;
}
.shipment-extra-block,
.shipment-attach-block {
  margin: 0.75rem 1rem 0;
}
.shipment-extra-pre {
  margin: 0;
  max-height: 12rem;
  overflow: auto;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  background: #fafafa;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8rem;
  line-height: 1.35;
}
.shipment-attach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.6rem;
}
.shipment-attach-card {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.shipment-attach-card a {
  display: block;
}
.shipment-attach-card img {
  display: block;
  width: 100%;
  height: 7.5rem;
  object-fit: cover;
  background: #f3f4f6;
}
.shipment-attach-card .cap {
  padding: 0.3rem 0.4rem;
  font-size: 0.75rem;
  color: #4b5563;
}

/* 发货明细：卡片板 + 工厂层级编辑（高级视觉） */
.ship-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 1rem;
  padding: 0.35rem 0 1.25rem;
}
.ship-card {
  position: relative;
  display: block;
  width: 100%;
  border: 1px solid rgba(19, 36, 31, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  padding: 0;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.ship-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 107, 92, 0.35);
  box-shadow: 0 14px 32px rgba(8, 69, 57, 0.12);
}
.ship-card-accent {
  height: 4px;
  background: linear-gradient(90deg, var(--teal), #1a9a82 55%, var(--amber));
}
.ship-card-body { padding: 0.95rem 1rem 0.9rem; }
.ship-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.ship-card-seq {
  font-family: var(--font-d);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--teal-ink);
}
.ship-card-country {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
  background: rgba(15, 107, 92, 0.1);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
}
.ship-card-wh {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.55rem;
  line-height: 1.3;
}
.ship-card-meta {
  display: grid;
  gap: 0.28rem;
  margin-bottom: 0.75rem;
}
.ship-card-meta div {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: 0.4rem;
  font-size: 0.78rem;
  line-height: 1.35;
}
.ship-card-meta i {
  font-style: normal;
  color: var(--muted);
  font-weight: 600;
}
.ship-card-meta b {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ship-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}
.ship-card-stats span {
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(19, 36, 31, 0.04);
  border-radius: 6px;
  padding: 0.22rem 0.5rem;
}
.ship-card-stats strong {
  color: var(--teal-ink);
  font-weight: 700;
  margin-left: 0.15rem;
}
/* 发货明细（Excel 同构）：左右各留约 10% */
main:has(#panel-logistics.active):has([data-logistics-pane="shipments"].active) {
  max-width: none;
  width: 100%;
  padding-left: 10vw;
  padding-right: 10vw;
}
#panel-logistics:has([data-logistics-pane="shipments"].active) .panel-head {
  max-width: none;
}

.ship-excel-shell {
  overflow: auto;
  max-height: calc(100vh - 12.5rem);
  width: 100%;
  border: 1px solid #bfc7c2;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}
.ship-excel {
  border-collapse: collapse;
  width: 100%;
  min-width: 1800px;
  table-layout: auto;
  font-size: 12px;
  line-height: 1.35;
  color: #1a1a1a;
}
.ship-excel th,
.ship-excel td {
  border: 1px solid #b0b8b3;
  padding: 5px 8px;
  vertical-align: middle;
  white-space: nowrap;
  background: #fff;
}
.ship-excel thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #e8eeeb;
  font-weight: 700;
  color: #24332e;
  text-align: center;
  box-shadow: 0 1px 0 #b0b8b3;
}
.ship-excel td.pre {
  white-space: pre-wrap;
  min-width: 16rem;
  max-width: 28rem;
  text-align: left;
  vertical-align: top;
}
.ship-excel td.merge {
  white-space: pre-wrap;
  min-width: 7.5rem;
  max-width: 20rem;
  text-align: center;
  vertical-align: middle;
}
.ship-excel td.seq {
  background: #7dce6f;
  font-weight: 800;
  font-size: 1.05rem;
  text-align: center;
  min-width: 2.6rem;
  width: 2.6rem;
}
.ship-excel td.factory {
  font-weight: 700;
  text-align: center;
  background: #f4faf7;
  min-width: 5rem;
}
.ship-excel td.pname {
  background: #ffe0b8;
  font-weight: 600;
  white-space: normal;
  min-width: 10rem;
  max-width: 18rem;
}
.ship-excel td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 4.2rem;
}
.ship-excel td.total {
  background: #f3f6f4;
  font-weight: 700;
  text-align: center;
  min-width: 4.5rem;
}
.ship-excel td.img-cell {
  min-width: 4.8rem;
  text-align: center;
  vertical-align: middle;
  padding: 3px;
}
.ship-excel .ship-x-img {
  width: 52px;
  height: 52px;
  margin: 2px auto;
  border: 1px solid #c5cec9;
  border-radius: 2px;
  overflow: hidden;
  background: #eef2f0;
}
.ship-excel .ship-x-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ship-excel td.empty {
  text-align: center;
  color: #6b7280;
  padding: 2rem;
}
.ship-excel tbody tr[data-ship-id] {
  cursor: pointer;
}
.ship-excel tbody tr[data-ship-id]:hover td {
  filter: brightness(0.97);
}
.ship-excel tbody tr[data-ship-id]:hover td.seq {
  filter: brightness(0.92);
}

#logistics-shipment-modal .col-modal-mask {
  background: rgba(6, 22, 18, 0.55);
  backdrop-filter: blur(2px);
}
#logistics-shipment-modal .ship-modal-panel {
  top: 1.5vh !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: min(96vw, 1600px) !important;
  max-width: none !important;
  height: 97vh !important;
  max-height: 97vh !important;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  border-radius: 16px;
  overflow: hidden;
  background: #f4f7f5 !important;
  border: 1px solid rgba(19, 36, 31, 0.1);
  box-shadow: 0 28px 80px rgba(8, 40, 32, 0.28);
}
.ship-modal-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem 0.9rem;
  background: linear-gradient(180deg, #ffffff, #f7faf8);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.ship-modal-kicker {
  margin: 0 0 0.15rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}
.ship-modal-hd h3 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.ship-modal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 1.1rem 1.4rem 1.4rem;
  display: grid;
  grid-template-columns: 1.05fr 1.15fr;
  grid-template-areas:
    "overview route"
    "metrics route"
    "media media"
    "factories factories";
  gap: 0.9rem 1rem;
  align-content: start;
}
.ship-modal-scroll .ship-batch-form {
  display: contents;
}
.ship-sec-overview { grid-area: overview; }
.ship-sec-route { grid-area: route; }
.ship-sec-metrics { grid-area: metrics; }
#ship-batch-media { grid-area: media; }
.ship-factories-block { grid-area: factories; }
.ship-modal-ft {
  margin: 0 !important;
  padding: 0.9rem 1.5rem;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
  flex: 0 0 auto;
}

.ship-sec {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(19, 36, 31, 0.08);
  border-radius: 14px;
  padding: 0.9rem 1rem 1rem;
}
.ship-sec-hd {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.75rem;
}
.ship-sec-num {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(15, 107, 92, 0.1);
  color: var(--teal-ink);
  font-family: var(--font-d);
  font-size: 0.78rem;
  font-weight: 800;
}
.ship-sec-hd strong {
  display: block;
  font-size: 0.95rem;
  color: var(--ink);
}
.ship-sec-hd em {
  display: block;
  font-style: normal;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.ship-batch-form { display: contents; }
.ship-batch-grid {
  display: grid;
  gap: 0.65rem 0.75rem;
}
.ship-batch-grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ship-batch-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ship-batch-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}
.ship-batch-grid label > span,
.ship-metric > span,
.ship-sku-f > span,
.ship-factory-name > span,
.ship-factory-ent > span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.ship-batch-grid label.span2 { grid-column: span 2; }
.ship-batch-grid label.span3 { grid-column: 1 / -1; }
.ship-batch-grid input,
.ship-batch-grid textarea,
.ship-metric input,
.ship-sku-f input,
.ship-factory-name input,
.ship-factory-ent input {
  border: 1px solid rgba(19, 36, 31, 0.12);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ship-batch-grid input:focus,
.ship-batch-grid textarea:focus,
.ship-metric input:focus,
.ship-sku-f input:focus,
.ship-factory-name input:focus,
.ship-factory-ent input:focus {
  outline: none;
  border-color: rgba(15, 107, 92, 0.45);
  box-shadow: 0 0 0 3px rgba(15, 107, 92, 0.12);
}
.ship-batch-grid textarea { resize: vertical; min-height: 4.2rem; }

.ship-metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}
.ship-metric {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(15, 107, 92, 0.06), rgba(15, 107, 92, 0.02));
  border: 1px solid rgba(15, 107, 92, 0.12);
}
.ship-metric input {
  font-family: var(--font-d);
  font-size: 1.15rem;
  font-weight: 700;
  border: 0;
  background: transparent;
  padding: 0.15rem 0;
}

.ship-media-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.ship-media-col {
  border-radius: 12px;
  background: #f8faf9;
  border: 1px solid rgba(19, 36, 31, 0.08);
  padding: 0.65rem 0.75rem 0.75rem;
  min-height: 7.5rem;
}
.ship-media-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.45rem;
}
.ship-img-add {
  cursor: pointer;
  margin: 0;
  flex: 0 0 auto;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
}
.ship-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-height: 4.2rem;
  align-items: flex-start;
}
.ship-thumbs.col {
  flex-direction: column;
  align-items: stretch;
}
.ship-thumb {
  position: relative;
  width: 5.2rem;
  height: 5.2rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(19, 36, 31, 0.1);
  background: #e8eeeb;
  display: block;
}
.ship-thumb > a {
  display: block;
  width: 100%;
  height: 100%;
}
.ship-thumb-del {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.35rem;
  height: 1.35rem;
  border: 0;
  border-radius: 999px;
  background: rgba(20, 24, 22, 0.72);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.ship-thumb-del:hover {
  background: #b42318;
}
.ship-thumb.lg {
  width: 100%;
  height: 9rem;
}
.ship-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ship-thumb-empty {
  font-size: 0.75rem;
  color: #94a3b8;
  align-self: center;
  padding: 0.5rem 0;
}

.ship-factories-block { padding-bottom: 0.35rem; }
.ship-factories-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.ship-factories {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.ship-factory {
  display: grid;
  grid-template-columns: minmax(15rem, 18rem) minmax(0, 1fr);
  gap: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(15, 107, 92, 0.18);
  background: #fff;
  box-shadow: 0 10px 28px rgba(8, 69, 57, 0.06);
}
.ship-factory-rail {
  background: linear-gradient(180deg, #0f6b5c 0%, #0b5549 100%);
  color: #e8f6f2;
  padding: 0.95rem 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.ship-factory-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  opacity: 0.75;
}
.ship-factory-name > span,
.ship-factory-ent > span,
.ship-dn-h {
  color: rgba(232, 246, 242, 0.72) !important;
}
.ship-dn-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
}
.ship-dn-h .ship-img-add {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
}
.ship-dn-h .ship-img-add:hover {
  background: rgba(255, 255, 255, 0.22);
}
.ship-factory-name input,
.ship-factory-ent input {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  color: #fff !important;
  font-weight: 700;
  font-size: 1rem;
}
.ship-factory-name input::placeholder,
.ship-factory-ent input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}
.ship-factory-name input:focus,
.ship-factory-ent input:focus {
  background: rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15) !important;
}
.ship-dn-col { margin-top: 0.15rem; }
.ship-factory-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.4rem;
}
.btn.sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.1); }
.ship-factory-rail .btn.solid {
  background: #fff;
  color: var(--teal-ink);
  border-color: #fff;
}
.ship-factory-rail .btn.solid:hover {
  background: #f0faf7;
}

.ship-factory-main {
  padding: 0.85rem 0.9rem 0.95rem;
  background: linear-gradient(180deg, #fbfcfb, #f5f8f6);
  min-width: 0;
}
.ship-factory-main-hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.ship-factory-main-hd strong {
  font-size: 0.88rem;
  color: var(--ink);
}
.ship-factory-main-hd span {
  font-size: 0.72rem;
  color: var(--muted);
}
.ship-sku-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.ship-sku {
  border: 1px solid rgba(19, 36, 31, 0.08);
  border-radius: 12px;
  background: #fff;
  padding: 0.65rem 0.7rem 0.7rem;
}
.ship-sku-main {
  display: flex;
  align-items: end;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}
.ship-sku-f {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.ship-sku-f.grow { flex: 1 1 auto; }
.ship-sku-f.sku-code { width: 8.5rem; flex: 0 0 auto; }
.ship-sku-f.name input {
  font-weight: 700;
  background: rgba(184, 108, 18, 0.08);
  border-color: rgba(184, 108, 18, 0.2);
}
.ship-sku-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.5rem 0.55rem;
}
.ship-media-col {
  min-height: 9.5rem;
}
.ship-batch-grid textarea {
  min-height: 4.2rem;
}
.ship-sku-f.num input {
  font-variant-numeric: tabular-nums;
  text-align: right;
  background: rgba(15, 107, 92, 0.04);
}
.ship-icon-btn {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.ship-icon-btn:hover {
  color: #9b1c1c;
  border-color: rgba(155, 28, 28, 0.3);
  background: #fff5f5;
}

@media (max-width: 1100px) {
  #logistics-shipment-modal .ship-modal-panel {
    width: 98vw !important;
    height: 98vh !important;
    max-height: 98vh !important;
    top: 1vh !important;
    border-radius: 10px;
  }
  .ship-modal-scroll {
    grid-template-columns: 1fr;
    grid-template-areas:
      "overview"
      "route"
      "metrics"
      "media"
      "factories";
  }
  .ship-batch-grid.g4,
  .ship-batch-grid.g3,
  .ship-metric-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ship-factory { grid-template-columns: 1fr; }
  .ship-sku-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ship-media-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .ship-batch-grid.g4,
  .ship-batch-grid.g3,
  .ship-metric-row,
  .ship-sku-grid { grid-template-columns: 1fr; }
  .ship-batch-grid label.span2 { grid-column: auto; }
}
.product-form label textarea {
  border: 1px solid var(--line); border-radius: 3px;
  padding: .4rem .5rem; font: inherit; background: #fff; resize: vertical;
}
.filters label.check-inline {
  flex-direction: row; align-items: center; gap: .4rem;
  font-size: .85rem; white-space: nowrap;
}
.product-form .product-img-preview-wrap { grid-column: 1 / -1; }
#product-img-preview {
  max-width: 140px; max-height: 140px; object-fit: contain;
  border: 1px solid var(--line); border-radius: 4px; background: #fff;
}
.product-modal-footer {
  margin-top: .85rem; display: flex; justify-content: flex-end; gap: .5rem;
}
.confirm-modal-panel { width: min(420px, 92vw); }

.col-modal[hidden] { display: none; }
.col-modal-mask {
  position: fixed; inset: 0; background: rgba(8,28,24,.4); z-index: 60;
}
.col-modal-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(520px, 94vw); max-height: 84vh;
  background: #f7f5ef; border: 1px solid var(--line); border-radius: 6px;
  z-index: 61; display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(8,40,32,.18);
  padding: 1rem 1.1rem 1rem;
}
/* 二次确认盖在供应链等到货/盘点弹窗之上，避免被挡住后误点遮罩关掉业务窗 */
#confirm-modal .col-modal-mask { z-index: 90; }
#confirm-modal .col-modal-panel { z-index: 91; }
.col-modal-panel header {
  display: flex; align-items: center; justify-content: space-between;
}
.col-modal-panel h3 { margin: 0; font-family: var(--font-d); }
.col-modal-panel .muted { color: var(--muted); font-size: .85rem; margin: .4rem 0 .7rem; }
.col-modal-actions { display: flex; gap: .4rem; margin-bottom: .6rem; flex-wrap: wrap; }
.col-list {
  list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1;
  border: 1px solid var(--line); border-radius: 4px; background: #fff;
  max-height: 48vh;
}
.col-list li {
  display: flex; align-items: center; gap: .55rem;
  padding: .45rem .6rem; border-bottom: 1px solid var(--line);
  cursor: grab;
}
.col-list li.dragging { opacity: .4; background: #e8f2ef; }
.col-list label { display: flex; align-items: center; gap: .4rem; flex: 1; cursor: pointer; }
.col-handle { color: var(--muted); font-size: 1rem; user-select: none; }
.col-modal-panel footer { margin-top: .75rem; display: flex; justify-content: flex-end; }

.grid th[data-sort] {
  cursor: pointer;
  user-select: none;
}
.grid th[data-sort]:hover { color: var(--teal); }
.grid th.sort-asc::after { content: " ↑"; color: var(--teal); }
.grid th.sort-desc::after { content: " ↓"; color: var(--teal); }
.pager input[type="number"] {
  width: 4.2rem; border: 1px solid var(--line); border-radius: 3px;
  padding: .35rem .4rem; font: inherit; text-align: center;
}
.pager select {
  border: 1px solid var(--line); border-radius: 3px; padding: .35rem .45rem; font: inherit;
}

.drawer[hidden] { display: none; }
.drawer:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 40;
}
.drawer-mask {
  /* 去掉 backdrop-filter，宽屏抽屉滑动更跟手 */
  position: fixed; inset: 0; background: rgba(8,28,24,.42);
}
.drawer-panel {
  position: fixed; top: 0; right: 0;
  width: min(460px, 100vw); height: 100vh;
  background: #f7f5ef; border-left: 1px solid var(--line);
  padding: 1.35rem 1.25rem 2rem; overflow: auto;
  box-shadow: -16px 0 40px rgba(8,40,32,.12);
  animation: slide .18s ease both;
  will-change: transform;
}
.drawer.drawer-wide .drawer-panel {
  width: min(94vw, 1100px);
}
.drawer-panel.is-user-sized {
  /* 用户拖拽后用内联 width，覆盖上面的 min() */
  max-width: 98vw;
}
.drawer-resize {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  z-index: 6;
  border: 0;
  padding: 0;
  cursor: ew-resize;
  background: transparent;
}
.drawer-resize::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 48px;
  border-radius: 2px;
  background: rgba(15, 107, 92, 0.35);
  opacity: 0;
  transition: opacity .15s;
}
.drawer-resize:hover::after,
.drawer-panel.is-resizing .drawer-resize::after {
  opacity: 1;
  background: rgba(15, 107, 92, 0.65);
}
.drawer-panel.is-resizing {
  user-select: none;
  transition: none;
}
.drawer-table {
  max-height: min(70vh, 720px);
  margin-top: .5rem;
  overflow: auto;
  resize: vertical;
  min-height: 160px;
}
.drawer-table-sm { max-height: min(28vh, 220px); }
.drawer-grid {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
}
.drawer-grid th,
.drawer-grid td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
}
.drawer-grid th:hover,
.drawer-grid td:hover {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  max-width: none;
  word-break: break-word;
  background: #fff;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 1px var(--line);
}
.drawer-more { margin: .35rem 0 .15rem; font-size: .82rem; }
.sku-samples-fold { margin-top: .35rem; font-size: .84rem; }
.sku-samples-fold > summary {
  cursor: pointer;
  color: var(--teal);
  padding: .25rem 0;
  list-style: none;
}
.sku-samples-fold > summary::-webkit-details-marker { display: none; }
.pid-fold {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  margin: 0 0 .55rem;
  overflow: hidden;
}
.pid-fold > summary {
  display: grid;
  grid-template-columns: minmax(150px, 1.35fr) minmax(100px, 1.4fr) minmax(110px, 0.9fr) auto;
  gap: .45rem .75rem;
  align-items: center;
  cursor: pointer;
  list-style: none;
  padding: .7rem .9rem;
  font-size: .88rem;
}
.pid-fold-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.pid-fold-gmv,
.pid-fold-meta {
  white-space: nowrap;
}
.pid-fold-gmv {
  justify-self: end;
  text-align: right;
}
.pid-fold > summary::-webkit-details-marker { display: none; }
.pid-fold > summary::before {
  content: "▸";
  color: var(--teal);
  margin-right: .15rem;
}
.pid-fold[open] > summary::before { content: "▾"; }
.pid-fold-body { padding: 0 .85rem .85rem; border-top: 1px solid var(--line); }
.sku-card {
  margin-top: .75rem;
  padding: .7rem .75rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fbfaf6;
  content-visibility: auto;
  contain-intrinsic-size: 120px;
}
.sku-card-head {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .35rem .75rem;
  font-size: .84rem;
}
.drawer-x {
  position: absolute; top: .8rem; right: .9rem; border: 0; background: none;
  font-size: 1.5rem; cursor: pointer; color: var(--muted);
}
.drawer-panel h2 { margin: 0 2rem 0 0; font-family: var(--font-d); }
.drawer-list { list-style: none; margin: 0; padding: 0; }
.drawer-list li { padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.block h3 {
  margin: 1rem 0 .4rem; font-size: .72rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--teal);
}

.toast {
  position: fixed; left: 50%; bottom: 1.3rem; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: .65rem 1.1rem; border-radius: 3px;
  font-size: .86rem; z-index: 50;
}
.toast[hidden] { display: none; }

.mermaid-shell {
  margin-top: .5rem; padding: 1.1rem; border: 1px solid var(--line);
  border-radius: 4px; background: var(--paper); overflow: auto; min-height: 320px;
}
.mermaid-shell .loading { color: var(--muted); padding: 1rem 0; }
.tables-list { display: flex; flex-direction: column; gap: .9rem; }
.table-card {
  border: 1px solid var(--line); border-radius: 4px; padding: 1rem 1.1rem;
  background: var(--paper);
}
.table-card-head {
  display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start;
  margin-bottom: .7rem;
}
.table-card h3 { margin: 0; font-family: var(--font-d); font-size: 1.05rem; }
.table-card p { margin: .25rem 0 0; color: var(--muted); font-size: .88rem; }
.table-preview { margin-top: .75rem; }
.sql-box textarea {
  width: 100%; box-sizing: border-box; margin-bottom: .7rem;
  border: 1px solid var(--line); border-radius: 4px; padding: .75rem .85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .84rem; background: rgba(255,255,255,.75); color: var(--ink);
  resize: vertical; min-height: 140px;
}
.error-box {
  margin: .7rem 0; padding: .75rem .9rem; border-radius: 4px;
  background: rgba(184,108,18,.12); color: #7a4508; border: 1px solid rgba(184,108,18,.28);
}
.alert-box {
  margin-top: 1.1rem; display: flex; flex-wrap: wrap; gap: .55rem;
}
.alert-chip {
  border: 1px solid rgba(184,108,18,.35);
  background: rgba(184,108,18,.12);
  color: #7a4508;
  border-radius: 4px;
  padding: .55rem .85rem;
  font: inherit;
  cursor: pointer;
}
.alert-chip:hover { background: rgba(184,108,18,.2); }
.ops-block { margin-top: 1.25rem; }
.ops-block h3 { margin: 0 0 .35rem; font-family: var(--font-d); }
.ops-block .hint { margin: 0 0 .7rem; color: var(--muted); font-size: .9rem; }
.ops-log {
  margin-top: .75rem; max-height: 240px; overflow: auto;
  padding: .65rem .75rem; font-size: .78rem; line-height: 1.35;
  background: #fff; border: 1px solid var(--line); border-radius: 4px;
  white-space: pre-wrap; word-break: break-word;
}
#drawer-body .sched-task-json {
  margin-top: 0;
  max-height: min(70vh, 640px);
}
.shop-daily-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
}
@media (max-width: 960px) {
  .shop-daily-progress { grid-template-columns: 1fr; }
}
.shop-daily-progress-card {
  padding: .85rem .9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.shop-daily-progress-card .pg-label {
  font-family: var(--font-d);
  font-weight: 700;
  margin-bottom: .35rem;
}
.shop-daily-progress-card .pg-last {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--teal-ink);
}
.shop-daily-progress-card .pg-next {
  margin-top: .25rem;
  color: var(--muted);
  font-size: .85rem;
}
.shop-daily-slot .slot-progress {
  font-size: .82rem;
  color: var(--teal-ink);
  font-weight: 600;
}
.shop-daily-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
}
@media (max-width: 960px) {
  .shop-daily-grid { grid-template-columns: 1fr; }
}
.shop-daily-slot {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: .85rem .9rem;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,.55);
  cursor: pointer;
}
.shop-daily-slot:hover { border-color: var(--teal); }
.shop-daily-slot .slot-title {
  font-family: var(--font-d);
  font-weight: 700;
  font-size: .95rem;
}
.shop-daily-slot .slot-req {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}
.shop-daily-slot input[type="file"] {
  font-size: .82rem;
  max-width: 100%;
}
.shop-daily-slot .slot-file {
  font-size: .8rem;
  word-break: break-all;
}
.shop-daily-status {
  margin-top: .85rem;
  display: grid;
  gap: .55rem;
}
.shop-daily-actions {
  display: flex;
  align-items: center;
  gap: .85rem 1.1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.shop-daily-action-btns {
  flex: 0 0 auto;
}
.shop-daily-run-progress {
  flex: 1 1 280px;
  min-width: 260px;
  margin-top: 0;
  padding: .6rem .85rem .7rem;
  border: 1.5px solid var(--teal);
  border-radius: 6px;
  background: #f3faf8;
  box-shadow: inset 0 0 0 1px rgba(26, 122, 109, .08);
}
.shop-daily-run-progress.is-idle {
  background: #f3faf8;
  border-style: solid;
  opacity: 1;
}
.shop-daily-run-progress.is-idle .run-pg-fill {
  width: 0 !important;
  background: transparent;
}
.shop-daily-run-progress.is-running {
  border-color: var(--teal);
  background: #fff;
}
.shop-daily-run-progress .run-pg-head {
  display: flex;
  align-items: baseline;
  gap: .45rem .65rem;
  margin-bottom: .4rem;
  flex-wrap: nowrap;
  min-width: 0;
}
.shop-daily-run-progress .run-pg-label {
  flex: 0 0 auto;
  font-size: .78rem;
  font-weight: 700;
  color: var(--teal-ink, #1a7a6d);
  letter-spacing: .02em;
}
.shop-daily-run-progress .run-pg-head strong {
  font-variant-numeric: tabular-nums;
  min-width: 2.6rem;
  flex: 0 0 auto;
}
.shop-daily-run-progress .run-pg-head .muted {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .82rem;
}
.shop-daily-run-progress .run-pg-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(26, 122, 109, .15);
  overflow: hidden;
}
.shop-daily-run-progress .run-pg-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #1a7a6d);
  transition: width .35s ease;
}
.shop-daily-run-progress.is-done .run-pg-fill {
  background: #2f6f4e;
}
.shop-daily-run-progress.is-failed .run-pg-fill {
  background: #a33;
}
@media (max-width: 720px) {
  .shop-daily-actions { align-items: stretch; }
  .shop-daily-run-progress { flex-basis: 100%; }
}
.shop-daily-check {
  padding: .65rem .75rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: .88rem;
  line-height: 1.4;
}
.shop-daily-check.ok {
  border-color: rgba(15,107,92,.35);
  background: rgba(15,107,92,.06);
}
.shop-daily-check.bad {
  border-color: rgba(176,48,48,.35);
  background: rgba(176,48,48,.06);
}
.shop-daily-check strong { display: block; margin-bottom: .2rem; }
.badge {
  display: inline-block; min-width: 1.4rem; padding: .05rem .4rem;
  border-radius: 999px; background: rgba(15,107,92,.12); color: var(--teal-ink);
  font-size: .8rem; font-weight: 700; text-align: center;
}
.inline-input {
  width: 11rem; border: 1px solid var(--line); border-radius: 4px;
  padding: .35rem .5rem; font: inherit; background: rgba(255,255,255,.8);
}
.btn-sm { padding: .3rem .55rem; font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; }
.topbar-actions { display: flex; gap: .5rem; align-items: center; }
.btn[aria-pressed="true"] {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}
body.help-mode th[data-help-key],
body.help-mode td[data-help-key] {
  cursor: help;
  outline: 1px dashed transparent;
}
body.help-mode th[data-help-key]:hover,
body.help-mode td[data-help-key]:hover {
  background: rgba(15, 107, 92, 0.08);
}
.field-help-tip {
  position: fixed;
  z-index: 9999;
  max-width: min(28rem, calc(100vw - 1.5rem));
  padding: .7rem .85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fffef9;
  box-shadow: 0 10px 28px rgba(19, 36, 31, 0.16);
  color: var(--ink);
  font-size: .88rem;
  line-height: 1.45;
  pointer-events: none;
}
.field-help-tip strong {
  display: block;
  font-family: var(--font-d);
  font-size: .95rem;
  margin-bottom: .25rem;
  color: var(--teal-ink);
}
.field-help-tip .help-src {
  margin-top: .4rem;
  color: var(--muted);
  font-size: .78rem;
}

.avg-gmv-wrap {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  white-space: nowrap;
}
.gmv-q {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: help;
  font-size: .78rem;
  line-height: 1;
  padding: 0 .1rem;
}
.gmv-q:hover { color: var(--teal); }
.gmv-chart-tip {
  position: fixed;
  z-index: 10000;
  width: min(600px, calc(100vw - 1.2rem));
  padding: .85rem 1rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 14px 36px rgba(19, 36, 31, 0.18);
  color: var(--ink);
  font-size: .84rem;
  line-height: 1.4;
  pointer-events: auto;
}
.gmv-chart-tip strong {
  display: block;
  font-family: var(--font-d);
  font-size: 1rem;
  margin-bottom: .2rem;
  color: var(--ink);
  font-weight: 700;
}
.gmv-chart-tip .muted { color: var(--muted); font-size: .78rem; margin: 0 0 .55rem; }
.gmv-chart-canvas {
  position: relative;
  width: 100%;
  background: #fff;
}
.gmv-chart-tip svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 560 / 280;
}
.gmv-chart-tip .gmv-hit { cursor: crosshair; }
.gmv-chart-tip .gmv-pt { pointer-events: all; cursor: crosshair; }

.creator-name-cell {
  display: flex;
  align-items: center;
  gap: .25rem;
  min-width: 0;
}
.creator-name-cell .creator-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.creator-name-cell .creator-trend-q {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  font-size: .72rem;
}

.creator-chart-tip {
  position: fixed;
  z-index: 10000;
  width: min(600px, calc(100vw - 1.2rem));
  max-height: min(640px, 92vh);
  overflow: auto;
  padding: .9rem 1rem 1rem;
  border-radius: 12px;
  border: 1px solid #e8eaef;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
  color: var(--ink);
  font-size: .84rem;
  line-height: 1.4;
  pointer-events: auto;
}
.creator-chart-tip strong {
  display: block;
  font-family: var(--font-d);
  font-size: 1.02rem;
  margin-bottom: .15rem;
  font-weight: 700;
}
.creator-chart-tip .creator-trend-meta {
  color: var(--muted);
  font-size: .76rem;
  margin: 0 0 .75rem;
}
.creator-trend-block {
  margin-bottom: .85rem;
}
.creator-trend-block:last-child {
  margin-bottom: 0;
}
.creator-trend-head {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 650;
  color: #374151;
  margin-bottom: .35rem;
}
.creator-trend-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.creator-chart-canvas {
  background: #fff;
  border-radius: 8px;
}
.creator-chart-canvas svg {
  display: block;
  width: 100%;
  height: auto;
}
.creator-chart-canvas .gmv-hit { cursor: crosshair; }
.creator-chart-canvas .gmv-pt { pointer-events: all; cursor: crosshair; }
.gmv-point-tip {
  position: absolute;
  z-index: 2;
  min-width: 96px;
  padding: .4rem .55rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 254, 249, 0.96);
  box-shadow: 0 6px 16px rgba(19, 36, 31, 0.14);
  font-size: .8rem;
  line-height: 1.35;
  pointer-events: none;
  white-space: nowrap;
}
.gmv-point-tip b { font-family: var(--font-d); color: var(--teal-ink); }

td.actions { white-space: nowrap; }
td.actions .btn.link { margin-right: .35rem; }
td.actions .sched-action {
  position: relative;
  z-index: 3;
  cursor: pointer;
  padding: .15rem .25rem;
}
tr.row-accent td { background: rgba(46, 125, 50, 0.08); }

/* —— AI 客服悬浮窗 —— */
.ai-dock {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 80;
  display: flex; flex-direction: column; align-items: flex-end; gap: .6rem;
}
.ai-fab {
  width: 3.25rem; height: 3.25rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--teal); color: #fff;
  font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 107, 92, 0.35);
}
.ai-fab:hover { filter: brightness(1.05); }
.ai-panel {
  position: relative;
  width: min(40rem, calc(100vw - 1.25rem));
  height: min(42rem, calc(100vh - 4.5rem));
  min-width: min(22rem, calc(100vw - 1.25rem));
  min-height: min(26rem, calc(100vh - 4.5rem));
  max-width: calc(100vw - 0.75rem);
  max-height: calc(100vh - 3.5rem);
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 14px;
  background: #fffef9;
  box-shadow: 0 16px 40px rgba(19, 36, 31, 0.18);
  overflow: hidden;
}
.ai-resize {
  position: absolute;
  left: 0; top: 0;
  width: 1.15rem; height: 1.15rem;
  z-index: 5;
  border: 0;
  padding: 0;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, rgba(15, 107, 92, 0.55) 0 2px, transparent 2px) 0 0 / 100% 100%,
    linear-gradient(135deg, transparent 40%, rgba(15, 107, 92, 0.45) 40% 42%, transparent 42%) 0 0 / 100% 100%,
    linear-gradient(135deg, transparent 62%, rgba(15, 107, 92, 0.35) 62% 64%, transparent 64%) 0 0 / 100% 100%;
  border-radius: 14px 0 10px 0;
  opacity: .85;
}
.ai-resize:hover,
.ai-panel.is-resizing .ai-resize {
  opacity: 1;
  background-color: rgba(15, 107, 92, 0.08);
}
.ai-panel.is-resizing {
  user-select: none;
}
.ai-panel[hidden] {
  display: none !important;
}
.ai-panel-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: .75rem; padding: .85rem 1rem .55rem;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 107, 92, 0.06);
}
.ai-panel-head strong { font-family: var(--font-d); font-size: 1.05rem; }
.ai-panel-head .muted { margin: .15rem 0 0; font-size: .78rem; }
.ai-panel-actions { display: flex; gap: .35rem; align-items: center; flex-shrink: 0; }
.ai-mode-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; padding: .45rem .75rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.7);
}
.ai-mode-switch {
  display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  background: #fff;
}
.ai-mode-switch button {
  border: 0; background: transparent; font: inherit; font-size: .72rem;
  padding: .28rem .45rem; cursor: pointer; color: var(--muted);
  white-space: nowrap;
}
.ai-mode-switch button.active {
  background: rgba(15, 107, 92, 0.12);
  color: var(--teal-ink);
  font-weight: 600;
}
.ai-mode-hint {
  font-size: .68rem; color: var(--muted);
  max-width: 7.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-mode-hint.warn { color: #b45309; }
.ai-msgs {
  flex: 1 1 auto; overflow-y: auto; padding: .75rem 1rem;
  display: flex; flex-direction: column; gap: .55rem;
  min-height: 14rem;
}
.ai-bubble {
  max-width: 92%; padding: .55rem .7rem; border-radius: 10px;
  font-size: .88rem; line-height: 1.45; white-space: pre-wrap;
}
.ai-bubble.bot {
  align-self: flex-start;
  background: rgba(19, 36, 31, 0.05);
  border: 1px solid var(--line);
}
.ai-bubble.user {
  align-self: flex-end;
  background: rgba(15, 107, 92, 0.12);
  border: 1px solid rgba(15, 107, 92, 0.2);
}
.ai-bubble.pending { opacity: .7; font-style: italic; }
.ai-bubble.ai-rich {
  max-width: 100%;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  white-space: normal;
}
.ai-result {
  border: 1px solid rgba(15, 107, 92, 0.18);
  border-radius: 12px;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(15, 107, 92, 0.1), transparent 55%),
    linear-gradient(180deg, #fffefb, #f4faf8);
  padding: .75rem .8rem .65rem;
  animation: ai-result-in .35s ease-out;
  box-shadow: 0 6px 18px rgba(19, 36, 31, 0.06);
}
@keyframes ai-result-in {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.ai-result-title {
  font-family: var(--font-d);
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: .55rem;
  color: var(--ink);
}
.ai-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .6rem;
  margin-bottom: .55rem;
}
.ai-result-head .ai-result-title {
  margin-bottom: 0;
  flex: 1 1 auto;
}
.ai-export-btn {
  flex: 0 0 auto;
  font-size: .75rem !important;
  padding: .35rem .65rem !important;
  white-space: nowrap;
}
.ai-result-foot {
  margin-top: .55rem;
  font-size: .68rem;
  color: var(--muted);
}
.ai-result-kpi .ai-kpi {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .55rem .65rem;
  border-radius: 10px;
  background: rgba(15, 107, 92, 0.08);
  border-left: 3px solid var(--teal);
}
.ai-kpi-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
}
.ai-kpi-value {
  font-family: var(--font-d);
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--teal-ink, #0b4f45);
  letter-spacing: -.03em;
  animation: ai-kpi-pop .45s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes ai-kpi-pop {
  from { opacity: 0; transform: scale(.9); }
  to { opacity: 1; transform: none; }
}
.ai-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
}
.ai-field {
  padding: .4rem .5rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(15, 107, 92, 0.1);
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}
.ai-field span {
  font-size: .68rem;
  color: var(--muted);
  font-weight: 600;
}
.ai-field strong {
  font-family: var(--font-d);
  font-size: .95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-table-wrap {
  overflow: auto;
  border-radius: 8px;
  border: 1px solid rgba(15, 107, 92, 0.12);
  background: rgba(255, 255, 255, 0.85);
}
.ai-table-wrap.ai-table-scroll {
  max-height: min(52vh, 420px);
}
.ai-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .76rem;
}
.ai-table th,
.ai-table td {
  padding: .35rem .45rem;
  text-align: left;
  border-bottom: 1px solid rgba(19, 36, 31, 0.06);
  white-space: nowrap;
}
.ai-table th {
  font-size: .68rem;
  color: var(--muted);
  font-weight: 700;
  background: rgba(15, 107, 92, 0.06);
  position: sticky;
  top: 0;
}
.ai-table tbody tr {
  animation: ai-row-in .3s ease-out both;
  animation-delay: calc(var(--i, 0) * 28ms);
}
.ai-table tbody tr:hover { background: rgba(15, 107, 92, 0.04); }
.ai-table .ai-idx {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  width: 1.5rem;
}
@keyframes ai-row-in {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 1; transform: none; }
}
.ai-empty {
  padding: .65rem .7rem;
  border-radius: 8px;
  background: rgba(19, 36, 31, 0.04);
  color: var(--muted);
  font-size: .82rem;
}
.ai-suggest {
  display: flex; flex-wrap: wrap; gap: .35rem;
  padding: 0 .75rem .5rem;
}
.ai-suggest .chip {
  border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: .2rem .55rem;
  font: inherit; font-size: .75rem; cursor: pointer; color: var(--muted);
}
.ai-suggest .chip:hover { color: var(--teal-ink); border-color: var(--teal); }
.ai-input {
  display: flex; gap: .4rem; padding: .65rem .75rem .8rem;
  border-top: 1px solid var(--line);
}
.ai-input input {
  flex: 1; border: 1px solid var(--line); border-radius: 8px;
  padding: .45rem .6rem; font: inherit; background: #fff;
}
body.ai-open .ai-fab { display: none; }

.qa-list {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  margin-top: .5rem;
}
.qa-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,249,.95));
  animation: rise .35s ease both;
}
.qa-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .75rem;
  align-items: center;
  margin-bottom: .65rem;
  font-size: .78rem;
  color: var(--muted, #6b7280);
}
.qa-card-meta .badge-mode {
  display: inline-block;
  padding: .1rem .45rem;
  border-radius: 4px;
  font-size: .72rem;
  border: 1px solid var(--line);
  background: #fff;
}
.qa-card-meta .badge-mode.llm {
  border-color: #9ec9b8;
  color: var(--teal-ink, #0f5c4c);
  background: rgba(158, 201, 184, .25);
}
.qa-q, .qa-a {
  margin: 0 0 .55rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}
.qa-q {
  font-weight: 600;
  color: var(--ink, #1a1f1c);
}
.qa-a {
  color: #374151;
  padding-left: .65rem;
  border-left: 3px solid var(--teal, #2a9d8f);
}
.qa-refs {
  margin: .4rem 0 0;
  font-size: .75rem;
  color: var(--muted, #6b7280);
}

.trends-block {
  margin: 1.6rem 0 1.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line, rgba(19,36,31,.12));
}
.trends-filters {
  align-items: center;
  flex-wrap: wrap;
  gap: .65rem .85rem;
}

/* —— 日期范围选择器（双月历 + 预设） —— */
.drp {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.drp-trigger {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-width: 15.5rem;
  padding: .45rem .7rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font-size: .88rem;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.3;
}
.drp-trigger:hover { border-color: #0d9488; }
.drp-trigger.is-open {
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .15);
}
.drp-trigger-text {
  flex: 1;
  text-align: left;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.drp-trigger-ico { color: #9ca3af; flex-shrink: 0; }
.drp-panel {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10050;
  display: flex;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .14);
  overflow: hidden;
  min-width: 0;
}
.drp-panel[hidden] { display: none !important; }
.drp-compact .drp-trigger {
  min-width: 13.5rem;
  padding: .38rem .6rem;
  font-size: .84rem;
}
.drp-field {
  display: inline-flex;
  flex-direction: column;
  gap: .25rem;
  align-items: flex-start;
}
.drp-field-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted, #6b7280);
  letter-spacing: .02em;
}
.board-head-right .drp {
  flex-shrink: 0;
}
.drp-presets {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .75rem .55rem;
  border-right: 1px solid #f0f0f0;
  background: #fafafa;
  min-width: 6.5rem;
}
.drp-presets button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: .45rem .55rem;
  border-radius: 6px;
  font-size: .82rem;
  color: #374151;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.drp-presets button:hover { background: #f0fdfa; color: #0f766e; }
.drp-presets button.is-active {
  background: #ccfbf1;
  color: #0f766e;
  font-weight: 600;
}
.drp-main { padding: .65rem .85rem .85rem; }
.drp-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .5rem;
  margin-bottom: .45rem;
}
.drp-nav-left,
.drp-nav-right { display: inline-flex; gap: .15rem; }
.drp-nav-titles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  text-align: center;
  font-size: .9rem;
  font-weight: 650;
  color: #111827;
}
.drp-nav-btn {
  border: 0;
  background: transparent;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
  font-size: 1rem;
  line-height: 1;
  font-family: inherit;
}
.drp-nav-btn:hover { background: #f3f4f6; color: #111827; }
.drp-cals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.drp-cal { min-width: 224px; }
.drp-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: .2rem;
}
.drp-week span {
  text-align: center;
  font-size: .72rem;
  color: #9ca3af;
  padding: .25rem 0;
  font-weight: 500;
}
.drp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}
.drp-day {
  position: relative;
  border: 0;
  background: transparent;
  height: 32px;
  font-size: .82rem;
  color: #111827;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  border-radius: 0;
}
.drp-day:hover:not(:disabled):not(.is-start):not(.is-end) {
  background: #f3f4f6;
}
.drp-day.is-out {
  color: #d1d5db;
}
.drp-day.is-in-range {
  background: #f3f4f6;
}
.drp-day.is-start,
.drp-day.is-end {
  background: #0d9488;
  color: #fff;
  font-weight: 700;
  border-radius: 4px;
  z-index: 1;
}
.drp-day.is-start.is-in-range {
  border-radius: 4px 0 0 4px;
}
.drp-day.is-end.is-in-range {
  border-radius: 0 4px 4px 0;
}
.drp-day.is-start.is-end {
  border-radius: 4px;
}
.drp-day.is-today::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #0d9488;
  transform: translateX(-50%);
}
.drp-day.is-start.is-today::after,
.drp-day.is-end.is-today::after {
  background: #fff;
}
.drp-day:disabled {
  cursor: default;
  opacity: .45;
}

@media (max-width: 720px) {
  .drp-panel {
    flex-direction: column;
    left: 0;
    right: auto;
    max-width: min(96vw, 360px);
  }
  .drp-presets {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid #f0f0f0;
    min-width: 0;
  }
  .drp-cals { grid-template-columns: 1fr; }
  .drp-nav-titles { grid-template-columns: 1fr; }
  .drp-nav-titles span:last-child { display: none; }
  .drp-cal:last-child { display: none; }
}
.channel-checks {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .55rem 1rem;
  align-items: center;
}
.channel-checks legend {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0;
  margin: 0 .4rem 0 0;
}
.channel-checks label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .88rem;
  font-weight: 600;
}
.trends-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .7rem;
  margin: .9rem 0 1rem;
}
.trends-summary .stat {
  border-top: 2px solid var(--ink);
  padding-top: .45rem;
}
.trends-summary .stat span {
  display: block;
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.trends-summary .stat strong {
  font-family: var(--font-d);
  font-size: 1.35rem;
  font-weight: 700;
}
.trends-subhead {
  margin: 0 0 .55rem;
  font-family: var(--font-d);
  font-size: 1.05rem;
  letter-spacing: -.01em;
}
.trends-volume-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem 1rem;
  margin-bottom: .35rem;
}
.volume-checks { margin: 0; }
.trends-smart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}
.trends-smart-charts { min-width: 0; }
.trends-insight {
  position: sticky;
  top: .75rem;
  max-height: calc(100vh - 1.5rem);
  overflow: auto;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line, rgba(19,36,31,.12));
  border-radius: 6px;
  padding: .85rem .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
}
.trends-analytics { display: flex; flex-direction: column; gap: .65rem; }
.trends-an-sec {
  border-top: 1px solid rgba(19,36,31,.1);
  padding-top: .55rem;
}
.trends-an-sec h4 {
  margin: 0 0 .4rem;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.trends-an-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem .55rem;
}
.trends-an-grid .kpi {
  border-top: 2px solid rgba(19,36,31,.18);
  padding-top: .25rem;
}
.trends-an-grid .kpi span {
  display: block;
  font-size: .68rem;
  color: var(--muted);
  font-weight: 600;
}
.trends-an-grid .kpi strong {
  font-family: var(--font-d);
  font-size: .98rem;
}
.trends-an-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .8rem;
  line-height: 1.4;
}
.trends-an-list li {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  padding: .18rem 0;
  border-bottom: 1px dashed rgba(19,36,31,.08);
}
.trends-an-list li:last-child { border-bottom: 0; }
.trends-an-list .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trends-an-warn {
  margin: .35rem 0 0;
  font-size: .78rem;
  color: #9a3412;
  background: rgba(251,146,60,.12);
  padding: .35rem .45rem;
  border-radius: 4px;
}
.trends-an-chip {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: .1rem .35rem;
  border-radius: 3px;
  background: rgba(15,107,92,.1);
  color: #0f6b5c;
  margin: 0 .25rem .25rem 0;
}
.trends-insight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.trends-insight-head h3 {
  margin: 0;
  font-family: var(--font-d);
  font-size: 1.02rem;
}
.trends-insight-note {
  margin: 0;
  font-size: .78rem;
  line-height: 1.35;
}
.trends-compare {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.trends-compare .cmp-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .35rem .6rem;
  align-items: baseline;
  padding: .4rem 0;
  border-top: 1px solid rgba(19,36,31,.08);
}
.trends-compare .cmp-row:first-child { border-top: 0; padding-top: 0; }
.trends-compare .cmp-label {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
}
.trends-compare .cmp-vals {
  text-align: right;
  font-size: .82rem;
}
.trends-compare .cmp-vals strong {
  font-family: var(--font-d);
  font-size: 1.05rem;
  display: block;
}
.trends-compare .cmp-pct {
  font-weight: 700;
  font-size: .8rem;
}
.trends-compare .cmp-up { color: #0f766e; }
.trends-compare .cmp-down { color: #b42318; }
.trends-compare .cmp-flat { color: var(--muted); }
.trends-ai-card {
  border-top: 1px solid rgba(19,36,31,.1);
  padding-top: .65rem;
}
.trends-ai-head {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: baseline;
  margin-bottom: .45rem;
  font-size: .82rem;
}
.trends-ai-body {
  font-size: .88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--ink);
  min-height: 4.5rem;
}
.trends-ai-body.is-error { color: #b42318; }
.trends-ai-body.is-loading { color: var(--muted); }
@media (max-width: 980px) {
  .trends-smart-row { grid-template-columns: 1fr; }
  .trends-insight { position: static; }
}
.trends-chart-wrap {
  background: rgba(255,255,255,.55);
  border: 1px solid var(--line, rgba(19,36,31,.1));
  border-radius: 4px;
  padding: .75rem .9rem .4rem;
  margin-bottom: 1rem;
}
.trends-chart {
  width: 100%;
  height: auto;
  display: block;
}
.trends-chart-interactive { cursor: crosshair; }
.trends-chart .axis { stroke: rgba(19,36,31,.18); stroke-width: 1; }
.trends-chart .grid-line { stroke: rgba(19,36,31,.08); stroke-width: 1; }
.trends-chart .series-line { fill: none; stroke-width: 2.2; pointer-events: none; }
.trends-chart .series-dot { stroke: #fff; stroke-width: 1.5; }
.trends-chart .legend-text { font-size: 12px; fill: var(--muted); font-family: var(--font-b); pointer-events: none; }
.trends-chart .trends-hits { pointer-events: all; }
.trends-chart .trends-hit { cursor: crosshair; }
.trends-chart .trends-guide {
  stroke: rgba(19,36,31,.35);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  pointer-events: none;
}
.trends-chart .trends-hover { pointer-events: none; }
.trends-chart-tip {
  position: fixed;
  z-index: 10001;
  min-width: 140px;
  max-width: 260px;
  padding: .55rem .7rem;
  border-radius: 6px;
  border: 1px solid var(--line, rgba(19,36,31,.14));
  background: #fff;
  box-shadow: 0 10px 28px rgba(19, 36, 31, 0.16);
  color: var(--ink);
  font-size: .82rem;
  line-height: 1.35;
  pointer-events: none;
}
.trends-tip-date {
  font-family: var(--font-d);
  font-weight: 700;
  margin-bottom: .35rem;
  font-size: .9rem;
}
.trends-tip-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: .4rem .55rem;
  align-items: center;
  margin-top: .2rem;
}
.trends-tip-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.trends-tip-row strong {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.trends-table-shell {
  max-height: 280px;
  overflow: auto;
}

.btn-help-q {
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #6b7280;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.btn-help-q:hover { color: #111827; border-color: #cbd5e1; background: #f8fafc; }

.gmv-bd-wrap.trends-chart-wrap,
.gmv-bd-wrap {
  overflow: visible;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1rem 1.15rem 1.05rem;
  margin-bottom: 1rem;
}
.gmv-bd-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: .65rem 1rem;
  margin-bottom: .85rem;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.gmv-bd-title-block { min-width: 0; }
.gmv-bd-title-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.gmv-bd-title-row .trends-subhead {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1f2937;
  font-family: var(--font-d);
}
.gmv-bd-note {
  margin: .3rem 0 0;
  font-size: .78rem;
  color: #9ca3af;
  line-height: 1.45;
  max-width: 36rem;
}
.gmv-bd-toggle {
  display: inline-flex;
  border-radius: 8px;
  background: #f3f4f6;
  padding: 3px;
  gap: 0;
  flex-shrink: 0;
}
.gmv-bd-tab {
  border: 0;
  background: transparent;
  padding: .4rem .95rem;
  font-size: .82rem;
  cursor: pointer;
  color: #6b7280;
  border-radius: 6px;
}
.gmv-bd-tab.is-active {
  background: #fff;
  color: #111827;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}
.gmv-bd-body {
  display: block;
  min-width: 0;
}

/* 主区：左环图+图例 | 右明细 —— 强制左右，不随窄屏改上下 */
.gmv-bd-card {
  display: grid !important;
  grid-template-columns: minmax(280px, 38%) minmax(320px, 1fr) !important;
  gap: 1.25rem 1.75rem;
  align-items: center;
  min-width: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}
.gmv-bd-left {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  gap: 1rem 1.15rem;
  min-width: 0;
}
.gmv-bd-pie-stage {
  flex: 0 0 168px;
  width: 168px;
  height: 168px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gmv-bd-donut {
  width: 168px !important;
  height: 168px !important;
  display: block;
}
.gmv-bd-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-width: 7.5rem;
}
.gmv-bd-legend li {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: .45rem;
  align-items: center;
  padding: .35rem 0;
  min-width: 0;
  border: 0;
}
.gmv-bd-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.gmv-bd-leg-nm {
  font-size: .82rem;
  color: #4b5563;
  font-weight: 500;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gmv-bd-leg-pct {
  font-size: .82rem;
  color: #111827;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gmv-bd-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}
.gmv-bd-dot.is-empty { visibility: hidden; }

.gmv-bd-tree {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border-top: 1px solid #f0f0f0;
}
.gmv-bd-node { min-width: 0; }
.gmv-bd-row {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center;
  gap: .45rem .55rem;
  min-height: 2.55rem;
  padding: .55rem .15rem;
  border-radius: 0;
  border-bottom: 1px solid #f0f0f0;
  background: transparent !important;
  box-shadow: none !important;
  border-left: 0 !important;
}
.gmv-bd-row:hover { background: #fafafa !important; }
.gmv-bd-node.depth-0 > .gmv-bd-row {
  min-height: 2.7rem;
}
.gmv-bd-node.depth-0.is-open > .gmv-bd-row {
  border-bottom-color: #f0f0f0;
}
.gmv-bd-node.depth-1 > .gmv-bd-row {
  min-height: 2.35rem;
  padding-left: 1.65rem;
}
.gmv-bd-chevron,
.gmv-bd-chevron-spacer {
  width: 18px;
  height: 18px;
  border: 0;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: .7rem;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
}
.gmv-bd-chevron:hover { color: #111827; background: transparent; }
.gmv-bd-chevron-spacer { visibility: hidden; cursor: default; }
.gmv-bd-node:not(.is-open) > .gmv-bd-row .gmv-bd-chevron {
  transform: rotate(-90deg);
}
.gmv-bd-label {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .25rem .45rem;
  min-width: 0;
  flex: 1 1 auto;
}
.gmv-bd-name {
  font-size: .92rem;
  color: #111827;
  font-weight: 600;
}
.gmv-bd-node.depth-1 .gmv-bd-name {
  font-size: .88rem;
  font-weight: 500;
  color: #374151;
}
.gmv-bd-share {
  display: inline;
  font-size: .78rem;
  font-weight: 400;
  color: #9ca3af;
  background: transparent;
  border-radius: 0;
  padding: 0;
  line-height: 1.3;
}
.gmv-bd-node.depth-1 .gmv-bd-share {
  color: #9ca3af;
  background: transparent;
  font-weight: 400;
}
.gmv-bd-right {
  display: inline-flex !important;
  align-items: center;
  gap: .55rem;
  justify-content: flex-end;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: 0 0 auto;
  margin-left: auto;
}
.gmv-bd-amt {
  font-size: .95rem;
  font-weight: 700;
  color: #111827;
  min-width: 5.5rem;
  text-align: right;
  letter-spacing: -.01em;
}
.gmv-bd-node.depth-1 .gmv-bd-amt {
  font-size: .9rem;
  font-weight: 600;
}
.gmv-bd-trend {
  display: inline-flex;
  align-items: center;
  gap: .15rem;
  font-size: .8rem;
  font-weight: 600;
  min-width: 4.2rem;
  justify-content: flex-end;
  padding: 0;
  border-radius: 0;
  line-height: 1.2;
  background: transparent !important;
}
.gmv-bd-trend.cmp-up { color: #16a34a; }
.gmv-bd-trend.cmp-down { color: #dc2626; }
.gmv-bd-trend.cmp-flat { color: #9ca3af; }
.gmv-bd-arrow { font-size: .65rem; }
.gmv-bd-spark {
  border: 0;
  background: transparent;
  color: #9ca3af;
  padding: .2rem;
  cursor: pointer;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  line-height: 0;
}
.gmv-bd-spark:hover { background: #f3f4f6; color: #4b5563; }
.gmv-bd-kids {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
#gmv-breakdown-meta {
  margin: .65rem 0 0;
  font-size: .78rem;
  color: #9ca3af;
}

.trends-summary.gmv-bd-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  margin: .9rem 0 1rem;
}
.trends-summary.gmv-bd-kpis .board-kpi {
  padding: 1rem 1.15rem 1.05rem;
}
.trends-summary.gmv-bd-kpis .board-kpi strong {
  font-size: 1.65rem;
}
.trends-summary.gmv-bd-kpis .board-kpi em {
  display: inline-block;
  margin-top: .4rem;
  font-style: normal;
  font-size: .82rem;
  font-weight: 700;
  padding: .15rem .4rem;
  border-radius: 6px;
}
.trends-summary.gmv-bd-kpis .board-kpi em.cmp-up { color: #15803d; background: #dcfce7; }
.trends-summary.gmv-bd-kpis .board-kpi em.cmp-down { color: #b91c1c; background: #fee2e2; }
.trends-summary.gmv-bd-kpis .board-kpi em.cmp-flat { color: #64748b; background: #f1f5f9; }
.trends-summary.gmv-bd-kpis .kpi-total strong { color: #111827; }
.trends-summary.gmv-bd-kpis .kpi-aff strong { color: #0f766e; }
.trends-summary.gmv-bd-kpis .kpi-sel strong { color: #ca8a04; }

/* 折线弹窗：对齐数据总看板 */
.gmv-bd-lines-panel {
  width: min(1080px, 96vw);
  max-height: min(900px, 92vh);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #f0f2f5;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
}
.gmv-bd-lines-panel .board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.2rem;
  background: #fff;
  border-bottom: 1px solid #e8eaef;
  margin: 0;
  flex-shrink: 0;
}
.gmv-bd-lines-panel .board-head h3 {
  margin: 0;
  font-family: var(--font-d);
  font-size: 1.15rem;
  font-weight: 700;
  color: #111827;
}
.gmv-lines-body {
  padding: .9rem 1rem 1rem;
  overflow: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.gmv-lines-card {
  background: #fff;
  border: 1px solid #e8eaef;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.gmv-lines-filters { padding: .85rem 1rem; }
.gmv-lines-filters-title {
  font-size: .9rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: .55rem;
}
.gmv-lines-checks {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 0;
}
.gmv-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .38rem .75rem;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  font-size: .84rem;
  color: #374151;
  cursor: pointer;
  user-select: none;
}
.gmv-chip:has(input:checked) {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
  font-weight: 600;
}
.gmv-chip input { accent-color: #0f766e; }
.gmv-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.gmv-lines-chart-card {
  padding: .85rem 1rem .65rem;
}
.gmv-lines-chart-card .trends-chart {
  background: #fff;
  border-radius: 8px;
  min-height: 320px;
}
.gmv-lines-meta {
  margin: .45rem .15rem .15rem;
  font-size: .78rem;
  color: #64748b;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .trends-summary.gmv-bd-kpis { grid-template-columns: 1fr; }
  .gmv-bd-card {
    grid-template-columns: 1fr !important;
  }
  .gmv-bd-left {
    justify-content: flex-start;
  }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes slide {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 980px) {
  .hero, .split { grid-template-columns: 1fr; }
  .hero { flex-direction: column; }
  .overview-data-freshness { margin-left: 0; width: 100%; flex: 1 1 auto; }
  .funnel { grid-template-columns: repeat(2, 1fr); }
  .ops-volume-bars-summary { grid-template-columns: repeat(2, 1fr); }
  .gmv-target-plan-summary.trends-summary { grid-template-columns: repeat(3, 1fr); }
  .trends-summary { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .hero-stats, .kv-grid, .funnel { grid-template-columns: 1fr; }
  .ops-volume-bars-summary { grid-template-columns: 1fr; }
  .gmv-target-plan-summary { grid-template-columns: 1fr; }
  .trends-summary { grid-template-columns: 1fr; }
  main { padding: 1rem; }
}

/* —— 月度总看板（视频汇总 ❓）—— */
.board-q {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: .4rem; vertical-align: middle;
  width: 1.4rem; height: 1.4rem; padding: 0;
  border: 1px solid #d1d5db; border-radius: 999px;
  background: #fff; color: #6b7280; font-size: .8rem; cursor: pointer;
  line-height: 1; transition: .15s ease;
}
.board-q:hover {
  color: #0f766e; border-color: #5eead4; background: #f0fdfa;
  box-shadow: 0 0 0 3px rgba(45,212,191,.18);
}

.monthly-board-panel {
  width: min(1120px, 96vw);
  max-height: min(900px, 92vh);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #f0f2f5;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
}
.monthly-board-panel .board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.2rem;
  background: #fff;
  border-bottom: 1px solid #e8eaef;
  margin: 0;
  flex-shrink: 0;
}
.monthly-board-panel .board-head h3 {
  margin: 0;
  font-family: var(--font-d);
  font-size: 1.15rem;
  font-weight: 700;
  color: #111827;
}
.board-head-right {
  display: flex; align-items: center; gap: .55rem; flex-shrink: 0;
}
.board-month-pick {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .82rem; color: #6b7280; background: #f9fafb;
  border: 1px solid #e5e7eb; border-radius: 8px; padding: .22rem .5rem .22rem .65rem;
}
.board-month-pick input {
  border: 0; background: transparent; font: inherit; color: #111827;
  padding: .1rem 0; outline: none; width: 10.5rem;
}
.board-close {
  width: 2rem; height: 2rem; border: 0; border-radius: 8px;
  background: transparent; color: #9ca3af; font-size: 1.35rem; cursor: pointer; line-height: 1;
}
.board-close:hover { background: #f3f4f6; color: #111827; }

.board-body {
  padding: .9rem 1rem 1rem;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.board-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: .75rem;
}
.board-kpi {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8eaef;
  padding: .95rem 1.1rem 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  overflow: hidden;
}
.board-kpi span {
  display: block;
  font-size: .9rem;
  color: #6b7280;
  margin-bottom: .55rem;
  font-weight: 500;
  white-space: nowrap;
}
.board-kpi strong {
  display: block;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-kpi.kpi-video strong { color: #22c55e; }
.board-kpi.kpi-live strong { color: #3b82f6; }
.board-kpi.kpi-sample strong { color: #f59e0b; }

.board-charts {
  display: grid;
  grid-template-columns: 1.35fr .9fr;
  gap: .75rem;
  align-items: stretch;
}
.board-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8eaef;
  padding: .9rem 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.board-card-title {
  margin: 0 0 .7rem;
  font-size: .98rem;
  font-weight: 650;
  color: #111827;
  flex-shrink: 0;
}
.board-pie-wrap {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: .85rem 1rem;
  align-items: center;
  min-width: 0;
  flex: 1;
}
.board-pie-stage {
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.board-pie {
  width: 220px;
  height: 220px;
  display: block;
}
.board-pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow: auto;
  min-width: 0;
}
.board-pie-legend li {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: .45rem;
  align-items: center;
  padding: .38rem 0;
  border-bottom: 1px solid #f3f4f6;
  min-width: 0;
}
.board-pie-legend .swatch {
  width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0;
}
.board-pie-legend .nm {
  min-width: 0;
  font-size: .78rem;
  color: #374151;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-pie-legend .amt {
  flex-shrink: 0;
  font-size: .72rem;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}
.board-pie path.board-slice,
.board-pie circle.board-slice {
  cursor: pointer;
  transition: opacity .12s ease, filter .12s ease;
}
.board-pie path.board-slice:hover,
.board-pie circle.board-slice:hover {
  filter: brightness(1.08);
  opacity: 1;
}
.board-pie.is-hovering path.board-slice:not(:hover),
.board-pie.is-hovering circle.board-slice:not(:hover) {
  opacity: .55;
}
.board-pie-tip {
  position: fixed;
  z-index: 90;
  min-width: 280px;
  max-width: min(420px, 92vw);
  padding: .85rem 1rem .95rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
  pointer-events: none;
  color: #111827;
}
.board-pie-tip[hidden] { display: none; }
.board-pie-tip .tip-head {
  display: flex; align-items: flex-start; gap: .55rem; margin-bottom: .65rem;
}
.board-pie-tip .tip-swatch {
  width: 12px; height: 12px; border-radius: 3px; margin-top: .28rem; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.board-pie-tip .tip-name {
  font-size: .95rem; font-weight: 650; line-height: 1.4;
  word-break: break-word;
}
.board-pie-tip .tip-rank {
  display: inline-block;
  margin-bottom: .35rem;
  font-size: .72rem;
  color: #6b7280;
  background: #f3f4f6;
  border-radius: 999px;
  padding: .12rem .45rem;
}
.board-pie-tip .tip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem .75rem;
  border-top: 1px solid #f3f4f6;
  padding-top: .7rem;
}
.board-pie-tip .tip-grid div span {
  display: block; font-size: .72rem; color: #9ca3af; margin-bottom: .2rem;
}
.board-pie-tip .tip-grid div strong {
  display: block; font-size: 1.05rem; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.board-pie-tip .tip-grid .pct strong { color: #0f766e; }
.board-tiers {
  width: 100%;
  height: 280px;
  display: block;
}
.board-tier-note {
  margin: .4rem 0 0;
  font-size: .72rem;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-meta {
  margin: .65rem 0 0;
  font-size: .72rem;
  color: #9ca3af;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 980px) {
  .board-kpis, .board-charts { grid-template-columns: 1fr; }
  .board-pie-wrap { grid-template-columns: 1fr; justify-items: center; }
  .board-pie-legend { width: 100%; max-height: 200px; }
  .board-kpi strong { font-size: 1.85rem; }
}

/* —— 寄样追踪 ❓ 当月各 PID 进度 —— */
.sample-pid-monthly-panel {
  width: min(920px, 96vw);
  max-height: min(820px, 92vh);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #f0f2f5;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
}
.sample-pid-monthly-panel .board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.2rem;
  background: #fff;
  border-bottom: 1px solid #e8eaef;
  margin: 0;
  flex-shrink: 0;
}
.sample-pid-monthly-panel .board-head h3 {
  margin: 0;
  font-family: var(--font-d);
  font-size: 1.15rem;
  font-weight: 700;
  color: #111827;
}
.sample-pid-hint {
  margin: 0;
  padding: .55rem 1.2rem 0;
  font-size: .78rem;
  flex-shrink: 0;
}
.sample-pid-table-wrap {
  padding: .65rem 1rem 1rem;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.sample-pid-grid {
  width: 100%;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8eaef;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.sample-pid-grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fafb;
}
.sample-pid-grid .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sample-pid-name {
  min-width: 12rem;
  max-width: 28rem;
}
.sample-pid-tag {
  display: inline-block;
  max-width: 100%;
  padding: .28rem .55rem;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.listing-badge {
  display: inline-block;
  padding: .15rem .45rem;
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 600;
}
.listing-badge.listing-active {
  background: #dcfce7;
  color: #166534;
}
.listing-badge.listing-delisted {
  background: #f3f4f6;
  color: #6b7280;
}
.sample-pid-target {
  width: 5.5rem;
  padding: .28rem .45rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font: inherit;
  font-size: .88rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  background: #fff;
}
.sample-pid-target:focus {
  outline: none;
  border-color: #5eead4;
  box-shadow: 0 0 0 3px rgba(45, 212, 191, .18);
}
.sample-pid-pct {
  display: inline-block;
  min-width: 3.2rem;
  font-weight: 700;
  font-size: .92rem;
}
.sample-pid-pct.done { color: #16a34a; }
.sample-pid-pct.mid { color: #d97706; }
.sample-pid-pct.low { color: #dc2626; }
.sample-pid-no-target {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #b45309;
  font-weight: 700;
  font-size: .82rem;
}
.sample-pid-grid td.empty {
  text-align: center;
  color: #9ca3af;
  padding: 2rem 1rem;
}

/* —— 任务调度 —— */
.scheduler-bg-jobs {
  margin: 0 0 .75rem;
  padding: .55rem .75rem .6rem;
  border-radius: 10px;
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: #9a3412;
  max-width: min(42rem, 100%);
}
.scheduler-bg-jobs[hidden] { display: none !important; }
.scheduler-bg-jobs.is-idle {
  border-color: var(--line);
  background: rgba(255,255,255,.72);
  color: var(--muted);
}
.scheduler-bg-jobs-title {
  font-size: .78rem;
  font-weight: 700;
  margin: 0 0 .35rem;
  letter-spacing: .02em;
}
.scheduler-bg-jobs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .28rem;
}
.scheduler-bg-jobs-list li {
  font-size: .82rem;
  line-height: 1.35;
  display: flex;
  flex-wrap: wrap;
  gap: .2rem .55rem;
  align-items: baseline;
}
.scheduler-bg-jobs-list .bgj-kind { font-weight: 700; color: inherit; }
.scheduler-bg-jobs-list .bgj-shop { font-weight: 600; opacity: .92; }
.scheduler-bg-jobs-list .bgj-msg { opacity: .88; }
.scheduler-bg-jobs-list .bgj-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  margin-left: auto;
}
.subtabs {
  display: flex; flex-wrap: wrap; gap: .35rem;
  margin: 0 0 1rem; padding: 0;
}
.subtab {
  font: inherit; font-weight: 600; font-size: .9rem;
  border: 1px solid var(--line); border-radius: 999px;
  padding: .35rem .85rem; background: rgba(255,255,255,.55);
  color: var(--muted); cursor: pointer;
}
.subtab.active {
  background: rgba(15,107,92,.12); color: var(--teal-ink);
  border-color: rgba(15,107,92,.28);
}
.sched-pane { display: none; }
.sched-pane.active { display: block; }
.local-job-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.15rem;
  background: rgba(255,255,255,.72);
}
.local-job-card .filters {
  margin-top: .35rem;
}
.feishu-search-results {
  margin: .55rem 0 .25rem;
  padding: .55rem .65rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.55);
  max-height: 220px;
  overflow: auto;
}
.feishu-search-item {
  display: grid;
  grid-template-columns: minmax(4rem,auto) minmax(0,1fr) auto;
  gap: .35rem .75rem;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid rgba(0,0,0,.06);
  background: transparent;
  padding: .45rem .2rem;
  cursor: pointer;
  font: inherit;
}
.feishu-search-item:last-child { border-bottom: 0; }
.feishu-search-item:hover { background: rgba(37,99,235,.06); }
.feishu-search-item code {
  font-size: .78rem;
  word-break: break-all;
}
.local-job-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .85rem 1rem;
  margin-bottom: .75rem;
  background: rgba(255,255,255,.65);
}
.local-job-item-head {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .75rem;
  align-items: baseline;
}
.local-job-item .chip {
  font-size: .72rem;
  padding: .1rem .45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.sched-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem; margin-bottom: 1rem;
}
.sched-stat {
  border: 1px solid var(--line); border-radius: 12px;
  padding: .85rem 1rem; background: var(--paper);
}
.sched-stat .k { font-size: .78rem; color: var(--muted); font-weight: 600; }
.sched-stat .v {
  margin-top: .2rem; font-family: var(--font-d);
  font-size: 1.45rem; font-weight: 800; color: var(--teal-ink);
}
.sched-dispatch-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem 1rem; margin-bottom: .75rem;
}
.sched-dispatch label,
.sched-fields label,
.sched-block {
  display: flex; flex-direction: column; gap: .25rem;
  font-size: .82rem; font-weight: 600; color: var(--muted);
}
.sched-block { margin-bottom: .75rem; }
.sched-dispatch input,
.sched-dispatch select,
.sched-dispatch textarea,
.sched-fields input,
.sched-fields textarea {
  font: inherit; font-weight: 500; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  padding: .45rem .6rem; background: rgba(255,255,255,.8);
}
.sched-fields { display: none; margin-bottom: .75rem; }
.sched-fields.on {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem 1rem;
}
.sched-fields .full,
.sched-dispatch .full { grid-column: 1 / -1; }
.sched-fields label.check {
  flex-direction: row; align-items: center; gap: .45rem;
  grid-column: 1 / -1;
}
.task-type-selector {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .5rem;
  margin-bottom: 1rem;
}
.task-type-btn {
  display: flex; flex-direction: column; gap: .15rem;
  text-align: left;
  font: inherit; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px;
  padding: .65rem .75rem; background: rgba(255,255,255,.7);
  color: var(--ink);
}
.task-type-btn .ttl { font-weight: 700; font-size: .9rem; }
.task-type-btn .desc { font-size: .72rem; color: var(--muted); font-weight: 500; }
.task-type-btn.active {
  border-color: rgba(15,107,92,.45);
  background: rgba(15,107,92,.12);
  color: var(--teal-ink);
}
@media (max-width: 800px) {
  .sched-stats,
  .sched-dispatch-grid,
  .sched-fields.on,
  .task-type-selector { grid-template-columns: 1fr; }
}

/* ----- Affiliate IM 聊天（对照 ui_demo，变量贴合站点） ----- */
/* 聊天页：整页高度锁死，左右各自内部滚动，避免整站外层滚动 */
#panel-chat.active {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 10.25rem);
  max-height: calc(100dvh - 10.25rem);
  min-height: 420px;
  overflow: hidden;
}
body.nav-tab-chat {
  overflow: hidden;
}
body.nav-tab-chat main {
  padding-bottom: 1rem;
}
#panel-chat .panel-head {
  flex: 0 0 auto;
  margin-bottom: .5rem;
}
.im-chat-app {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.im-chat-sidebar {
  border-right: 1px solid var(--line);
  background: rgba(247, 248, 250, 0.95);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.im-chat-side-head {
  flex: 0 0 auto;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.im-chat-search input {
  width: 100%;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .45rem .75rem;
  background: #fff;
}
.im-chat-thread-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.im-chat-thread {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.im-chat-thread.active {
  border-color: rgba(15, 107, 92, 0.35);
  box-shadow: inset 0 0 0 1px rgba(15, 107, 92, 0.25);
}
.im-chat-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(145deg, #cfd8e3, #9aa8b8);
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; flex: none;
}
.im-chat-name { font-size: 14px; font-weight: 600; }
.im-chat-preview {
  margin-top: 2px; font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.im-chat-meta { margin-top: 4px; font-size: 11px; color: var(--muted); opacity: .9; }
.im-chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #f0f2f5;
}
.im-chat-head {
  flex: 0 0 auto;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.im-chat-title { font-size: 16px; font-weight: 700; }
.im-chat-sub { font-size: 12px; color: var(--muted); }
.im-chat-feed {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px 24px;
  background-image: radial-gradient(rgba(0,0,0,0.015) 0.6px, transparent 0.6px);
  background-size: 18px 18px;
}
.im-chat-empty {
  text-align: center; color: var(--muted); font-size: 13px; padding: 24px 12px;
}
.im-chat-day, .im-chat-system {
  text-align: center; color: var(--muted); font-size: 12px; margin: 10px 0 14px;
}
.im-chat-row {
  display: flex; margin: 0 0 14px; gap: 8px; align-items: flex-end;
}
.im-chat-row.seller { justify-content: flex-end; }
.im-chat-row.creator { justify-content: flex-start; }
.im-chat-stack {
  max-width: min(520px, 78%);
  display: flex; flex-direction: column; gap: 6px;
}
.im-chat-row.seller .im-chat-stack { align-items: flex-end; }
.im-chat-row.creator .im-chat-stack { align-items: flex-start; }
.im-chat-who {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
}
.im-chat-mini {
  width: 18px; height: 18px; border-radius: 50%;
  background: #c5ced8; color: #fff;
  display: grid; place-items: center; font-size: 9px; font-weight: 700;
}
.im-chat-row.seller .im-chat-mini { background: var(--teal-ink, #0f6b5c); }
.im-chat-bubble {
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  border: 1px solid rgba(0,0,0,0.04);
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 14px;
}
.im-chat-row.seller .im-chat-bubble {
  background: #e8f7f6;
  border-color: #d7efed;
}
.im-chat-img {
  max-width: 280px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  border: 1px solid var(--line);
  background: #fff;
  cursor: zoom-in;
}
.im-chat-img img { display: block; width: 100%; height: auto; }
.im-chat-card {
  width: min(360px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}
.im-chat-card-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px 8px; font-size: 14px; font-weight: 700;
}
.im-chat-card-status { color: #f59a23; font-weight: 600; font-size: 13px; }
.im-chat-card-body {
  margin: 0 12px;
  background: #f3f4f6;
  border-radius: 10px;
  padding: 10px;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
}
.im-chat-card-body img {
  width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: #ddd;
}
.im-chat-badge {
  display: inline-flex; align-items: center;
  background: #ffe4ec; color: #ff5a7a;
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; margin-bottom: 4px;
}
.im-chat-prod-name {
  font-size: 13px; font-weight: 700; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.im-chat-prod-meta { margin-top: 4px; font-size: 12px; color: var(--muted); }
.im-chat-prod-earn { margin-top: 2px; font-size: 13px; font-weight: 700; }
.im-chat-card-actions {
  display: flex; justify-content: flex-end; gap: 8px; padding: 12px 14px 14px;
}
.im-chat-btn {
  appearance: none; border-radius: 8px; padding: 7px 16px;
  font: inherit; font-size: 13px; font-weight: 600; cursor: default; opacity: .85;
}
.im-chat-btn-ghost {
  background: #fff; color: var(--teal-ink, #0f6b5c); border: 1px solid var(--teal-ink, #0f6b5c);
}
.im-chat-btn-solid {
  background: var(--teal-ink, #0f6b5c); color: #fff; border: 1px solid var(--teal-ink, #0f6b5c);
}
.im-chat-composer {
  flex: 0 0 auto;
  background: #fff; border-top: 1px solid var(--line);
  padding: 12px 16px; display: flex; gap: 10px; align-items: center;
}
.im-chat-composer input {
  flex: 1; border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 14px; font: inherit; font-size: 14px;
  background: #f8fafc; color: var(--muted);
}
.im-chat-composer button {
  border: 0; background: var(--teal-ink, #0f6b5c); color: #fff;
  border-radius: 999px; padding: 10px 18px; font: inherit; font-weight: 600;
  opacity: .55; cursor: not-allowed;
}
.im-chat-lightbox {
  position: fixed; inset: 0; background: rgba(15,23,42,0.72);
  display: none; place-items: center; z-index: 80; padding: 24px;
}
.im-chat-lightbox.show { display: grid; }
.im-chat-lightbox img {
  max-width: min(920px, 100%); max-height: 90vh; border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
@media (max-width: 860px) {
  #panel-chat.active {
    height: calc(100dvh - 9.5rem);
    max-height: calc(100dvh - 9.5rem);
  }
  .im-chat-app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(160px, 32%) minmax(0, 1fr);
  }
  .im-chat-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: none;
  }
  .im-chat-stack { max-width: 92%; }
}
