/* Sequences and workflows.
   Intercom-style area overrides. Loaded after every other desk stylesheet.
   Shared automation tokens (block-type tones, canvas grid, connectors) and line icons. */
:is(#sequences-view, #workflows-view, #sequence-report, #workflow-preview) {
  /* Block-type tones: soft well + ink. Neutral app chrome; color only identifies block types. */
  --auto-entry-fill: var(--success-soft);
  --auto-entry-ink: var(--success-ink);
  --auto-message-fill: var(--accent-soft);
  --auto-message-ink: var(--accent);
  --auto-timing-fill: var(--warning-soft);
  --auto-timing-ink: var(--warning-ink);
  --auto-logic-fill: #f1edfd;
  --auto-logic-ink: #6a46cf;
  --auto-action-fill: #e3f4f1;
  --auto-action-ink: #0f7166;
  --auto-exit-fill: var(--hover);
  --auto-exit-ink: var(--muted);
  /* Canvas */
  --auto-canvas: var(--page);
  --auto-grid-dot: color-mix(in srgb, var(--quiet) 38%, transparent);
  --auto-edge: color-mix(in srgb, var(--quiet) 62%, transparent);
  --auto-node-shadow: 0 1px 2px rgb(0 0 0 / .05), 0 2px 8px rgb(0 0 0 / .04);
  --auto-ring: var(--focus-ring, color-mix(in srgb, var(--accent) 22%, transparent));
}
[data-desk-theme="dark"] :is(#sequences-view, #workflows-view, #sequence-report, #workflow-preview) {
  --auto-logic-fill: #2b2442;
  --auto-logic-ink: #bba8ff;
  --auto-action-fill: #13302c;
  --auto-action-ink: #6fd5c6;
  --auto-grid-dot: color-mix(in srgb, var(--quiet) 30%, transparent);
  --auto-edge: color-mix(in srgb, var(--quiet) 58%, transparent);
  --auto-node-shadow: 0 1px 2px rgb(0 0 0 / .45), 0 4px 14px rgb(0 0 0 / .3);
}

/* Area icons, CSS-drawn (the CSP blocks data: images). Sprite icons (chat, clock, code, copy,
   sequence, check, reopen, people) cover the rest. */
.icon[class*="i-am-"] { position: relative; background: none; -webkit-mask: none; mask: none; }
.icon:is(.i-am-bolt, .i-am-flask, .i-am-tag, .i-am-flag) { background: currentColor; }
.icon.i-am-bolt { clip-path: polygon(58% 4%, 18% 56%, 46% 56%, 38% 96%, 82% 40%, 54% 40%, 62% 4%); }
.icon.i-am-flask { clip-path: polygon(33% 6%, 67% 6%, 67% 14%, 61% 14%, 61% 38%, 92% 84%, 88% 94%, 12% 94%, 8% 84%, 39% 38%, 39% 14%, 33% 14%); }
.icon.i-am-tag { clip-path: polygon(4% 50%, 32% 16%, 94% 16%, 94% 84%, 32% 84%); }
.icon.i-am-flag { clip-path: polygon(16% 6%, 26% 6%, 26% 12%, 90% 12%, 72% 35%, 90% 58%, 26% 58%, 26% 95%, 16% 95%); }
.icon:is(.i-am-mail, .i-am-calendar, .i-am-sms)::before { content: ''; position: absolute; border: 1.7px solid currentColor; border-radius: 3px; }
.icon.i-am-mail::before { inset: 3.5px 1.5px; }
.icon.i-am-mail::after { content: ''; position: absolute; left: 5px; top: 1.6px; width: 8px; height: 8px; border-right: 1.7px solid currentColor; border-bottom: 1.7px solid currentColor; border-bottom-right-radius: 1px; transform: rotate(45deg) scale(.86); }
.icon.i-am-calendar::before { inset: 3px 2px 2px; border-top-width: 4px; }
.icon.i-am-calendar::after { content: ''; position: absolute; top: 1.5px; left: 5.5px; width: 7px; height: 3px; border-inline: 1.7px solid currentColor; }
.icon.i-am-sms::before { inset: 1.5px 4.5px; }
.icon.i-am-sms::after { content: ''; position: absolute; left: 7.5px; right: 7.5px; bottom: 4px; height: 1.6px; border-radius: 1px; background: currentColor; }
.icon:is(.i-am-plus, .i-am-rules)::before, .icon.i-am-plus::after { content: ''; position: absolute; border-radius: 1px; background: currentColor; }
.icon.i-am-plus::before { left: 3.5px; right: 3.5px; top: calc(50% - .9px); height: 1.8px; }
.icon.i-am-plus::after { top: 3.5px; bottom: 3.5px; left: calc(50% - .9px); width: 1.8px; }
.icon.i-am-rules::before { left: 2.5px; right: 2.5px; top: 3.5px; height: 1.7px; box-shadow: 0 4.5px currentColor; }
.icon.i-am-rules::after { content: ''; position: absolute; left: 2.5px; width: 8px; top: 12.5px; height: 1.7px; border-radius: 1px; background: currentColor; }

/* Type well: a rounded square with the block-type tone (shared by sequences and workflows). */
.auto-well {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md, 8px);
  background: var(--auto-exit-fill);
  color: var(--auto-exit-ink);
}
.auto-well[data-tone="entry"] { background: var(--auto-entry-fill); color: var(--auto-entry-ink); }
.auto-well[data-tone="message"] { background: var(--auto-message-fill); color: var(--auto-message-ink); }
.auto-well[data-tone="timing"] { background: var(--auto-timing-fill); color: var(--auto-timing-ink); }
.auto-well[data-tone="logic"] { background: var(--auto-logic-fill); color: var(--auto-logic-ink); }
.auto-well[data-tone="action"] { background: var(--auto-action-fill); color: var(--auto-action-ink); }

.i-workflow { background: currentColor; mask: none; clip-path: polygon(33% 5%, 67% 5%, 67% 33%, 55% 33%, 55% 50%, 84% 50%, 84% 67%, 95% 67%, 95% 95%, 64% 95%, 64% 67%, 75% 67%, 75% 58%, 25% 58%, 25% 67%, 37% 67%, 37% 95%, 5% 95%, 5% 67%, 16% 67%, 16% 50%, 45% 50%, 45% 33%, 33% 33%); }

/* Overrides of shared desk rules for this area (these sheets load before desk-layout.css). */
#sequences-view .sequence-library { background: transparent; }
#workflows-view .workflow-content { background: var(--page); }
#workflows-view .workflow-content[data-mode="builder"] { display: flex; flex-direction: column; padding: 0; }
#workflows-view .workflow-content[data-mode="builder"] > .workflow-header { position: sticky; top: 0; z-index: 4; }
