.project-command-center[hidden],
#projects-matrix-section[hidden],
.project-command-center [hidden] {
  display: none !important;
}

.app.route-projects:not(.pcc-matrix-mode) #projects-fab {
  display: none !important;
}

.project-command-center {
  padding: 22px;
  overflow: hidden;
  border-color: rgba(29, 45, 62, 0.12);
  gap: 0;
  min-height: 0;
}

.pcc-header,
.pcc-title-row,
.pcc-toolbar,
.pcc-filter-row,
.pcc-row,
.pcc-completed-item,
.pcc-matrix-note {
  display: flex;
  align-items: center;
}

.pcc-header {
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(29, 45, 62, 0.1);
}

.pcc-heading {
  min-width: 0;
}

.pcc-kicker {
  display: block;
  margin-bottom: 5px;
  color: #a2732e;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.pcc-title-row {
  gap: 10px;
}

.pcc-title-row .card-title {
  margin: 0;
}

.pcc-heading .card-note {
  margin: 7px 0 0;
}

.pcc-health {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #edf4ef;
  color: #366346;
  font-size: 12px;
  font-weight: 700;
}

.pcc-health[data-health="risk"],
.pcc-health[data-health="stalled"] {
  background: #fff4df;
  color: #9a641b;
}

.pcc-health[data-health="overdue"] {
  background: #fff0ed;
  color: #a33d32;
}

.pcc-tabs,
.pcc-scope,
.pcc-risk-filters {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pcc-tabs {
  flex: 0 0 auto;
  padding: 4px;
  border-radius: 12px;
  background: #f4f1eb;
}

.pcc-tab,
.pcc-scope button,
.pcc-risk-filter {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.pcc-tab {
  padding: 8px 13px;
  border-radius: 9px;
  background: transparent;
  color: #66717b;
  font-size: 13px;
  font-weight: 650;
}

.pcc-tab span {
  margin-left: 4px;
  opacity: 0.75;
}

.pcc-tab:hover {
  color: #263746;
}

.pcc-tab.is-active {
  background: #fff;
  color: #263746;
  box-shadow: 0 2px 8px rgba(23, 35, 46, 0.08);
}

.pcc-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.pcc-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  padding: 12px 14px;
  border: 1px solid rgba(29, 45, 62, 0.1);
  border-radius: 12px;
  background: #fbfaf7;
  color: #65707a;
  cursor: pointer;
  text-align: left;
}

.pcc-metric:hover,
.pcc-metric.is-active {
  border-color: rgba(163, 61, 50, 0.35);
  background: #fff8f5;
}

.pcc-metric--secondary:hover,
.pcc-metric--secondary.is-active {
  border-color: rgba(162, 115, 46, 0.35);
  background: #fffaf1;
}

.pcc-metric span {
  font-size: 12px;
  font-weight: 650;
}

.pcc-metric strong {
  color: #263746;
  font-size: 24px;
  line-height: 1;
}

.pcc-toolbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.pcc-scope {
  padding: 3px;
  border: 1px solid rgba(29, 45, 62, 0.1);
  border-radius: 10px;
  background: #fff;
}

.pcc-scope button {
  padding: 6px 10px;
  border-radius: 7px;
  background: transparent;
  color: #6b747c;
  font-size: 12px;
}

.pcc-scope button.is-active {
  background: #263746;
  color: #fff;
}

.pcc-search {
  width: min(260px, 100%);
}

.pcc-search .input {
  width: 100%;
}

.pcc-filter-row {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.pcc-risk-filters {
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.pcc-risk-filter {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f4f1eb;
  color: #67717a;
  font-size: 12px;
}

.pcc-risk-filter.is-active {
  background: #a2732e;
  color: #fff;
}

.pcc-risk-filter span {
  margin-left: 3px;
  opacity: 0.8;
}

.pcc-summary {
  flex: 0 0 auto;
  color: #7d858c;
  font-size: 12px;
}

.pcc-list,
.pcc-completed-list {
  display: grid;
  gap: 8px;
}

.pcc-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.4fr) minmax(160px, 0.9fr) minmax(120px, 0.65fr) minmax(105px, 0.55fr) auto;
  gap: 14px;
  min-height: 70px;
  padding: 13px 14px;
  border: 1px solid rgba(29, 45, 62, 0.09);
  border-left: 3px solid #d5a654;
  border-radius: 11px;
  background: #fff;
}

.pcc-row[data-level="danger"],
.pcc-row[data-level="blocked"] {
  border-left-color: #b65347;
}

.pcc-row-title,
.pcc-row-owner,
.pcc-row-date {
  min-width: 0;
}

.pcc-row-title strong,
.pcc-row-owner strong,
.pcc-row-date strong {
  display: block;
  overflow: hidden;
  color: #263746;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pcc-row-title span,
.pcc-row-owner span,
.pcc-row-date span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: #80878d;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pcc-reason {
  align-self: center;
  justify-self: start;
  padding: 5px 8px;
  border-radius: 7px;
  background: #fff3e0;
  color: #96601a;
  font-size: 11px;
  font-weight: 650;
}

.pcc-row[data-level="danger"] .pcc-reason,
.pcc-row[data-level="blocked"] .pcc-reason {
  background: #fff0ed;
  color: #a33d32;
}

.pcc-handle {
  align-self: center;
  padding: 7px 12px;
  border: 1px solid rgba(38, 55, 70, 0.2);
  border-radius: 8px;
  background: #fff;
  color: #263746;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.pcc-handle:hover {
  border-color: #a2732e;
  color: #8b5e21;
}

.pcc-completed-item {
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(29, 45, 62, 0.08);
  border-radius: 11px;
  background: #fbfaf7;
}

.pcc-completed-item strong {
  display: block;
  color: #263746;
  font-size: 13px;
}

.pcc-completed-item span {
  display: block;
  margin-top: 4px;
  color: #7d858c;
  font-size: 11px;
}

.pcc-completed-check {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e8f3ea;
  color: #3f744d !important;
  font-size: 15px !important;
  line-height: 26px;
  text-align: center;
}

.pcc-matrix-note {
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f6f3ed;
  color: #58636d;
  font-size: 12px;
}

.pcc-empty,
.pcc-error {
  padding: 28px 18px;
  border: 1px dashed rgba(29, 45, 62, 0.16);
  border-radius: 11px;
  color: #7a838a;
  text-align: center;
}

.pcc-error {
  color: #a33d32;
}

.pcc-highlight {
  animation: pcc-highlight-pulse 1.6s ease;
  outline: 3px solid rgba(162, 115, 46, 0.35);
  outline-offset: 3px;
}

@keyframes pcc-highlight-pulse {
  0%, 100% { outline-color: rgba(162, 115, 46, 0); }
  35%, 70% { outline-color: rgba(162, 115, 46, 0.45); }
}

@media (max-width: 1000px) {
  .pcc-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .pcc-tabs {
    width: 100%;
  }

  .pcc-tab {
    flex: 1;
  }

  .pcc-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pcc-row {
    grid-template-columns: minmax(200px, 1fr) minmax(140px, 0.8fr) minmax(110px, 0.6fr) auto;
  }

  .pcc-row-date {
    display: none;
  }
}

@media (max-width: 720px) {
  .project-command-center {
    padding: 16px;
  }

  .pcc-tabs {
    overflow-x: auto;
  }

  .pcc-tab {
    flex: 0 0 auto;
  }

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

  .pcc-toolbar,
  .pcc-filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .pcc-search {
    width: 100%;
  }

  .pcc-summary {
    white-space: normal;
  }

  .pcc-row {
    grid-template-columns: 1fr auto;
  }

  .pcc-row-owner,
  .pcc-row-date {
    display: none;
  }

  .pcc-reason {
    grid-column: 1;
  }

  .pcc-handle {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .pcc-matrix-note {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* 项目空间桌面端紧凑首屏：把判断和操作留在上方，把任务内容尽早露出。 */
@media (min-width: 721px) {
  .app.route-projects .app-main {
    padding-top: 14px;
  }

  .app.route-projects .app-header {
    min-height: 42px;
    padding: 0 2px 9px;
    align-items: center;
  }

  .app.route-projects .app-title {
    font-size: 23px;
    line-height: 1.2;
  }

  .app.route-projects .app-subtitle {
    display: none;
  }

  .app.route-projects .view--projects {
    padding-top: 9px;
  }

  .app.route-projects .projects-page {
    gap: 8px;
  }

  .app.route-projects .project-command-center {
    padding: 12px 16px 14px;
    margin-bottom: 0;
  }

  .project-command-center .sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  .pcc-header {
    gap: 14px;
    padding-bottom: 8px;
  }

  .pcc-heading {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    gap: 10px;
  }

  .pcc-kicker {
    display: none;
  }

  .pcc-title-row {
    flex: 0 0 auto;
    gap: 7px;
  }

  .pcc-title-row .card-title {
    font-size: 18px;
    line-height: 1.25;
  }

  .pcc-heading .card-note {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .pcc-health {
    min-height: 21px;
    padding: 2px 7px;
    font-size: 11px;
  }

  .pcc-tabs {
    padding: 3px;
  }

  .pcc-tab {
    padding: 6px 10px;
    font-size: 12px;
  }

  .pcc-metrics {
    gap: 7px;
    margin: 8px 0;
  }

  .pcc-metric {
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 9px;
  }

  .pcc-metric span {
    font-size: 11px;
  }

  .pcc-metric strong {
    font-size: 17px;
  }

  .pcc-toolbar {
    gap: 10px;
    margin-bottom: 6px;
  }

  .pcc-scope {
    padding: 2px;
  }

  .pcc-scope button {
    padding: 5px 9px;
  }

  .pcc-search {
    width: min(220px, 100%);
  }

  .pcc-search .input {
    min-height: 32px;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .pcc-filter-row {
    gap: 10px;
    margin-bottom: 7px;
  }

  .pcc-risk-filters {
    gap: 4px;
  }

  .pcc-risk-filter {
    padding: 5px 8px;
    font-size: 11px;
  }

  .pcc-summary {
    font-size: 11px;
  }

  .pcc-row {
    min-height: 58px;
    padding: 9px 12px;
  }
}

@media (min-width: 1001px) {
  .app.route-projects .projects-hero {
    padding: 11px 16px;
    margin-bottom: 0;
  }

  .app.route-projects .projects-hero-header {
    align-items: center;
    gap: 16px;
  }

  .app.route-projects .projects-hero-header > div:first-child {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: minmax(280px, 420px) auto;
    grid-template-areas:
      "selector owner"
      "meta meta";
    align-items: center;
    gap: 5px 12px;
    min-width: 0;
  }

  .app.route-projects .projects-hero-title-row {
    grid-area: selector;
    min-width: 0;
  }

  .app.route-projects #projects-hero-name {
    display: none;
  }

  .app.route-projects .project-picker-toggle {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 36px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .app.route-projects .projects-hero-meta {
    grid-area: meta;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 5px 14px;
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
  }

  .app.route-projects .projects-hero-owner {
    grid-area: owner;
    margin: 0;
    white-space: nowrap;
  }

  .app.route-projects .projects-hero-owner-icon {
    width: 22px;
    height: 22px;
  }

  .app.route-projects .projects-hero-progress {
    display: grid;
    flex: 0 0 310px;
    grid-template-columns: minmax(100px, 1fr) auto;
    grid-template-areas:
      "bar percent"
      "actions actions";
    align-items: center;
    gap: 5px 9px;
    min-width: 0;
  }

  .app.route-projects .projects-hero-progress-label {
    display: none;
  }

  .app.route-projects .projects-hero-progress-bar {
    grid-area: bar;
    width: 100%;
  }

  .app.route-projects .projects-hero-progress-percent {
    grid-area: percent;
    font-size: 15px;
  }

  .app.route-projects .projects-hero-actions {
    grid-area: actions;
  }

  .app.route-projects .projects-hero-actions .btn {
    min-height: 32px;
    padding: 6px 11px;
    font-size: 12px;
  }

  .app.route-projects .projects-hero .card-resize-handle,
  .app.route-projects .project-command-center .card-resize-handle {
    display: none;
  }
}

/* 视图切换栏始终固定在同一位置，切换时只更新下方内容。 */
.app.route-projects .project-command-center {
  padding: 6px 10px;
}

.app.route-projects .project-command-center .pcc-header {
  justify-content: flex-start;
  padding: 0;
  border-bottom: 0;
}

.app.route-projects .project-command-center .pcc-heading {
  display: none !important;
}

.project-command-center[data-view="matrix"] .pcc-metrics,
.project-command-center[data-view="matrix"] .pcc-toolbar,
.project-command-center[data-view="matrix"] .pcc-panel,
.project-command-center[data-view="matrix"] .pcc-matrix-note {
  display: none !important;
}

/* 项目矩阵筛选：使用安静的蓝灰分段控件，避免旧版金色抢占视觉焦点。 */
.app.route-projects .projects-matrix-toolbar .weekly-planner-view-toggle {
  gap: 2px;
  margin-right: 0;
  padding: 3px;
  border: 1px solid rgba(10, 54, 99, 0.11);
  border-radius: 999px;
  background: rgba(10, 54, 99, 0.045);
  box-shadow: inset 0 1px 2px rgba(5, 30, 56, 0.035);
}

.app.route-projects .projects-matrix-toolbar .weekly-planner-view-btn {
  min-height: 30px;
  padding: 5px 13px;
  border-radius: 999px;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition:
    color var(--motion-fast),
    background var(--motion-fast),
    box-shadow var(--motion-fast);
}

.app.route-projects .projects-matrix-toolbar .weekly-planner-view-btn:hover {
  background: rgba(10, 54, 99, 0.075);
  color: var(--bodhi-blue);
}

.app.route-projects
  .projects-matrix-toolbar
  .weekly-planner-view-btn--active {
  background: var(--bodhi-blue);
  color: #fff;
  box-shadow: 0 3px 9px rgba(10, 54, 99, 0.18);
}

.app.route-projects
  .projects-matrix-toolbar
  .weekly-planner-view-btn--active:hover {
  background: var(--bodhi-blue-dark);
  color: #fff;
}

.app.route-projects
  .projects-matrix-toolbar
  .weekly-planner-view-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(47, 100, 142, 0.16);
}
