/* ==========================================================================
   AutoR — Сценарии: правила бота, режим «Шаблоны / ИИ»
   ========================================================================== */

.automation-banner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(80% 160% at 100% 0%, rgba(255, 194, 26, 0.162), transparent 60%),
    linear-gradient(120deg, #fffefb, #fffdf8);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
  overflow: hidden;
}
.automation-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(#fff3cf 0.7px, transparent 0.7px);
  background-size: 13px 13px;
  mask-image: linear-gradient(90deg, transparent 40%, rgba(0, 0, 0, 0.55));
  -webkit-mask-image: linear-gradient(90deg, transparent 40%, rgba(0, 0, 0, 0.55));
  pointer-events: none;
  opacity: 0.55;
}
.automation-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}
.automation-copy h2 {
  font-size: 17px;
  letter-spacing: -0.025em;
}
.automation-copy p {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 380px;
}
.automation-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  font-size: 10px;
  color: var(--green-deep);
  font-weight: 500;
}
.automation-status .demo-dot {
  background: var(--green);
}
.pipeline {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0;
  flex: none;
}
.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 74px;
  text-align: center;
}
.pipeline-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: #fffefb;
  border: 1px solid #fff5d8;
  box-shadow: 0 4px 10px -6px rgba(18, 28, 35, 0.15);
  color: var(--blue);
}
.pipeline-icon .icon {
  width: 18px;
  height: 18px;
}
.pipeline-step:nth-child(3) .pipeline-icon {
  color: #6e4a00;
  background: #fcf7e9;
  border-color: #f3e7c7;
}
.pipeline-step:nth-child(5) .pipeline-icon {
  color: var(--green-deep);
  background: var(--green-soft);
  border-color: #d6f5e3;
}
.pipeline-step span {
  font-size: 9px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.3;
}
.pipeline-connector {
  position: relative;
  width: 38px;
  height: 1px;
  background: repeating-linear-gradient(90deg, #5d7c92 0 4px, transparent 4px 8px);
  margin-top: -19px;
  overflow: hidden;
}
.pipeline-connector::after {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 7px;
  height: 3px;
  border-radius: 2px;
  background: var(--lime-strong);
  box-shadow: 0 0 8px rgba(239, 192, 61, 0.8);
  animation: pipeline-flow 2.6s linear infinite;
}
.pipeline-connector:nth-of-type(2)::after {
  animation-delay: 0.8s;
}
@keyframes pipeline-flow {
  from { transform: translateX(-10px); }
  to { transform: translateX(48px); }
}
.rules-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 18px 0 12px;
}
.rules-toolbar h2 {
  font-size: 15px;
}
.rules-toolbar p {
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
}
.rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.rule-card {
  display: flex;
  flex-direction: column;
  padding: 18px;
  border-radius: 16px;
  background: #fffefb;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.rule-card:hover {
  border-color: #fff1c6;
  box-shadow: 0 16px 32px -26px rgba(18, 28, 35, 0.28);
}
.rule-card.is-off {
  background: #fffefa;
}
.rule-card.is-off .rule-icon,
.rule-card.is-off .rule-main,
.rule-card.is-off .rule-reply,
.rule-card.is-off .rule-foot {
  opacity: 0.62;
}
.rule-top {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}
.rule-icon {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border-radius: 11px;
  flex: none;
  background: #fffbef;
  color: var(--blue);
}
.rule-icon .icon {
  width: 17px;
  height: 17px;
}
.rule-icon.amber { background: var(--amber-soft); color: #b54708; }
.rule-icon.green { background: var(--green-soft); color: var(--green-deep); }
.rule-icon.violet { background: var(--violet-soft); color: #5b3fd6; }
.rule-icon.cyan { background: #fffaec; color: #ab800b; }
.rule-icon.rose { background: #fff1f3; color: #c01048; }
.rule-main {
  flex: 1;
  min-width: 0;
}
.rule-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.rule-desc {
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.45;
}
.rule-top .switch {
  margin-top: 2px;
}
.rule-body {
  flex: 1;
  margin-top: 12px;
}
.rule-triggers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 9px;
}
.rule-trigger-label {
  font-size: 8.5px;
  font-weight: 500;
  color: var(--muted-light);
  align-self: center;
  margin-right: 2px;
}
.rule-trigger {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  background: #faf8f5;
  border: 1px solid #f6f4ee;
  font-size: 8.5px;
  color: var(--muted);
}
.rule-reply {
  position: relative;
  padding: 9px 10px 9px 12px;
  border-radius: 8px;
  background: #fffdf8;
  border: 1px solid #f7f5f0;
  font-size: 10px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.rule-reply::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: #fff1c6;
}
.rule-reply-label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted-light);
}
.rule-reply-label .icon {
  width: 9px;
  height: 9px;
}
.rule-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid #f7f6f2;
}
.rule-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.rule-stat strong {
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.rule-stat span {
  font-size: 8px;
  color: var(--muted-light);
}
.rule-edit-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
  height: 27px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fffefb;
  transition: all 0.16s;
}
.rule-edit-btn:hover {
  color: var(--blue);
  border-color: #fff0c4;
  background: #fffdf8;
}
.rule-edit-btn .icon {
  width: 12px;
  height: 12px;
}
.rule-accuracy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 8.5px;
  font-weight: 500;
  color: var(--green-deep);
}
.rule-accuracy .icon {
  width: 10px;
  height: 10px;
}
