/* ════════════════════════════════════════════════════════════════════════
   ATLAS V6 — AUTOMATIONS  (data-view="automations-panel" → #view-automations-panel)
   ────────────────────────────────────────────────────────────────────────
   Operator launch surface: browse the key GPR workflows and fire them manually,
   with a live Recent Activity feed. Distinct from the dense Workflow Monitor
   (data-view="automation"). All triggers route SAME-ORIGIN through atlas-fetcher
   (POST /api/atlas/workflows/trigger) — the browser never calls n8n cross-origin.

   V6 language: warm cream work surface, dark command rail elsewhere, a single
   gold accent (--gold #c18a25). Bound to v6-tokens.css — no hardcoded palette.
   Loads BEFORE v6-lock.css. aut6-* selectors are unique to this view.
   ════════════════════════════════════════════════════════════════════════ */

#view-automations-panel { padding: 0; }
.aut6-page {
  height: 100%;
  overflow: auto;               /* internal scroll only — outer frame never scrolls */
  padding: 26px 32px 36px;
  box-sizing: border-box;
}

/* ── Page header (V6 north-star: eyebrow → large H1 → sub) ──────────────── */
.aut6-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: end;
  margin-bottom: 22px;
}
.aut6-eyebrow {
  margin: 0 0 6px;
  font-size: 12px; font-weight: 900;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted, #647184);
}
.aut6-title {
  margin: 0;
  font: 850 32px/1.08 var(--font-display, Inter, "Segoe UI", system-ui, sans-serif);
  color: var(--ink, #101722);
}
.aut6-sub {
  margin: 8px 0 0; max-width: 640px;
  color: var(--text-dim, #526175); font-size: 16px; line-height: 1.42;
}

/* connection chip (live / connecting) */
.aut6-conn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 14px; border-radius: 999px;
  font-size: 12px; font-weight: 800; letter-spacing: .02em;
  background: var(--surface, #fffdf8); border: 1px solid var(--line, #d7d0c3);
  color: var(--muted, #647184); white-space: nowrap;
}
.aut6-conn .aut6-conn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--faint, #8a95a3);
}
.aut6-conn.is-live { color: #1f6b52; border-color: #b3ddc8; background: var(--good-soft, #dff2e7); }
.aut6-conn.is-live .aut6-conn-dot { background: var(--good, #2e8b57); box-shadow: 0 0 0 3px rgba(46,139,87,.16); }
.aut6-conn.is-warn { color: #8a5a12; border-color: #e6cfa0; background: var(--warn-soft, #fbecd0); }
.aut6-conn.is-warn .aut6-conn-dot { background: var(--warn, #c18a25); }

/* ── 2-column layout — Library | Recent Activity ───────────────────────── */
.aut6-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1180px) { .aut6-grid { grid-template-columns: 1fr; } }

.aut6-panel {
  background: var(--surface, #fffdf8);
  border: 1px solid var(--line, #d7d0c3);
  border-radius: 12px;
  box-shadow: var(--card-shadow, 0 10px 24px rgba(29,24,14,.07));
  overflow: hidden;
}
.aut6-panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--line, #d7d0c3);
}
.aut6-panel-head h2 { margin: 0; font-size: 18px; font-weight: 800; color: var(--ink, #101722); }
.aut6-panel-note { font-size: 12px; font-weight: 700; color: var(--muted, #647184); }
.aut6-panel-body { padding: 16px 18px; }

/* ── Workflow Library cards ────────────────────────────────────────────── */
.aut6-wf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .aut6-wf-grid { grid-template-columns: 1fr; } }

.aut6-wf-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px; border: 1px solid var(--line, #d7d0c3); border-radius: 10px;
  background: var(--bg2, #fbfaf7);
  transition: transform .14s ease, box-shadow .2s ease, border-color .2s ease;
}
.aut6-wf-card:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(29,24,14,.1); border-color: var(--line-strong, #c4b9a8); }
.aut6-wf-card.is-disabled { opacity: .82; background: var(--surface-3, #f0eee8); }
.aut6-wf-card.is-disabled:hover { transform: none; box-shadow: none; border-color: var(--line, #d7d0c3); }

.aut6-wf-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.aut6-wf-name { font-size: 16px; font-weight: 800; color: var(--ink, #101722); line-height: 1.25; }
.aut6-wf-slug {
  font: 700 11px/1 var(--font-mono, Consolas, monospace);
  color: var(--muted, #647184); background: var(--surface-2, #ebe7de);
  padding: 4px 7px; border-radius: 5px; white-space: nowrap;
}
.aut6-wf-desc { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--text-dim, #526175); flex: 1; }

.aut6-wf-foot { display: flex; align-items: center; justify-content: flex-start; padding-top: 2px; }

/* Run button — gold is the single accent, this is the primary action */
.aut6-run {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 8px;
  font-size: 13.5px; font-weight: 800; cursor: pointer;
  border: 1px solid var(--gold, #c18a25);
  background: var(--gold, #c18a25); color: #fff;
  transition: transform .12s ease, box-shadow .18s ease, background .18s ease, opacity .15s ease;
}
.aut6-run svg { width: 14px; height: 14px; fill: currentColor; }
.aut6-run:hover { transform: translateY(-1px); background: #a8761c; box-shadow: 0 8px 18px rgba(193,138,37,.28); }
.aut6-run:focus-visible { outline: 2px solid var(--ink, #101722); outline-offset: 2px; }
.aut6-run:disabled, .aut6-run.is-running { cursor: default; opacity: .7; transform: none; box-shadow: none; }
.aut6-run-spin {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff;
  animation: aut6-spin .7s linear infinite;
}
@keyframes aut6-spin { to { transform: rotate(360deg); } }

/* Disabled / honest-label state */
.aut6-disabled-label {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 8px;
  font-size: 12.5px; font-weight: 700; color: var(--muted, #647184);
  background: var(--surface-2, #ebe7de); border: 1px dashed var(--line-strong, #c4b9a8);
}
.aut6-disabled-label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint, #8a95a3); }

/* ── Recent Activity feed ──────────────────────────────────────────────── */
.aut6-feed { display: flex; flex-direction: column; }
.aut6-feed-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center;
  padding: 11px 2px; border-bottom: 1px solid var(--border2, #ebe7de);
}
.aut6-feed-row:last-child { border-bottom: 0; }
.aut6-feed-name { font-size: 13.5px; font-weight: 700; color: var(--ink, #101722); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aut6-feed-meta { font-size: 11.5px; color: var(--muted, #647184); }

/* status chips — green success · red error · blue running */
.aut6-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11px; font-weight: 850; letter-spacing: .02em; white-space: nowrap;
  background: var(--surface-2, #ebe7de); color: var(--muted, #647184); border: 1px solid var(--line, #d7d0c3);
}
.aut6-chip .aut6-chip-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.aut6-chip.ok      { background: var(--good-soft, #dff2e7); color: #1f6b52; border-color: #b3ddc8; }
.aut6-chip.err     { background: var(--bad-soft, #fde1ea);  color: #9c1844; border-color: #f0bcce; }
.aut6-chip.running { background: var(--blue-soft, #e0e9fb); color: #17468e; border-color: #bacbf0; }
.aut6-chip.running .aut6-chip-dot { animation: aut6-pulse 1.1s ease-in-out infinite; }
@keyframes aut6-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* empty / loading states (honest — never fabricated rows) */
.aut6-empty {
  padding: 26px 14px; text-align: center;
  color: var(--muted, #647184); font-size: 13.5px; line-height: 1.5;
}
.aut6-empty strong { display: block; color: var(--ink, #101722); font-size: 14.5px; margin-bottom: 4px; }

/* toast (fallback when window.atlasToast is absent) */
.aut6-toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(14px);
  z-index: 9000; max-width: 460px;
  padding: 12px 18px; border-radius: 10px;
  font-size: 13.5px; font-weight: 700; color: #fff;
  background: #121d27; box-shadow: 0 14px 34px rgba(0,0,0,.26);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.aut6-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.aut6-toast.is-error { background: #9c1844; }
.aut6-toast.is-ok { background: #1f6b52; }
