.cqo-workbench {
  --cqo-ink: #13243a;
  --cqo-muted: #63758c;
  --cqo-line: #d8e2ef;
  --cqo-blue: #1768e5;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 282px);
  gap: 14px;
  color: var(--cqo-ink);
  font-family: "Microsoft YaHei UI", "Noto Sans CJK SC", "PingFang SC", sans-serif;
}

.cqo-loading,
.cqo-mode-banner,
.cqo-status {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  border: 1px solid #bfd5f5;
  border-radius: 10px;
  background: #eef6ff;
  padding: 9px 13px;
  color: #255488;
  font-size: 12px;
}

.cqo-loading svg {
  width: 17px;
  height: 17px;
  animation: cqo-pulse 1.25s ease-in-out infinite;
}

.cqo-errors {
  display: grid;
  gap: 7px;
}

.cqo-error {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  border: 1px solid #f6c7c7;
  border-radius: 10px;
  background: #fff3f3;
  padding: 10px 12px;
  color: #9b2c2c;
}

.cqo-error svg {
  width: 20px;
  height: 20px;
}

.cqo-error div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.cqo-error strong,
.cqo-error span {
  overflow-wrap: anywhere;
}

.cqo-error span {
  color: #a65858;
  font-size: 11px;
}

.cqo-project-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid #1c65ca;
  border-radius: 16px;
  background:
    radial-gradient(circle at 86% 18%, rgb(102 185 255 / 24%), transparent 26%),
    linear-gradient(124deg, #0b3d84 0%, #0f56bd 56%, #1977e7 100%);
  box-shadow: 0 14px 28px rgb(21 78 150 / 15%);
  padding: 22px 24px 20px;
  color: #fff;
}

.cqo-project-hero::after {
  position: absolute;
  right: -46px;
  bottom: -84px;
  width: 280px;
  height: 180px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 50%;
  content: "";
  transform: rotate(-12deg);
}

.cqo-project-heading {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 350px);
  gap: 28px;
  align-items: start;
}

.cqo-eyebrow,
.cqo-projects-panel header span,
.cqo-activity-panel header span {
  display: block;
  margin-bottom: 6px;
  color: #9fd0ff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.cqo-project-heading h2 {
  margin: 0;
  max-width: 980px;
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.28;
  letter-spacing: -.02em;
}

.cqo-project-heading p {
  margin: 7px 0 0;
  color: #d5e9ff;
  font-size: 13px;
  line-height: 1.6;
}

.cqo-project-select {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #d9ebff;
  font-size: 11px;
  font-weight: 700;
}

.cqo-project-select select {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgb(255 255 255 / 38%);
  border-radius: 10px;
  background: rgb(255 255 255 / 96%);
  padding: 0 34px 0 12px;
  color: #15395f;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}

.cqo-project-select select:focus-visible,
.cqo-action-card:focus-visible,
.cqo-activity-row:focus-visible,
.cqo-project-choice:focus-visible {
  outline: 3px solid #8ed0ff;
  outline-offset: 2px;
}

.cqo-project-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 9px;
  margin: 20px 0 0;
}

.cqo-project-metrics div {
  min-width: 0;
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 11px;
  background: rgb(4 38 84 / 30%);
  padding: 11px 13px;
  backdrop-filter: blur(5px);
}

.cqo-project-metrics dt {
  color: #bbdcff;
  font-size: 11px;
}

.cqo-project-metrics dd {
  margin: 5px 0 0;
  overflow: hidden;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cqo-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 11px;
}

.cqo-action-card {
  --cqo-accent: #1768e5;
  --cqo-soft: #eaf3ff;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 82px;
  border: 1px solid var(--cqo-line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  color: var(--cqo-ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 5px 16px rgb(18 52 86 / 6%);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.cqo-action-card:hover {
  border-color: var(--cqo-accent);
  box-shadow: 0 11px 24px rgb(18 52 86 / 11%);
  transform: translateY(-2px);
}

.cqo-action-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 13px;
  background: var(--cqo-soft);
  color: var(--cqo-accent);
}

.cqo-action-icon svg {
  width: 24px;
  height: 24px;
}

.cqo-action-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.cqo-action-copy strong {
  font-size: 14px;
  line-height: 1.35;
}

.cqo-action-copy small {
  overflow: hidden;
  color: var(--cqo-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cqo-action-count {
  max-width: 112px;
  overflow: hidden;
  color: var(--cqo-accent);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cqo-action-card.is-contract { --cqo-accent: #1768e5; --cqo-soft: #e8f1ff; }
.cqo-action-card.is-bq { --cqo-accent: #0787a6; --cqo-soft: #e5f8fb; }
.cqo-action-card.is-payment { --cqo-accent: #16835a; --cqo-soft: #e6f7ef; }
.cqo-action-card.is-vo { --cqo-accent: #b66a05; --cqo-soft: #fff3dc; }
.cqo-action-card.is-log { --cqo-accent: #6d55b8; --cqo-soft: #f0ecff; }
.cqo-action-card.is-draft { --cqo-accent: #b43e53; --cqo-soft: #fff0f2; }
.cqo-action-card.is-documents { --cqo-accent: #3c70b2; --cqo-soft: #ebf3fc; }
.cqo-action-card.is-claims { --cqo-accent: #36804a; --cqo-soft: #edf8ef; }

.cqo-action-card.is-secondary {
  grid-template-columns: 38px minmax(0, 1fr) auto;
  min-height: 62px;
  padding: 10px 13px;
  box-shadow: none;
}

.cqo-action-card.is-secondary .cqo-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.cqo-action-card.is-secondary .cqo-action-icon svg {
  width: 19px;
  height: 19px;
}

.cqo-mode-banner {
  border-color: #f0d2d7;
  background: #fff4f5;
  color: #8e3545;
}

.cqo-work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(310px, 1fr);
  gap: 12px;
  min-height: 410px;
  flex: 1 1 auto;
}

.cqo-projects-panel,
.cqo-activity-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--cqo-line);
  border-radius: 14px;
  background: #fff;
}

.cqo-projects-panel header,
.cqo-activity-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e5ecf4;
  background: #fbfdff;
  padding: 14px 16px 12px;
}

.cqo-projects-panel header span,
.cqo-activity-panel header span {
  margin-bottom: 3px;
  color: #6c86a5;
}

.cqo-projects-panel h3,
.cqo-activity-panel h3 {
  margin: 0;
  font-size: 16px;
}

.cqo-projects-panel header > strong,
.cqo-activity-panel header > strong {
  color: #2b5e96;
  font-size: 12px;
}

.cqo-table-scroll {
  min-height: 0;
  overflow: auto;
}

.cqo-table-scroll table {
  width: 100%;
  min-width: 830px;
  border-collapse: collapse;
  font-size: 12px;
}

.cqo-table-scroll th,
.cqo-table-scroll td {
  border-bottom: 1px solid #edf1f6;
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

.cqo-table-scroll th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f2f6fb;
  color: #526a84;
  font-weight: 700;
  white-space: nowrap;
}

.cqo-table-scroll tbody tr:hover,
.cqo-table-scroll tbody tr.is-selected {
  background: #f1f7ff;
}

.cqo-table-scroll tbody tr.is-selected {
  box-shadow: inset 3px 0 0 var(--cqo-blue);
}

.cqo-project-choice {
  max-width: 330px;
  border: 0;
  background: transparent;
  padding: 0;
  color: #194f8d;
  font: inherit;
  font-weight: 700;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}

.cqo-selected-pill {
  display: inline-flex;
  border-radius: 999px;
  background: #e5f1ff;
  padding: 3px 8px;
  color: #155cab;
  font-size: 10px;
  font-weight: 800;
}

.cqo-empty,
.cqo-activity-empty {
  color: #78889a;
  text-align: center !important;
}

.cqo-empty {
  padding: 38px 18px !important;
}

.cqo-activity-list {
  min-height: 0;
  overflow: auto;
  padding: 7px 10px 10px;
}

.cqo-activity-row {
  --cqo-event: #1768e5;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 60px;
  border: 0;
  border-bottom: 1px solid #edf1f6;
  background: transparent;
  padding: 9px 5px;
  color: var(--cqo-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cqo-activity-row:hover {
  background: #f7faff;
}

.cqo-activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cqo-event);
  box-shadow: 0 0 0 4px rgb(23 104 229 / 12%);
}

.cqo-activity-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.cqo-activity-main strong,
.cqo-activity-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cqo-activity-main strong {
  font-size: 12px;
}

.cqo-activity-main small,
.cqo-activity-row time {
  color: var(--cqo-muted);
  font-size: 10px;
}

.cqo-activity-row.is-payment { --cqo-event: #16835a; }
.cqo-activity-row.is-bq { --cqo-event: #0787a6; }
.cqo-activity-row.is-vo { --cqo-event: #b66a05; }
.cqo-activity-row.is-claims { --cqo-event: #36804a; }
.cqo-activity-row.is-documents { --cqo-event: #3c70b2; }

.cqo-activity-empty {
  display: grid;
  min-height: 210px;
  place-items: center;
  padding: 24px;
  font-size: 12px;
  line-height: 1.7;
}

.cqo-status {
  border-color: #dce5ef;
  background: #f8fafc;
  color: #5f7185;
}

@keyframes cqo-pulse {
  50% { opacity: .42; transform: scale(.9); }
}

@media (max-width: 1439px) {
  .cqo-actions {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

@media (max-width: 1179px) {
  .cqo-workbench {
    min-height: auto;
  }

  .cqo-project-heading {
    grid-template-columns: minmax(0, 1fr);
  }

  .cqo-project-select {
    max-width: 460px;
  }

  .cqo-project-metrics {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .cqo-work-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cqo-projects-panel,
  .cqo-activity-panel {
    min-height: 320px;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .civil-command-header:has(+ [data-workbench-module="qsWorkbench"]) {
    grid-template-columns: 50px minmax(0, 1fr) auto;
  }

  .civil-command-header:has(+ [data-workbench-module="qsWorkbench"]) .civil-command-actions {
    grid-column: auto;
    justify-content: flex-end;
  }
}

@media (max-width: 720px) {
  .cqo-project-hero {
    padding: 18px;
  }

  .cqo-actions,
  .cqo-project-metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .cqo-action-card {
    min-height: 70px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cqo-action-card,
  .cqo-loading svg {
    animation: none;
    transition: none;
  }
}
