.sop-library {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.sop-library-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.34fr);
  gap: 14px;
  align-items: stretch;
  padding: 16px;
  border: 1px solid #d8e4ee;
  border-radius: 16px;
  background:
    radial-gradient(circle at 4% 0%, rgba(37, 99, 235, 0.13), transparent 34%),
    linear-gradient(135deg, #f8fbff, #fff 58%, #eefbf7);
}

.sop-library-head h3 {
  margin: 3px 0 7px;
  color: #0f172a;
  font-size: clamp(20px, 2vw, 27px);
}

.sop-library-head p:last-child {
  max-width: 820px;
  margin: 0;
  color: #526174;
  line-height: 1.55;
}

.sop-current-case {
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 14px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.86);
}

.sop-current-case span,
.sop-card-kicker,
.sop-step-meta span {
  color: #2563eb;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sop-current-case strong {
  color: #0f172a;
  font-size: 16px;
}

.sop-current-case small {
  color: #64748b;
  line-height: 1.4;
}

.sop-library-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 36px;
}

.sop-category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.sop-filter,
.sop-apply-button {
  border: 1px solid #d6e1eb;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}

.sop-filter {
  min-height: 31px;
  padding: 5px 11px;
}

.sop-filter.active {
  border-color: #2563eb;
  background: #edf5ff;
  color: #1d4ed8;
}

.sop-library-status {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.sop-library-status[data-tone="success"] { color: #047857; }
.sop-library-status[data-tone="error"] { color: #b91c1c; }

.sop-library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.sop-card,
.sop-empty {
  min-width: 0;
  border: 1px solid #dbe5ef;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 9px 26px rgba(15, 23, 42, 0.055);
}

.sop-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 11px;
  padding: 15px;
  overflow: hidden;
}

.sop-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.sop-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #2563eb, #0f766e);
  content: "";
}

.sop-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.sop-card-head h4 {
  margin: 3px 0 5px;
  color: #0f172a;
  font-size: 18px;
}

.sop-card-head p {
  margin: 0;
  color: #5b6b7d;
  font-size: 13px;
  line-height: 1.45;
}

.sop-version {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef5ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
}

.sop-trigger-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sop-trigger-row span {
  padding: 4px 7px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
}

.sop-steps {
  margin: 0;
  border-top: 1px solid #edf1f5;
}

.sop-steps summary {
  padding: 10px 0 6px;
  color: #334155;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.sop-step-list {
  display: grid;
  gap: 7px;
  padding-top: 4px;
}

.sop-step {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px;
  border-radius: 9px;
  background: #f8fafc;
}

.sop-step > b {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #e7f0ff;
  color: #1d4ed8;
  font-size: 11px;
}

.sop-step-copy {
  min-width: 0;
}

.sop-step-copy strong,
.sop-step-copy small {
  display: block;
}

.sop-step-copy strong {
  color: #172033;
  font-size: 12px;
  line-height: 1.35;
}

.sop-step-copy small {
  margin-top: 3px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
}

.sop-step-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.sop-step-meta span {
  padding: 3px 6px;
  border-radius: 6px;
  background: #eef2f6;
  color: #526174;
  letter-spacing: 0;
  text-transform: none;
}

.sop-step-meta span[data-blocking="true"] {
  background: #fff1f2;
  color: #be123c;
}

.sop-card-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-top: auto;
}

.sop-card-footer small {
  color: #64748b;
  font-size: 11px;
  line-height: 1.35;
}

.sop-apply-button {
  min-height: 34px;
  padding: 6px 12px;
  border-color: #2563eb;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #0f766e);
  color: #fff;
}

.sop-apply-button:disabled {
  border-color: #cbd5e1;
  background: #e2e8f0;
  color: #64748b;
  cursor: not-allowed;
}

.sop-empty {
  grid-column: 1 / -1;
  padding: 24px;
  color: #64748b;
  text-align: center;
}

.lmw-sop-list {
  display: grid;
  gap: 8px;
}

.lmw-task-guidance {
  display: block;
  margin: 5px 0 0 28px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.45;
}

.lmw-sop-run {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e0e8ef;
  border-radius: 10px;
  background: #f8fafc;
}

.lmw-sop-run strong,
.lmw-sop-run small { display: block; }
.lmw-sop-run small { margin-top: 3px; color: #64748b; }

.lmw-sop-progress {
  min-width: 88px;
  color: #0f766e;
  font-size: 12px;
  font-weight: 900;
  text-align: right;
}

@media (max-width: 900px) {
  .sop-library-head,
  .sop-library-grid { grid-template-columns: 1fr; }
  .sop-card:last-child:nth-child(odd) { grid-column: auto; }
}

@media (max-width: 640px) {
  .sop-library { gap: 9px; }
  .sop-library-head { padding: 12px; }
  .sop-library-toolbar,
  .sop-card-footer { align-items: stretch; flex-direction: column; }
  .sop-library-status { text-align: left; }
  .sop-card { padding: 12px; }
  .sop-card-head { gap: 8px; }
  .sop-apply-button { width: 100%; }
  .lmw-sop-run { grid-template-columns: 1fr; }
  .lmw-sop-progress { text-align: left; }
}
