.pmc-page {
  --pmc-green: #0f7d64;
  --pmc-green-soft: #e6f5ee;
  --pmc-blue-gray: #eef4f1;
}

.pmc-page-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.pmc-page-head h3 {
  margin: 4px 0 8px;
  color: var(--ink);
  font-size: clamp(24px, 2.3vw, 34px);
  letter-spacing: -0.035em;
}

.pmc-page-head > div:first-child > p:last-child {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.pmc-head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.pmc-live-status {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green-text);
  background: var(--green-weak);
  font-size: 12px;
  font-weight: 700;
}

.pmc-scope-note {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #cce5da;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #eaf7f1, #f8fcfa);
}

.pmc-scope-note strong {
  flex-shrink: 0;
  color: var(--green-text);
}

.pmc-scope-note span {
  color: #4d665c;
  font-size: 13px;
  line-height: 1.55;
}

.pmc-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.pmc-summary-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.pmc-summary-card span,
.pmc-summary-card small,
.pmc-summary-card strong {
  display: block;
}

.pmc-summary-card span {
  color: var(--muted);
  font-size: 12px;
}

.pmc-summary-card strong {
  margin: 8px 0 5px;
  color: var(--ink);
  font-size: 25px;
  line-height: 1;
}

.pmc-summary-card small {
  overflow: hidden;
  color: #78867f;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pmc-filter-panel {
  margin-bottom: 14px;
}

.pmc-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  align-items: end;
}

.pmc-filter-grid label,
.pmc-window-switch {
  display: grid;
  min-width: 0;
  gap: 6px;
  margin: 0;
}

.pmc-filter-grid label > span,
.pmc-window-switch legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pmc-filter-grid select,
.pmc-filter-grid input,
.pmc-material-toolbar select,
.pmc-material-toolbar input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--panel);
}

.pmc-search-field {
  grid-column: span 2;
}

.pmc-window-switch {
  grid-column: span 2;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0;
  border: 0;
}

.pmc-window-switch legend {
  grid-column: 1 / -1;
  padding: 0;
}

.pmc-window-switch button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--panel-soft);
  cursor: pointer;
}

.pmc-window-switch button.active {
  border-color: #8dcbb5;
  color: var(--green-text);
  background: var(--green-weak);
  font-weight: 800;
}

.pmc-table-panel {
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.pmc-table-title {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.pmc-table-hint {
  color: var(--muted);
  font-size: 12px;
}

.pmc-table-wrap {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.pmc-plan-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  table-layout: fixed;
}

.pmc-plan-table th,
.pmc-plan-table td {
  padding: 13px 12px;
  border-bottom: 1px solid #e8efeb;
  text-align: left;
  vertical-align: middle;
}

.pmc-plan-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #5c6c64;
  background: #f7faf8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.pmc-plan-table th:nth-child(1) { width: 180px; }
.pmc-plan-table th:nth-child(2) { width: 170px; }
.pmc-plan-table th:nth-child(3) { width: 92px; }
.pmc-plan-table th:nth-child(4) { width: 190px; }
.pmc-plan-table th:nth-child(5) { width: 92px; }
.pmc-plan-table th:nth-child(n+6):nth-child(-n+9) { width: 108px; }
.pmc-plan-table th:nth-child(10) { width: 120px; }

.pmc-plan-table tbody tr {
  background: var(--panel);
  cursor: pointer;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.pmc-plan-table tbody tr:hover,
.pmc-plan-table tbody tr:focus-visible {
  outline: none;
  background: #f1f8f5;
  box-shadow: inset 3px 0 var(--green);
}

.pmc-primary-cell,
.pmc-context-cell,
.pmc-sync-cell,
.pmc-material-count {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.pmc-primary-cell strong,
.pmc-context-cell > span {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pmc-primary-cell code,
.pmc-material-title code {
  overflow: hidden;
  color: #748179;
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pmc-context-cell small,
.pmc-sync-cell small,
.pmc-material-count span,
.pmc-material-count small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pmc-material-count strong {
  color: var(--ink);
  font-size: 18px;
}

.pmc-chip,
.pmc-type-badge {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
}

.pmc-chip-ok {
  color: #0d6f58;
  background: #dcf3e9;
}

.pmc-chip-warn {
  color: #8a5d0c;
  background: #fff2d8;
}

.pmc-chip-bad {
  color: #943c32;
  background: #fde8e5;
}

.pmc-chip-neutral {
  color: #607068;
  background: #edf2ef;
}

.pmc-metric {
  display: grid;
  gap: 2px;
}

.pmc-metric strong {
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pmc-metric small {
  color: var(--amber);
  font-size: 9px;
}

.pmc-metric-missing strong {
  color: #94a099;
}

.pmc-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 18px;
  color: var(--muted);
  font-size: 12px;
}

.pmc-pager > div {
  display: flex;
  gap: 8px;
}

.pmc-state-panel:empty {
  display: none;
}

.pmc-empty-state {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 150px;
  padding: 24px;
  text-align: center;
}

.pmc-empty-state strong {
  color: var(--ink);
}

.pmc-empty-state span {
  max-width: 520px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.pmc-loading-grid {
  display: grid;
  gap: 10px;
  padding: 20px 18px;
}

.pmc-skeleton {
  display: block;
  height: 42px;
  border-radius: 6px;
  background: linear-gradient(90deg, #edf3f0 25%, #f8fbf9 45%, #edf3f0 65%);
  background-size: 300% 100%;
  animation: pmc-shimmer 1.25s infinite linear;
}

@keyframes pmc-shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

body.pmc-drawer-open {
  overflow: hidden;
}

.pmc-drawer-shell {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.pmc-drawer-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: rgba(19, 35, 29, 0.34);
  cursor: default;
}

.pmc-drawer {
  position: absolute;
  inset: 0 0 0 auto;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  width: min(820px, calc(100vw - 72px));
  max-width: 100%;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: var(--bg);
  box-shadow: -24px 0 60px rgba(20, 60, 45, 0.16);
}

.pmc-drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.pmc-drawer-head h4 {
  margin: 3px 0 5px;
  color: var(--ink);
  font-size: 21px;
}

.pmc-drawer-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.pmc-drawer-context {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.pmc-drawer-context > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 11px 14px;
  background: var(--panel-soft);
}

.pmc-drawer-context span {
  color: var(--muted);
  font-size: 10px;
}

.pmc-drawer-context strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pmc-material-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 130px 145px;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.pmc-material-list {
  min-height: 0;
  padding: 14px 16px 24px;
  overflow-y: auto;
}

.pmc-material-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.pmc-material-cover {
  display: grid;
  place-items: center;
  min-height: 92px;
  overflow: hidden;
  border-radius: 7px;
  color: var(--green-text);
  background:
    radial-gradient(circle at 25% 25%, rgba(15, 139, 110, 0.18), transparent 38%),
    #eef7f3;
}

.pmc-material-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pmc-type-badge {
  color: #0d6f58;
  background: #dcf3e9;
}

.pmc-type-carousel { color: #6a5511; background: #f8efcb; }
.pmc-type-image { color: #69518e; background: #efe9f8; }
.pmc-type-title { color: #426278; background: #e6f0f5; }
.pmc-type-live_room { color: #943c32; background: #fde8e5; }

.pmc-material-main {
  min-width: 0;
}

.pmc-material-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.pmc-material-title > div {
  display: flex;
  min-width: 0;
  gap: 8px;
  align-items: center;
}

.pmc-material-title strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pmc-material-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.pmc-material-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid #edf2ef;
  border-bottom: 1px solid #edf2ef;
}

.pmc-material-meta span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pmc-material-meta b {
  margin-right: 5px;
  color: #47594f;
}

.pmc-material-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.pmc-material-metrics > div {
  display: grid;
  gap: 4px;
}

.pmc-material-metrics > div > span {
  color: var(--muted);
  font-size: 10px;
}

.pmc-material-state:empty {
  display: none;
}

.pmc-drawer-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.pmc-drawer-footer > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pmc-drawer-footer strong,
.pmc-drawer-footer span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pmc-drawer-footer strong {
  color: var(--ink);
  font-size: 12px;
}

.pmc-drawer-footer span {
  color: var(--muted);
  font-size: 10px;
}

@media (max-width: 1080px) {
  .pmc-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pmc-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .pmc-page-head {
    display: grid;
  }

  .pmc-head-actions {
    justify-content: space-between;
  }

  .pmc-scope-note {
    display: grid;
    gap: 4px;
  }

  .pmc-summary-grid {
    display: flex;
    margin-inline: -2px;
    padding: 2px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .pmc-summary-card {
    min-width: 150px;
    scroll-snap-align: start;
  }

  .pmc-filter-grid {
    grid-template-columns: 1fr;
  }

  .pmc-search-field,
  .pmc-window-switch {
    grid-column: auto;
  }

  .pmc-table-wrap {
    overflow: visible;
  }

  .pmc-plan-table,
  .pmc-plan-table tbody,
  .pmc-plan-table tr,
  .pmc-plan-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .pmc-plan-table thead {
    display: none;
  }

  .pmc-plan-table tbody {
    padding: 12px;
  }

  .pmc-plan-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .pmc-plan-table td {
    padding: 0;
    border: 0;
  }

  .pmc-plan-table td:nth-child(1),
  .pmc-plan-table td:nth-child(2),
  .pmc-plan-table td:nth-child(4),
  .pmc-plan-table td:nth-child(10) {
    grid-column: 1 / -1;
  }

  .pmc-plan-table td:nth-child(6)::before { content: "消耗"; }
  .pmc-plan-table td:nth-child(7)::before { content: "含券成交"; }
  .pmc-plan-table td:nth-child(8)::before { content: "订单"; }
  .pmc-plan-table td:nth-child(9)::before { content: "支付 ROI"; }

  .pmc-plan-table td:nth-child(n+6):nth-child(-n+9)::before {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 9px;
  }

  .pmc-drawer {
    inset: 0;
    width: 100%;
  }

  .pmc-drawer-context {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pmc-material-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .pmc-material-toolbar input {
    grid-column: 1 / -1;
  }

  .pmc-material-list {
    padding: 10px;
  }

  .pmc-material-card {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .pmc-material-cover {
    min-height: 70px;
  }

  .pmc-material-title {
    display: grid;
  }

  .pmc-material-meta {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .pmc-material-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pmc-drawer-footer {
    align-items: stretch;
  }
}
