/* automations.css — экран автоматизаций (роботов) и пошаговый конструктор
   «Когда → Если → То», галерея пресетов и лог запусков. */

.btn--xs { padding: 3px; }
.btn--on { color: var(--accent-ink); background: var(--accent-tint); }

/* ---------- экран ---------- */
.autoscreen { display: flex; flex-direction: column; min-height: 0; flex: 1; background: var(--bg); }
.autoscreen__top { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.autoscreen__titles h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.autoscreen__titles h2 svg { color: var(--accent); }
.autoscreen__sub { font-size: 12.5px; color: var(--muted); }
.autoscreen__body { flex: 1; min-height: 0; overflow: auto; padding: 20px 22px; }

.autoscreen__empty { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; color: var(--muted); padding: 56px 16px; }
.autoscreen__empty svg { color: var(--line-2); }
.autoscreen__empty p { max-width: 420px; margin: 0; }
.autoscreen__emptybtns { display: flex; gap: 10px; }

/* ---------- список ---------- */
.autoscreen__list { display: flex; flex-direction: column; gap: 10px; max-width: 940px; }
.autorow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .12s, box-shadow .12s; }
.autorow:hover { border-color: var(--line-2); box-shadow: var(--shadow-1); }
.autorow--off { opacity: .62; }
.autorow__sw { flex: none; }
.autorow__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; text-align: left; background: none; border: none; cursor: pointer; padding: 0; }
.autorow__name { font-weight: 600; font-size: 14px; color: var(--ink); }
.autorow__flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.autorow__chip { font-size: 12px; padding: 2px 9px; border-radius: var(--r-pill); white-space: nowrap; }
.autorow__chip--when { background: var(--accent-tint); color: var(--accent-ink); }
.autorow__chip--then { background: var(--sink); color: var(--ink-2); }
.autorow__meta { font-size: 11.5px; color: var(--muted); }

/* ---------- конструктор ---------- */
.autoscreen__editor { max-width: 720px; }
.autob { display: flex; flex-direction: column; gap: 4px; }
.autob__meta { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.autob__name { font-size: 18px; font-weight: 650; border: none; background: none; color: var(--ink); padding: 4px 0; border-bottom: 2px solid transparent; }
.autob__name:focus { outline: none; border-bottom-color: var(--accent); }
.autob__metarow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.autob__mlbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.autob__desc { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; background: var(--surface); color: var(--ink); }

.step { display: flex; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.step--when { border-left: 3px solid var(--accent); }
.step--if { border-left: 3px solid #d9a441; }
.step--then { border-left: 3px solid var(--good, #3aa76d); }
.step__badge { flex: none; width: 58px; height: 26px; display: grid; place-items: center; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 700; background: var(--accent-tint); color: var(--accent-ink); }
.step__badge--if { background: #f6ebd3; color: #8a6116; }
.step__badge--then { background: var(--good-tint, #dff0e6); color: var(--good, #2e7d51); }
.step__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.step__hint { margin: 0; font-size: 12px; color: var(--muted); }
.step__empty { font-size: 12.5px; color: var(--muted); font-style: italic; }
.step__arrow { display: flex; justify-content: center; color: var(--line-2); margin: -2px 0; }
.step__arrow svg { transform: rotate(0deg); }

.cfggrid { display: flex; flex-direction: column; gap: 10px; }
.cfg { display: flex; flex-direction: column; gap: 4px; }
.cfg__lbl { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.cfg__hint { margin: 0; font-size: 11.5px; color: var(--muted); }

.autob__conj { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.condrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.condrow > .selm { min-width: 140px; }
.condrow .input { flex: 1; min-width: 120px; }

.actcard { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); margin-bottom: 10px; }
.actcard__head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.actcard__title { font-weight: 600; font-size: 13px; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.actcard__body { padding: 10px; }

.fmap { display: flex; flex-direction: column; gap: 6px; }
.fmap__row { display: flex; align-items: center; gap: 8px; }
.fmap__row .input { flex: 1; }

.autob__foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.autob__test { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 12.5px; }
.autob__test ul { margin: 6px 0 0; padding-left: 18px; }
.autob__test li.bad { color: var(--bad); }

/* ---------- галерея пресетов ---------- */
.pgal { display: flex; flex-direction: column; gap: 16px; }
.pgal__lead { margin: 0; font-size: 13px; color: var(--muted); }
.pgal__coll { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.pgal__cat { display: flex; flex-direction: column; gap: 8px; }
.pgal__catlbl { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.pgal__grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.pcard { display: flex; gap: 11px; align-items: flex-start; text-align: left; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.pcard:hover { border-color: var(--accent); box-shadow: var(--shadow-1); }
.pcard__icon { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--radius-xs); background: var(--accent-tint); color: var(--accent-ink); }
.pcard__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pcard__title { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.pcard__desc { font-size: 12px; color: var(--muted); }

/* ---------- лог запусков ---------- */
.runs { display: flex; flex-direction: column; gap: 12px; }
.runs__title { font-weight: 650; font-size: 15px; color: var(--ink); }
.runs__empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: var(--muted); padding: 40px 16px; }
.runs__empty svg { color: var(--line-2); }
.runs__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.runrow { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface); }
.runrow__head { display: flex; align-items: center; gap: 8px; }
.runrow__status { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill); }
.runrow__status--success { background: var(--good-tint, #dff0e6); color: var(--good, #2e7d51); }
.runrow__status--failed { background: var(--bad-tint); color: var(--bad); }
.runrow__status--skipped { background: var(--sink); color: var(--muted); }
.runrow__trig { font-size: 12px; color: var(--ink-2); }
.runrow__time { font-size: 11.5px; color: var(--muted); }
.runrow__acts { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); }
.runrow__acts li { display: flex; align-items: center; gap: 6px; }
.runrow__acts li.bad { color: var(--bad); }
.runrow__err { margin-top: 6px; font-size: 12px; color: var(--bad); }

@media (min-width: 720px) {
  .pgal__grid { grid-template-columns: 1fr 1fr; }
}
