.orders-progress-shell {
  display: grid;
  gap: 12px;
}

.orders-progress-shell h1 {
  font-size: 22px;
}

.order-filters,
.orders-summary,
.orders-list-panel,
.order-detail-panel {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--shadow-crisp);
}

.order-filters {
  display: grid;
  gap: 12px;
  padding: 14px;
}

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

.order-filters label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.order-filters input,
.order-filters select {
  min-height: 34px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 750;
}

.order-filters input:focus,
.order-filters select:focus {
  border-color: rgba(36, 95, 126, .52);
  box-shadow: 0 0 0 3px rgba(36, 95, 126, .11);
  outline: 0;
}

.filter-actions {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px;
}

.filter-actions .primary-action,
.filter-actions .secondary-action {
  min-height: 34px;
  white-space: nowrap;
}

.quick-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-filter {
  min-height: 30px;
  border: 1px solid #d8e0e8;
  border-radius: 4px;
  padding: 0 14px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}

.quick-filter:hover,
.quick-filter.selected {
  border-color: var(--blue);
  color: white;
  background: var(--blue);
}

.filter-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
  padding-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.active-filter-chips {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  border: 1px solid rgba(36, 95, 126, .22);
  border-radius: 999px;
  padding: 0 8px;
  color: var(--blue);
  background: var(--soft-blue);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}

.orders-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.orders-summary div {
  position: relative;
  display: grid;
  min-height: 78px;
  align-content: center;
  gap: 5px;
  min-width: 0;
  padding: 12px 14px 12px 64px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--shadow-crisp);
}

.orders-summary div::before {
  position: absolute;
  left: 18px;
  top: 50%;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: var(--blue);
  content: attr(data-icon);
  font-size: 14px;
  font-weight: 900;
  transform: translateY(-50%);
}

.orders-summary div:nth-child(3)::before {
  background: #f59e0b;
}

.orders-summary div:nth-child(4)::before {
  background: #e23b34;
}

.orders-summary div:nth-child(5)::before {
  background: #0a9f3f;
}

.orders-summary div:nth-child(6)::before {
  background: #8a95a3;
}

.orders-summary span,
.panel-head span,
.detail-metrics span,
.detail-progress span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.orders-summary strong {
  overflow-wrap: anywhere;
  font-size: 24px;
  line-height: 1.1;
}

.orders-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 12px;
  align-items: start;
}

.orders-list-panel,
.order-detail-panel {
  min-width: 0;
  padding: 12px;
}

.panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2,
.detail-head h2 {
  margin: 0;
  font-size: 20px;
}

.orders-list {
  max-height: calc(100vh - 430px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.order-matrix {
  width: 100%;
  min-width: 1220px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.order-matrix th,
.order-matrix td {
  border-bottom: 1px solid #e4eae5;
  padding: 8px 7px;
  vertical-align: middle;
  text-align: left;
}

.order-matrix th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: #f8fafc;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.order-matrix tbody tr {
  cursor: pointer;
}

.order-matrix tbody tr:hover,
.order-matrix tbody tr.selected {
  background: var(--soft-green);
}

.order-matrix tbody tr.is-risk {
  background: #fffaf1;
}

.order-matrix tbody tr.is-overdue {
  background: #fff6f4;
}

.order-matrix tbody tr.selected {
  box-shadow: inset 4px 0 0 var(--green);
}

.matrix-main,
.matrix-stack {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.matrix-main strong,
.matrix-stack strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
}

.matrix-main span,
.matrix-stack span,
.matrix-muted {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.matrix-product {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.risk-pill,
.stage-pill,
.due-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 4px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.risk-normal {
  color: var(--green-deep);
  background: var(--soft-green);
}

.risk-watch {
  color: var(--amber);
  background: var(--soft-amber);
}

.risk-bad {
  color: var(--red);
  background: #fbefed;
}

.stage-pill {
  color: var(--blue);
  background: var(--soft-blue);
}

.due-pill {
  color: var(--muted);
  background: #eef2ef;
}

.due-pill.overdue {
  color: var(--red);
  background: #fbefed;
}

.due-pill.soon {
  color: var(--amber);
  background: var(--soft-amber);
}

.matrix-progress {
  display: grid;
  gap: 4px;
  min-width: 76px;
}

.matrix-progress span {
  color: var(--green-deep);
  font-size: 11px;
  font-weight: 900;
}

.mini-progress,
.detail-progress div:last-child {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e1e8e3;
}

.mini-progress i,
.detail-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.step-cell {
  width: 34px;
  min-width: 34px;
  text-align: center;
}

.step-dot {
  display: inline-grid;
  width: 14px;
  height: 14px;
  place-items: center;
  border: 1px solid #c8d0d8;
  border-radius: 2px;
  background: #c8d0d8;
  color: var(--muted);
  font-size: 0;
  font-weight: 900;
}

.step-dot.done {
  border-color: #0a9f3f;
  background: #0a9f3f;
}

.step-dot.active {
  border-color: var(--blue);
  background: var(--blue);
}

.step-dot.bad {
  border-color: #e23b34;
  background: #e23b34;
}

.step-dot.muted {
  opacity: .58;
}

.order-detail-panel {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  border-radius: 4px;
}

.empty-list,
.empty-detail {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 20px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .62);
  text-align: center;
}

.empty-detail strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.empty-detail span {
  margin-top: 6px;
}

.detail-head {
  display: flex;
  gap: 10px;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-head p:not(.kicker) {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 14px;
}

.detail-metrics div {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.detail-metrics strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.detail-progress {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.detail-progress > div:first-child {
  display: flex;
  gap: 10px;
  align-items: start;
  justify-content: space-between;
}

.flow-list {
  display: grid;
  gap: 9px;
}

.flow-step {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.flow-dot {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border: 3px solid #cad5ce;
  border-radius: 999px;
  background: white;
  z-index: 1;
}

.flow-step strong,
.flow-step span,
.flow-step small,
.flow-step a {
  display: block;
}

.flow-step strong {
  margin-bottom: 5px;
}

.flow-step span {
  width: fit-content;
  margin-bottom: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.flow-step small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.flow-step a {
  width: fit-content;
  margin-top: 8px;
  padding: 6px 9px;
  border-radius: 6px;
  color: white;
  background: var(--green-deep);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.flow-step.done .flow-dot {
  border-color: var(--green);
  background: var(--green);
}

.flow-step.done span {
  color: var(--green-deep);
  background: var(--soft-green);
}

.flow-step.active .flow-dot {
  border-color: var(--blue);
  background: var(--blue);
}

.flow-step.active span {
  color: var(--blue);
  background: var(--soft-blue);
}

.flow-step.bad .flow-dot {
  border-color: var(--red);
  background: var(--red);
}

.flow-step.bad span {
  color: var(--red);
  background: #fbefed;
}

.flow-step.todo span,
.flow-step.muted span {
  color: var(--muted);
  background: #eef2ef;
}

@media (max-width: 1180px) {
  .filter-grid,
  .orders-layout {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    justify-content: start;
  }

  .order-detail-panel {
    position: static;
    max-height: none;
  }
}

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

  .orders-summary div {
    border-bottom: 1px solid var(--line);
  }

  .detail-head {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .orders-summary,
  .detail-metrics,
  .filter-actions {
    grid-template-columns: 1fr;
  }

  .filter-status {
    align-items: flex-start;
    flex-direction: column;
  }
}
