/* MoMoSwap 营销看板。依附现有 admin.css、readability.css、admin-brand.css 加载。 */
.mkt-root {
  --mkt-purple: var(--adm-purple, #401dfc);
  --mkt-pink: #f9037d;
  --mkt-ink: var(--adm-ink, #20213a);
  --mkt-muted: var(--adm-muted, #65718b);
  --mkt-line: var(--adm-line, #e5e6ef);
  --mkt-card: var(--adm-card, #fff);
  --mkt-soft: #f7f5ff;
  --mkt-good: #087d5d;
  --mkt-warn: #945b0f;
  --mkt-danger: #b62e59;
  color: var(--mkt-ink);
  min-width: 0;
  font-size: 15px;
}

.mkt-root *, .mkt-modal-host * { box-sizing: border-box; }
.mkt-root button, .mkt-modal-host button, .mkt-root input { font: inherit; }
.mkt-root button, .mkt-modal-host button { cursor: pointer; }
.mkt-root button:focus-visible, .mkt-modal-host button:focus-visible, .mkt-root a:focus-visible, .mkt-root input:focus-visible {
  outline: 3px solid rgb(64 29 252 / 30%);
  outline-offset: 2px;
}

.mkt-page-head { margin-bottom: 20px; }
.mkt-page-head h1 { max-width: 18ch; }
.mkt-page-head p { max-width: 58ch; color: var(--mkt-muted); }
.mkt-page-head .adm-page-actions { min-width: 0; }

.mkt-preview-banner {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 0 0 15px;
  padding: 11px 13px;
  border: 1px solid #e3dbff;
  border-radius: 10px;
  color: #514672;
  background: linear-gradient(100deg, #f4f1ff, #fff4fa);
  font-size: 14px;
  line-height: 1.6;
}
.mkt-preview-banner strong {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 5px;
  color: #401dfc;
  background: #eae5ff;
  font-size: 12px;
  line-height: 1.45;
}
.mkt-preview-banner span { min-width: 0; }

.mkt-data-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  min-height: 28px;
  margin: -3px 0 12px;
  color: #61708b;
  font-size: 12px;
  line-height: 1.5;
}
.mkt-data-status__error { color: var(--mkt-danger); font-weight: 700; }
.mkt-link-button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 5px;
  border: 0;
  border-radius: 6px;
  color: #4824d2;
  background: transparent;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
  text-decoration: none;
}
.mkt-link-button:hover { color: #2f12bd; background: #f2efff; }

.mkt-toolbar { margin: -2px 0 17px; }
.mkt-range-wrap { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 9px; }
.mkt-range { flex: 0 0 auto; max-width: 100%; }
.mkt-range button { min-height: 37px; }
.mkt-custom-range {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid #dfd9fa;
  border-radius: 10px;
  background: #fbfaff;
}
.mkt-custom-range label {
  display: grid;
  gap: 4px;
  color: #59657c;
  font-size: 12px;
  font-weight: 700;
}
.mkt-custom-range input {
  width: 145px;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid #dcdcea;
  border-radius: 7px;
  color: #273149;
  background: #fff;
  font-size: 14px;
}
.mkt-custom-range input:focus { border-color: #8c76ff; box-shadow: 0 0 0 3px rgb(64 29 252 / 11%); }

.mkt-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 17px;
}
.mkt-kpis article {
  position: relative;
  min-width: 0;
  min-height: 124px;
  overflow: hidden;
  padding: 19px 18px;
  border: 1px solid var(--mkt-line);
  border-radius: 12px;
  background: var(--mkt-card);
  box-shadow: 0 10px 28px rgb(32 33 58 / 4%);
}
.mkt-kpis article::after {
  position: absolute;
  right: -21px;
  bottom: -36px;
  width: 88px;
  height: 88px;
  border: 14px solid rgb(64 29 252 / 7%);
  border-radius: 50%;
  content: "";
}
.mkt-kpis article:nth-child(2)::after, .mkt-kpis article:nth-child(6)::after { border-color: rgb(249 3 125 / 7%); }
.mkt-kpis article:nth-child(7)::after { border-color: rgb(11 159 119 / 9%); }
.mkt-kpis article:nth-child(8)::after { border-color: rgb(216 66 112 / 8%); }
.mkt-kpis small, .mkt-kpis span, .mkt-kpis strong { position: relative; z-index: 1; display: block; }
.mkt-kpis small { color: #5e6a81; font-size: 14px; font-weight: 750; }
.mkt-kpis strong { margin: 7px 0 4px; color: #20213a; font-size: clamp(23px, 2.1vw, 31px); letter-spacing: -1px; line-height: 1.1; }
.mkt-kpis span { color: #68758b; font-size: 12px; line-height: 1.5; }

.mkt-health { margin-bottom: 17px; }
.mkt-health__body { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 18px; padding: 17px 20px; }
.mkt-health-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mkt-health-item {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid #eeeef4;
  border-radius: 9px;
  background: #fcfcfe;
}
.mkt-health-item > span { width: 8px; height: 8px; border-radius: 50%; background: #c0892c; }
.mkt-health-item.is-live > span { background: #0b9f77; box-shadow: 0 0 0 4px rgb(11 159 119 / 11%); }
.mkt-health-item strong, .mkt-health-item small { display: block; }
.mkt-health-item strong { color: #303a50; font-size: 14px; line-height: 1.3; }
.mkt-health-item small { overflow-wrap: anywhere; margin-top: 3px; color: #6b778b; font-size: 12px; line-height: 1.45; }
.mkt-health-item b { color: #087d5d; font-size: 12px; white-space: nowrap; }
.mkt-health-item.is-off b { color: #945b0f; }
.mkt-queue-meta { display: grid; align-content: center; gap: 10px; margin: 0; padding: 4px 0 4px 18px; border-left: 1px solid #ececf3; }
.mkt-queue-meta div { display: grid; gap: 2px; }
.mkt-queue-meta dt { color: #6e798c; font-size: 12px; }
.mkt-queue-meta dd { margin: 0; color: #313b50; font-size: 14px; font-weight: 750; overflow-wrap: anywhere; }

.mkt-processing { margin-bottom: 18px; }
.mkt-processing > header > span, .mkt-items > header > span { color: #64708a; font-size: 13px; font-weight: 700; white-space: nowrap; }
.mkt-task-list { display: grid; gap: 13px; padding: 15px; }
.mkt-task-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid #e8e8f1;
  border-radius: 11px;
  background: linear-gradient(115deg, #fff, #fdfcff);
}
.mkt-task-card + .mkt-task-card { margin-top: 14px; }
.mkt-task-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.mkt-task-title { min-width: 0; }
.mkt-task-title h3 { overflow-wrap: anywhere; margin: 0; color: #29334a; font-size: 16px; line-height: 1.4; }
.mkt-task-title p { margin: 4px 0 0; color: #6c7890; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.mkt-task-badges { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.mkt-state, .mkt-flag, .mkt-review {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}
.mkt-state { color: #89540e; background: #fff5df; }
.mkt-state--sending, .mkt-state--processing, .mkt-state--queued, .mkt-state--pending { color: #89540e; background: #fff5df; }
.mkt-state--completed, .mkt-state--sent, .mkt-state--delivered { color: #087d5d; background: #e9faf4; }
.mkt-state--paused { color: #4f32bf; background: #f0edff; }
.mkt-state--failed, .mkt-state--interrupted, .mkt-state--unknown { color: #b62e59; background: #fff0f4; }
.mkt-state--skipped, .mkt-state--expired { color: #626d81; background: #f0f2f6; }
.mkt-flag { color: #4f32bf; background: #f0edff; }
.mkt-review { color: #b62e59; background: #fff0f4; }

.mkt-progress-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; margin: 15px 0 14px; }
.mkt-progress { height: 9px; overflow: hidden; border-radius: 99px; background: #ecebf2; box-shadow: inset 0 1px 2px rgb(32 33 58 / 7%); }
.mkt-progress > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #401dfc, #8a31f5 55%, #f9037d); transition: width .25s ease; }
.mkt-progress-wrap > strong { color: #3e316d; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mkt-task-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0; }
.mkt-task-metrics div { min-width: 0; padding: 8px 9px; border-radius: 7px; background: #f8f8fc; }
.mkt-task-metrics dt { overflow-wrap: anywhere; color: #66738a; font-size: 12px; line-height: 1.4; }
.mkt-task-metrics dd { overflow-wrap: anywhere; margin: 3px 0 0; color: #2f3950; font-size: 14px; font-weight: 800; line-height: 1.35; font-variant-numeric: tabular-nums; }
.mkt-task-card__foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 9px 14px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #eeeeF4; color: #657188; font-size: 12px; line-height: 1.5; }
.mkt-task-actions, .mkt-table-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.mkt-control { min-height: 34px; }

.mkt-table-panel { overflow: hidden; }
.mkt-history-table { min-width: 1120px; }
.mkt-items-table { min-width: 1370px; }
.mkt-history-table td, .mkt-items-table td { vertical-align: middle; }
.mkt-history-table td:first-child { min-width: 220px; }
.mkt-history-table td:first-child strong, .mkt-history-table td:first-child small { display: block; overflow-wrap: anywhere; }
.mkt-history-table td:first-child strong { color: #303a50; font-size: 14px; }
.mkt-history-table td:first-child small { margin-top: 3px; color: #6f7c91; font-size: 12px; }
.mkt-history-table .mkt-progress-wrap { min-width: 142px; margin: 0; }
.mkt-history-table .mkt-progress { height: 7px; }
.mkt-items { margin-top: 17px; overflow: hidden; }
.mkt-email, .mkt-error-reason, .mkt-provider-id { max-width: 245px; overflow-wrap: anywhere; word-break: break-word; white-space: normal; }
.mkt-error-reason { color: #9a3155; }
.mkt-provider-id { color: #5b6680; font-size: 12px; }

.mkt-pagination { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px; padding: 13px 17px; border-top: 1px solid #eeeeF4; }
.mkt-pagination button {
  min-width: 35px;
  min-height: 35px;
  padding: 4px 8px;
  border: 1px solid #dddded;
  border-radius: 7px;
  color: #4d5b73;
  background: #fff;
  font-size: 13px;
  font-weight: 750;
}
.mkt-pagination button:hover:not(:disabled), .mkt-pagination button.is-active { border-color: #c1b4ff; color: #401dfc; background: #f3f0ff; }
.mkt-pagination button:disabled { cursor: not-allowed; opacity: .52; }

.mkt-loading, .mkt-empty, .mkt-error-card {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-height: 180px;
  padding: 28px 20px;
  border: 1px dashed #dedde9;
  border-radius: 11px;
  color: #66738a;
  background: #fff;
  text-align: center;
}
.mkt-loading { min-height: 250px; flex-direction: row; gap: 10px; border: 0; background: transparent; }
.mkt-loading i { width: 21px; height: 21px; border: 2px solid #e5dfff; border-top-color: #401dfc; border-radius: 50%; animation: mkt-spin .7s linear infinite; }
.mkt-empty strong, .mkt-error-card strong { color: #3d4860; font-size: 16px; }
.mkt-empty p, .mkt-error-card p { max-width: 540px; margin: 6px 0 0; color: #68758b; font-size: 14px; line-height: 1.7; }
.mkt-error-card { border-style: solid; border-color: #f0d5df; background: #fffafb; }
.mkt-error-card strong { color: #a52b55; }
.mkt-error-card .adm-btn { margin-top: 13px; }
@keyframes mkt-spin { to { transform: rotate(1turn); } }

.mkt-modal-host { position: relative; z-index: 90; }
.mkt-dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: min(580px, calc(100vh - 24px));
  margin: auto;
  padding: 0;
  border: 1px solid #e4e1f0;
  border-radius: 13px;
  color: #29334a;
  background: #fff;
  box-shadow: 0 24px 65px rgb(21 23 52 / 26%);
}
.mkt-dialog::backdrop { background: rgb(24 27 54 / 45%); }
.mkt-dialog:not([open]) { display: none; }
.mkt-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 61px; padding: 0 15px 0 20px; border-bottom: 1px solid #ededf4; }
.mkt-dialog__head h2 { margin: 0; font-size: 18px; letter-spacing: -.3px; }
.mkt-dialog__close { min-width: 40px; min-height: 36px; border: 0; border-radius: 7px; color: #64718a; background: transparent; font-size: 13px; font-weight: 700; }
.mkt-dialog__close:hover { color: #401dfc; background: #f2efff; }
.mkt-dialog__body { padding: 20px; }
.mkt-dialog__body > p:first-child { margin: 0; color: #57647b; font-size: 15px; line-height: 1.75; }
.mkt-dialog__task { display: grid; gap: 3px; margin: 16px 0 0; padding: 12px; border-left: 3px solid #7454e8; border-radius: 0 7px 7px 0; background: #f8f7fd; }
.mkt-dialog__task strong { overflow-wrap: anywhere; font-size: 15px; }
.mkt-dialog__task span { color: #69758c; font-size: 12px; overflow-wrap: anywhere; }
.mkt-dialog__error { margin: 13px 0 0; padding: 9px 10px; border: 1px solid #f0cbd8; border-radius: 7px; color: #a62a55; background: #fff4f7; font-size: 13px; line-height: 1.55; }
.mkt-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.mkt-dialog__actions .adm-btn { min-width: 98px; }

@media (max-width: 1100px) {
  .mkt-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mkt-health__body { grid-template-columns: 1fr; }
  .mkt-queue-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0; border-top: 1px solid #ececf3; border-left: 0; padding-top: 13px; }
}
@media (max-width: 760px) {
  .mkt-root { font-size: 15px; }
  .mkt-page-head { gap: 12px; }
  .mkt-page-head h1 { font-size: 24px; }
  .mkt-page-head .adm-page-actions { width: 100%; justify-content: flex-start; }
  .mkt-page-head .adm-btn { flex: 1 1 auto; min-width: 0; }
  .mkt-range { width: 100%; flex-wrap: wrap; }
  .mkt-range button { flex: 1 1 auto; }
  .mkt-custom-range { width: 100%; }
  .mkt-custom-range label { flex: 1 1 130px; min-width: 0; }
  .mkt-custom-range input { width: 100%; min-width: 0; }
  .mkt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mkt-kpis article { min-height: 111px; padding: 15px 13px; }
  .mkt-kpis small { font-size: 13px; }
  .mkt-kpis strong { font-size: 24px; }
  .mkt-health > header, .mkt-processing > header, .mkt-items > header { align-items: flex-start; padding: 15px; }
  .mkt-health__body { padding: 13px; }
  .mkt-health-grid { grid-template-columns: 1fr; }
  .mkt-task-list { padding: 10px; }
  .mkt-task-card { padding: 14px; }
  .mkt-task-card__head { flex-direction: column; gap: 8px; }
  .mkt-task-badges { justify-content: flex-start; }
  .mkt-task-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mkt-task-card__foot { align-items: flex-start; flex-direction: column; }
  .mkt-task-actions { width: 100%; }
  .mkt-task-actions .adm-btn, .mkt-task-actions .mkt-link-button { flex: 1 1 auto; justify-content: center; }
  .mkt-data-status { margin-bottom: 10px; }
  .mkt-pagination { justify-content: flex-start; padding: 12px; }
  .mkt-dialog__actions { flex-direction: column-reverse; }
  .mkt-dialog__actions .adm-btn { width: 100%; }
}
@media (max-width: 390px) {
  .mkt-preview-banner { padding: 10px; }
  .mkt-kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .mkt-kpis article { padding: 13px 10px; }
  .mkt-kpis strong { font-size: 22px; }
  .mkt-kpis span, .mkt-task-title p, .mkt-task-card__foot, .mkt-data-status { font-size: 12px; }
  .mkt-task-metrics { gap: 6px; }
  .mkt-task-metrics div { padding: 8px; }
  .mkt-task-metrics dt { font-size: 12px; }
  .mkt-progress-wrap { gap: 7px; }
  .mkt-custom-range .adm-btn { flex: 1 1 auto; }
}

.mkt-overall { margin-bottom: 17px; }
.mkt-overall__body { padding: 0 20px 20px; }
.mkt-overall__body .mkt-progress-wrap { margin-top: 5px; }
.mkt-range button.is-active { color: #401dfc; background: #eee9ff; }
@media (max-width: 760px) {
  .mkt-overall__body { padding: 0 14px 14px; }
  .mkt-custom-range input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .mkt-progress > span { transition: none; }
}
