:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #e1e4e8;
  --text: #1a1d21;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --danger: #dc2626;
  --success: #059669;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px rgba(16, 24, 40, 0.04);
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --topbar-h: 30px;
  --tl-purchase-gold: #9a6700;
  --tl-mail-sent-fill: #4f46e5;
  --tl-draft-muted: #94a3b8;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: var(--font); color: var(--text); background: var(--bg); }

.hidden { display: none !important; }

.topbar {
  min-height: var(--topbar-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 2px 12px 2px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-brand-wrap { justify-self: start; min-width: 0; }
.topbar-progress-wrap {
  justify-self: center;
  min-width: 0;
  max-width: min(520px, 46vw);
}
.topbar-progress {
  display: block;
  text-align: center;
  font-weight: 500;
  color: #374151;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand { display: flex; align-items: center; gap: 6px; }
.logo { font-size: 0.85rem; color: var(--accent); display: flex; align-items: center; }
.logo-img { width: 20px; height: 20px; display: block; object-fit: contain; }
.logo-svg { display: block; color: var(--accent); }

.brand-text-block {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.brand-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.brand-name {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.copyright-line {
  display: block;
  font-size: 0.5rem;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-selector {
  display: flex;
  gap: 1px;
  margin-top: 0;
}

.current-store-label {
  font-size: 0.5rem;
  font-weight: 600;
  color: #6366f1;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  align-self: center;
}

.lang-btn {
  padding: 1px 5px;
  font-size: 0.5rem;
  border: 1px solid var(--border);
  background: #f3f4f6;
  border-radius: 2px;
  cursor: pointer;
  color: var(--muted);
}

.lang-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.lang-btn:hover:not(.active) {
  background: #e5e7eb;
}
.tiny { font-size: 0.55rem; }
.muted { color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; justify-self: end; }
.topbar .top-actions .btn {
  padding: 2px 6px;
  font-size: 0.55rem;
  border-radius: 4px;
}
.pill {
  font-size: 0.55rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #1e40af;
  font-weight: 600;
}

.layout-with-rail {
  display: grid;
  grid-template-columns: 52px 1fr;
  height: calc(100vh - var(--topbar-h));
  min-height: 0;
}

#decision-page .layout-with-rail {
  grid-template-columns: 52px 132px 1fr;
}

/* ── Sprint U Phase B prep — TrackTrack standalone workspace (/lab/tracktrack) ─── */
/* The page reuses the same SPA but hides employee-internal modules so the
   decision workspace is the only thing visible. */
body.tt-standalone #queue-count,
body.tt-standalone #btn-macros-admin,
body.tt-standalone #btn-prompt-center,
body.tt-standalone #btn-workflow,
body.tt-standalone #btn-decisions,
body.tt-standalone #btn-stats,
body.tt-standalone #btn-refresh,
body.tt-standalone #btn-trueview {
  display: none !important;
}
/* Hide the employee home layout (support/social/shopee/shopify) — TrackTrack
   only uses the dedicated #decision-page below it. */
body.tt-standalone #app-shell > .layout-with-rail {
  display: none !important;
}
/* The "返回 (back)" button in decision list view would close the decision
   page back to the support shell — meaningless in standalone mode. */
body.tt-standalone #btn-decision-back {
  display: none !important;
}
/* Slight brand differentiator so the user always knows they're in TT-only mode */
body.tt-standalone .brand-name::after {
  content: " · 决策工作区";
  color: #6b7280;
  font-weight: 400;
  margin-left: 4px;
}
body.tt-standalone .copyright-line {
  display: none;
}
/* The topbar's current-store-label is set by the support flow; in standalone
   mode the store rail (left column) is the source of truth, so hide the topbar
   label to avoid duplication. */
body.tt-standalone #current-store-label {
  display: none;
}

.store-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 6px;
  background: #e8edf3;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.store-rail-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  border: 2px solid transparent;
  background: var(--surface);
  color: var(--text);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.1s ease;
}

.store-rail-btn:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: #f8fafc;
}

.store-rail-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.store-rail-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #1e3a8a;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.store-rail-btn:active {
  transform: scale(0.96);
}

.layout {
  display: grid;
  grid-template-columns: 58px minmax(260px, 320px) 1fr;
  height: 100%;
  min-height: 0;
}

/* iniCotton Shopee 模块排到最上面(此 tab 仅 iniCotton 显示,故只影响 iniCotton) */
#module-shopee-tab { order: -1; }

.store-module-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 7px;
  border-right: 1px solid var(--border);
  background: #f8fafc;
}

.store-module-btn {
  width: 44px;
  min-height: 42px;
  padding: 4px 3px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: #4b5563;
  font-size: clamp(0.3rem, 0.74vw, 0.58rem);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  text-align: center;
  cursor: pointer;
}

.store-module-btn[data-module="workflow"] {
  font-size: clamp(0.28rem, 0.68vw, 0.52rem);
}

.store-module-btn:hover {
  border-color: rgba(37, 99, 235, 0.35);
  color: #1f2937;
}

.store-module-btn.is-active {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.layout.social-mode {
  grid-template-columns: 58px 1fr;
}

.layout.social-mode .social-module {
  grid-column: 2;
}

.layout.shopee-mode .shopee-module {
  grid-column: 2;
}

.layout.workflow-mode {
  grid-template-columns: 58px 1fr;
}

.layout.workflow-mode .workflow-module {
  grid-column: 2;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.social-module {
  overflow: auto;
  background: var(--bg);
}

.shopee-module {
  overflow: auto;
  background: var(--bg);
}

.workflow-module {
  overflow: auto;
  background: var(--bg);
}

.social-workspace {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shopee-workspace {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.workflow-workspace {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.workflow-module-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.workflow-module-head h2 {
  margin: 4px 0;
  font-size: 1.15rem;
}

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

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

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

.social-head h2 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.shopee-head h2 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.module-kicker {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  margin: 0 0 4px;
  color: #64748b;
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
}

.module-kicker-code {
  color: #cbd5e1;
  font-size: 0.53rem;
  font-weight: 800;
}

.module-range-label {
  color: var(--muted);
  font-size: 0.78em;
  font-weight: 500;
  margin-left: 8px;
  text-transform: none;
}

.social-head p {
  margin: 0;
}

.shopee-head p {
  margin: 0;
}

.social-head-actions,
.shopee-head-actions,
.social-controls,
.shopee-controls,
.social-bulk-bar,
.social-followers-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.shopee-control-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 10px;
}

/* 顶部操作栏永远单行,日期控件在「刷新数据」左侧,自定义日期横向铺开不换行 */
.shopee-head-actions {
  flex-wrap: nowrap;
  align-items: center;
}

.shopee-head-actions .shopee-range-preset {
  width: auto;
  min-width: 92px;
  flex: 0 0 auto;
}

.shopee-custom-range {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}

.shopee-custom-range.hidden {
  display: none;
}

.shopee-custom-range input {
  width: 120px;
}

.shopee-head-range-sep {
  color: var(--muted);
}

.shopee-status-line {
  display: block;
  min-height: 1em;
  margin: 2px 0 6px;
}

/* Shopify 式日期范围选择器 */
.shopee-head-title { position: relative; display: flex; align-items: flex-end; gap: 14px; }
.shopee-dr-wrap { position: relative; }
.shopee-dr-trigger { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; margin-bottom: 3px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; font-size: 0.8rem; font-weight: 600; }
.shopee-dr-caret { color: var(--muted); font-size: 0.7rem; }
.shopee-dr-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; display: flex; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.16); padding: 10px; gap: 6px; }
.shopee-dr-presets { display: flex; flex-direction: column; gap: 2px; min-width: 124px; border-right: 1px solid var(--border); padding-right: 8px; }
.shopee-dr-preset { text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 0.8rem; color: #334155; }
.shopee-dr-preset:hover { background: #f1f5f9; }
.shopee-dr-cal { padding: 0 6px; }
.shopee-dr-inputs { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.shopee-dr-inputs input { width: 130px; }
.shopee-dr-months { display: flex; gap: 18px; }
.shopee-dr-mon { width: 232px; }
.shopee-dr-mhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 0.82rem; }
.shopee-dr-nav { background: none; border: 0; cursor: pointer; font-size: 1rem; color: #334155; padding: 0 6px; }
.shopee-dr-navsp { width: 22px; display: inline-block; }
.shopee-dr-wk { display: grid; grid-template-columns: repeat(7,1fr); color: var(--muted); font-size: 0.66rem; }
.shopee-dr-wk span { text-align: center; padding: 2px 0; }
.shopee-dr-grid { display: grid; grid-template-columns: repeat(7,1fr); grid-auto-rows: 30px; }
.shopee-dr-day { height: 30px; border: 0; background: none; cursor: pointer; font-size: 0.76rem; border-radius: 6px; color: #1e293b; }
.shopee-dr-day.empty { visibility: hidden; }
.shopee-dr-day:hover:not(.empty) { background: #e2e8f0; }
.shopee-dr-day.in-range { background: #eef2ff; border-radius: 0; }
.shopee-dr-day.endpoint { background: #1e293b; color: #fff; border-radius: 6px; }
.shopee-dr-foot { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.shopee-dr-footlabel { margin-right: auto; color: var(--muted); font-size: 0.76rem; }

.shopee-events-panel {
  margin-top: 8px;
}

.shopee-collapse-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.shopee-collapse-caret {
  color: var(--muted);
  font-size: 0.7rem;
}

.shopee-sku-table-wrap {
  max-height: 60vh;
  overflow: auto;
}

.shopee-sku-table input {
  width: 78px;
}

.shopee-sku-unset {
  background: #fff7ed;
}

.shopee-sku-badge {
  background: #f59e0b;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 6px;
}

.shopee-cost-seg {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}

.shopee-cost-seg-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 8px;
  margin-bottom: 8px;
}

.shopee-cost-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.shopee-cost-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.7rem;
}

.shopee-cost-field input {
  width: 100%;
}

.shopee-cost-addrow {
  margin: 4px 0 8px;
}

.shopee-cost-grp-title { font-weight: 700; font-size: 0.78rem; margin: 10px 0 2px; }
.shopee-cost-grp-muted { color: var(--muted); font-weight: 600; }
.shopee-cost-grp-note { font-size: 0.66rem; color: var(--muted); margin-bottom: 6px; line-height: 1.4; }

.shopee-m11-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
/* M11 对照表(算/表 并列):高滚动框 + 表头/日期列双向冻结 */
.shopee-m11-wrap { overflow: auto; max-height: 88vh; }
.shopee-m11 { font-size: 0.7rem; border-collapse: separate; border-spacing: 0; white-space: nowrap; width: auto; }
.shopee-m11 th, .shopee-m11 td { padding: 5px 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: right; height: 26px; box-sizing: border-box; }
.shopee-m11 thead th { background: #f1f5f9; position: sticky; z-index: 3; }
.shopee-m11 thead tr:nth-child(1) th { top: 0; }      /* 列字母 A/B/C */
.shopee-m11 thead tr:nth-child(2) th { top: 20px; }   /* 指标母标题 */
.shopee-m11 thead tr:nth-child(3) th { top: 46px; }   /* 算/表/API 子标题 */
.shopee-m11-letter { height: 20px; padding: 1px 8px; font-size: 0.62rem; font-weight: 700; color: #64748b; background: #e2e8f0; text-align: center; }
.shopee-m11 .shopee-m11-date { text-align: left; position: sticky; left: 0; background: #fff; z-index: 2; }
.shopee-m11 thead .shopee-m11-date { background: #f1f5f9; z-index: 5; }
.shopee-m11-group, .shopee-m11-single { text-align: center; white-space: normal; max-width: 96px; line-height: 1.18; }
.shopee-m11-info { display: inline-flex; align-items: center; justify-content: center; width: 13px; height: 13px; border: 1px solid currentColor; border-radius: 50%; font-size: 9px; font-style: italic; font-weight: 700; cursor: pointer; margin-left: 3px; opacity: 0.55; vertical-align: middle; }
.shopee-m11-info:hover { opacity: 1; }
.shopee-m11-infopop { position: absolute; z-index: 100; max-width: 300px; background: #1e293b; color: #fff; font-size: 0.72rem; line-height: 1.5; padding: 8px 11px; border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.28); white-space: normal; }
.shopee-m11-sub { font-weight: 500; color: var(--muted); }
.shopee-m11-sheetcell, .shopee-m11-sheetsub { background: #f8fafc; color: #475569; }
.shopee-m11-apicell, .shopee-m11-apisub { background: #eff6ff; color: #1e40af; }
.shopee-m11-diff { background: #fef2f2 !important; color: #b91c1c; font-weight: 700; }

.shopee-report-text {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  white-space: pre;
  resize: vertical;
}

.social-control-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.2fr);
  gap: 10px;
}

.shopee-control-panel,
.social-control-panel {
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
}

.shopee-control-panel p,
.social-control-panel p {
  margin: 0 0 8px;
}

.social-controls,
.social-bulk-bar,
.social-followers {
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
}

.shopee-control-panel .shopee-controls {
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
}

.social-control-panel .social-controls {
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
}

.shopee-file-field {
  min-width: 260px;
}

.shopee-file-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

.tt-date-input {
  cursor: pointer;
  background: #fff;
}

.tt-date-popover {
  position: fixed;
  z-index: 10050;
  width: 284px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
}

.tt-date-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.tt-date-head strong {
  color: #334155;
  font-size: 0.78rem;
}

.tt-date-nav {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
}

.tt-date-weekdays,
.tt-date-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.tt-date-weekdays span {
  color: #94a3b8;
  font-size: 0.56rem;
  font-weight: 800;
  text-align: center;
}

.tt-date-cell {
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  font-size: 0.72rem;
  cursor: pointer;
}

.tt-date-cell:hover {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.tt-date-cell.is-selected {
  background: #111827;
  color: #fff;
}

.tt-date-cell.is-empty {
  pointer-events: none;
}

.tt-date-time {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: #64748b;
  font-size: 0.66rem;
  font-weight: 700;
}

.tt-date-time-input {
  flex: 1;
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
  font: inherit;
}

.tt-date-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 10px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.shopee-api-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.64rem;
}

.shopee-api-note strong {
  font-size: 0.68rem;
}

.shopee-api-note em {
  color: #475569;
  font-style: normal;
}

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

.shopee-kpi,
.shopee-panel {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
}

.shopee-kpi {
  padding: 10px;
}

.shopee-kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.58rem;
}

.shopee-kpi strong {
  display: block;
  margin-top: 4px;
  font-size: 0.95rem;
}

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

.shopee-panel {
  padding: 10px;
  min-width: 0;
}

.shopee-wide-panel {
  grid-column: 1 / -1;
}

.shopee-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.shopee-m5-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.shopee-m5-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 14px; background: #fff; cursor: pointer; font-size: 0.74rem; color: #475569; }
.shopee-m5-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); opacity: 0.3; }
.shopee-m5-chip.active { border-color: var(--c); color: #1e293b; font-weight: 600; }
.shopee-m5-chip.active i { opacity: 1; }
.shopee-m5-svg { width: 100%; height: auto; }
.shopee-m5-axis { font-size: 9px; fill: #94a3b8; }
.shopee-m5-grid { stroke: #eef2f7; stroke-width: 1; }
.shopee-m5-tip { position: absolute; z-index: 100; background: #1e293b; color: #fff; font-size: 0.72rem; line-height: 1.6; padding: 7px 10px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.28); pointer-events: none; white-space: nowrap; }
.shopee-m5-tip b { display: block; margin-bottom: 3px; }
.shopee-m5-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.shopee-head-right { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.shopee-src { display: block; margin-top: 3px; line-height: 1.4; }
.shopee-src-warn { color: #b45309; }
.shopee-copy-btn { flex: 0 0 auto; }
.shopee-panel-head h3 {
  margin: 0;
  font-size: 0.8rem;
}

.shopee-bars {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.trend-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trend-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.76rem;
}

.trend-toolbar select,
.trend-toolbar input[type="range"] {
  min-width: 130px;
}

.trend-svg {
  width: 100%;
  height: 190px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  background: #fff;
}

.trend-grid line {
  stroke: #eef2f7;
  stroke-width: 1;
}

.trend-grid text,
.trend-x text {
  fill: #64748b;
  font-size: 10px;
}

.trend-area {
  fill: rgba(37, 99, 235, 0.08);
  stroke: none;
}

.trend-line {
  fill: none;
  stroke: #2563eb;
  stroke-width: 2.4;
}

.trend-points circle {
  fill: #2563eb;
}

.trend-empty {
  padding: 18px;
  color: var(--muted);
  font-size: 0.82rem;
  border: 1px dashed #d1d5db;
  border-radius: 7px;
  background: #fafafa;
}

.shopee-bar-row {
  display: grid;
  grid-template-columns: 108px 1fr 72px;
  gap: 8px;
  align-items: center;
  font-size: 0.58rem;
}

.shopee-bar-row span,
.shopee-bar-row strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shopee-bar-row i {
  position: relative;
  display: block;
  height: 6px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.shopee-bar-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #0f766e;
}

.shopee-upload-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.shopee-event-list,
.shopee-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

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

.shopee-period-card {
  min-width: 0;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 7px;
  padding: 8px;
  overflow: hidden;
}

.shopee-event-item,
.shopee-offline-card {
  min-width: 0;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  border-radius: 7px;
  padding: 8px;
  font-size: 0.62rem;
}

.shopee-event-item time,
.shopee-offline-card em {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-size: 0.56rem;
  margin-bottom: 3px;
}

.shopee-event-item strong,
.shopee-offline-card strong,
.shopee-offline-card span,
.shopee-offline-card p {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shopee-event-item span {
  display: inline-block;
  margin: 4px 0;
  color: #0f766e;
  font-size: 0.56rem;
  font-weight: 700;
}

.shopee-event-item p {
  margin: 4px 0 0;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.shopee-event-edit {
  margin-top: 6px;
}

.shopee-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.56rem;
}

.shopee-mini-table th,
.shopee-mini-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 4px 5px;
  text-align: left;
  vertical-align: top;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopee-offline-card span {
  color: #374151;
  white-space: nowrap;
}

.shopee-offline-card p {
  margin: 5px 0 0;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.shopee-upload-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  border-radius: 7px;
  padding: 7px;
  font-size: 0.58rem;
}

.shopee-upload-item strong,
.shopee-upload-item span,
.shopee-upload-item em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopee-upload-item span,
.shopee-upload-item em {
  color: var(--muted);
  font-style: normal;
}

.shopee-table-wrap {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  overflow: visible;
}

.shopee-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  font-size: 0.66rem;
}

.shopee-table th,
.shopee-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 6px 8px;
  text-align: right;
  white-space: nowrap;
}

.shopee-table th {
  background: #f8fafc;
  color: #374151;
  font-weight: 700;
}

.shopee-table th:first-child,
.shopee-table td:first-child {
  text-align: left;
}

.shopee-calculated-col {
  background: #ecfdf5 !important;
  color: #065f46;
  font-weight: 800;
}

.shopee-empty,
.shopee-empty-cell {
  color: var(--muted);
  text-align: center !important;
  padding: 16px !important;
}

.social-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.social-view-btn {
  border: 0;
  background: transparent;
  color: #4b5563;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.social-view-btn.is-active {
  background: #111827;
  color: #fff;
}

.social-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #4b5563;
  min-width: 140px;
}

.social-field .stb-input,
.social-bulk-input,
.social-bulk-select {
  margin: 0;
  min-height: 32px;
}

.social-bulk-input {
  flex: 1 1 220px;
}

.social-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.social-kpi {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 10px;
}

.social-kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.58rem;
}

.social-kpi strong {
  display: block;
  margin-top: 4px;
  font-size: 0.95rem;
}

.social-insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.social-insight-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 9px 10px;
}

.social-insight-card span,
.social-insight-card em {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-size: 0.62rem;
  line-height: 1.35;
}

.social-insight-card strong {
  display: block;
  margin: 3px 0;
  font-size: 0.95rem;
}

.social-followers {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.social-follower-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.social-follower-stat {
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 10px;
}

.social-follower-stat span {
  display: block;
  font-size: 0.58rem;
  color: var(--muted);
  font-weight: 700;
}

.social-follower-stat strong {
  display: block;
  margin-top: 3px;
  font-size: 1rem;
}

.social-follower-stat em {
  display: block;
  margin-top: 2px;
  font-size: 0.58rem;
  color: var(--muted);
  font-style: normal;
}

.social-follower-chart {
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 8px;
  padding: 10px;
  overflow: hidden;
  width: 100%;
}

.social-follower-chart--large {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.social-follower-chart--large .trend-svg {
  height: 300px;
}

.social-follower-trend-card {
  min-width: 0;
}

.social-follower-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.social-followers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.social-follower-chip {
  padding: 4px 7px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
}

.social-follower-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.social-follower-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
}

.social-follower-table th,
.social-follower-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  font-size: 0.66rem;
  white-space: nowrap;
}

.social-follower-table th {
  color: #64748b;
  font-size: 0.58rem;
  font-weight: 800;
  background: #f8fafc;
}

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

.social-post-list.dense {
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 8px;
}

.social-post-list.cards {
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

.social-post-list.is-viz {
  display: none;
}

.social-post-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.social-post-media {
  position: relative;
  aspect-ratio: 4 / 5;
  background: #e5e7eb;
  display: flex;
  color: var(--muted);
  font-size: 0.72rem;
  overflow: hidden;
}

.social-post-card--cards {
  display: grid;
  grid-template-columns: minmax(140px, 170px) 1fr;
  min-height: 240px;
}

.social-post-card--cards .social-post-media {
  aspect-ratio: auto;
  min-height: 100%;
}

.social-post-card--cards .social-post-media-inner {
  aspect-ratio: 4 / 5;
}

.social-post-media-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.social-post-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.social-post-media-rail {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: space-between;
  pointer-events: none;
}

.social-ai-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.9);
  color: #fff;
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.social-post-body {
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.social-post-list.dense .social-post-body {
  padding: 8px;
  gap: 6px;
}

.social-post-list.dense .social-post-caption {
  -webkit-line-clamp: 3;
  min-height: 3.8em;
}

.social-post-list.dense .social-post-media {
  aspect-ratio: 4 / 5;
}

.social-post-list.dense .social-tag {
  font-size: 0.52rem;
  padding: 2px 4px;
}

.social-post-list.dense .social-post-item {
  font-size: 0.56rem;
}

.social-post-topline,
.social-post-tags,
.social-post-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.social-post-topline {
  justify-content: space-between;
}

.social-post-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.social-post-caption {
  color: #374151;
  font-size: 0.72rem;
  line-height: 1.35;
  min-height: 2.7em;
  max-height: 4.05em;
  overflow: hidden;
}

.social-post-item {
  color: #4b5563;
  line-height: 1.25;
}

.social-post-lights {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 2px;
}

.social-light-row {
  display: grid;
  grid-template-columns: 44px 1fr 34px;
  gap: 6px;
  align-items: center;
  font-size: 0.55rem;
}

.social-light-row span,
.social-light-row em,
.social-light-row strong {
  font-style: normal;
  font-weight: 700;
  color: #4b5563;
  white-space: nowrap;
}

.social-light-row i {
  position: relative;
  display: block;
  height: 3px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.social-light-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: inherit;
}

.social-light-bar.up,
.social-light-row--up strong { color: var(--success); }
.social-light-bar.mid,
.social-light-row--mid strong { color: #0f766e; }
.social-light-bar.down,
.social-light-row--down strong { color: var(--danger); }
.social-light-bar.neutral,
.social-light-row--neutral strong { color: #6b7280; }

.social-light-bar.up { background: var(--success); }
.social-light-bar.mid { background: #0ea5e9; }
.social-light-bar.down { background: var(--danger); }
.social-light-bar.neutral { background: #9ca3af; }

.social-post-detail-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 2px;
}

.social-post-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 0.58rem;
}

.social-post-detail-row span {
  color: #6b7280;
  font-weight: 700;
}

.social-post-detail-row strong {
  color: #111827;
  font-weight: 700;
}

.social-viz-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

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

.social-viz-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
  min-width: 0;
}

.social-viz-card--wide {
  grid-column: 1 / -1;
}

.social-viz-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.social-viz-card-head h3 {
  margin: 0;
  font-size: 0.8rem;
}

.social-viz-card-head p {
  margin: 2px 0 0;
}

.social-viz-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.social-viz-badge {
  font-size: 0.55rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
}

.social-viz-svg {
  width: 100%;
  height: auto;
  display: block;
}

.social-viz-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.social-viz-bar-row {
  display: grid;
  grid-template-columns: 96px 1fr 54px;
  gap: 8px;
  align-items: center;
  font-size: 0.58rem;
}

.social-viz-bar-row span,
.social-viz-bar-row strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.social-viz-bar-row i {
  position: relative;
  display: block;
  height: 6px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.social-viz-bar-row b {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  border-radius: inherit;
  background: #2563eb;
}

.social-viz-toplist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.social-viz-toprow {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  font-size: 0.58rem;
}

.social-viz-toprow span,
.social-viz-toprow strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.social-viz-empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fff;
}

.social-metric,
.social-tag {
  font-size: 0.58rem;
  border-radius: 999px;
  padding: 3px 6px;
  background: #f3f4f6;
  color: #4b5563;
}

.social-tag.ai {
  background: #dcfce7;
  color: #166534;
}

.social-tag.non-ai {
  background: #fee2e2;
  color: #991b1b;
}

.social-tag.platform {
  background: #e0f2fe;
  color: #075985;
}

.social-tag.follower {
  background: #fef3c7;
  color: #92400e;
}

.social-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  background: var(--surface);
  border-radius: 8px;
}

.social-report-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.social-report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}

.social-report-scroll {
  overflow: auto;
  max-height: calc(100vh - 280px);
}

.social-report-table {
  border-collapse: collapse;
  min-width: 2600px;
  width: max-content;
  font-size: 0.68rem;
}

.social-report-table th,
.social-report-table td {
  border: 1px solid #e5e7eb;
  padding: 4px 6px;
  white-space: nowrap;
  text-align: right;
}

.social-report-table th {
  background: #f8fafc;
  color: #374151;
  font-weight: 700;
}

.social-report-table th:nth-child(-n+5),
.social-report-table td:nth-child(-n+5) {
  text-align: left;
}

.social-report-table td:nth-child(3),
.social-report-table td:nth-child(4),
.social-report-table td:nth-child(5) {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.social-empty-cell {
  text-align: center !important;
  color: var(--muted);
  padding: 18px !important;
}
.queue-search-row {
  padding: 12px 14px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.queue-search-input {
  font-size: 0.85rem;
}

.sidebar-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
  align-items: end;
  padding: 4px 10px 2px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-toolbar-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.stb-lbl {
  font-size: 0.58rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.stb-input,
.stb-select {
  width: 100%;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.68rem;
  line-height: 1.25;
  min-height: 26px;
  background: #fafbfc;
}
.stb-input::placeholder {
  font-size: 0.65rem;
}

.filter-row { padding: 8px 14px 8px; display: flex; flex-direction: column; gap: 6px; }
.select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.85rem;
  background: #fafbfc;
}
.hint {
  padding: 2px 10px 4px;
  line-height: 1.3;
  font-size: 0.58rem;
  white-space: normal;
  overflow-wrap: anywhere;
}
.sidebar .hint {
  max-width: 100%;
}
.queue-hint {
  margin: 0 14px 10px;
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  line-height: 1.45;
  color: #92400e;
}

.sidebar-list-footer {
  padding: 8px 14px 12px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}
.sidebar-list-footer .btn {
  width: 100%;
  font-size: 0.72rem;
  padding: 6px 8px;
}

.queue-list-stack {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.queue-filter-loading {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  pointer-events: auto;
}
.queue-filter-loading.hidden {
  display: none !important;
}
.queue-filter-loading-inner {
  font-size: 0.78rem;
  font-weight: 600;
  color: #1e293b;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* 左侧列表内：终身时间轴缩略条（形状/配色与主时间轴一致，尺寸缩小） */
.tl-thumb-track {
  position: relative;
  height: 8px;
  margin: 0 0 1px;
}
.tl-thumb-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  margin-top: -0.5px;
  background: #e5e7eb;
  border-radius: 1px;
}
.tl-thumb-dot.tl-thumb-shape {
  position: absolute;
  width: 4px;
  height: 4px;
  top: 50%;
  margin-top: -2px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--surface, #fff);
  border: 1px solid #e5e7eb;
  box-sizing: border-box;
  box-shadow: 0 0 0 1px #fff;
}
.tl-thumb-dot.tl-thumb-shape.tl-shape-dot-sm {
  width: 3px;
  height: 3px;
  margin-top: -1.5px;
  margin-left: -1.5px;
}
.tl-thumb-dot.tl-thumb-shape[class*="tl-shape-"] {
  border: none;
  background: var(--tl-thumb-fill, #57534e);
}
.tl-thumb-dot.tl-thumb-shape[class*="tl-shape-"] .tl-thumb-core {
  display: none;
}
.tl-thumb-dot.tl-thumb-shape.tl-shape-square {
  border-radius: 1px;
}
.tl-thumb-dot.tl-thumb-shape.tl-shape-triangle-up {
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  border-radius: 0;
}
.tl-thumb-dot.tl-thumb-shape.tl-shape-triangle-down {
  clip-path: polygon(50% 100%, 0% 0%, 100% 0%);
  border-radius: 0;
}
.tl-thumb-dot.tl-thumb-shape.tl-shape-diamond {
  width: 3px;
  height: 3px;
  margin-top: -1.5px;
  margin-left: -1.5px;
  transform: rotate(45deg);
  border-radius: 1px;
}
.tl-thumb-dot.tl-thumb-shape.tl-shape-diamond-alt {
  width: 3px;
  height: 3px;
  margin-top: -1.5px;
  margin-left: -1.5px;
  transform: rotate(45deg) scale(0.88);
  border-radius: 1px;
}
.tl-thumb-dot.tl-thumb-shape.tl-shape-hex {
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  border-radius: 0;
}
.tl-thumb-dot.tl-thumb-shape.tl-shape-oct {
  clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  border-radius: 0;
}
.tl-thumb-dot.tl-thumb-shape.tl-shape-star {
  width: 8px;
  height: 8px;
  margin-top: -4px;
  margin-left: -4px;
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
  border-radius: 0;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.28)) drop-shadow(0 0.5px 0 rgba(255, 255, 255, 0.35));
}
.tl-thumb-dot.tl-thumb-shape.tl-shape-circle-filled {
  border-radius: 50%;
}

/* 缩略条：已发跟进邮件（信封形，高亮）；草稿压低为灰小方块 */
.tl-thumb-dot.tl-thumb-shape.tl-shape-mail-sent {
  width: 9px;
  height: 7px;
  margin-top: -3.5px;
  margin-left: -4.5px;
  clip-path: polygon(0% 18%, 50% 48%, 100% 18%, 100% 82%, 0% 82%);
  border-radius: 1px;
  filter: drop-shadow(0 0 2px rgba(79, 70, 229, 0.85)) drop-shadow(0 0.5px 0 rgba(255, 255, 255, 0.35));
}
.tl-thumb-dot.tl-thumb-dot--mail-sent {
  z-index: 3;
}
.tl-thumb-dot.tl-thumb-shape.tl-shape-mail-in {
  width: 9px;
  height: 7px;
  margin-top: -3.5px;
  margin-left: -4.5px;
  clip-path: polygon(0% 18%, 50% 48%, 100% 18%, 100% 82%, 0% 82%);
  border-radius: 1px;
  filter: drop-shadow(0 0 2px rgba(22, 163, 74, 0.85)) drop-shadow(0 0.5px 0 rgba(255, 255, 255, 0.35));
}
.tl-thumb-dot.tl-thumb-dot--mail-in {
  z-index: 3;
}
.tl-thumb-dot.tl-thumb-dot--draft-muted {
  width: 3px !important;
  height: 3px !important;
  margin-top: -1.5px !important;
  margin-left: -1.5px !important;
  opacity: 0.72;
  filter: none;
}
.tl-thumb-dot.tl-thumb-dot--draft-muted.tl-shape-square {
  border-radius: 1px;
}
.tl-thumb-dot.tl-thumb-dot--manual {
  z-index: 2;
}
.tl-thumb-dot.tl-thumb-dot--stale-followup {
  outline: 2px solid #ea580c;
  outline-offset: 1px;
  border-radius: 2px;
  animation: tl-thumb-stale-pulse 2.4s ease-in-out infinite;
}
@keyframes tl-thumb-stale-pulse {
  0%, 100% { outline-color: rgba(234, 88, 12, 0.95); }
  50% { outline-color: rgba(251, 191, 36, 0.72); }
}

/* 左侧客户列表 - 紧凑化以显示10个客户 */
.customer-list {
  list-style: none;
  margin: 0;
  padding: 2px 4px;
  overflow-y: auto;
  flex: 1;
}
.customer-list li {
  padding: 2px 5px;
  margin-bottom: 1px;
  border-radius: 4px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  background: #fafbfc;
  line-height: 1.15;
  position: relative;
}
.customer-list li:hover { border-color: #c5cad3; background: #fff; }
.customer-list li.active { border-color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,0.1); background: #fff; }
.customer-list li.muted-row { opacity: 0.48; background: #eef0f3; }
.customer-list li .name { font-weight: 600; font-size: 0.68rem; line-height: 1.1; }
.customer-list li .sub,
.customer-list li .email-clip {
  font-size: 0.55rem;
  color: var(--muted);
  line-height: 1.1;
}
.customer-list li .queue-row-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 6px;
  justify-content: space-between;
}
.customer-list li .queue-tags-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: flex-end;
  flex: 1;
  min-width: 0;
}
.customer-list li .queue-tags-inline .seg-tag,
.customer-list li .queue-tags-inline .tag-warn {
  margin: 0;
  font-size: 0.52rem;
  padding: 0 4px;
  line-height: 1.2;
}
.customer-list li .queue-row-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 8px;
  margin-top: 1px;
}
.customer-list li .email-clip {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-list li .date-inline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px;
  font-size: 0.52rem;
  flex-shrink: 0;
  max-width: 100%;
}
.customer-list li .date-label {
  color: var(--muted);
  background: #f3f4f6;
  padding: 0 2px;
  border-radius: 2px;
}
.customer-list li .date-val {
  color: #374151;
  font-weight: 500;
}
/* 刷新蒙版 */
.customer-list.refreshing::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  z-index: 10;
  pointer-events: all;
}
.seg-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
  margin-top: 6px;
}
.seg-ab { background: #fef3c7; color: #92400e; }
.seg-recent { background: #dbeafe; color: #1d4ed8; }
.seg-stale { background: #e0e7ff; color: #3730a3; }
.tag-warn { background: var(--warn-bg); color: var(--warn); font-size: 0.65rem; padding: 2px 6px; border-radius: 4px; margin-left: 4px; }

.main { overflow-y: auto; padding: 20px 24px 40px; min-width: 0; }
.empty { max-width: 480px; margin: 80px auto; text-align: center; color: var(--muted); line-height: 1.6; }

#detail-panel.detail {
  position: relative;
}
.detail-loading {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 28px 16px;
  pointer-events: auto;
}
.detail-loading.hidden {
  display: none !important;
}
.detail-loading-card {
  max-width: 360px;
  text-align: center;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.detail-loading-title {
  margin: 12px 0 6px;
  font-weight: 600;
  font-size: 0.95rem;
}
.detail-loading-spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tt-spin 0.75s linear infinite;
}
@keyframes tt-spin {
  to { transform: rotate(360deg); }
}
.detail-loading-active .panel,
.detail-loading-active .detail-head {
  pointer-events: none;
  user-select: none;
}
/* 终身时间轴工具栏在加载遮罩期间仍可操作（已选客户、仅详情区锁定） */
.detail-loading-active .timeline-panel .timeline-panel-toolbar,
.detail-loading-active .timeline-panel .timeline-panel-toolbar * {
  pointer-events: auto;
  user-select: auto;
}

.product-img-toolbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
}
.product-img-toolbar .btn-xs-toolbar {
  font-size: 0.55rem;
  padding: 2px 5px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
}
.product-img-toolbar .btn-xs-toolbar:hover {
  background: #fff;
}
.product-img-toolbar .btn-xs-toolbar.btn-copy-product-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.product-img-toolbar .btn-copy-svg {
  display: block;
}

.detail-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
  max-height: 13.5rem;
  overflow-y: auto;
  padding-bottom: 4px;
}
.detail-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex: 1;
  min-width: 260px;
  flex-wrap: wrap;
}
.detail-ident-block { min-width: 0; flex: 0 1 auto; }
.detail-address {
  flex: 1 1 260px;
  max-width: min(520px, 56%);
  text-align: right;
  line-height: 1.35;
  font-size: 0.72rem;
  word-break: break-word;
}
.detail-address:empty { display: none; }
.detail-head h2 { margin: 0 0 4px; font-size: 1.05rem; line-height: 1.25; }
.email-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.email-row code { font-size: 0.85rem; background: #f3f4f6; padding: 4px 8px; border-radius: 6px; }

.badges { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.panel > h3 {
  font-size: 0.98rem;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.2;
}
.coupon-h4 { margin: 0 0 8px; font-size: 0.88rem; font-weight: 600; }
.coupon-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.coupon-form-grid .mail-field.chk { display: flex; align-items: center; gap: 8px; }
.coupon-form-grid .full { grid-column: 1 / -1; }
.mail-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 10px 0;
}
.mail-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.72rem; color: var(--muted); }
.mail-field .sender-email-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sender-local-input {
  flex: 1 1 120px;
  min-width: 100px;
  max-width: 220px;
}
.sender-domain-suffix {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  user-select: all;
}
.coupon-list { margin-top: 8px; line-height: 1.5; }
.coupon-list code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; }

/* —— 邮件编写 v2：主编辑区突出，发件/目标/优惠券折叠 —— */
.mail-panel-v2 {
  padding: 12px 14px;
  border: 1px solid #c7d2fe;
  background: linear-gradient(180deg, #fafbff 0%, #fff 45%);
}
.mail-panel-v2 .mail-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.mail-panel-v2 .mail-panel-head h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
}
.mail-panel-v2 .mail-panel-hint {
  margin: 0;
  font-size: 0.62rem;
  max-width: 58ch;
  line-height: 1.35;
}
.mail-recipient-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  margin-bottom: 10px;
}
.mail-recipient-chip-lbl {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
}
.mail-recipient-chip-email {
  font-size: 0.78rem;
  background: #fff;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-all;
}
.mail-opts-panel {
  margin: 10px 0 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
  padding: 10px 12px;
  overflow: visible;
}
.mail-opts-panel-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: #334155;
  margin: 0 0 8px;
}
.mail-opts-panel .mail-meta-grid-tight {
  margin-top: 0;
}
.mail-compose-core {
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: var(--surface);
  padding: 10px 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.mail-compose-fields-wrap {
  position: relative;
}
.mail-gen-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: rgba(248, 250, 252, 0.78);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 32px;
  border-radius: 8px;
}
.mail-gen-overlay.hidden {
  display: none !important;
}
.mail-gen-overlay-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1e293b;
  background: rgba(255, 255, 255, 0.95);
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.12);
  border: 1px solid #e2e8f0;
}
.mail-field-tight {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mail-field-tight-lbl {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
}
.mail-input {
  font-size: 0.8rem !important;
  padding: 6px 10px !important;
  border-radius: 8px !important;
}
.mail-panel-v2 .mail-body-area {
  width: 100%;
  margin: 0 0 8px;
  font-family: inherit;
  font-size: 0.84rem;
  line-height: 1.52;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  resize: vertical;
  min-height: 168px;
  max-height: 440px;
}
.mail-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  justify-content: space-between;
}
.mail-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.mail-save-btn {
  border-color: #059669;
  color: #047857;
  background: #ecfdf5;
}
.mail-save-btn:hover {
  background: #d1fae5;
}
.mail-status-inline {
  margin: 0;
  flex: 1 1 160px;
  text-align: right;
  /* 原约 0.68rem，放大 50% 便于扫读 */
  font-size: 1.02rem;
  line-height: 1.35;
  min-width: 120px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.mail-status-inline--neutral {
  color: #0f172a;
}
.mail-status-inline--busy {
  color: #1d4ed8;
  text-shadow: 0 0 1px rgba(37, 99, 235, 0.35);
}
.mail-status-inline--ok {
  color: #047857;
  text-shadow: 0 0 1px rgba(5, 150, 105, 0.35);
}
.mail-status-inline--err {
  color: var(--danger);
  text-shadow: 0 0 1px rgba(220, 38, 38, 0.25);
}
.mail-details {
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f8fafc;
  overflow: hidden;
}
.mail-details-sum {
  cursor: pointer;
  padding: 8px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #334155;
  list-style: none;
  user-select: none;
}
.mail-details-sum::-webkit-details-marker {
  display: none;
}
.mail-details-sum::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  color: var(--muted);
  transition: transform 0.15s;
  font-size: 0.65rem;
}
.mail-details[open] > .mail-details-sum::before {
  transform: rotate(90deg);
}
.mail-details-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
  background: #fff;
}
.mail-meta-grid-tight {
  margin: 10px 0 6px;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.mail-field-tightlbl {
  font-size: 0.7rem;
}
.mail-embed-in-details {
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px dashed var(--border);
}
.mail-send-row-tight {
  margin-top: 10px;
  align-items: center;
}
.mail-send-row-tight .mail-test-zone {
  flex: 1 1 260px;
}
.mail-send-row-tight .btn-send-official {
  flex: 0 0 auto;
  align-self: center;
  min-height: 34px;
}
.coupon-details-inner {
  padding-top: 4px;
}
.coupon-hint-line {
  margin: 0 0 12px;
}
/* 优惠券折叠区：分组卡片布局 */
.mail-details-coupon .coupon-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mail-details-coupon .coupon-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  background: #f8fafc;
}
.mail-details-coupon .coupon-card-code {
  background: #fff;
}
.coupon-block-title {
  margin: 0 0 10px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.25;
}
.coupon-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  align-items: end;
}
.coupon-row-usage {
  align-items: stretch;
}
.coupon-field-tight .mail-input,
.coupon-field-tight select.mail-input {
  width: 100%;
}
.coupon-chk-tile {
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 8px !important;
  padding-top: 6px;
}
.coupon-chk-tile span {
  line-height: 1.35;
  font-size: 0.72rem;
  color: var(--text);
}
.coupon-stack-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: flex-start;
}
.mail-details-coupon .coupon-stack-row .coupon-chk-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.mail-details-coupon .coupon-stack-row .coupon-chk-inline span {
  font-size: 0.72rem;
  color: #334155;
  line-height: 1.35;
}
.coupon-code-hint {
  margin: -6px 0 8px;
  font-size: 0.62rem;
  line-height: 1.4;
}
.coupon-code-input {
  max-width: min(100%, 340px);
}
.coupon-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
@media (max-width: 560px) {
  .coupon-row-2 {
    grid-template-columns: 1fr;
  }
}
.coupon-form-tight {
  margin-bottom: 8px;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.timeline-panel {
  position: relative;
  isolation: isolate;
}
.timeline-panel #timeline {
  display: none !important;
}

.timeline {
  display: none !important;
}
.timeline .tl-meta {
  font-size: 0.54rem;
  line-height: 1.2;
  color: var(--muted);
  margin-bottom: 2px;
}
.timeline .tl-label {
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1.2;
}
.timeline .tl-detail {
  font-size: 0.6rem;
  line-height: 1.3;
  color: #374151;
  margin-top: 3px;
}
.tl-dot {
  position: absolute;
  left: -22px;
  top: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  line-height: 0;
}
.tl-dot-core {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.tl-item.type-purchase .tl-dot { border-color: var(--tl-purchase-gold); }
.tl-item.type-purchase .tl-dot.tl-trace-other .tl-dot-core {
  background: var(--tl-purchase-gold);
}
.tl-item.type-abandoned .tl-dot { border-color: var(--warn); }
.tl-item.type-contact .tl-dot { border-color: var(--accent); }
.tl-item.type-shipment .tl-dot { border-color: #64748b; }
.tl-item.type-info .tl-dot { border-color: #94a3b8; }
.tl-item.type-marketing .tl-dot { border-color: #9333ea; }
.tl-item.type-journey .tl-dot { border-color: #94a3b8; }
.tl-item.type-draft .tl-dot { border-color: #0d9488; }

/* 时间轴圆点内核色：外圈仍随事件类型，内核表示归因 / 渠道 */
.tl-dot.tl-trace-meta .tl-dot-core { background: #1877f2; }
.tl-dot.tl-trace-google .tl-dot-core { background: #4285f4; }
.tl-dot.tl-trace-paid .tl-dot-core { background: #7c3aed; }
.tl-dot.tl-trace-other .tl-dot-core { background: #0f766e; }
.tl-dot.tl-trace-abandoned .tl-dot-core { background: #ea580c; }
.tl-dot.tl-trace-shipment .tl-dot-core { background: #475569; }
.tl-dot.tl-trace-zoko .tl-dot-core { background: #0284c7; }
.tl-dot.tl-trace-postscript .tl-dot-core { background: #f43f5e; }
.tl-dot.tl-trace-mailchimp .tl-dot-core { background: #facc15; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28); }
.tl-dot.tl-trace-marketing .tl-dot-core { background: #a855f7; }
.tl-dot.tl-trace-journey .tl-dot-core { background: #64748b; }
.tl-dot.tl-trace-ga .tl-dot-core { background: #f97316; }
.tl-dot.tl-trace-draft .tl-dot-core { background: #0d9488; }
.tl-dot.tl-trace-mail .tl-dot-core { background: #2563eb; }
.tl-dot.tl-trace-contact .tl-dot-core { background: #4f46e5; }
.tl-dot.tl-trace-ad .tl-dot-core { background: #db2777; }
.tl-dot.tl-trace-neutral .tl-dot-core { background: #94a3b8; }
.tl-dot.tl-trace-mail_sent .tl-dot-core {
  background: var(--tl-mail-sent-fill, #4f46e5);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45);
}
.tl-dot.tl-trace-manual .tl-dot-core { background: #c026d3; }

.timeline-panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  position: relative;
  z-index: 25;
  background: var(--surface);
  padding: 4px 0 6px;
  flex-shrink: 0;
}
.timeline-panel-toolbar h3 {
  margin: 0;
}
.timeline-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  position: relative;
  z-index: 4;
}

.conversation-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(52vh, 560px);
  overflow-y: auto;
  padding: 10px 8px 14px;
  background: #eef2f7;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.conv-row {
  display: flex;
  width: 100%;
}
.conv-row--in {
  justify-content: flex-start;
}
.conv-row--out {
  justify-content: flex-end;
}
.conv-bubble {
  max-width: min(92%, 520px);
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 0.72rem;
  line-height: 1.45;
}
.conv-bubble--in {
  background: #e5e7eb;
  border: 1px solid #d1d5db;
}
.conv-bubble--out {
  background: #bfdbfe;
  border: 1px solid #60a5fa;
  color: #1e3a8a;
}
.conv-meta {
  font-size: 0.58rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.conv-subject {
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.74rem;
}
.conv-body-text {
  white-space: pre-wrap;
  word-break: break-word;
}
.conv-toggle {
  margin-top: 6px;
}
.conv-empty {
  padding: 14px 10px;
  text-align: center;
  margin: 0;
}

.conv-system-row {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 4px 0;
}
.conv-system-strip {
  display: inline-block;
  max-width: 96%;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.65rem;
  line-height: 1.4;
  text-align: center;
  color: #4b5563;
  background: #e5e7eb;
  border: 1px solid #d1d5db;
}
.conv-system-strip--order {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}
.conv-system-strip--abandon {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}
.conv-system-strip--note {
  background: #fef9c3;
  border-color: #fde047;
  color: #713f12;
}
.conv-system-time {
  display: block;
  font-size: 0.58rem;
  color: inherit;
  opacity: 0.85;
  margin-bottom: 2px;
}
.conv-system-label {
  font-weight: 600;
}
.conv-system-detail {
  display: block;
  margin-top: 2px;
  font-weight: 400;
  opacity: 0.92;
}
.conv-system-strip--internal {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #78350f;
}

.queue-row--ticket-open {
  border-left: 3px solid #f97316;
  padding-left: 6px;
}
.ticket-pill {
  display: inline-block;
  font-size: 0.58rem;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}
.ticket-pill--open {
  background: #ffedd5;
  color: #9a3412;
}
.ticket-pill--pending {
  background: #dbeafe;
  color: #1e40af;
}
.ticket-pill--solved {
  background: #e5e7eb;
  color: #374151;
}

.ticket-status-inline {
  margin-top: 6px;
}
.ticket-status-lbl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
}
.ticket-status-select {
  min-width: 8rem;
}

.mail-compose-mode-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.mail-mode-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #f3f4f6;
  cursor: pointer;
  font-size: 0.72rem;
}
.mail-mode-tab.active {
  background: #e0e7ff;
  border-color: #6366f1;
  font-weight: 600;
}
.mail-compose-mode-hint {
  margin: 0 0 8px;
}
.mail-body-area--internal {
  background: #fffbeb !important;
  border-color: #fbbf24 !important;
}

/* 内部备注专用区域 */
.internal-note-zone {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0 10px;
}
.internal-note-hint {
  margin: 0;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 0.72rem;
}
.internal-note-area {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 100px;
  padding: 8px 10px;
  font-size: 0.82rem;
  line-height: 1.5;
  border-radius: var(--radius);
  border: 1.5px solid #fbbf24;
  background: #fffbeb;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s;
}
.internal-note-area:focus {
  outline: none;
  border-color: #d97706;
  background: #fefce8;
}
.internal-note-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.mail-macro-wrap {
  position: relative;
}
.mail-macro-btn {
  font-size: 1rem;
  line-height: 1;
}
.mail-macro-popover {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 50;
  margin-top: 4px;
  min-width: 220px;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
}
.mail-macro-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 6px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.72rem;
}
.mail-macro-item:hover {
  background: #f3f4f6;
}

.timeline-manual-modal .timeline-manual-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}
.timeline-manual-modal .timeline-manual-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.timeline-summary-wrap {
  margin: 0 0 12px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  min-width: 0;
}
.timeline-summary-wrap.hidden {
  display: none !important;
}
.timeline-summary-wrap--collapsed {
  max-height: min(280px, 48vh);
  overflow: hidden;
}
.timeline-summary-wrap--expanded {
  max-height: min(64vh, 900px);
  min-height: 140px;
  overflow: auto;
}

.timeline-summary {
  margin: 0;
  padding: 0;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  overflow-x: hidden;
  overflow-y: visible;
  min-width: 0;
}
.timeline-summary.hidden {
  display: none !important;
}
.timeline-summary:empty {
  display: none;
}

/* ---------- 终身时间轴：横向 flex 事件带（可滚宽度 = 卡片自然宽度之和，无绝对定位裁切） ---------- */
.tl-rail-scroll {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.tl-rail {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  width: max-content;
  min-height: 118px;
  padding: 14px 18px 18px;
  position: relative;
  box-sizing: border-box;
  gap: 0;
}
.tl-rail::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 38px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #cbd5e1 0%, #e2e8f0 50%, #cbd5e1 100%);
  z-index: 0;
  pointer-events: none;
}

.timeline-summary-wrap--collapsed .tl-rail {
  min-height: 92px;
  padding: 12px 14px 14px;
}
.timeline-summary-wrap--collapsed .tl-rail::before {
  top: 40px;
}
.timeline-summary-wrap--collapsed .tl-chip-detail {
  display: none !important;
}
.timeline-summary-wrap--collapsed .tl-chip-time {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  font-size: 0.68rem !important;
  font-weight: 500;
  line-height: 1.2;
  color: #475569 !important;
  text-align: center;
  max-width: 112px;
  margin: 0 auto 4px;
  padding: 2px 4px 0;
  min-height: 2.5em;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.timeline-summary-wrap--collapsed .tl-chip-card {
  padding: 6px 8px;
}
.timeline-summary-wrap--collapsed .tl-chip-label {
  font-size: 0.64rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.timeline-summary-wrap--collapsed .tl-chip {
  width: auto;
  min-width: 104px;
  max-width: 200px;
}
.timeline-summary-wrap--collapsed .tl-h-log-btn {
  padding: 2px 6px;
  font-size: 0.58rem;
  margin-top: 4px;
  width: 100%;
  text-align: center;
  line-height: 1.2;
}

.tl-chip {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 200px;
  max-width: min(200px, 42vw);
  box-sizing: border-box;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.tl-chip-time {
  font-size: 0.55rem;
  color: var(--muted);
  line-height: 1.25;
  margin-bottom: 2px;
  min-height: 2.2em;
}

.tl-chip-axis {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 28px;
  margin: 2px 0 8px;
  position: relative;
  z-index: 1;
}

.tl-chip-card {
  border-radius: 8px;
  padding: 8px 10px;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.tl-chip:hover .tl-chip-card {
  border-color: #c4b5fd;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.07);
}

.tl-chip-label {
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  word-break: break-word;
}

.tl-chip-detail {
  font-size: 0.62rem;
  line-height: 1.38;
  color: #374151;
  margin-top: 6px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.tl-h-log-btn {
  margin-top: 6px;
  flex-shrink: 0;
}

.tl-chip .tl-sum-dot {
  width: 18px;
  height: 18px;
}
.tl-chip .tl-sum-core {
  width: 8px;
  height: 8px;
}

.tl-rail-err {
  padding: 12px 16px;
  margin: 0;
}

.tl-sum-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.tl-sum-dot[class*="tl-shape-"] {
  border: none;
  background: var(--tl-dot-fill, #57534e);
}
.tl-sum-dot[class*="tl-shape-"] .tl-sum-core {
  display: none;
}
.tl-sum-dot.tl-shape-square {
  border-radius: 3px;
}
.tl-sum-dot.tl-shape-triangle-up {
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  border-radius: 0;
}
.tl-sum-dot.tl-shape-triangle-down {
  clip-path: polygon(50% 100%, 0% 0%, 100% 0%);
  border-radius: 0;
}
.tl-sum-dot.tl-shape-diamond {
  width: 13px;
  height: 13px;
  transform: rotate(45deg);
  border-radius: 2px;
}
.tl-sum-dot.tl-shape-diamond-alt {
  width: 12px;
  height: 12px;
  transform: rotate(45deg) scale(0.88);
  border-radius: 2px;
}
.tl-sum-dot.tl-shape-hex {
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  border-radius: 0;
}
.tl-sum-dot.tl-shape-oct {
  clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  border-radius: 0;
}
.tl-sum-dot.tl-shape-star {
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
  border-radius: 0;
}
.tl-sum-dot.tl-shape-circle-filled {
  border-radius: 50%;
}
.tl-sum-dot.tl-shape-dot-sm {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.tl-sum-core {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
}

.tl-chip.type-purchase .tl-sum-dot:not([class*="tl-shape-"]) {
  border-color: var(--tl-purchase-gold);
}
.tl-chip.type-abandoned .tl-sum-dot:not([class*="tl-shape-"]) {
  border-color: var(--warn);
}
.tl-chip.type-marketing .tl-sum-dot:not([class*="tl-shape-"]) {
  border-color: #9333ea;
}
.tl-chip.type-contact .tl-sum-dot:not([class*="tl-shape-"]),
.tl-chip.type-mail .tl-sum-dot:not([class*="tl-shape-"]) {
  border-color: var(--accent);
}
.tl-chip.type-shipment .tl-sum-dot:not([class*="tl-shape-"]) {
  border-color: #64748b;
}
.tl-chip.type-journey .tl-sum-dot:not([class*="tl-shape-"]) {
  border-color: #94a3b8;
}
.tl-chip.type-draft .tl-sum-dot:not([class*="tl-shape-"]) {
  border-color: #0d9488;
}
.tl-chip.type-info .tl-sum-dot:not([class*="tl-shape-"]) {
  border-color: #94a3b8;
}
.tl-chip.type-followup .tl-sum-dot:not([class*="tl-shape-"]) {
  border-color: var(--tl-mail-sent-fill, #4f46e5);
}
.tl-chip.type-manual .tl-sum-dot:not([class*="tl-shape-"]) {
  border-color: #c026d3;
}

.tl-sum-dot.tl-shape-mail-sent {
  width: 17px;
  height: 13px;
  clip-path: polygon(0% 18%, 50% 52%, 100% 18%, 100% 88%, 0% 88%);
  filter: drop-shadow(0 0 3px rgba(79, 70, 229, 0.55));
}
.tl-chip .tl-sum-dot.tl-sum-dot--mail-sent {
  width: 20px;
  height: 16px;
}
.tl-chip.tl-chip--mail-sent .tl-chip-label {
  font-weight: 650;
  color: #312e81;
}
.tl-chip.tl-chip--draft-quiet {
  opacity: 0.9;
}
.tl-chip.tl-chip--draft-quiet .tl-chip-detail {
  color: var(--muted);
}
.tl-sum-dot.tl-sum-dot--draft-quiet {
  opacity: 0.78;
  transform: scale(0.92);
}
.tl-chip.tl-chip--manual .tl-chip-label {
  font-weight: 600;
  color: #86198f;
}
.tl-sum-dot.tl-sum-dot--manual {
  filter: drop-shadow(0 0 2px rgba(192, 38, 211, 0.45));
}

.tl-sum-dot.tl-trace-meta .tl-sum-core {
  background: #1877f2;
}
.tl-sum-dot.tl-trace-google .tl-sum-core {
  background: #4285f4;
}
.tl-sum-dot.tl-trace-paid .tl-sum-core {
  background: #7c3aed;
}
.tl-sum-dot.tl-trace-other .tl-sum-core {
  background: #0f766e;
}
.tl-sum-dot.tl-trace-abandoned .tl-sum-core {
  background: #ea580c;
}
.tl-sum-dot.tl-trace-shipment .tl-sum-core {
  background: #475569;
}
.tl-sum-dot.tl-trace-zoko .tl-sum-core {
  background: #0284c7;
}
.tl-sum-dot.tl-trace-postscript .tl-sum-core {
  background: #f43f5e;
}
.tl-sum-dot.tl-trace-mailchimp .tl-sum-core {
  background: #facc15;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
}
.tl-sum-dot.tl-trace-marketing .tl-sum-core {
  background: #a855f7;
}
.tl-sum-dot.tl-trace-journey .tl-sum-core {
  background: #64748b;
}
.tl-sum-dot.tl-trace-ga .tl-sum-core {
  background: #f97316;
}
.tl-sum-dot.tl-trace-draft .tl-sum-core {
  background: #0d9488;
}
.tl-sum-dot.tl-trace-mail .tl-sum-core {
  background: #2563eb;
}
.tl-sum-dot.tl-trace-contact .tl-sum-core {
  background: #4f46e5;
}
.tl-sum-dot.tl-trace-ad .tl-sum-core {
  background: #db2777;
}
.tl-sum-dot.tl-trace-neutral .tl-sum-core {
  background: #94a3b8;
}
.tl-sum-dot.tl-trace-mail_sent .tl-sum-core {
  background: var(--tl-mail-sent-fill, #4f46e5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.tl-sum-dot.tl-trace-manual .tl-sum-core {
  background: #c026d3;
}

.mail-send-test-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 6px;
}
.mail-official-col {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 160px;
}
.mail-embed-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.mail-embed-chk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.62rem;
  white-space: nowrap;
  cursor: pointer;
  margin: 0;
}
.mail-embed-chk input {
  margin: 0;
}
.mail-coupon-pick-select {
  flex: 1 1 140px;
  min-width: 120px;
  max-width: 240px;
  font-size: 0.65rem !important;
  padding: 3px 6px !important;
  min-height: 26px;
}
/* 折扣码搜索组合框 */
.coupon-combobox {
  position: relative;
  flex: 1 1 140px;
  min-width: 120px;
  max-width: 260px;
}
.coupon-search-input {
  font-size: 0.65rem !important;
  padding: 3px 6px !important;
  min-height: 26px;
  width: 100%;
  box-sizing: border-box;
}
.coupon-dropdown {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  z-index: 5000;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  max-height: 200px;
  overflow-y: auto;
}
.coupon-dd-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border: none;
  background: none;
  font-size: 0.72rem;
  cursor: pointer;
  color: var(--text);
}
.coupon-dd-item:hover {
  background: #f0f4ff;
}
.coupon-dd-empty {
  padding: 8px 10px;
  font-size: 0.72rem;
  color: var(--muted);
}
.mail-coupon-pick-detail {
  font-size: 0.56rem;
  line-height: 1.2;
  margin: 0;
  min-height: 1.2em;
}
.mail-test-zone {
  flex: 1 1 220px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 2px dashed #a78bfa;
  background: #f5f3ff;
}
.mail-test-zone.mail-test-inline {
  flex: 1 1 260px;
  max-width: min(100%, 380px);
  padding: 6px 8px;
  gap: 6px;
  border-width: 1px;
}
.mail-test-inline .mail-test-input {
  min-width: 120px;
  flex: 1 1 140px;
}
.mail-official-send-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.mail-official-hint {
  flex: 1 1 220px;
  margin: 0 !important;
  min-width: 0;
}
.mail-official-send-row .btn-send-official {
  flex-shrink: 0;
}
.mail-test-zone-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #5b21b6;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mail-test-input {
  flex: 1 1 160px;
  min-width: 140px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #c4b5fd;
  font-family: inherit;
  font-size: 0.78rem;
  background: #fff;
}
.mail-test-btn {
  border-color: #7c3aed;
  color: #5b21b6;
  background: #ede9fe;
}
.mail-test-btn:hover {
  background: #ddd6fe;
}
.btn-send-official {
  flex: 0 0 auto;
  align-self: flex-start;
  min-height: 32px;
  font-size: 0.75rem;
  padding: 5px 12px;
}
.mail-test-hint {
  font-size: 0.65rem !important;
  margin: 0 0 8px !important;
}

/* 订单与商品卡片 - 紧凑样式 */
.orders { display: flex; flex-direction: column; gap: 8px; }

.order-block-compact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.order-header-compact {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.order-title-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.order-title-sm {
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--text);
}

.order-meta-xs {
  font-size: 0.62rem;
  color: var(--muted);
}

.order-total-xs {
  font-weight: 700;
  font-size: 0.72rem;
  text-align: right;
}

/* 紧凑商品卡片 */
.product-grid-compact {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
}

.product-card-compact {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px;
  font-size: 0.6rem;
}

.product-img-compact {
  width: 100%;
  height: 160px;
  overflow: hidden;
  border-radius: 6px;
  background: #f3f4f6;
  margin-bottom: 4px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-img-compact img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-img-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 0.6rem;
}

.product-info-compact {
  line-height: 1.25;
}

.product-name-compact {
  font-weight: 600;
  font-size: 0.62rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-variant-compact {
  font-size: 0.58rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-vendor-compact {
  font-size: 0.56rem;
  color: var(--muted);
}

.product-meta-xs {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.6rem;
  margin-top: 2px;
}

.product-actions {
  display: flex;
  gap: 2px;
  margin-top: 2px;
}

.badge-xs {
  background: var(--accent-soft);
  color: #1e40af;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 8px;
  font-size: 0.56rem;
}

.orders-panel .order-block-compact,
.abandoned-panel .order-block-compact {
  padding: 6px 9px;
}
.orders-panel .order-header-compact,
.abandoned-panel .order-header-compact {
  gap: 6px;
  margin-bottom: 5px;
}
.orders-panel .order-title-sm,
.abandoned-panel .order-title-sm {
  font-size: 0.54rem;
}
.orders-panel .order-meta-xs,
.abandoned-panel .order-meta-xs {
  font-size: 0.47rem;
}
.orders-panel .order-total-xs,
.abandoned-panel .order-total-xs {
  font-size: 0.54rem;
}
.orders-panel .product-grid-compact,
.abandoned-panel .product-grid-compact {
  gap: 5px;
}
.orders-panel .product-card-compact,
.abandoned-panel .product-card-compact {
  font-size: 0.45rem;
  padding: 5px;
}
.orders-panel .product-name-compact,
.abandoned-panel .product-name-compact {
  font-size: 0.47rem;
}
.orders-panel .product-variant-compact,
.abandoned-panel .product-variant-compact {
  font-size: 0.44rem;
}
.orders-panel .product-vendor-compact,
.abandoned-panel .product-vendor-compact {
  font-size: 0.42rem;
}
.orders-panel .product-meta-xs,
.abandoned-panel .product-meta-xs {
  font-size: 0.45rem;
}
.orders-panel .product-img-compact,
.abandoned-panel .product-img-compact {
  height: 120px;
  margin-bottom: 3px;
}
.orders-panel .badge-xs,
.abandoned-panel .badge-xs {
  font-size: 0.42rem;
}

.btn-xs {
  padding: 2px 4px;
  font-size: 0.6rem;
  border: none;
  background: #e5e7eb;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* 弃单商品模块 */
.abandoned-block {
  border: 1px solid #fcd34d;
  background: #fffbeb;
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 6px;
}

.ab-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  color: #92400e;
  margin-bottom: 4px;
  border-bottom: 1px dashed #fcd34d;
  padding-bottom: 2px;
}

.ab-id { font-weight: 600; }
.ab-date { color: #a16207; }

.ab-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.abandoned-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6rem;
  padding: 2px 0;
}

.ab-title {
  flex: 1;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ab-sku {
  color: var(--muted);
  font-size: 0.56rem;
}

/* 旧版兼容（若仍有使用） */
.order-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fafbfc;
}
.order-card h4 { margin: 0 0 8px; font-size: 0.88rem; }
.order-meta { font-size: 0.72rem; color: var(--muted); margin-bottom: 8px; }
.line-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  font-size: 0.78rem;
}
.line-grid span:nth-child(odd) { color: #374151; }
.line-grid span:nth-child(even) { color: var(--muted); text-align: right; }

.mail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}
.btn:hover { background: #f9fafb; }
.btn.primary { background: var(--accent); color: #fff; border-color: #1d4ed8; }
.btn.primary:hover { background: #1d4ed8; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 0.75rem; }

.overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
/* 登录层始终在主界面之上（主界面未隐藏时也不透出） */
#login-overlay.overlay {
  z-index: 5000;
}
.login-modal-card {
  text-align: center;
  width: min(380px, 92vw);
}
.login-brand-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.login-brand-logo {
  display: block;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}
.login-title-block {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 6px 10px;
  row-gap: 2px;
}
.login-product-name {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.login-byline {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.login-modal-card .login-welcome {
  text-align: center;
  margin: 14px 0 4px;
}
.login-modal-card input,
.login-modal-card button {
  text-align: left;
}
.login-modal-card #login-btn {
  text-align: center;
}
#admin-modal.overlay {
  z-index: 6000;
}
#stats-modal.overlay {
  z-index: 6000;
}
#timeline-log-modal.overlay {
  z-index: 6200;
}
.timeline-log-modal {
  width: min(580px, 94vw);
}
.timeline-log-modal .modal-head {
  align-items: flex-start;
  gap: 10px;
}
.timeline-log-h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}
.timeline-log-meta {
  margin: 0 0 12px;
}
.timeline-log-field {
  margin-bottom: 12px;
}
.timeline-log-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}
.timeline-log-pre {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 28vh;
  overflow: auto;
}
.timeline-log-pre-body {
  max-height: 40vh;
}

/* AI 邮件：Prompt 预览与自定义模版 */
.mail-prompt-block {
  margin: 10px 0 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e0e7ff;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}
.mail-prompt-block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 8px;
}
.mail-prompt-block-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: #334155;
  flex: 1 1 200px;
  min-width: 0;
}
.mail-prompt-status {
  flex: 1 1 160px;
  margin: 0 !important;
  text-align: right;
}
.mail-prompt-panel-combined {
  max-height: 320px;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}
.mail-prompt-sec {
  border-bottom: 1px dashed #e2e8f0;
}
.mail-prompt-sec:last-child {
  border-bottom: none;
}
.mail-prompt-sec-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #64748b;
  padding: 6px 12px 2px;
  background: #f8fafc;
}
.mail-prompt-pre-embedded {
  padding-top: 4px;
}
.mail-prompt-panel {
  max-height: 240px;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}
.mail-prompt-pre {
  margin: 0;
  padding: 10px 12px;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.mail-prompt-user-html {
  padding: 10px 12px;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.mail-prompt-user-html mark.prompt-slot {
  padding: 1px 4px;
  margin: 0 1px;
  border-radius: 4px;
  font-weight: 600;
  background: #e2e8f0;
  color: #0f172a;
}
.mail-prompt-user-html mark[data-slot-key="customer_first_name"] { background: #fef08a; color: #713f12; }
.mail-prompt-user-html mark[data-slot-key="city"] { background: #bfdbfe; color: #1e3a5f; }
.mail-prompt-user-html mark[data-slot-key="country"] { background: #99f6e4; color: #134e4a; }
.mail-prompt-user-html mark[data-slot-key="days_since_last_action"] { background: #fecaca; color: #7f1d1d; }
.mail-prompt-user-html mark[data-slot-key="purchased_item_hints"] { background: #fde68a; color: #78350f; }
.mail-prompt-user-html mark[data-slot-key="traffic_source_blurred"] { background: #ddd6fe; color: #4c1d95; }
.mail-prompt-user-html mark[data-slot-key="event_action_blurred"] { background: #fbcfe8; color: #831843; }
.mail-prompt-user-html mark[data-slot-key="store_display_name"] { background: #a5b4fc; color: #312e81; }
.mail-prompt-user-html mark[data-slot-key="customer_email"] { background: #94a3b8; color: #0f172a; }
.mail-prompt-user-html mark[data-slot-key="mail_goal_label"] { background: #fed7aa; color: #7c2d12; }
.mail-prompt-user-html mark[data-slot-key="sender_display_line"] { background: #bbf7d0; color: #14532d; }
.mail-prompt-user-html mark[data-slot-key="coupon_lines"] { background: #fce7f3; color: #831843; }
.mail-prompt-user-html mark[data-slot-key="order_summary_compact"] { background: #e9d5ff; color: #4a148c; }
.mail-prompt-user-html mark[data-slot-key="locale_hint"] { background: #cffafe; color: #164e63; }

/* Prompt 预览：默认折叠，位于工具栏下方 */
.mail-prompt-details {
  margin: 14px 0 0;
  padding: 0;
  border: none;
  background: transparent;
}
.mail-prompt-details-sum {
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  margin: 0;
  border-radius: 10px;
  border: 1px solid #e0e7ff;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  font-size: 0.68rem;
  font-weight: 700;
  color: #334155;
  user-select: none;
}
.mail-prompt-details-sum::-webkit-details-marker {
  display: none;
}
.mail-prompt-details-sum::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  color: var(--muted);
  transition: transform 0.15s;
  font-size: 0.65rem;
}
.mail-prompt-details[open] > .mail-prompt-details-sum::before {
  transform: rotate(90deg);
}
.mail-prompt-details-sum-title {
  flex: 1 1 200px;
  min-width: 0;
}
.mail-prompt-details-sum .mail-prompt-status {
  flex: 1 1 160px;
  margin: 0 !important;
  text-align: right;
  font-weight: 500;
}
.mail-prompt-details-body {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e0e7ff;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}
.mail-prompt-details-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.mail-prompt-dd {
  position: relative;
}
.mail-prompt-dd-btn {
  max-width: 240px;
  text-align: left;
}
.mail-prompt-caret {
  margin-left: 4px;
  opacity: 0.65;
}
.mail-prompt-dd-menu {
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 4px;
  min-width: 340px;
  max-width: 400px;
  max-height: 300px;
  overflow: auto;
  z-index: 80;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 6px;
}
.mp-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 4px;
  align-items: stretch;
  margin-bottom: 4px;
}
.mp-main {
  min-width: 0;
  text-align: left;
  font-size: 0.72rem;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #f8fafc;
  cursor: pointer;
  font-family: inherit;
}
.mp-side {
  flex: 0 0 auto;
  font-size: 0.65rem;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.mp-edit {
  font-size: 0.65rem;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #fcd34d;
  background: #fffbeb;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.mp-edit-off {
  display: block;
  min-height: 2rem;
  min-width: 2.6rem;
}
.mp-add {
  width: 100%;
  margin-top: 6px;
  padding: 8px;
  font-size: 0.72rem;
  border-radius: 8px;
  border: 1px dashed var(--accent);
  background: #eff6ff;
  cursor: pointer;
  font-family: inherit;
  color: var(--accent);
}
.mail-prompt-modal .modal-head {
  align-items: flex-start;
}
.mail-prompt-modal-h2 {
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.35;
  flex: 1;
}
.mail-prompt-pre-tpl {
  max-height: 52vh;
}
.mail-prompt-view-meta {
  margin: 0 0 10px;
  padding: 10px 12px;
  background: #f1f5f9;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  line-height: 1.5;
}
.mail-prompt-view-meta dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
}
.mail-prompt-view-meta dt {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}
.mail-prompt-view-meta dd {
  margin: 0;
}
.mail-prompt-view-tz-note {
  grid-column: 1 / -1;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
}
.mail-prompt-view-copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.mail-prompt-view-copy-status {
  min-height: 1em;
}
.mp-creator-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15em;
  height: 1.15em;
  margin-left: 4px;
  border-radius: 999px;
  font-size: 0.72em;
  font-weight: 700;
  color: #fff;
  vertical-align: middle;
  line-height: 1;
  flex-shrink: 0;
}
.mail-prompt-guide {
  white-space: pre-wrap;
  line-height: 1.45;
  max-height: 30vh;
  overflow: auto;
  padding: 10px 12px;
  background: #f1f5f9;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.72rem;
}
.mail-prompt-add-textarea {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
}
.mail-prompt-add-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.mail-prompt-add-actions #mail-prompt-add-save {
  margin-left: auto;
}
.mail-prompt-delete-btn {
  color: #b91c1c;
  border-color: #fecaca !important;
}
.mail-prompt-add-copy-status {
  flex: 1 1 120px;
  min-width: 0;
}
#mail-prompt-tpl-view-modal.overlay,
#mail-prompt-add-modal.overlay {
  z-index: 6300;
}

.modal {
  background: var(--surface);
  padding: 28px 32px;
  border-radius: 14px;
  width: min(360px, 92vw);
  box-shadow: 0 24px 48px rgba(0,0,0,.12);
  max-height: 90vh;
  overflow-y: auto;
}
.modal.wide { width: min(720px, 96vw); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; margin: 16px 0; }
.admin-table th, .admin-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.admin-table th { background: #f3f4f6; }
.admin-form { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.admin-form h3 { margin: 0 0 10px; font-size: 0.95rem; }
.admin-form .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-form input, .admin-form select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); font-family: inherit; font-size: 0.82rem; }
#macros-admin-modal.overlay { z-index: 6200; }
#prompt-center-modal.overlay { z-index: 6250; }
.prompt-center-toolbar { margin: 12px 0; gap: 16px; align-items: flex-end; flex-wrap: wrap; display: flex; }
.prompt-center-toolbar .stb-select { min-width: 220px; }
.prompt-center-active { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; }
.prompt-center-ta { font-family: inherit; font-size: 0.82rem; line-height: 1.45; width: 100%; box-sizing: border-box; margin: 6px 0 0; }
.prompt-center-modal .macros-admin-lbl.block { margin-bottom: 12px; }
.macros-admin-form { margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.macros-admin-form h3 { margin: 0 0 10px; font-size: 0.95rem; }
.macros-admin-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 10px; }
.macros-admin-lbl { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; flex: 1 1 200px; }
.macros-admin-lbl.block { flex-basis: 100%; }
.macros-admin-sort-wrap { flex: 0 0 100px; max-width: 120px; }
.macros-admin-body { width: 100%; resize: vertical; min-height: 88px; margin: 0; font-family: inherit; }
.macros-admin-form .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.macros-admin-modal .macros-admin-lbl .stb-input { margin: 0; width: 100%; box-sizing: border-box; }
#new-user { min-width: 120px; flex: 0 1 140px; }
#new-pass { min-width: 160px; flex: 1 1 200px; }
.modal h1 { margin: 0 0 8px; font-size: 1.5rem; }
.modal input {
  width: 100%;
  margin: 16px 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
}
/* Shopee 弹窗内紧凑输入(覆盖 .modal input 的大尺寸/100% 宽,等优先级靠位置取胜) */
.shopee-sku-table input,
.shopee-cost-seg input {
  width: 60px;
  margin: 0;
  padding: 4px 6px;
  font-size: 0.82rem;
  text-align: center;
}
.shopee-cost-field input { width: 100%; text-align: left; }
.shopee-cost-seg input[type="date"] { width: 150px; text-align: left; }
.shopee-sku-name { white-space: normal; word-break: break-word; }
.shopee-sku-num-col { width: 96px; }
.err { color: var(--danger); font-size: 0.8rem; min-height: 1.2em; }

@media (max-width: 900px) {
  .layout-with-rail {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: auto;
    min-height: calc(100vh - var(--topbar-h));
  }
  #decision-page .layout-with-rail {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
  }
  #decision-page #tt-function-column {
    width: 100% !important;
    flex-direction: row !important;
    overflow-x: auto;
  }
  .store-rail {
    flex-direction: row;
    justify-content: flex-start;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .layout,
  .layout.social-mode {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .store-module-nav {
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .store-module-btn {
    width: auto;
    min-width: 72px;
    min-height: 34px;
    font-size: clamp(0.42rem, 1.8vw, 0.68rem);
    white-space: nowrap;
  }
  .layout.social-mode .social-module {
    grid-column: 1;
  }
  .sidebar { max-height: 42vh; border-right: none; border-bottom: 1px solid var(--border); }
  .social-summary-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .shopee-control-grid { grid-template-columns: 1fr; }
  .social-control-grid { grid-template-columns: 1fr; }
}

/* 统计弹窗 */
.stats-body {
  font-size: 0.78rem;
  line-height: 1.5;
  max-height: 70vh;
  overflow: auto;
  color: var(--text);
}
.stats-kpi-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0 16px;
}
.stats-kpi {
  flex: 1;
  min-width: 100px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.stats-kpi-val {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}
.stats-kpi-lbl {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 4px;
}

.stats-section { margin-bottom: 14px; }
.stats-body h4 {
  margin: 14px 0 6px;
  font-size: 0.82rem;
  font-weight: 600;
}
.stats-lead { margin: 0 0 8px; }
.stats-pricing-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.72rem;
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: 1fr; }
}
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}
.stats-table th,
.stats-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
}
.stats-table th { background: #f3f4f6; }
.mail-panel-v2 #draft-cost-hint { margin: 0; line-height: 1.35; }

/* 统计页面（类似 TrueView 的完整页面视图） */
.page-view {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  overflow-y: auto;
}
#stats-page.page-view {
  z-index: 3500;
}
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.page-header h2 {
  margin: 0;
  font-size: 1.35rem;
}
#stats-page .stats-body {
  max-height: none;
  min-height: 200px;
  font-size: 0.88rem;
}
#stats-page .stats-section {
  background: var(--surface);
  padding: 16px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
#stats-page .stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
#stats-page .stats-table {
  font-size: 0.82rem;
}
#stats-page .stats-table th,
#stats-page .stats-table td {
  padding: 8px 10px;
}

/* ── TrueView Page ─────────────────────────────────────────────────────── */
#trueview-page.page-view {
  z-index: 3500;
}
.trueview-page-container {
  max-width: none;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-sizing: border-box;
}
.trueview-frame-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  min-height: 0;
}
.trueview-iframe {
  width: 100%;
  flex: 1;
  border: none;
  min-height: 0;
}

/* TrueView tabs */
.tv-tab-bar {
  display: flex;
  gap: 4px;
}
.tv-tab {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.tv-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.tv-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* TrueView ad report */
.tv-ar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  flex-wrap: wrap;
}
.tv-ar-date-label {
  display: flex;
  flex-direction: column;
  font-size: .8rem;
  color: var(--text-muted);
  gap: 3px;
}
.tv-ar-date-input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 8px;
  background: var(--surface);
  font-size: .85rem;
  color: var(--text);
}
.tv-ar-report {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 40px;
}
.tv-ar-section {
  margin-bottom: 24px;
}
.tv-ar-h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}
.tv-ar-h4 {
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-muted);
}
.tv-ar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.tv-ar-table th {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
}
.tv-ar-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.tv-ar-table tr.tv-ar-total td {
  font-weight: 700;
  background: var(--surface-alt, #f8fafc);
}

/* ── Ad Report Page ────────────────────────────────────────────────────── */
#ad-report-page.page-view {
  z-index: 3500;
}
.ad-report-page-container {
  max-width: none;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-sizing: border-box;
}
.ad-report-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ad-report-list-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.ad-report-site-group {
  margin-bottom: 14px;
}
.ad-report-site-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
  margin: 0 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.ad-report-file-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ad-report-file-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.72rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  gap: 8px;
}
.ad-report-file-btn:hover {
  background: #eef2ff;
  border-color: #6366f1;
}
.ad-report-file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ad-report-file-date {
  font-size: 0.62rem;
  color: var(--muted);
  white-space: nowrap;
}
.ad-report-viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.ad-report-viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ad-report-iframe {
  flex: 1;
  border: none;
  min-height: 0;
  width: 100%;
}
.ad-report-unavailable {
  padding: 24px;
  color: var(--muted);
  font-size: 0.8rem;
}

/* ── Source Investigation Panel ────────────────────────────────────────── */
.source-investigation-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: 6px;
  font-size: 0.8rem;
}
.btn-source-investigate {
  margin-top: 6px;
  font-size: 0.75rem;
}

/* ── Timeline email dot shapes ─────────────────────────────────────────── */
.tl-shape-mail-in,
.tl-shape-mail-sent {
  border-radius: 3px;
  transform: rotate(45deg);
  width: 10px;
  height: 10px;
}

/* ── Admin stores section ──────────────────────────────────────────────── */
.admin-stores-section h3 {
  font-size: 0.95rem;
}

/* ── Extra Instructions textarea ──────────────────────────────────────── */
.mail-extra-instructions-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
}
.mail-extra-instructions-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.mail-extra-instructions-area {
  width: 100%;
  min-height: 52px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  padding: 6px 8px;
  font-family: inherit;
  line-height: 1.45;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.mail-extra-instructions-area:focus {
  outline: none;
  border-color: var(--primary);
}
.mail-extra-instructions-area::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

/* ── Email Effectiveness Stats ─────────────────────────────────────────── */
.stats-effectiveness-row {
  margin-top: 14px;
}
.stats-effectiveness-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.stats-effectiveness-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}
.kpi-good { color: #059669; }
.kpi-ok   { color: #d97706; }
.kpi-low  { color: #dc2626; }

/* ── Extra Instructions (below mail body) ─────────────────────────────── */
.mail-extra-instr-row {
  margin-top: 8px;
  width: 100%;
}
.mail-extra-instr-wrap {
  width: 90%;
  margin: 0 auto;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.mail-extra-instr-label {
  display: block;
  font-size: 0.73rem;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.02em;
  margin-bottom: 5px;
}
.mail-extra-instr-area {
  width: 100%;
  min-height: 52px;
  resize: vertical;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.55);
  color: #475569;
  font-size: 0.82rem;
  padding: 6px 8px;
  font-family: inherit;
  line-height: 1.45;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.mail-extra-instr-area:focus {
  outline: none;
  border-color: #94a3b8;
  background: rgba(255, 255, 255, 0.8);
}
.mail-extra-instr-area::placeholder {
  color: #94a3b8;
}
.mail-extra-instr-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  justify-content: flex-end;
}
.mail-extra-instr-save-btn {
  background: #0d9488;
  color: #fff;
  border: none;
  font-size: 0.78rem;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s;
}
.mail-extra-instr-save-btn:hover { background: #0f766e; }
.extra-instr-saved-hint {
  font-size: 0.73rem;
  color: #0d9488;
  font-weight: 500;
}

/* ── Prompt Generate (step 1+2 in add modal) ──────────────────────────── */
.prompt-gen-step {
  margin-bottom: 12px;
}
.prompt-gen-step-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}
.prompt-gen-base-select {
  width: 100%;
  margin-bottom: 4px;
}
.prompt-gen-instructions {
  width: 100%;
  resize: vertical;
  font-size: 0.82rem;
}
.prompt-gen-btn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.prompt-gen-generate-btn {
  background: #7c3aed;
  color: #fff;
  border: none;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.prompt-gen-generate-btn:hover { background: #6d28d9; }
.prompt-gen-generate-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.mail-prompt-gen-status {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ── Workflow Page ─────────────────────────────────────────────────────── */
.workflow-page-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px;
}
.workflow-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}
.workflow-empty {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 32px 0;
}
.workflow-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 0.15s;
}
.workflow-card--enabled { border-left: 3px solid #059669; }
.workflow-card--disabled { border-left: 3px solid #94a3b8; opacity: 0.85; }
.workflow-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.workflow-card-title,
.workflow-card-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.workflow-card-name {
  font-weight: 600;
  font-size: 0.95rem;
}
.workflow-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}
.workflow-badge--on  { background: #d1fae5; color: #065f46; }
.workflow-badge--off { background: #f1f5f9; color: #64748b; }
.workflow-card-meta {
  display: flex;
  gap: 16px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.workflow-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.workflow-run-live {
  margin-top: 8px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 7px;
  padding: 7px 9px;
  font-size: 0.76rem;
  font-weight: 700;
}
.workflow-jobs {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 10px;
}
.workflow-job-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.workflow-job-tab {
  border: 1px solid var(--border);
  background: #fff;
  color: #475569;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}
.workflow-job-tab.is-active {
  background: #111827;
  color: #fff;
  border-color: #111827;
}
.workflow-jobs-head {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.workflow-select-ready {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #334155;
  letter-spacing: 0;
  text-transform: none;
}
.workflow-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.workflow-job-header {
  display: grid;
  grid-template-columns: 24px minmax(110px, 0.7fr) minmax(190px, 1.1fr) minmax(120px, 0.8fr) minmax(150px, auto) minmax(220px, 1.3fr) minmax(150px, auto);
  gap: 8px;
  align-items: center;
  padding: 0 8px 6px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 6px;
}
.workflow-job-header span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workflow-job {
  display: grid;
  grid-template-columns: 24px minmax(110px, 0.7fr) minmax(190px, 1.1fr) minmax(120px, 0.8fr) minmax(150px, auto) minmax(220px, 1.3fr) minmax(150px, auto);
  gap: 8px;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 6px 8px;
  background: #fafafa;
  font-size: 0.74rem;
}
.workflow-job-status {
  font-weight: 700;
  color: #475569;
}
.workflow-job--sent .workflow-job-status { color: #047857; }
.workflow-job--sending .workflow-job-status,
.workflow-job--queued .workflow-job-status,
.workflow-job--candidate .workflow-job-status,
.workflow-job--draft_ready .workflow-job-status,
.workflow-job--approved .workflow-job-status,
.workflow-job--drafting .workflow-job-status,
.workflow-job--qa_checking .workflow-job-status { color: #1d4ed8; }
.workflow-job--qa_failed .workflow-job-status,
.workflow-job--error .workflow-job-status { color: #b91c1c; }
.workflow-job--skipped .workflow-job-status { color: #92400e; }
.workflow-job-person,
.workflow-job-reason,
.workflow-job-qa,
.workflow-job-timeline {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workflow-job-person strong,
.workflow-job-person em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workflow-job-person em {
  margin-top: 2px;
  color: var(--muted);
  font-style: normal;
  font-size: 0.68rem;
}
.workflow-job-reason,
.workflow-job-qa {
  white-space: nowrap;
}
.workflow-job-time {
  color: var(--muted);
  white-space: nowrap;
}
.workflow-job-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.workflow-modal {
  max-width: 440px;
}
.workflow-delay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.workflow-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  margin: 8px 0;
}
.workflow-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.workflow-preview-modal {
  width: min(980px, calc(100vw - 32px));
  max-width: 980px;
  max-height: min(860px, calc(100vh - 32px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.workflow-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.workflow-preview-head h2 {
  margin: 0;
  font-size: 1rem;
}
.workflow-preview-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.workflow-preview-summary {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.workflow-preview-alert {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.78rem;
  color: #475569;
}
.workflow-preview-status {
  flex: 0 0 auto;
  font-weight: 800;
}
.workflow-preview-status--sent { color: #047857; }
.workflow-preview-status--queued,
.workflow-preview-status--sending,
.workflow-preview-status--drafting,
.workflow-preview-status--qa_checking { color: #1d4ed8; }
.workflow-preview-status--qa_failed,
.workflow-preview-status--error { color: #b91c1c; }
.workflow-preview-status--skipped { color: #92400e; }
.workflow-preview-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.workflow-preview-fields > div {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
}
.workflow-preview-fields span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  margin-bottom: 3px;
}
.workflow-preview-fields strong,
.workflow-preview-subject {
  display: block;
  color: #111827;
  font-size: 0.82rem;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}
.workflow-preview-subject {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 8px;
  font-family: inherit;
}
.workflow-preview-body-wrap {
  padding-top: 12px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.workflow-preview-body {
  margin: 8px 0 0;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.75;
  white-space: pre-wrap;
  resize: vertical;
  overflow: auto;
  min-height: 280px;
  max-height: calc(100vh - 380px);
}
@media (max-width: 720px) {
  .workflow-job { grid-template-columns: 1fr; }
  .workflow-job-header { display: none; }
  .workflow-delay-grid { grid-template-columns: 1fr; }
  .workflow-preview-head,
  .workflow-preview-alert {
    flex-direction: column;
    align-items: stretch;
  }
  .workflow-preview-fields {
    grid-template-columns: 1fr;
  }
}

/* ── TrackTrack UI System (Polaris-inspired, no framework) ──────────── */

/* Page layout */
.tt-page { padding: 24px 28px; max-width: 960px; }
.tt-page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.tt-page-title { font-size: 1.2rem; font-weight: 700; margin: 0; }
.tt-page-actions { display: flex; gap: 8px; align-items: center; }

/* Card */
.tt-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.tt-card + .tt-card { margin-top: 12px; }
.tt-card-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.tt-card-section { padding: 14px; }
.tt-card-section + .tt-card-section { border-top: 1px solid var(--border); }

/* Stack / Inline */
.tt-stack { display: flex; flex-direction: column; gap: 12px; }
.tt-stack--sm { gap: 6px; }
.tt-stack--lg { gap: 20px; }
.tt-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tt-inline--end { justify-content: flex-end; }
.tt-inline--between { justify-content: space-between; align-items: flex-start; }

/* Form fields */
.tt-field { display: flex; flex-direction: column; gap: 4px; }
.tt-label {
  font-size: 0.75rem; font-weight: 600; color: var(--text);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.tt-input, .tt-textarea, .tt-select {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; font-size: 0.875rem;
  background: #fff; font-family: inherit; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tt-input:focus, .tt-textarea:focus, .tt-select:focus {
  outline: none; border-color: #5c6ac4;
  box-shadow: 0 0 0 2px rgba(92,106,196,0.15);
}
.tt-textarea { resize: vertical; min-height: 80px; line-height: 1.55; }
.tt-textarea--sm { min-height: 56px; }
.tt-select { cursor: pointer; }

/* Badge */
.tt-badge {
  display: inline-flex; align-items: center;
  font-size: 0.68rem; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; letter-spacing: 0.03em; flex-shrink: 0;
}

/* Empty */
.tt-empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 0.875rem; }

/* Two-column layout */
.tt-modal-wide { max-width: 820px !important; }
.tt-two-column {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 600px) { .tt-two-column { grid-template-columns: 1fr; } }
.tt-main-column { min-width: 0; }
.tt-side-column { min-width: 0; }

/* Decision Detail — wide stable layout */
.tt-modal-xl { width: min(1200px, 96vw) !important; max-width: none !important; }
.tt-two-col-detail {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(280px, 320px);
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) { .tt-two-col-detail { grid-template-columns: 1fr; } }
.tt-detail-main { min-width: 0; }
.tt-detail-side { min-width: 0; }

/* Amendment inline form */
.decision-amend-form { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; }
.decision-amend-item { font-size: 0.78rem; line-height: 1.5; padding: 6px 0; border-bottom: 1px solid var(--border); }
.decision-amend-item:last-child { border-bottom: none; }

/* Resource list */
.tt-resource-list {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.tt-resource-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.1s;
}
.tt-resource-item:last-child { border-bottom: none; }
.tt-resource-item:hover { background: #f8fafc; }
.tt-resource-item-main { flex: 1; min-width: 0; }
.tt-resource-item-side { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* Meta row */
.tt-meta {
  display: flex; gap: 10px; font-size: 0.775rem;
  color: var(--muted); flex-wrap: wrap; align-items: center; margin-top: 3px;
}

/* Choice grid (mode selector) */
.tt-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tt-choice-card {
  border: 2px solid var(--border); border-radius: 8px;
  padding: 12px 14px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.tt-choice-card:hover { border-color: #5c6ac4; }
.tt-choice-card.selected { border-color: #5c6ac4; background: #f5f6ff; }
.tt-choice-card-title { font-weight: 600; font-size: 0.875rem; margin-bottom: 2px; }
.tt-choice-card-desc { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }

/* ── Decision Cards specifics ─────────────────────────────────────────── */
.decision-badge {
  font-size: 0.68rem; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; letter-spacing: 0.03em; flex-shrink: 0;
}
.decision-badge--active    { background: #dbeafe; color: #1d4ed8; }
.decision-badge--reviewing { background: #fef3c7; color: #92400e; }
.decision-badge--concluded { background: #d1fae5; color: #065f46; }
.decision-badge--cancelled { background: #f1f5f9; color: #64748b; }
.decision-badge--track     { background: #ede9fe; color: #5b21b6; }
.decision-badge--review    { background: #fce7f3; color: #9d174d; }
.decision-badge--question  { background: #e0f2fe; color: #0369a1; }
.decision-badge--watch     { background: #dcfce7; color: #15803d; }

.decision-item-title {
  font-weight: 600; font-size: 0.9rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.decision-item-goal {
  font-size: 0.8rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 2px;
}

.decision-due-warn    { color: #b45309; font-weight: 600; }
.decision-due-overdue { color: #dc2626; font-weight: 600; }

.decision-detail-text { font-size: 0.875rem; line-height: 1.55; white-space: pre-wrap; color: var(--text); }
.decision-detail-empty { font-size: 0.875rem; color: var(--muted); font-style: italic; }

.decision-action-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.decision-action-row:last-child { border-bottom: none; }
.decision-action-check { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; margin-top: 2px; }
.decision-action-text { flex: 1; font-size: 0.875rem; min-width: 0; word-break: break-word; line-height: 1.5; white-space: pre-wrap; }
.decision-action-text.done { text-decoration: line-through; color: var(--muted); }
.decision-action-del { font-size: 0.8rem; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; }
.decision-action-del:hover { color: #dc2626; background: #fee2e2; }

/* Decision Detail — full-page layout */
.tt-detail-page { padding: 20px 28px; max-width: 1280px; margin: 0 auto; }
.tt-detail-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.tt-detail-header h2 { margin: 0; font-size: 1.1rem; word-break: break-word; min-width: 0; }
.tt-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 960px) { .tt-detail-layout { grid-template-columns: 1fr; } }

.decision-chips-wrap { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; }
.decision-chip {
  background: #eff6ff; color: #1d4ed8; border-radius: 999px;
  padding: 3px 10px 3px 12px; font-size: 0.8rem;
  display: flex; align-items: center; gap: 4px;
}
.decision-chip-del { cursor: pointer; color: #93c5fd; line-height: 1; }
.decision-chip-del:hover { color: #dc2626; }

.decision-review-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.decision-review-item:last-child { border-bottom: none; }
.decision-review-verdict-success { color: #065f46; font-weight: 600; }
.decision-review-verdict-partial  { color: #92400e; font-weight: 600; }
.decision-review-verdict-failure  { color: #991b1b; font-weight: 600; }
.decision-review-verdict-unclear  { color: #64748b; font-weight: 600; }

.decision-detail-meta-row { display: flex; flex-direction: column; gap: 2px; }
.decision-detail-meta-val { font-size: 0.85rem; }
.shopee-sku-locked { background: #f8fafc; color: #64748b; }
.shopee-sku-locknote { font-size: 0.66rem; color: #64748b; margin-top: 2px; line-height: 1.4; }
.shopee-sku-badge-lock { background: #64748b; }
.shopee-sku-locked input { opacity: .5; }
.shopee-period-scroll { max-height: 200px; overflow: auto; }
.shopee-period-scroll .shopee-mini-table thead th { position: sticky; top: 0; background: #f1f5f9; }
.shopee-period-full { grid-column: 1 / -1; }
.shopee-period-scroll-full { max-height: 46vh; }
.shopee-period-bigtable { width: 100%; white-space: nowrap; }
.shopee-period-bigtable th, .shopee-period-bigtable td { padding: 5px 10px; }
