/* AI 密谋士指挥台 — 主区 + 右侧整列侧栏 */

.xm-command-center:not(.is-collapsed) {
  display: block;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.xm-command-center:not(.is-collapsed) .xm-command-center-head {
  padding: 12px 16px;
  border: 1px solid #d7e4f2;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, .07) 0%, rgba(21, 94, 239, .06) 100%),
    #fff;
  box-shadow: 0 4px 18px rgba(15, 35, 62, .04);
}

.xm-command-expanded {
  display: block;
  min-width: 0;
}

.xm-command-center:not(.is-collapsed) .xm-command-expanded {
  display: block !important;
  grid-template-columns: unset;
  gap: 0;
}

.xm-command-center:not(.is-collapsed) .xm-command-insight {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

/* ── 画布：左主区 + 右侧栏 ── */
.xm-command-canvas {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  min-width: 0;
  border: 1px solid #d7e4f2;
  border-top: none;
  border-radius: 0 0 12px 12px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(15, 35, 62, .07);
}

.xm-command-main {
  position: relative;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-width: 0;
  min-height: 0;
}

.xm-command-main > .xm-command-insight {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.xm-command-main > .xm-command-insight[hidden] {
  display: none !important;
}

.xm-command-insight {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.xm-command-insight-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 0;
  min-width: 0;
  min-height: 0;
}

/* ── Hero 摘要区 ── */
.xm-command-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px 20px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(226, 235, 245, .92);
  background:
    radial-gradient(circle at 0% 0%, rgba(21, 94, 239, .08) 0%, transparent 42%),
    radial-gradient(circle at 100% 0%, rgba(15, 118, 110, .06) 0%, transparent 36%),
    linear-gradient(135deg, rgba(238, 245, 255, .92) 0%, rgba(248, 250, 252, .88) 52%, rgba(236, 253, 245, .72) 100%);
}

.xm-command-hero--empty {
  align-items: center;
}

.xm-command-hero-main {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.xm-command-hero-aside {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  min-width: 280px;
}

.xm-command-hero-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.xm-command-hero-action {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 10px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 2px 10px rgba(15, 35, 62, .05);
  text-align: left;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease, background .16s ease;
}

.xm-command-hero-action:hover,
.xm-command-hero-action:focus-visible {
  border-color: rgba(21, 94, 239, .28);
  background: #fff;
  box-shadow: 0 6px 18px rgba(21, 94, 239, .1);
  transform: translateY(-1px);
}

.xm-command-hero-action-label {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  color: #1e293b;
}

.xm-command-hero-action-hint {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.25;
  color: #64748b;
}

.xm-command-hero-action[data-ai-advisor-action="top3"],
.xm-command-hero-action[data-ai-advisor-action="intervention"],
.xm-command-hero-action[data-ai-advisor-action="decisions"] {
  border-color: rgba(191, 219, 254, .85);
  background: linear-gradient(135deg, rgba(255, 255, 255, .96) 0%, rgba(239, 246, 255, .92) 100%);
}

.xm-command-hero-action[data-ai-advisor-action="week-report"],
.xm-command-hero-action[data-ai-advisor-action="blockers"],
.xm-command-hero-action[data-ai-advisor-action="risk"] {
  border-color: rgba(153, 246, 228, .75);
  background: linear-gradient(135deg, rgba(255, 255, 255, .96) 0%, rgba(236, 253, 245, .9) 100%);
}

.xm-command-insight-body .xm-command-summary {
  display: block;
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: #1e293b;
  letter-spacing: -.01em;
}

.xm-command-hero-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── 建议先做 ── */
.xm-command-workbench {
  flex: 1 1 auto;
  padding: 16px 22px 20px;
  min-width: 0;
}

.xm-command-priority {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.xm-command-priority-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  color: #475569;
}

.xm-command-priority-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, #155eef 0%, #0f766e 100%);
}

.xm-command-priority-list {
  display: grid;
  gap: 10px;
}

.xm-command-priority-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid #e8eef5;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 35, 62, .03);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.xm-command-priority-item:hover {
  border-color: rgba(21, 94, 239, .22);
  box-shadow: 0 8px 20px rgba(15, 35, 62, .06);
  transform: translateY(-1px);
}

.xm-command-priority-item[data-rank="1"] { border-left: 3px solid #155eef; }
.xm-command-priority-item[data-rank="2"] { border-left: 3px solid #6366f1; }
.xm-command-priority-item[data-rank="3"] { border-left: 3px solid #0f766e; }

.xm-command-priority-rank {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: linear-gradient(135deg, #155eef 0%, #6366f1 100%);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(21, 94, 239, .22);
}

.xm-command-priority-item[data-rank="2"] .xm-command-priority-rank {
  background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
}

.xm-command-priority-item[data-rank="3"] .xm-command-priority-rank {
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
}

.xm-command-priority-copy b { font-size: 13px; }

.xm-command-priority-copy small {
  margin-top: 2px;
  line-height: 1.4;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.xm-command-next-btn {
  min-height: 30px;
  padding: 5px 12px;
  border: 1px solid rgba(21, 94, 239, .22);
  border-radius: 999px;
  background: #eef5ff;
  font-size: 11px;
  font-weight: 700;
}

.xm-command-next-btn:hover,
.xm-command-next-btn:focus-visible {
  border-color: rgba(21, 94, 239, .38);
  background: #dbeafe;
}

.xm-command-signal {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #dbeafe;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 2px 8px rgba(15, 35, 62, .04);
}

.xm-command-insight-empty { font-size: 13px; line-height: 1.55; }
.xm-command-insight .xm-ai-loading { padding: 20px; }

/* ── 右侧栏：仅待跟进 ── */
.xm-command-sidebar {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-width: 0;
  min-height: 0;
  height: 100%;
  border-top: 1px solid rgba(226, 232, 240, .95);
  background: rgba(248, 250, 252, .72);
}

.xm-command-sidebar.is-followups-empty,
.xm-command-canvas.is-no-followups .xm-command-sidebar {
  display: none;
}

.xm-command-canvas.is-no-followups {
  grid-template-columns: minmax(0, 1fr) !important;
}

.xm-command-followups-col.is-empty {
  display: none;
}

.xm-command-followups-col {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 16px;
  overflow: hidden;
}

.xm-command-followups-slot {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.xm-command-followups-slot:empty {
  display: none;
}

.xm-command-followups-panel,
.xm-command-aside {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 10px;
  min-height: 0;
  height: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(207, 221, 234, .92);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(248, 251, 255, .96) 0%, rgba(255, 255, 255, .92) 100%);
}

.xm-command-followups-list {
  display: grid;
  flex: 1 1 auto;
  gap: 8px;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.xm-command-followup-item {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 10px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 8px rgba(15, 35, 62, .03);
}

.xm-command-followup-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.xm-command-followup-main b {
  font-size: 12px;
  line-height: 1.35;
  color: #1e293b;
}

.xm-command-followup-main span {
  font-size: 11px;
  line-height: 1.45;
  color: #64748b;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.xm-command-followup-main small {
  color: #94a3b8;
  font-size: 10px;
  font-weight: 700;
}

.xm-command-followup-actions {
  display: flex;
  gap: 6px;
}

.xm-command-followup-open,
.xm-command-followup-done {
  flex: 1 1 auto;
  min-height: 28px;
  font-size: 11px;
  font-weight: 800;
}

.xm-command-aside-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.xm-command-aside-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.xm-command-aside-list li {
  padding: 10px 12px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 10px;
  background: rgba(255, 255, 255, .92);
}

.xm-command-aside-list b {
  display: block;
  font-size: 12px;
  color: #1e293b;
}

.xm-command-aside-list span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.45;
  color: #64748b;
}

/* ── 宽屏：左右双栏，侧栏贯穿全高 ── */
@media (min-width: 1100px) {
  .xm-command-canvas {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
    align-items: stretch;
  }

  .xm-command-sidebar {
    border-top: none;
    border-left: 1px solid rgba(226, 232, 240, .95);
  }
}

@media (min-width: 1280px) {
  .xm-command-canvas:not(.is-no-followups) {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  }

  .xm-command-hero-aside {
    min-width: 300px;
  }

  .xm-command-priority-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .xm-command-priority-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-height: 128px;
    padding: 12px 14px;
  }

  .xm-command-priority-copy {
    flex: 1 1 auto;
    width: 100%;
  }

  .xm-command-priority-copy b {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .xm-command-priority-cta {
    width: 100%;
    margin-top: auto;
  }

  .xm-command-next-btn {
    display: block;
    width: 100%;
    text-align: center;
  }

  .xm-command-hero {
    padding: 20px 24px;
  }

  .xm-command-workbench {
    padding: 18px 24px 22px;
  }
}

@media (min-width: 1480px) {
  .xm-command-canvas:not(.is-no-followups) {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  }
}

/* ── 中窄屏：纵向堆叠 ── */
@media (max-width: 1099px) {
  .xm-command-hero {
    grid-template-columns: 1fr;
  }

  .xm-command-hero-aside {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .xm-command-hero-actions {
    flex: 1 1 auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .xm-command-followups-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .xm-command-hero {
    padding: 14px 16px;
  }

  .xm-command-hero-actions {
    grid-template-columns: 1fr;
  }

  .xm-command-workbench {
    padding: 12px 16px 14px;
  }

  .xm-command-followups-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .xm-command-center:not(.is-collapsed) .xm-command-center-head {
    border-radius: 10px 10px 0 0;
  }

  .xm-command-canvas {
    border-radius: 0 0 10px 10px;
  }
}
