/* ---------- Base app UI ---------- */
.rd-app {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    Arial, sans-serif;
  color: #0f172a;
}
.rd-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.rd-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -0.02em;
}
.rd-sub {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.35;
}
.rd-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid #e6ebf5;
  background: #fff;
  text-decoration: none;
  color: #0f172a;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  white-space: nowrap;
}
.rd-pill:hover {
  border-color: #d7def0;
}
.rd-grid {
  display: grid;
  gap: 12px;
}
.rd-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 640px) {
  .rd-grid-2 {
    grid-template-columns: 1fr;
  }
}
.rd-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 12px;
  border-radius: 18px;
  border: 1px solid #e6ebf5;
  background: #fff;
  text-decoration: none;
  color: #0f172a;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}
.rd-btn:hover {
  border-color: #d7def0;
  transform: translateY(-1px);
}
.rd-ghost {
  background: #f7f9fe;
  border-style: dashed;
}

/* ---------- SOP Library cards ---------- */
.rd-lib-section {
  margin-top: 16px;
}
.rd-lib-section-title {
  font-size: 13px;
  font-weight: 950;
  color: #334155;
  margin: 0 0 10px;
}
.rd-lib-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 640px) {
  .rd-lib-grid {
    grid-template-columns: 1fr;
  }
}
.rd-lib-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid #e6ebf5;
  background: #fff;
  text-decoration: none;
  color: #0f172a;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}
.rd-lib-card:hover {
  border-color: #d7def0;
  transform: translateY(-1px);
}
.rd-lib-ico {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(38, 103, 255, 0.08);
  border: 1px solid rgba(38, 103, 255, 0.14);
  font-size: 20px;
  flex: 0 0 auto;
}
.rd-lib-title {
  font-weight: 950;
  letter-spacing: -0.01em;
}
.rd-lib-desc {
  margin-top: 4px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.35;
}

/* ---------- Flow UI ---------- */
.rd-flow {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
}
.rd-flow-shell {
  background: #fff;
  border: 1px solid #e6ebf5;
  border-radius: 22px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
  overflow: hidden;
}
.rd-flow-top {
  padding: 14px;
  border-bottom: 1px solid #eef2fb;
  background: #fbfcff;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.rd-flow-title {
  font-size: 16px;
  font-weight: 900;
  margin: 0;
  color: #0f172a;
}
.rd-flow-sub {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 13px;
}
.rd-flow-progress {
  height: 8px;
  background: #eef2fb;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}
.rd-flow-bar {
  height: 8px;
  width: 0%;
  background: #2667ff;
  border-radius: 999px;
  transition: width 0.25s ease;
}
.rd-flow-hub {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid #e6ebf5;
  background: #fff;
  text-decoration: none;
  color: #0f172a;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  white-space: nowrap;
}
.rd-flow-body {
  padding: 16px;
}
.rd-flow-step {
  display: none;
}
.rd-flow-step.is-active {
  display: block;
}
.rd-flow-step h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 900;
}
.rd-flow-step p {
  margin: 8px 0;
  line-height: 1.55;
}
.rd-flow-ul {
  margin: 10px 0 0;
  padding-left: 18px;
}
.rd-flow-ul li {
  margin: 6px 0;
  line-height: 1.45;
}
.rd-flow-card {
  border: 1px solid #e6ebf5;
  background: #fbfcff;
  border-radius: 18px;
  padding: 14px;
}
.rd-flow-q {
  font-weight: 900;
  font-size: 16px;
  margin: 0 0 8px;
}
.rd-flow-hint {
  color: #64748b;
  font-size: 13px;
  margin: 0 0 10px;
}
.rd-flow-answers {
  display: grid;
  grid-gap: 10px;
}
.rd-flow-ans {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid #e6ebf5;
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}
.rd-flow-ans.is-picked {
  border-color: rgba(38, 103, 255, 0.35);
  background: rgba(38, 103, 255, 0.08);
}
.rd-flow-stop {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.22);
  color: #7f1d1d;
  font-weight: 900;
}
.rd-flow-stop small {
  display: block;
  margin-top: 6px;
  font-weight: 700;
  color: #991b1b;
  line-height: 1.35;
}
.rd-flow-nav {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 12px 14px;
  border-top: 1px solid #eef2fb;
  background: #fbfcff;
}
.rd-flow-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid #e6ebf5;
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}
.rd-flow-btn.primary {
  background: #2667ff;
  border-color: #2667ff;
  color: #fff;
}
.rd-flow-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* STOP actions */
.rd-stop-actions {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
.rd-stop-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.rd-stop-select {
  flex: 1 1 220px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(239, 68, 68, 0.28);
  background: #fff;
  font-weight: 900;
  color: #7f1d1d;
}
.rd-stop-btn {
  flex: 1 1 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: #fff;
  color: #7f1d1d;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}
.rd-stop-btn:hover {
  background: rgba(239, 68, 68, 0.08);
}
.rd-stop-note {
  margin-top: 8px;
  font-size: 12px;
  color: #991b1b;
  font-weight: 700;
  line-height: 1.35;
}
/* ---------- Forms ---------- */
.rd-form {
  background: #fff;
  border: 1px solid #e6ebf5;
  border-radius: 22px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
  padding: 14px;
}
.rd-form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 640px) {
  .rd-form-grid {
    grid-template-columns: 1fr;
  }
}

.rd-field {
  display: block;
  margin: 12px 0 0;
}
.rd-field span {
  display: block;
  font-size: 13px;
  font-weight: 950;
  color: #334155;
  margin: 0 0 6px;
}
.rd-field input,
.rd-field textarea {
  width: 100%;
  border: 1px solid #e6ebf5;
  border-radius: 16px;
  padding: 12px 12px;
  font-size: 14px;
  outline: none;
  background: #fbfcff;
}
.rd-field textarea {
  min-height: 92px;
  resize: vertical;
}
.rd-field input:focus,
.rd-field textarea:focus {
  border-color: rgba(38, 103, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(38, 103, 255, 0.1);
  background: #fff;
}

.rd-form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  flex-wrap: wrap;
}
.rd-btn-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 14px;
  border-radius: 18px;
  border: 1px solid #2667ff;
  background: #2667ff;
  color: #fff;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(38, 103, 255, 0.18);
}
.rd-btn-submit:hover {
  filter: brightness(0.98);
}
.rd-btn-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 14px;
  border-radius: 18px;
  border: 1px solid #e6ebf5;
  background: #fff;
  color: #0f172a;
  font-weight: 950;
  text-decoration: none;
}