/* ====================================================================
 * 达人营销 · 内容排期模块 · 样式
 * 与 index.html :root 里的 CSS 变量复用（--primary/--bg-base/etc.）
 * ==================================================================== */

/* ============ 顶部工具条 ============ */
.sched-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  background: var(--bg-panel);
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}
.sched-month-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
}
.sched-month-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-panel);
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.sched-month-btn:hover { background: var(--bg-hover); border-color: var(--border-lit); }
.sched-month-current {
  font-size: 1.05rem; font-weight: 600;
  padding: 0 10px;
  min-width: 130px;
  text-align: center;
  color: var(--text-primary);
}
.sched-month-today {
  font-size: .8rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-panel);
  cursor: pointer;
  color: var(--text-secondary);
  margin-left: 4px;
}
.sched-month-today:hover { background: var(--bg-hover); }

.sched-filter-chip {
  font-size: .8rem;
  padding: 6px 12px;
  border-radius: 16px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 4px;
}
.sched-filter-chip .clear { cursor: pointer; opacity: .6; }
.sched-filter-chip .clear:hover { opacity: 1; }

/* ============ 状态色图例（工具栏下方） ============ */
.sched-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--bg-panel);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  font-size: .78rem;
}
.sched-legend-label {
  color: var(--text-secondary);
  font-weight: 500;
}
.sched-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sched-legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  vertical-align: middle;
}
.sched-legend-dot[data-status="planned"]   { background: #9ca3af; }
.sched-legend-dot[data-status="contacted"] { background: #d97706; }
.sched-legend-dot[data-status="confirmed"] { background: #2563eb; }
.sched-legend-dot[data-status="published"] { background: #7c3aed; }
.sched-legend-dot[data-status="settled"]   { background: #059669; }
.sched-legend-dot[data-status="cancelled"] { background: #d1d5db; }
.sched-legend-hint {
  margin-left: auto;
  color: var(--text-muted);
  font-size: .72rem;
}

/* ============ 右键状态切换菜单 ============ */
.sched-status-menu {
  position: absolute;
  z-index: 9000;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  padding: 4px;
}
.sched-status-menu-title {
  padding: 4px 10px 6px;
  font-size: .72rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.sched-status-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: .85rem;
  white-space: nowrap;
}
.sched-status-menu-item:hover { background: var(--bg-hover); }
.sched-status-menu-item.current { background: var(--primary-light); }
.sched-status-menu-item .check {
  margin-left: auto;
  color: var(--primary);
  font-weight: 600;
}

/* ============ 双月日历容器 ============ */
.sched-calendars {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
}
.sched-cal-card {
  background: var(--bg-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sched-cal-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-primary);
  background: linear-gradient(180deg, #fafbfd 0%, #ffffff 100%);
  display: flex; align-items: center; justify-content: space-between;
}
.sched-cal-month-stats {
  font-size: .78rem;
  font-weight: 400;
  color: var(--text-secondary);
}
.sched-cal-month-stats b {
  color: var(--primary);
  font-weight: 600;
  margin: 0 2px;
}

/* ============ 月历网格 ============ */
.sched-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--border);
  gap: 1px;
}
.sched-cal-wkhead {
  background: #fafbfd;
  text-align: center;
  font-size: .72rem;
  color: var(--text-secondary);
  padding: 8px 0;
  font-weight: 500;
}
.sched-cal-wkhead.sat, .sched-cal-wkhead.sun { color: var(--danger); opacity: .7; }

.sched-cal-cell {
  background: var(--bg-panel);
  min-height: 110px;
  padding: 4px 6px 6px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
  display: flex; flex-direction: column;
}
.sched-cal-cell:hover { background: var(--bg-hover); }
.sched-cal-cell.other-month { background: #fafbfd; color: var(--text-muted); }
.sched-cal-cell.other-month .sched-cal-daynum { color: var(--text-muted); }
.sched-cal-cell.today { background: linear-gradient(180deg, #f5f3ff 0%, #ffffff 60%); }
.sched-cal-cell.today .sched-cal-daynum { color: var(--purple); font-weight: 700; }

.sched-cal-dayrow {
  display: flex; align-items: center; gap: 4px;
  margin-bottom: 2px;
}
.sched-cal-daynum {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.sched-cal-todaybadge {
  font-size: .65rem;
  background: var(--purple);
  color: #fff;
  padding: 1px 6px;
  border-radius: 8px;
  line-height: 1.4;
  font-weight: 500;
}

/* ============ 月历卡片（3 行） ============ */
.sched-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px;
  margin-bottom: 3px;
  font-size: .72rem;
  line-height: 1.35;
  cursor: pointer;
  transition: all var(--transition);
  overflow: hidden;
}
.sched-card:hover {
  border-color: var(--primary);
  box-shadow: 0 1px 4px rgba(26,86,219,.15);
  transform: translateY(-1px);
}
.sched-card.dragging {
  opacity: .4;
  cursor: grabbing;
}
.sched-cal-cell.drop-target {
  background: var(--primary-light) !important;
  box-shadow: inset 0 0 0 2px var(--primary);
}
.sched-cal-cell.frozen-cell {
  background: #f8f9fa;
  cursor: not-allowed;
}
.sched-cal-cell.frozen-cell:hover { background: #f1f3f5; }
.sched-card-row1 {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.sched-card-name {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.sched-card-draft-badge {
  flex-shrink: 0;
  font-size: .65rem;
  font-weight: 600;
  color: #9ca3af;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  padding: 0 4px;
  line-height: 1.4;
  letter-spacing: .02em;
  font-style: italic;
}
.sched-card-link {
  flex-shrink: 0;
  font-size: .72rem;
  text-decoration: none;
  color: var(--text-muted);
  padding: 0 3px;
  border-radius: 3px;
  line-height: 1;
  transition: all var(--transition);
  opacity: .2;            /* 平时几乎隐形 */
  filter: grayscale(1);   /* 去掉 emoji 自带的彩色 */
}
.sched-card:hover .sched-card-link { opacity: .7; }  /* 鼠标移到卡片：提示可见 */
.sched-card-link:hover {
  background: var(--primary-light);
  color: var(--primary);
  opacity: 1;
  filter: none;
  transform: scale(1.15);
}
.sched-card-row2 {
  display: flex; align-items: center;
  margin-top: 2px;
}
.sched-card-amount { font-weight: 600; }

/* 元信息 chip 行 */
.sched-card-meta {
  display: flex;
  gap: 3px;
  margin-top: 3px;
  flex-wrap: wrap;
}
.sched-card-chip {
  font-size: .65rem;
  line-height: 1.5;
  padding: 0 5px;
  border-radius: 3px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}
.sched-card-chip.tier {
  flex-shrink: 0;
  color: #475569;
  background: #e2e8f0;
}
.sched-card-chip.direction {
  color: #6d28d9;
  background: rgba(124, 58, 237, .1);
}
.sched-card-chip.platform {
  color: #0369a1;
  background: rgba(2, 132, 199, .1);
}
.sched-card-chip.platform.empty {
  color: var(--text-muted);
  background: transparent;
  border: 1px dashed var(--border-lit);
  font-style: italic;
}
.sched-card-more {
  font-size: .68rem;
  color: var(--primary);
  font-weight: 500;
  text-align: center;
  padding: 2px 4px;
  background: var(--primary-light);
  border-radius: 3px;
  margin-top: 2px;
  cursor: pointer;
}
.sched-card-more:hover { background: rgba(26,86,219,.15); }

/* status colors (apply to .sched-card-amount) */
.sched-status-draft     { color: #9ca3af; font-style: italic; }  /* gray-400, italic */
.sched-status-planned   { color: #6b7280; }   /* gray-500 */
.sched-status-contacted { color: #b45309; }   /* amber-700 */
.sched-status-confirmed { color: #1d4ed8; }   /* blue-700 */
.sched-status-published { color: #6d28d9; }   /* violet-700 */
.sched-status-settled   { color: #047857; }   /* green-700 */
.sched-status-cancelled { color: #9ca3af; text-decoration: line-through; }

/* 已去掉左边框色条；仅保留已取消的置灰 */
.sched-card[data-status="cancelled"] { opacity: .65; }

/* ============ 空态 ============ */
.sched-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: .85rem;
}

/* ============ 筛选弹窗 ============ */
.sched-filter-pop {
  position: absolute;
  z-index: 100;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  min-width: 220px;
}
.sched-filter-pop label {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 4px;
  cursor: pointer;
  font-size: .85rem;
}
.sched-filter-pop label:hover { background: var(--bg-hover); border-radius: 4px; }
.sched-filter-pop .actions {
  display: flex; justify-content: space-between;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
}
.sched-filter-pop button {
  font-size: .8rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
}

/* ============ 右滑抽屉（排期编辑器） ============ */
.sched-drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 8000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.sched-drawer-overlay.open { opacity: 1; pointer-events: auto; }

.sched-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 480px;
  max-width: 100vw;
  background: var(--bg-panel);
  z-index: 8001;
  box-shadow: -8px 0 24px rgba(0,0,0,.12);
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.2,.7,.3,1);
  display: flex; flex-direction: column;
}
.sched-drawer.open { transform: translateX(0); }
.sched-drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.sched-drawer-title { font-weight: 600; font-size: 1.05rem; }
.sched-drawer-close {
  background: none; border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
}
.sched-drawer-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.sched-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.sched-drawer-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  background: #fafbfd;
}
.sched-drawer-footer .spacer { flex: 1; }

.sched-form-group { margin-bottom: 14px; }
.sched-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sched-form-label {
  display: block;
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.sched-form-label .req { color: var(--danger); margin-left: 2px; }
.sched-form-control {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: .88rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  color: var(--text-primary);
}
.sched-form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: var(--bg-panel);
}
.sched-form-control.error { border-color: var(--danger); }
.sched-form-control[readonly] { background: #f0f3f7; cursor: not-allowed; }
textarea.sched-form-control { resize: vertical; min-height: 60px; }

.sched-form-hint {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.sched-form-checkbox {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .82rem;
  color: var(--text-secondary);
  cursor: pointer;
}

/* 状态联动：发布链接/日期块 */
.sched-form-publish {
  background: linear-gradient(180deg, #f5f3ff 0%, #ffffff 100%);
  border: 1px dashed var(--purple);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
}
.sched-form-publish-title {
  font-size: .75rem;
  font-weight: 500;
  color: var(--purple);
  margin-bottom: 8px;
}

/* 状态历史时间线 */
.sched-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sched-history-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: .82rem;
}
.sched-history-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.sched-history-dot[data-status="planned"]   { background: #9ca3af; }
.sched-history-dot[data-status="contacted"] { background: #d97706; }
.sched-history-dot[data-status="confirmed"] { background: #2563eb; }
.sched-history-dot[data-status="published"] { background: #7c3aed; }
.sched-history-dot[data-status="settled"]   { background: #059669; }
.sched-history-dot[data-status="cancelled"] { background: #d1d5db; }
.sched-history-content { flex: 1; }

/* P2: 排期编辑抽屉 Tab 化 */
.sched-tab-bar {
  display: flex;
  gap: 2px;
  margin: -16px -20px 16px;
  padding: 0 12px;
  background: #fafbfd;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.sched-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 12px 10px;
  cursor: pointer;
  font-size: .85rem;
  color: var(--text-secondary);
  font-family: inherit;
  white-space: nowrap;
  transition: all var(--transition);
  margin-bottom: -1px;
}
.sched-tab:hover { color: var(--text-primary); background: rgba(0,0,0,.02); }
.sched-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 500;
}
.sched-tab-badge {
  display: inline-block;
  margin-left: 4px;
  background: var(--primary);
  color: #fff;
  font-size: .68rem;
  padding: 0 6px;
  border-radius: 9px;
  min-width: 18px;
  text-align: center;
  line-height: 16px;
  vertical-align: middle;
}
.sched-tab:not(.active) .sched-tab-badge {
  background: var(--border-lit);
  color: var(--text-secondary);
}

.sched-linked-tab { padding: 0; }
.sched-linked-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.sched-linked-list { display: flex; flex-direction: column; gap: 8px; }
.sched-linked-item {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.sched-linked-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(26,86,219,.1);
  transform: translateY(-1px);
}
.sched-linked-main {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.sched-linked-meta {
  font-size: .76rem;
  color: var(--text-muted);
}
.sched-linked-sub {
  font-size: .78rem;
  color: var(--text-secondary);
}

/* ============ 内容发布（传播执行）表格 ============ */
.comm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
  table-layout: auto;
}
.comm-table th, .comm-table td {
  padding: 6px 8px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
/* 表头：每个格子单独 sticky（支持双行表头 + 冻结列，避免 thead 整体 sticky 冲突） */
.comm-table thead th {
  background: #f9fafb;
  font-weight: 500;
  color: var(--text-secondary);
  position: sticky;
  z-index: 2;
}
.comm-table thead tr:first-child th { top: 0; }
.comm-table thead tr:nth-child(2) th { top: 36px; } /* 第一行高度，JS 会精确校准 */
.comm-table .comm-group {
  text-align: center;
  font-weight: 600;
  color: var(--text-primary);
  font-size: .82rem;
}
.comm-table .comm-actions {
  text-align: center;
  background: #fafbfd;
}
/* 冻结首两列：选择框 + 达人昵称（横向滚动时固定） */
.comm-table .comm-fz1,
.comm-table .comm-fz2 {
  position: sticky;
  z-index: 3;
}
.comm-table .comm-fz1 { left: 0; }
.comm-table .comm-fz2 {
  left: 45px;
  box-shadow: 1px 0 0 var(--border), 4px 0 6px -3px rgba(0,0,0,.12);
}
/* 表头冻结列：横纵都固定，层级最高 */
.comm-table thead .comm-fz1,
.comm-table thead .comm-fz2 { z-index: 5; top: 0; }

.comm-table tbody tr:hover { background: var(--bg-hover); }
.comm-table .comm-sub-row td { background: #fafbfd; color: var(--text-secondary); }
.comm-table .comm-main-row td { border-top: 2px solid var(--border-lit); }
.comm-table .comm-footer-row td {
  background: linear-gradient(180deg,#f5f3ff 0%,#ede9fe 100%);
  font-weight: 600;
  padding: 10px;
}

/* 编辑器 publication block */
.comm-pub-block {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
  min-width: 0;
  overflow: hidden;
}
.comm-pub-head {
  display: flex; justify-content: space-between; align-items: center;
}
.comm-pub-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}
.comm-pub-grid > div { display: flex; flex-direction: column; min-width: 0; }
.comm-pub-grid label {
  font-size: .72rem; color: var(--text-secondary); margin-bottom: 3px;
}
.comm-pub-grid input {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .82rem;
  outline: none;
  background: var(--bg-panel);
}
.comm-pub-grid input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.comm-pub-subgroup {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-lit);
}
.comm-pub-subgroup-title {
  font-size: .78rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 8px;
}

/* ============ 品宣 ROI · 平台×日期 主表 ============ */
.roi-kpi-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: .92rem;
}

.roi-matrix {
  border-collapse: separate;
  border-spacing: 0;
  font-size: .82rem;
  width: max-content;
  min-width: 100%;
  background: var(--bg-panel);
}
.roi-matrix th, .roi-matrix td {
  border: 1px solid var(--border);
  padding: 3.5px 10px;
  line-height: 15px;
  text-align: center;
  white-space: nowrap;
  color: var(--text-primary);
}
.roi-matrix thead th {
  background: var(--bg-panel);
  font-weight: 500;
  color: var(--text-secondary);
  position: sticky; top: 0;
  z-index: 2;
  font-size: .82rem;
}
.roi-matrix .roi-platform-name {
  background: var(--bg-panel);
  font-weight: 500;
  color: var(--text-primary);
  width: 80px;
  position: sticky; left: 0;
  z-index: 3;
}
.roi-matrix thead .roi-platform-name {
  z-index: 4;
}
.roi-matrix .roi-metric {
  background: var(--bg-panel);
  text-align: center;
  color: var(--text-secondary);
  width: 96px;
  position: sticky; left: 80px;
  z-index: 3;
  font-weight: 400;
}
.roi-matrix thead .roi-metric { z-index: 4; }
.roi-matrix .roi-day {
  width: 56px;
  font-size: .8rem;
  color: var(--text-secondary);
}
.roi-matrix .roi-total {
  background: var(--bg-panel);
  font-weight: 500;
  color: var(--text-primary);
  width: 80px;
  min-width: 80px;
  position: sticky;
  right: 0;
  z-index: 3;
  box-shadow: -3px 0 6px rgba(0,0,0,0.08);
}
.roi-matrix thead th.roi-total {
  z-index: 5;
  top: 0;
  right: 0;
}
.roi-matrix .roi-promo-edit:hover { background: rgba(99,102,241,0.08); cursor: pointer; }
.roi-matrix tbody tr:hover td:not(.roi-platform-name):not(.roi-metric):not(.roi-total) { background: var(--bg-hover); }

/* 投流行：蓝色字体（仿原表） */
.roi-matrix .roi-promo-row td,
.roi-matrix .roi-promo-row th.roi-metric {
  color: #2563eb;
}
.roi-matrix .roi-promo-row .roi-total {
  color: #2563eb;
}

/* 置换成本：纯白底，无特殊背景 */
.roi-matrix .roi-replacement-row td,
.roi-matrix .roi-replacement-row th {
  background: var(--bg-panel);
}

/* 合计：浅灰底，加粗 */
.roi-matrix .roi-total-row td,
.roi-matrix .roi-total-row th {
  background: #fafbfd;
  font-weight: 600;
}

/* 投流编辑输入框：隐藏上下箭头 */
.roi-matrix input[type=number]::-webkit-outer-spin-button,
.roi-matrix input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.roi-matrix input[type=number] { -moz-appearance: textfield; }

/* ============ KolSelector（达人选择器） ============ */
.kol-selector { position: relative; z-index: 10; }
.kol-selector-dropdown {
  position: absolute;
  top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-lit);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 9999;
  max-height: 280px;
  overflow-y: auto;
}
.kol-selector-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem;
  border-bottom: 1px solid #f0f2f5;
}
.kol-selector-item:last-child { border-bottom: none; }
.kol-selector-item:hover { background: var(--bg-hover); }
.kol-selector-item .name { flex: 1; font-weight: 500; }
.kol-selector-item .meta {
  font-size: .72rem; color: var(--text-muted);
  background: var(--bg-base);
  padding: 1px 6px;
  border-radius: 3px;
}
.kol-selector-create {
  padding: 8px 12px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: .82rem;
  cursor: pointer;
  font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.kol-selector-create:hover { background: rgba(26,86,219,.18); }
.kol-selector-empty {
  padding: 12px;
  text-align: center;
  font-size: .8rem;
  color: var(--text-muted);
}
.kol-selector-tag {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 6px;
  font-size: .72rem;
  color: var(--success);
  background: rgba(5,150,105,.08);
  padding: 2px 8px;
  border-radius: 10px;
}
.kol-selector-tag .unlink {
  cursor: pointer;
  color: var(--text-muted);
}

/* ============ 月度规划表 ============ */
.sched-budget-card {
  background: var(--bg-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: visible;
}
.sched-budget-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  background: linear-gradient(180deg, #fafbfd 0%, #ffffff 100%);
  flex-wrap: wrap;
}
.sched-budget-title { font-weight: 600; font-size: .95rem; }
.sched-budget-title small {
  font-weight: 400; color: var(--text-secondary);
  margin-left: 8px; font-size: .78rem;
}
.sched-budget-actions { display: flex; align-items: center; gap: 6px; }

/* 视图切换按钮组 */
.sched-view-switcher {
  display: inline-flex;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  padding: 2px;
  margin-right: 8px;
}
.sched-view-btn {
  background: none;
  border: none;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: .78rem;
  color: var(--text-secondary);
  font-family: inherit;
  transition: all var(--transition);
}
.sched-view-btn:hover { color: var(--text-primary); }
.sched-view-btn.active {
  background: var(--bg-panel);
  color: var(--primary);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.sched-budget-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.sched-budget-table th, .sched-budget-table td {
  padding: 0;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  position: relative;
}
.sched-budget-table th {
  background: #f9fafb;
  font-weight: 500;
  font-size: .78rem;
  color: var(--text-secondary);
  padding: 9px 12px;
}
.sched-budget-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.sched-budget-table td { padding: 0; }

/* 列宽（按 MD §4.9 比例） */
.sched-budget-table col.col-type     { width: 12%; }
.sched-budget-table col.col-product  { width: 10%; }
.sched-budget-table col.col-platform { width: 9%; }
.sched-budget-table col.col-budget   { width: 8%; }
.sched-budget-table col.col-count    { width: 7%; }
.sched-budget-table col.col-actual   { width: 11%; }
.sched-budget-table col.col-gap      { width: 8%; }
.sched-budget-table col.col-func     { width: 13%; }
.sched-budget-table col.col-req      { width: 17%; }
.sched-budget-table col.col-act      { width: 5%; }

.sched-budget-cell {
  padding: 9px 12px;
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: var(--text-primary);
  text-align: left;
  transition: background var(--transition);
  min-height: 36px;
  box-sizing: border-box;
}
.sched-budget-cell.editable:hover {
  background: rgba(124, 58, 237, 0.06);
}
.sched-budget-cell.readonly { cursor: default; }
.sched-budget-cell.muted { color: var(--text-muted); }

.sched-budget-cell-input {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  background: var(--bg-panel);
  font-family: inherit;
  font-size: inherit;
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-light);
  color: var(--text-primary);
  box-sizing: border-box;
}

/* 产品线多选浮层（单元格编辑态） */
.sched-product-multi-pop {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  z-index: 50;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 10px 12px;
  min-width: 180px;
  max-width: 260px;
}

.sched-budget-row-orphan { background: #fffbeb; }
.sched-budget-row-orphan td { background: #fffbeb; }
.sched-budget-orphan-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: .68rem;
  padding: 1px 6px;
  background: #fbbf24;
  color: #78350f;
  border-radius: 10px;
  font-weight: 500;
}

.sched-budget-actual { font-weight: 500; }
.sched-budget-gap-pos { color: var(--success); }
.sched-budget-gap-neg { color: var(--danger); }

.sched-budget-total-row {
  background: linear-gradient(180deg, #f5f3ff 0%, #ede9fe 100%);
  font-weight: 600;
}
.sched-budget-total-row td { padding: 12px; border-bottom: none; }

/* 只读统计子表（BD / 层级维度） */
.sched-budget-table.view-table th {
  padding: 12px 18px;
  font-size: .82rem;
  letter-spacing: .01em;
}
.sched-budget-table.view-table td {
  padding: 14px 18px;
  line-height: 1.5;
}
.sched-budget-table.view-table tbody tr {
  transition: background .12s ease;
}
.sched-budget-table.view-table tbody tr:hover {
  background: var(--bg-hover);
}
.sched-budget-table.view-table .sched-budget-total-row td {
  padding: 14px 18px;
}

.sched-budget-del {
  background: none; border: none;
  cursor: pointer; opacity: 0;              /* 默认隐藏 */
  color: var(--danger); font-size: .92rem;
  padding: 2px 6px; border-radius: 4px;
  transition: opacity .15s;
}
.sched-budget-table tbody tr:hover .sched-budget-del { opacity: .55; } /* 悬停整行才显示 */
.sched-budget-del:hover { opacity: 1 !important; background: rgba(220, 38, 38, .08); }

/* 「+ 添加层级」行 */
.sched-add-tier-row td {
  background: #f8fafc;
  border-bottom: 2px solid var(--border);
}
.sched-add-tier-btn {
  background: none;
  border: 1px dashed var(--border-lit);
  color: var(--text-muted);
  font-size: .78rem;
  padding: 3px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.sched-add-tier-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* 「+ 添加达人类型」浮层 */
.sched-add-dir-row td {
  padding: 8px 12px;
  background: #fafbfd;
}
.sched-add-dir-trigger {
  background: none;
  border: 1px dashed var(--border-lit);
  color: var(--text-secondary);
  font-size: .82rem;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.sched-add-dir-trigger:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.sched-add-dir-pop {
  position: absolute;
  z-index: 50;
  margin-top: 4px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  width: 320px;
  max-height: 360px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.sched-add-dir-pop-search {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}
.sched-add-dir-pop-search input {
  width: 100%; padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .85rem;
  outline: none;
}
.sched-add-dir-pop-list {
  overflow-y: auto;
  max-height: 260px;
}
.sched-add-dir-pop-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  font-size: .85rem;
  border-bottom: 1px solid #f0f2f5;
}
.sched-add-dir-pop-item:hover { background: var(--bg-hover); }
.sched-add-dir-pop-item .status-in   { color: var(--success); font-size: .72rem; }
.sched-add-dir-pop-item .status-off  { color: var(--text-muted); font-size: .72rem; }
.sched-add-dir-pop-item--added {
  cursor: default;
  opacity: .55;
  background: #f8fafc;
}
.sched-add-dir-pop-item--added:hover { background: #f8fafc; }
.sched-add-dir-pop-create {
  padding: 8px 12px;
  background: var(--primary-light);
  color: var(--primary);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 500;
}
.sched-add-dir-pop-create:hover { background: rgba(26,86,219,.18); }

/* ============ 字典管理面板（modal） ============ */
.sched-dict-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 9500;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.sched-dict-overlay.open { opacity: 1; pointer-events: auto; }
.sched-dict-panel {
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 720px; max-width: 95vw;
  max-height: 85vh;
  display: flex; flex-direction: column;
  transform: scale(.95);
  transition: transform .2s;
}
.sched-dict-overlay.open .sched-dict-panel { transform: scale(1); }
.sched-dict-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.sched-dict-title { font-weight: 600; font-size: 1.05rem; }
.sched-dict-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 20px 0;
  border-bottom: 1px solid var(--border);
  background: #fafbfd;
}
.sched-dict-tab {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: .88rem;
  color: var(--text-secondary);
  font-family: inherit;
  margin-bottom: -1px;
}
.sched-dict-tab:hover { color: var(--text-primary); }
.sched-dict-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 500;
}

.sched-dict-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.sched-dict-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #fafbfd;
  display: flex; gap: 8px; align-items: center;
}
.sched-dict-footer .spacer { flex: 1; }

.sched-dict-create-row {
  display: flex; gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  background: linear-gradient(180deg, #f5f3ff 0%, #ffffff 100%);
  border: 1px solid #ede9fe;
  border-radius: var(--radius-sm);
}
.sched-dict-create-row input {
  flex: 1;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .9rem;
  outline: none;
}
.sched-dict-create-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.sched-dict-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .87rem;
}
.sched-dict-table th, .sched-dict-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.sched-dict-table th {
  background: #f9fafb;
  font-size: .76rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.sched-dict-table .col-order { width: 80px; }
.sched-dict-table .col-status { width: 100px; }
.sched-dict-table .col-usage { width: 110px; }
.sched-dict-table .col-actions { width: 140px; text-align: right; }

.sched-dict-table tr.inactive { opacity: .55; background: #fafbfd; }
.sched-dict-table tr.inactive td:first-child::before {
  content: '⊝ ';
  color: var(--text-muted);
}

.sched-dict-order-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  font-size: .7rem;
  padding: 2px 6px;
  color: var(--text-secondary);
}
.sched-dict-order-btn:hover { background: var(--bg-hover); border-color: var(--border-lit); }
.sched-dict-order-btn:disabled { opacity: .3; cursor: not-allowed; }

.sched-dict-status-on  { color: var(--success); font-weight: 500; }
.sched-dict-status-off { color: var(--text-muted); }

.sched-dict-row-action {
  background: none; border: none;
  cursor: pointer;
  font-size: .78rem;
  padding: 3px 8px;
  border-radius: 3px;
  color: var(--text-secondary);
}
.sched-dict-row-action:hover { background: var(--bg-hover); }
.sched-dict-row-action.danger { color: var(--danger); }
.sched-dict-row-action.danger:hover { background: rgba(220,38,38,.08); }
.sched-dict-row-action.primary { color: var(--primary); }
.sched-dict-row-action.primary:hover { background: var(--primary-light); }

/* ============ Excel 导入向导（4 步） ============ */
.sched-import-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .5);
  z-index: 7000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.sched-import-overlay.open { opacity: 1; pointer-events: auto; }
.sched-import-panel {
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 880px; max-width: 95vw;
  max-height: 90vh;
  display: flex; flex-direction: column;
}

.sched-import-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

/* steps indicator */
.sched-import-steps {
  display: flex; align-items: center;
  padding: 14px 20px;
  background: #fafbfd;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.sched-import-step {
  display: flex; align-items: center; gap: 8px;
  font-size: .82rem;
  color: var(--text-muted);
}
.sched-import-step .num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .78rem;
  font-weight: 600;
}
.sched-import-step.active .num { background: var(--primary); color: #fff; }
.sched-import-step.active { color: var(--primary); font-weight: 500; }
.sched-import-step.done .num { background: var(--success); color: #fff; }
.sched-import-step.done { color: var(--success); }
.sched-import-step-sep {
  flex: 1; height: 2px;
  background: var(--border);
  max-width: 40px;
}
.sched-import-step.done + .sched-import-step-sep { background: var(--success); }

.sched-import-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
}
.sched-import-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #fafbfd;
  display: flex; gap: 8px;
}
.sched-import-footer .spacer { flex: 1; }

/* Step 1: drop zone */
.sched-import-drop {
  border: 2px dashed var(--border-lit);
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
  background: #fafbfd;
}
.sched-import-drop:hover, .sched-import-drop.drag {
  border-color: var(--primary);
  background: var(--primary-light);
}
.sched-import-drop .icon { font-size: 2.2rem; }
.sched-import-drop .title {
  font-size: 1rem; font-weight: 500;
  margin: 12px 0 4px;
  color: var(--text-primary);
}
.sched-import-drop .sub {
  font-size: .82rem;
  color: var(--text-muted);
}
.sched-import-template-link {
  display: inline-block;
  margin-top: 16px;
  font-size: .85rem;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
}

/* Step 2: field mapping */
.sched-import-mapping {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 8px 14px;
  align-items: center;
}
.sched-import-mapping-col {
  font-size: .85rem;
  background: var(--bg-base);
  padding: 7px 11px;
  border-radius: 4px;
  font-weight: 500;
}
.sched-import-mapping-col small { color: var(--text-muted); font-weight: 400; margin-left: 4px; }
.sched-import-mapping select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .85rem;
  outline: none;
  background: var(--bg-panel);
}
.sched-import-mapping select:focus { border-color: var(--primary); }

/* Step 3: preview */
.sched-import-preview-stats {
  display: flex; gap: 14px;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #f5f3ff 0%, #ffffff 100%);
  border-radius: var(--radius-sm);
  font-size: .85rem;
}
.sched-import-preview-stats .stat b { font-size: 1.05rem; margin-right: 4px; }
.sched-import-preview-stats .ok b { color: var(--success); }
.sched-import-preview-stats .err b { color: var(--danger); }

.sched-import-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
}
.sched-import-preview-table th, .sched-import-preview-table td {
  padding: 6px 8px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.sched-import-preview-table th { background: #f9fafb; font-size: .74rem; }
.sched-import-preview-table tr.err td { background: #fef2f2; }
.sched-import-preview-table .err-msg {
  display: block;
  color: var(--danger);
  font-size: .72rem;
  margin-top: 2px;
}

.sched-import-strategy {
  margin: 12px 0;
  padding: 10px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  font-size: .85rem;
}
.sched-import-strategy label {
  display: inline-flex; align-items: center; gap: 6px;
  margin-right: 14px;
  cursor: pointer;
}

/* Step 4: progress */
.sched-import-progress {
  text-align: center;
  padding: 20px;
}
.sched-import-progress-bar {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
  margin: 14px 0;
}
.sched-import-progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--purple) 100%);
  transition: width .2s;
}
.sched-import-result-card {
  background: var(--bg-base);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
}
.sched-import-result-stats {
  display: flex; gap: 24px;
  margin-bottom: 8px;
  font-size: .9rem;
}
