/* Визуальный редактор этапов в существующей системе CRM. Без анимаций. */
html.pipeline-open { overflow: hidden; }
.pipeline-page { position: fixed; inset: 0; z-index: 50; background: var(--bg); color: var(--text); }
.pipeline-form { height: 100dvh; display: flex; flex-direction: column; }
.pipeline-topbar { flex: none; display: flex; align-items: center; gap: 20px; min-height: 64px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.pipeline-logo { height: 14px; width: auto; flex: none; }
.pipeline-topbar h1 { margin: 0; padding-left: 20px; border-left: 1px solid var(--line); font-size: 18px; line-height: 1.3; font-weight: 600; }
.pipeline-save-state { margin-left: auto; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.pipeline-page-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.pipeline-toolbar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 20px 2px; }
.pipeline-instruction { margin: 0; color: var(--text-2); font-size: 13px; }
.pipeline-mobile-instruction { display: none; }
.pipeline-toolbar [data-add] { flex: none; }
.pipeline-error { flex: none; margin: 12px 20px 0; padding: 10px 12px; border: 1px solid var(--late-line); border-radius: var(--r); background: var(--late-soft); color: var(--late); font-size: 13px; }
.pipeline-rail { display: grid; grid-template-columns: repeat(var(--pipeline-count, 3), minmax(300px, 1fr)); gap: 12px; flex: 1; min-height: 0; padding: 12px 20px 16px; overflow: auto; overscroll-behavior: contain; scroll-padding-inline: 20px; }
.pipeline-stage { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.pipeline-stage-head { position: relative; flex: none; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.pipeline-stage-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--text-3); font-size: 12px; }
.pipeline-stage-meta span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pipeline-stage-name { gap: 4px; }
.pipeline-stage-name .input { font-weight: 600; font-size: 15px; background: var(--surface); }
.pipeline-stage-name .err, .pipeline-stage-rule .err { font-size: 12px; color: var(--late); }
.pipeline-stage-actions { display: flex; align-items: center; gap: 4px; min-height: 36px; margin-top: 8px; }
.pipeline-stage-actions .btn-icon { width: 32px; height: 32px; }
.pipeline-grip { cursor: grab; color: var(--text-3); }
.pipeline-grip:active { cursor: grabbing; }
.pipeline-delete { margin-left: auto; }
.pipeline-fixed-note { color: var(--text-3); font-size: 12px; }
.pipeline-insert.btn { position: absolute; right: -21px; top: 48px; z-index: 2; width: 28px; height: 28px; padding: 0; border-radius: 50%; background: var(--surface); border-color: var(--line-strong); color: var(--text-2); }
.pipeline-insert::after { content: ''; position: absolute; inset: -8px; }
.pipeline-stage-body { min-height: 0; flex: 1; overflow-y: auto; padding: 16px; }
.pipeline-stage-rule { padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-card); }
.pipeline-stage-rule h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 14px; font-weight: 600; line-height: 1.4; }
.pipeline-stage-rule h2 svg { width: 16px; height: 16px; flex: none; color: var(--text-2); }
.pipeline-stage-rule p { margin: 10px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.pipeline-stage-rule h2 + p { margin-top: 0; }
.pipeline-stage-check { display: flex; align-items: flex-start; gap: 8px; color: var(--text); font-size: 13px; line-height: 1.5; cursor: pointer; }
.pipeline-stage-check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 2px 0 0; flex: none; }
.pipeline-stage-rule .field { margin-top: 16px; }
.pipeline-stage-rule .select { width: 100%; }
.pipeline-automations { display: grid; gap: 10px; margin-top: 20px; }
.pipeline-automations .automation-heading { margin: 0; color: var(--text-2); font-size: 13px; font-weight: 600; }
.automation-toggle { display: flex; align-items: flex-start; gap: 8px; min-height: 24px; font-size: 13px; line-height: 1.5; font-weight: 500; cursor: pointer; }
.automation-toggle input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.automation-fields .field { margin-top: 12px; }
.automation-fields .label { font-size: 12px; }
.automation-fields .input { width: 100%; min-width: 0; }
.pipeline-automations .automation-help { margin: 0; color: var(--text-3); font-size: 12px; line-height: 1.5; }
.pipeline-stage.is-removed { background: var(--surface-2); border-color: var(--late-line); }
.is-removed .pipeline-stage-meta span:first-child { color: var(--late); }
.pipeline-stage.is-dragging { opacity: .5; }
.pipeline-stage.drop-before { border-left-color: var(--accent); box-shadow: -2px 0 0 var(--accent); }
.pipeline-stage.drop-after { border-right-color: var(--accent); box-shadow: 2px 0 0 var(--accent); }
.pipeline-page-footer { flex: none; padding: 0 20px calc(12px + env(safe-area-inset-bottom)); color: var(--text-3); font-size: 12px; line-height: 1.5; }
@media (hover: hover) {
  .pipeline-stage-name .input:hover { border-color: var(--text-3); }
  .pipeline-insert.btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
}
@media (max-width: 900px) {
  .pipeline-topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 10px 16px; }
  .pipeline-logo { height: 11px; grid-column: 1; grid-row: 1; max-width: 100%; }
  .pipeline-topbar h1 { padding: 0; border: 0; grid-column: 1; grid-row: 2; font-size: 16px; }
  .pipeline-save-state { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .pipeline-page-actions { display: contents; }
  .pipeline-page-actions [data-back] { grid-column: 2; grid-row: 1; justify-self: end; }
  .pipeline-page-actions [data-save] { grid-column: 2; grid-row: 2; }
  .pipeline-toolbar { padding: 12px 16px 0; gap: 12px; }
  .pipeline-instruction { flex: 1; min-width: 0; font-size: 12px; }
  .pipeline-desktop-instruction { display: none; }
  .pipeline-mobile-instruction { display: inline; }
  .pipeline-error { margin: 12px 16px 0; }
  .pipeline-rail { grid-template-columns: repeat(var(--pipeline-count, 3), minmax(300px, calc(100vw - 56px))); padding: 12px 16px; scroll-padding-inline: 16px; scroll-snap-type: x proximity; }
  .pipeline-stage { scroll-snap-align: start; }
  .pipeline-stage-actions { min-height: 44px; }
  .pipeline-stage-actions .btn-icon { width: 44px; height: 44px; }
  .pipeline-stage-name .input { font-size: 16px; }
  .pipeline-insert.btn { top: 54px; }
  .pipeline-stage-check { min-height: 44px; }
  .pipeline-stage-check input { width: 18px; height: 18px; }
  .automation-toggle { min-height: 44px; align-items: center; }
  .automation-toggle input { width: 18px; height: 18px; }
  .pipeline-page-footer { padding: 0 16px calc(12px + env(safe-area-inset-bottom)); }
}
