/* Collaboration Performance V2 — dashboard điều hành, ưu tiên đọc trong 5 giây. */
/* `hidden` phải thắng các khai báo display:grid/flex của từng khối. Nếu thiếu,
   nút tab đổi trạng thái nhưng nội dung của hai tab vẫn cùng hiển thị. */
#collabView .cp-dashboard[hidden],
#collabView .cp-target-overview[hidden],
#collabView .collab-filter[hidden],
#collabView .table-shell[hidden],
#collabView .collab-menu-wrap[hidden],
#collabView #refreshCollab[hidden] {
  display: none !important;
}

#collabView {
  --cp-purple: var(--p600, #6e4ae8);
  --cp-purple-strong: var(--p700, #5b36d6);
  --cp-purple-soft: var(--p50, #f7f4ff);
  --cp-orange: var(--o600, #e9792f);
  --cp-orange-soft: var(--o50, #fff8f2);
  --cp-pink: var(--pk600, #d84c8e);
  --cp-pink-soft: var(--pk50, #fff6fa);
  --cp-blue: var(--blue, #3e8ed0);
  --cp-blue-soft: var(--blue-soft, #edf6fd);
  --cp-danger: var(--danger, #d94c4c);
  --cp-danger-soft: var(--danger-soft, #fdeeee);
  /* Alias cho các class cũ trong phần drawer, tránh tạo một bảng màu thứ hai. */
  --cp-green: var(--cp-blue);
  --cp-green-soft: var(--cp-blue-soft);
  --cp-amber: var(--cp-orange);
  --cp-amber-soft: var(--cp-orange-soft);
  --cp-red: var(--cp-danger);
  --cp-red-soft: var(--cp-danger-soft);
  --cp-slate: var(--cp-pink);
  --cp-line: color-mix(in srgb, var(--line, #e5e7eb) 88%, transparent);
}

#collabPerformancePanel {
  color: var(--text, #1f2937);
  padding: 2px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 0 0, color-mix(in srgb, var(--cp-purple) 8%, transparent), transparent 28%),
    radial-gradient(circle at 100% 18%, color-mix(in srgb, var(--cp-pink) 7%, transparent), transparent 25%);
}

.cp-target-overview {
  display: flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 4px;
  border-radius: 8px;
  background: var(--surface-2, #f7f7f8);
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}
.cp-target-overview:empty { display: none; }
.cp-target-stat {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.cp-target-stat:hover { background: var(--card, #fff); }
.cp-target-stat:focus-visible {
  outline: 2px solid var(--cp-purple);
  outline-offset: 2px;
}
.cp-target-stat.active {
  border-color: color-mix(in srgb, var(--cp-purple) 18%, transparent);
  background: var(--card, #fff);
  box-shadow: 0 1px 4px rgba(31, 41, 55, .08);
}
.cp-target-stat span { color: var(--text, #1f2937); font-size: 13px; font-weight: 650; }
.cp-target-stat strong { font-size: 14px; line-height: 1; font-variant-numeric: tabular-nums; }
.cp-target-stat.active span { color: var(--cp-purple-strong); }
.cp-target-stat[data-status="1"] strong { color: var(--cp-purple); }
.cp-target-stat[data-status="2"] strong { color: var(--cp-orange); }
.cp-target-stat[data-status="3"] strong { color: var(--cp-pink); }
.cp-target-stat[data-status="4"] strong { color: var(--cp-blue); }

.cp-dashboard { display: grid; gap: 14px; }
.cp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--cp-line);
  border-radius: 14px;
  background:
    linear-gradient(112deg, color-mix(in srgb, var(--cp-purple-soft) 72%, var(--card, #fff)) 0%,
      color-mix(in srgb, var(--cp-pink-soft) 42%, var(--card, #fff)) 62%,
      color-mix(in srgb, var(--cp-orange-soft) 48%, var(--card, #fff)) 100%);
  box-shadow: inset 4px 0 0 var(--cp-purple), 0 8px 24px color-mix(in srgb, var(--cp-purple) 8%, transparent);
}
.cp-toolbar h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.cp-toolbar p { margin: 3px 0 0; color: var(--muted, #667085); font-size: 12px; }
.cp-toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.cp-toolbar-actions label { color: var(--muted, #667085); font-size: 12px; font-weight: 650; }
.cp-toolbar-actions select { min-height: 40px; border: 1px solid var(--line, #d9dce5); border-radius: 9px; padding: 0 10px; background: var(--surface, #fff); color: var(--text, #1f2937); }
.cp-toolbar-actions button { min-height: 42px; }
.cp-sync-time { font-size: 12px; color: var(--muted, #667085); padding: 0 4px; }

.cp-progress { border: 1px solid color-mix(in srgb, var(--cp-purple) 25%, transparent); border-radius: 11px; padding: 10px 12px; background: var(--cp-purple-soft); }
.cp-progress > div:first-child { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.cp-progress-track { height: 7px; margin-top: 8px; border-radius: 999px; background: color-mix(in srgb, var(--cp-purple) 14%, transparent); overflow: hidden; }
.cp-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cp-purple), var(--cp-pink), var(--cp-orange)); transition: width .22s ease; }

.cp-source-panel { padding: 14px; border: 1px solid var(--cp-line); border-radius: 14px; background: var(--card, #fff); }
.cp-source-panel > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.cp-source-panel h3 { margin: 0; font-size: 14px; }
.cp-source-panel header p { margin: 3px 0 0; color: var(--muted, #667085); font-size: 11px; }
.cp-source-panel header > strong { color: var(--cp-purple); font-size: 13px; white-space: nowrap; }
.cp-source-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cp-source-chart { min-width: 0; padding: 11px; border: 1px solid var(--cp-line); border-radius: 11px; background: var(--surface, #fff); }
.cp-source-chart.is-complete { border-color: color-mix(in srgb, var(--source-color, var(--cp-purple)) 32%, var(--cp-line)); background: color-mix(in srgb, var(--source-color, var(--cp-purple)) 5%, var(--surface, #fff)); }
.cp-source-chart[data-source="target_groups"] { --source-color: var(--cp-purple); }
.cp-source-chart[data-source="sample_free"] { --source-color: var(--cp-blue); }
.cp-source-chart[data-source="sample_refundable"] { --source-color: var(--cp-pink); }
.cp-source-chart > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cp-source-chart h4 { margin: 0; font-size: 12px; }
.cp-source-chart b { font-size: 10px; color: var(--muted, #667085); }
.cp-source-chart.is-complete b { color: var(--source-color, var(--cp-purple)); }
.cp-source-chart strong { display: block; margin-top: 9px; font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.cp-source-chart small { display: block; min-height: 15px; margin-top: 5px; color: var(--muted, #667085); font-size: 10px; }
.cp-source-track { height: 7px; margin-top: 9px; overflow: hidden; border-radius: 999px; background: var(--muted-surface, #eef0f4); }
.cp-source-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--source-color, var(--cp-purple)); transition: width .22s ease; }
.cp-source-chart.is-complete .cp-source-track i { background: var(--source-color, var(--cp-purple)); }
.cp-live-placeholder { display: grid; place-items: center; width: 100%; min-height: 54px; color: var(--muted, #667085); font-size: 11px; text-align: center; }
.cp-live-note { color: var(--muted, #667085); font-size: 11px; }
.cp-trend-loading { fill: var(--muted, #667085); font: 12px system-ui, sans-serif; }

.cp-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.cp-kpi {
  --kpi-accent: var(--cp-purple);
  --kpi-soft: var(--cp-purple-soft);
  position: relative;
  overflow: hidden;
  min-height: 116px;
  padding: 14px;
  text-align: left;
  border: 1px solid var(--cp-line);
  border-radius: 14px;
  background: linear-gradient(160deg, var(--card, #fff) 54%, color-mix(in srgb, var(--kpi-soft) 72%, var(--card, #fff)) 100%);
  color: inherit;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(37, 45, 72, .045);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.cp-kpi::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--kpi-accent); }
.cp-kpi::after { content: ""; position: absolute; width: 68px; height: 68px; right: -30px; top: -30px; border-radius: 50%; background: color-mix(in srgb, var(--kpi-accent) 10%, transparent); }
.cp-kpi:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--kpi-accent) 36%, var(--cp-line)); box-shadow: 0 10px 24px color-mix(in srgb, var(--kpi-accent) 11%, transparent); }
.cp-kpi:focus-visible { outline: 3px solid color-mix(in srgb, var(--cp-purple) 35%, transparent); outline-offset: 2px; }
.cp-kpi span { display: block; color: var(--muted, #667085); font-size: 12px; font-weight: 700; }
.cp-kpi strong { display: block; margin: 9px 0 7px; font-size: clamp(25px, 2.2vw, 34px); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.cp-kpi small { color: var(--muted, #667085); font-size: 11px; line-height: 1.35; }
.cp-kpi strong { color: var(--kpi-accent); }
.cp-kpi-purple { --kpi-accent: var(--cp-purple); --kpi-soft: var(--cp-purple-soft); }
.cp-kpi-orange, .cp-kpi-amber { --kpi-accent: var(--cp-orange); --kpi-soft: var(--cp-orange-soft); }
.cp-kpi-blue, .cp-kpi-green { --kpi-accent: var(--cp-blue); --kpi-soft: var(--cp-blue-soft); }
.cp-kpi-pink, .cp-kpi-gray { --kpi-accent: var(--cp-pink); --kpi-soft: var(--cp-pink-soft); }
.cp-kpi-red { --kpi-accent: var(--cp-danger); --kpi-soft: var(--cp-danger-soft); }
.cp-kpi-alert { border-color: color-mix(in srgb, var(--cp-pink) 24%, var(--cp-line)); }

.cp-video-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.cp-video-kpi {
  --video-accent: var(--cp-purple);
  min-height: 94px;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--video-accent) 22%, var(--cp-line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--video-accent) 5%, var(--card, #fff));
  color: inherit;
  text-align: left;
}
button.cp-video-kpi { cursor: pointer; }
.cp-video-kpi span,.cp-video-kpi small { display: block; color: var(--muted, #667085); }
.cp-video-kpi span { font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .035em; }
.cp-video-kpi strong { display: block; margin: 7px 0 5px; color: var(--video-accent); font-size: clamp(22px, 2vw, 30px); line-height: 1; font-variant-numeric: tabular-nums; }
.cp-video-kpi small { font-size: 10px; }
.cp-video-kpi-purple { --video-accent: var(--cp-purple); }
.cp-video-kpi-pink { --video-accent: var(--cp-pink); }
.cp-video-kpi-blue { --video-accent: var(--cp-blue); }
.cp-video-kpi-orange { --video-accent: var(--cp-orange); }

.cp-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr); gap: 14px; }
.cp-grid-top { grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); }
.cp-card { min-width: 0; padding: 16px; border: 1px solid var(--cp-line); border-radius: 14px; background: var(--card, #fff); box-shadow: 0 6px 18px rgba(37, 45, 72, .035); }
.cp-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cp-card h3 { margin: 0; font-size: 14px; letter-spacing: -.01em; }
.cp-card header p { margin: 3px 0 0; color: var(--muted, #667085); font-size: 11px; }
.cp-card header > strong { color: var(--cp-green); font-size: 18px; }

.cp-flow { display: flex; width: 100%; height: 28px; overflow: hidden; border-radius: 8px; background: var(--muted-surface, #f1f3f7); }
.cp-flow button { min-width: 3px; height: 100%; padding: 0; border: 0; cursor: pointer; position: relative; }
.cp-flow button:hover { filter: brightness(.92); }
.cp-flow button:focus-visible { outline: 3px solid #111827; outline-offset: -3px; }
.cp-flow .ready_to_ship { background: var(--cp-orange); }
.cp-flow .shipped { background: var(--cp-purple); }
.cp-flow .in_progress { background: var(--cp-blue); }
.cp-flow .completed { background: var(--cp-pink); }
.cp-flow .cancelled { background: var(--cp-danger); }
.cp-flow-legend { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; margin-top: 12px; }
.cp-flow-legend button { display: flex; min-width: 0; align-items: center; gap: 6px; padding: 5px; border: 0; background: transparent; color: var(--muted, #667085); font-size: 11px; cursor: pointer; }
.cp-flow-legend i { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 3px; background: var(--legend-color); }
.cp-flow-legend b { margin-left: auto; color: var(--text, #1f2937); font-variant-numeric: tabular-nums; }

.cp-compare { display: grid; gap: 11px; }
.cp-compare-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 42px; align-items: center; gap: 8px; }
.cp-compare-row > span { font-size: 11px; color: var(--muted, #667085); }
.cp-compare-row > strong { font-size: 11px; text-align: right; font-variant-numeric: tabular-nums; }
.cp-compare-bars { display: grid; gap: 4px; }
.cp-compare-bar { height: 8px; border-radius: 999px; background: var(--muted-surface, #eef0f4); overflow: hidden; }
.cp-compare-bar i { display: block; height: 100%; width: 0; border-radius: inherit; }
.cp-compare-bar.free i { background: var(--cp-blue); }
.cp-compare-bar.refundable i { background: var(--cp-pink); }
.cp-compare-key { display: flex; gap: 14px; margin-top: 2px; font-size: 11px; color: var(--muted, #667085); }
.cp-compare-key span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: var(--key); }

.cp-trend { display: block; width: 100%; height: 230px; overflow: visible; }
.cp-trend .grid { stroke: color-mix(in srgb, var(--line, #e5e7eb) 75%, transparent); stroke-width: 1; }
.cp-trend .axis-label { fill: var(--muted, #667085); font: 10px system-ui, sans-serif; }
.cp-trend .line { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.cp-trend .line.approved { stroke: var(--cp-purple); }
.cp-trend .line.completed { stroke: var(--cp-blue); }
.cp-trend .line.cancelled { stroke: var(--cp-pink); stroke-dasharray: 6 5; }
.cp-trend .point { stroke: var(--card, #fff); stroke-width: 2; cursor: pointer; }
.cp-trend-legend { display: flex; justify-content: center; gap: 18px; color: var(--muted, #667085); font-size: 11px; }
.cp-trend-legend span::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-right: 5px; vertical-align: middle; border-radius: 99px; background: currentColor; }
.cp-trend-legend .approved { color: var(--cp-purple); }
.cp-trend-legend .completed { color: var(--cp-blue); }
.cp-trend-legend .cancelled { color: var(--cp-pink); }

.cp-source-details { border: 1px dashed color-mix(in srgb, var(--cp-purple) 28%, var(--cp-line)); border-radius: 13px; background: color-mix(in srgb, var(--cp-purple-soft) 45%, var(--card, #fff)); }
.cp-source-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 0 14px; color: var(--muted, #667085); font-size: 11px; font-weight: 700; cursor: pointer; }
.cp-source-details > summary strong { color: var(--cp-purple); }
.cp-source-details .cp-source-panel { margin: 0 10px 10px; }

.cp-issues { display: grid; gap: 8px; }
.cp-issue { width: 100%; min-height: 44px; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--cp-line); border-radius: 10px; background: var(--surface, #fff); color: inherit; text-align: left; cursor: pointer; transition: border-color .16s ease, background .16s ease; }
.cp-issue:hover { border-color: color-mix(in srgb, var(--issue-color) 45%, var(--cp-line)); background: color-mix(in srgb, var(--issue-color) 5%, var(--surface, #fff)); }
.cp-issue:focus-visible { outline: 3px solid color-mix(in srgb, var(--cp-blue) 30%, transparent); outline-offset: 2px; }
.cp-issue-rank { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: color-mix(in srgb, var(--issue-color) 12%, transparent); color: var(--issue-color); font-weight: 800; font-size: 11px; }
.cp-issue span { min-width: 0; }
.cp-issue span strong { display: block; font-size: 12px; }
.cp-issue span small { display: block; margin-top: 2px; color: var(--muted, #667085); font-size: 10px; }
.cp-issue > strong { font-size: 17px; color: var(--issue-color); font-variant-numeric: tabular-nums; }

.cp-refund-flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.cp-refund-step { position: relative; min-height: 76px; padding: 12px; border-radius: 11px; border: 1px solid var(--cp-line); background: var(--surface, #fff); cursor: pointer; }
.cp-refund-step:not(:last-child)::after { content: ""; position: absolute; right: -10px; top: 50%; width: 10px; height: 1px; background: var(--cp-line); }
.cp-refund-step span { display: block; font-size: 11px; color: var(--muted, #667085); }
.cp-refund-step strong { display: block; margin-top: 8px; font-size: 22px; font-variant-numeric: tabular-nums; }
.cp-refund-step.problem { border-color: color-mix(in srgb, var(--cp-red) 30%, var(--cp-line)); background: var(--cp-red-soft); }
.cp-refund-step.problem strong { color: var(--cp-red); }

.cp-drawer-backdrop { position: fixed; inset: 0; z-index: 180; background: rgba(17, 24, 39, .34); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.cp-drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.cp-drawer { position: fixed; z-index: 181; top: 0; right: 0; width: min(760px, 92vw); height: 100dvh; display: flex; flex-direction: column; background: var(--card, #fff); box-shadow: -18px 0 44px rgba(17, 24, 39, .16); transform: translateX(102%); transition: transform .22s ease; }
.cp-drawer.open { transform: translateX(0); }
.cp-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line, #e5e7eb); }
.cp-drawer-head h2 { margin: 0; font-size: 17px; }
.cp-drawer-head p { margin: 3px 0 0; font-size: 11px; color: var(--muted, #667085); }
.cp-drawer-close { width: 44px; height: 44px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; background: var(--surface, #fff); color: inherit; font-size: 22px; cursor: pointer; }
.cp-drawer-tools { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 18px; border-bottom: 1px solid var(--line, #e5e7eb); }
.cp-drawer-tools input,
.cp-drawer-tools select { min-height: 40px; padding: 0 10px; border: 1px solid var(--line, #d9dce5); border-radius: 9px; background: var(--surface, #fff); color: inherit; }
.cp-drawer-tools input { flex: 1 1 220px; }
.cp-drawer-body { flex: 1; overflow: auto; padding: 14px 18px 24px; }
.cp-creator { border: 1px solid var(--line, #e5e7eb); border-radius: 12px; margin-bottom: 9px; overflow: hidden; }
.cp-creator summary { min-height: 66px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
.cp-creator summary::-webkit-details-marker { display: none; }
.cp-creator img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #f0f2f5; }
.cp-creator-copy { min-width: 0; }
.cp-creator-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.cp-creator-copy small { display: block; margin-top: 3px; color: var(--muted, #667085); font-size: 10px; }
.cp-creator-metrics { text-align: right; }
.cp-creator-metrics strong { display: block; font-size: 13px; }
.cp-creator-metrics small { color: var(--muted, #667085); font-size: 10px; }
.cp-request-list { display: grid; gap: 7px; padding: 0 12px 12px 64px; }
.cp-request { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 8px; border-radius: 9px; background: var(--muted-surface, #f6f7f9); }
.cp-request img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.cp-request strong { display: block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.cp-request small { color: var(--muted, #667085); font-size: 10px; }
.cp-review-btn { min-height: 36px; border: 1px solid var(--line, #d9dce5); border-radius: 8px; padding: 0 9px; background: var(--surface, #fff); color: inherit; cursor: pointer; }
.cp-drawer-empty { padding: 40px 16px; text-align: center; color: var(--muted, #667085); }
.cp-drawer-pager { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 12px; }
.cp-drawer-pager button { min-width: 44px; min-height: 40px; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; background: var(--surface, #fff); color: inherit; cursor: pointer; }

.cp-review-modal { position: fixed; z-index: 190; inset: 0; display: none; place-items: center; padding: 18px; background: rgba(17, 24, 39, .46); }
.cp-review-modal.open { display: grid; }
.cp-review-card { width: min(460px, 100%); padding: 18px; border-radius: 15px; background: var(--card, #fff); box-shadow: 0 22px 60px rgba(17, 24, 39, .22); }
.cp-review-card h3 { margin: 0 0 4px; }
.cp-review-card > p { margin: 0 0 14px; color: var(--muted, #667085); font-size: 12px; }
.cp-review-row { display: grid; grid-template-columns: minmax(0, 1fr) 100px; align-items: center; gap: 12px; margin: 10px 0; }
.cp-review-row label { font-size: 12px; font-weight: 650; }
.cp-review-row select { min-height: 42px; border: 1px solid var(--line, #d9dce5); border-radius: 9px; padding: 0 8px; background: var(--surface, #fff); color: inherit; }
.cp-review-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Bảng điều hành CEO: một mặt phẳng thống nhất như báo cáo CRM, không còn cụm thẻ rời. */
.cp-executive-board {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--cp-purple) 30%, var(--cp-line));
  border-radius: 16px;
  background: linear-gradient(135deg, #fbf9ff 0%, #ffffff 56%, #fff9fc 100%);
  color: var(--text, #1f2937);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--cp-purple) 9%, transparent);
}
.cp-board-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 58px; padding: 10px 14px; border-bottom: 1px solid var(--cp-line); }
.cp-board-heading div { display: grid; gap: 3px; }
.cp-board-heading span { color: var(--cp-purple); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.cp-board-heading strong { font-size: 15px; }
.cp-board-heading small { color: var(--muted, #667085); font-size: 10px; }
.cp-executive-board .cp-kpis,
.cp-executive-board .cp-video-kpis { gap: 0; }
.cp-executive-board .cp-kpi,
.cp-executive-board .cp-video-kpi {
  min-height: 108px;
  border: 0;
  border-right: 1px solid var(--cp-line);
  border-bottom: 1px solid var(--cp-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.cp-executive-board .cp-kpi:last-child,
.cp-executive-board .cp-video-kpi:last-child { border-right: 0; }
.cp-executive-board .cp-kpi::before { width: 34px; height: 3px; inset: 0 auto auto 14px; border-radius: 0 0 4px 4px; }
.cp-executive-board .cp-kpi::after { display: none; }
.cp-executive-board .cp-kpi:hover,
.cp-executive-board button.cp-video-kpi:hover { transform: none; background: color-mix(in srgb, var(--kpi-accent, var(--video-accent)) 5%, #fff); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--kpi-accent, var(--video-accent)) 30%, transparent); }
.cp-executive-board .cp-kpi span,
.cp-executive-board .cp-kpi small,
.cp-executive-board .cp-video-kpi span,
.cp-executive-board .cp-video-kpi small { color: var(--muted, #667085); }
.cp-executive-board .cp-kpi strong,
.cp-executive-board .cp-video-kpi strong { text-shadow: none; }
.cp-executive-board .cp-video-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cp-video-kpi-refund { --video-accent: #ff9f43; }
.cp-video-kpi-refund strong { font-size: clamp(19px, 1.65vw, 26px); }
.cp-executive-insight { display: flex; align-items: center; gap: 16px; min-height: 48px; padding: 9px 14px; color: var(--muted, #667085); background: color-mix(in srgb, var(--cp-purple) 3%, #fff); font-size: 11px; }
.cp-executive-insight > strong { flex: 0 0 auto; padding-right: 16px; border-right: 1px solid var(--cp-line); color: var(--text, #1f2937); font-size: 12px; }
.cp-executive-insight b { color: var(--cp-orange); }

/* Hành trình dùng các bước độc lập để số nhỏ không bị thanh 488 mẫu nuốt mất. */
.cp-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; height: auto; overflow: visible; border-radius: 0; background: transparent; }
.cp-flow .cp-flow-stage { position: relative; display: grid; align-content: start; min-width: 0; height: 112px; padding: 12px; border: 1px solid color-mix(in srgb, var(--stage-color) 32%, var(--cp-line)); border-radius: 12px; background: color-mix(in srgb, var(--stage-color) 6%, var(--card, #fff)); color: inherit; text-align: left; }
.cp-flow .cp-flow-stage:not(:last-child)::after { content: ""; position: absolute; z-index: 2; right: -13px; top: 39px; width: 17px; height: 28px; display: grid; place-items: center; border-radius: 999px; background-color: var(--card, #fff); background-image: var(--stonk-chevron-right-image); background-position: center; background-size: 13px 13px; background-repeat: no-repeat; }
.cp-flow-stage small { color: var(--muted, #667085); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.cp-flow-stage strong { margin-top: 7px; color: var(--stage-color); font-size: 27px; line-height: 1; }
.cp-flow-stage span { margin-top: 5px; color: var(--text, #1f2937); font-size: 11px; font-weight: 750; }
.cp-flow-stage i { position: absolute; right: 10px; top: 10px; color: var(--stage-color); font-size: 10px; font-style: normal; font-weight: 800; }
.cp-flow-legend { display: block; margin-top: 10px; }
.cp-flow-legend .cp-flow-loss { width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid color-mix(in srgb, var(--cp-danger) 22%, var(--cp-line)); border-radius: 10px; background: color-mix(in srgb, var(--cp-danger) 5%, var(--card, #fff)); }
.cp-flow-loss span b { color: var(--cp-danger); }
.cp-flow-loss > strong { margin-left: auto; color: var(--cp-danger); font-size: 11px; }

/* So sánh theo nguồn: quy mô trước, hiệu suất sau, số và mẫu số luôn hiện cạnh nhau. */
.cp-compare { gap: 14px; }
.cp-kind-scope { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.cp-kind-summary { padding: 12px; border: 1px solid color-mix(in srgb, var(--kind-color) 34%, var(--cp-line)); border-radius: 12px; background: color-mix(in srgb, var(--kind-color) 5%, var(--card, #fff)); color: inherit; text-align: left; cursor: pointer; }
.cp-kind-summary header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cp-kind-summary header span { font-size: 11px; font-weight: 800; }
.cp-kind-summary header b { color: var(--kind-color); font-size: 9px; }
.cp-kind-summary > strong { display: block; margin: 10px 0; color: var(--kind-color); font-size: 26px; line-height: 1; }
.cp-kind-summary > strong small { font-size: 10px; }
.cp-kind-summary > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.cp-kind-summary > div span { color: var(--muted, #667085); font-size: 9px; }
.cp-kind-summary > div b { display: block; margin-bottom: 2px; color: var(--text, #1f2937); font-size: 13px; }
.cp-kind-summary > small { display: block; margin-top: 9px; color: var(--muted, #667085); font-size: 9px; }
.cp-kind-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cp-compare-metric { padding: 10px; border: 1px solid var(--cp-line); border-radius: 10px; }
.cp-compare-metric h4 { margin: 0 0 8px; font-size: 10px; }
.cp-compare-metric > p { margin: 7px 0 0; color: var(--muted, #667085); font-size: 8px; }
.cp-kind-rate { display: grid; grid-template-columns: 44px minmax(20px, 1fr) 35px 34px; align-items: center; gap: 4px; margin: 5px 0; }
.cp-kind-rate > span,.cp-kind-rate > small { color: var(--muted, #667085); font-size: 8px; }
.cp-kind-rate > div { height: 6px; overflow: hidden; border-radius: 999px; background: var(--muted-surface, #eef0f4); }
.cp-kind-rate i { display: block; height: 100%; border-radius: inherit; background: var(--rate-color); }
.cp-kind-rate strong { font-size: 9px; text-align: right; }

/* Biểu đồ xu hướng cùng light theme STONK; chỉ mượn cách vẽ đường mượt của CRM. */
.cp-trend-card { border-color: color-mix(in srgb, var(--cp-purple) 26%, var(--cp-line)); background: linear-gradient(145deg, #ffffff, #faf7ff); color: var(--text, #1f2937); box-shadow: 0 10px 28px color-mix(in srgb, var(--cp-purple) 8%, transparent); }
.cp-trend-card header p { color: var(--muted, #667085); }
.cp-trend { height: 260px; }
.cp-trend .grid { stroke: color-mix(in srgb, var(--cp-purple) 10%, var(--cp-line)); }
.cp-trend .axis-label { fill: var(--muted, #667085); }
.cp-trend .axis-right { fill: var(--cp-blue); }
.cp-trend .trend-area { fill: url(#cpTrendArea); }
.cp-trend .line { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.cp-trend .line.approved { stroke: #8a62ff; }
.cp-trend .line.completed { stroke: #36c7ff; }
.cp-trend .line.cancelled { stroke: #ff5ca8; stroke-dasharray: 5 5; }
.cp-trend .hover-column .hit { fill: transparent; pointer-events: all; }
.cp-trend .hover-column line { stroke: color-mix(in srgb, var(--cp-purple) 28%, transparent); opacity: 0; }
.cp-trend .hover-column circle { stroke: #fff; stroke-width: 2; opacity: 0; }
.cp-trend .hover-column circle.approved { fill: #8a62ff; }
.cp-trend .hover-column circle.completed { fill: #36c7ff; }
.cp-trend .hover-column circle.cancelled { fill: #ff5ca8; }
.cp-trend .hover-column:hover line,
.cp-trend .hover-column:hover circle { opacity: 1; }
.cp-trend-legend { align-items: center; color: var(--muted, #667085); }
.cp-trend-legend span b { margin-left: 3px; color: var(--text, #1f2937); }
.cp-trend-legend small { margin-left: auto; color: var(--muted, #667085); font-size: 9px; }

@media (max-width: 1100px) {
  .cp-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cp-video-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cp-executive-board .cp-video-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cp-grid, .cp-grid-top { grid-template-columns: 1fr; }
  .cp-source-charts { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .cp-toolbar { align-items: flex-start; flex-direction: column; }
  .cp-toolbar-actions { justify-content: flex-start; }
  .cp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cp-flow-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cp-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cp-flow .cp-flow-stage::after { display: none; }
  .cp-kind-scope,.cp-kind-metrics { grid-template-columns: 1fr; }
  .cp-executive-insight,.cp-board-heading { align-items: flex-start; flex-direction: column; }
  .cp-executive-insight > strong { border-right: 0; padding-right: 0; }
  .cp-refund-flow { grid-template-columns: 1fr 1fr; }
  .cp-refund-step::after { display: none; }
  .cp-request-list { padding-left: 12px; }
}
@media (max-width: 460px) {
  .cp-kpis, .cp-video-kpis, .cp-refund-flow { grid-template-columns: 1fr; }
  .cp-toolbar-actions button { width: 100%; }
  .cp-executive-board .cp-video-kpis,.cp-flow { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .cp-kpi, .cp-progress-track span, .cp-drawer, .cp-drawer-backdrop { transition: none !important; }
}
