/* Automation and AI area: automations, AI tools and connections. Prefix .au- */

.au-tile { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: var(--r-small);
  background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: color-mix(in srgb, var(--c) 80%, var(--ink)); }
.au-tile svg { width: 18px; height: 18px; }
.au-tile--lg { width: 52px; height: 52px; border-radius: var(--r-surface); }
.au-tile--lg svg { width: 24px; height: 24px; }

/* A rule drawn as when > only if > then */
.au-flow { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.au-node { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: var(--r-control); border: 1.5px solid; min-width: 0; flex: 1 1 160px; }
.au-node small { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.au-node b { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink); font-weight: 600; }
.au-node b svg { width: 15px; height: 15px; flex: none; }
.au-node--when { border-color: var(--accent); background: var(--accent-soft); }
.au-node--when small, .au-node--when svg { color: var(--accent-ink); }
.au-node--if { border-color: var(--warn); background: var(--warn-soft); border-style: dashed; }
.au-node--if small, .au-node--if svg { color: var(--warn-ink); }
.au-node--then { border-color: var(--good); background: var(--good-soft); }
.au-node--then small, .au-node--then svg { color: var(--good-ink); }
.au-arrow { display: grid; place-items: center; color: var(--muted); flex: none; }
.au-arrow svg { width: 20px; height: 20px; }
.au-flow--big .au-node { padding: 14px 16px; }
.au-flow--big .au-node b { font-size: var(--fs-md); }
.au-flow--big .au-node--when { animation: au-pulse 2.6s var(--ease) infinite; }
@keyframes au-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 30%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }

/* The list of rules */
.au-rules { display: flex; flex-direction: column; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.au-rule { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-bottom: 1px solid var(--line); border-radius: var(--r-control); cursor: pointer; transition: background .12s; }
.au-rule:last-child { border-bottom: 0; }
.au-rule:hover { background: var(--surface-2); }
.au-rule--off { opacity: .55; }
.au-rule__main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.au-rule__main b { color: var(--ink); font-size: var(--fs-sm); font-weight: 600; }
.au-rule__main small { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: var(--fs-xs); color: var(--muted); }
.au-chip { padding: 1px 7px; border-radius: var(--r-pill); background: var(--warn-soft); color: var(--warn-ink); font-weight: 600; }
.au-chip--when { background: var(--accent-soft); color: var(--accent-ink); }
.au-then { display: inline-flex; align-items: center; gap: 4px; color: var(--good-ink); font-weight: 600; }
.au-then svg { width: 13px; height: 13px; }
.au-rule__stats { display: grid; grid-template-columns: auto auto; gap: 0 10px; align-items: center; font-size: var(--fs-xs); text-align: right; flex: none; }
.au-rule__stats .au-mini { grid-row: span 2; }
.au-rule__stats b { color: var(--ink); }
.au-mini { display: inline-flex; align-items: flex-end; gap: 2px; width: 70px; height: 26px; }
.au-mini i { flex: 1; background: color-mix(in srgb, var(--accent) 55%, var(--surface)); border-radius: 1px; }

/* Builder */
.au-build { gap: 10px; overflow-y: auto; max-height: calc(100vh - 160px); }
.au-build .choices { gap: 6px; }
.au-build .choice { min-height: 30px; padding: 4px 10px; font-size: var(--fs-xs); }
.au-step { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.au-step b { color: var(--ink); font-size: var(--fs-md); }
.au-step__n { width: 24px; height: 24px; display: grid; place-items: center; border-radius: var(--r-dot); background: var(--accent); color: var(--on-accent); font: 700 12px var(--font-head); }
.au-save { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.au-dry { overflow-y: auto; min-height: 160px; }
.au-would { display: inline-flex; gap: 4px; color: var(--good-ink); }
.au-would svg { width: 15px; height: 15px; }

/* Last night's timeline */
.au-night { position: relative; padding: 18px 10px 26px; }
.au-night__line { position: relative; height: 4px; border-radius: var(--r-pill); background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 30%, var(--surface-3)), var(--warn-soft)); }
.au-night__dot { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: var(--r-dot); display: grid; place-items: center;
  border: 2px solid var(--surface); background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-1); transition: transform .15s var(--ease); }
.au-night__dot:hover { transform: translate(-50%, -50%) scale(1.15); }
.au-night__dot svg { width: 14px; height: 14px; }
.au-night__dot.bad { background: var(--bad); }
.au-night__hours { position: relative; height: 16px; margin-top: 14px; }
.au-night__hours span { position: absolute; transform: translateX(-50%); font-size: var(--fs-xs); color: var(--muted); }
.au-nightlist { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 16px; }
.au-nl { display: flex; align-items: center; gap: 10px; font-size: var(--fs-xs); padding: 6px 8px; border-radius: var(--r-small); transition: background .2s; }
.au-nl b { color: var(--ink); font-variant-numeric: tabular-nums; }
.au-nl span { flex: 1; min-width: 0; }
.au-nl.bad { background: var(--bad-soft); color: var(--bad-ink); }
.au-nl.hi { background: var(--accent-soft); }

/* AI tools */
.au-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; overflow-y: auto; align-content: start; padding: 2px; }
.au-tool { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-surface); background: var(--surface); box-shadow: var(--shadow-1); cursor: pointer; transition: box-shadow .15s, transform .15s var(--ease); }
.au-tool:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.au-tool--off { opacity: .6; }
.au-tool__top { display: flex; align-items: center; gap: 10px; }
.au-tool__top b { flex: 1; color: var(--ink); font-family: var(--font-head); font-size: var(--fs-md); }
.au-io { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; font-size: var(--fs-xs); }
.au-io__col { display: flex; flex-wrap: wrap; gap: 4px; }
.au-io__col span { padding: 2px 7px; border-radius: var(--r-small); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.au-io__col--out span { background: var(--good-soft); border-color: transparent; color: var(--good-ink); }
.au-io__ai { width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--r-dot); background: var(--spark-soft); color: color-mix(in srgb, var(--spark) 75%, black); }
.au-io__ai svg { width: 15px; height: 15px; }
.au-human { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--accent-ink); padding: 6px 8px; border-radius: var(--r-small); background: var(--accent-soft); }
.au-human svg { width: 14px; height: 14px; flex: none; }
.au-tool__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-xs); color: var(--muted); }
.au-pipe { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; gap: 8px; align-items: center; }
.au-pipe > div { padding: 12px; border-radius: var(--r-control); background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 4px; text-align: center; font-size: var(--fs-xs); }
.au-pipe > div b { color: var(--ink); font-size: var(--fs-sm); }
.au-pipe > div svg { width: 20px; height: 20px; margin: 0 auto; color: var(--accent-ink); }
.au-pipe > div.au-pipe__ai { background: var(--spark-soft); border-color: transparent; }
.au-pipe > div.au-pipe__ai svg { color: color-mix(in srgb, var(--spark) 75%, black); }
.au-pipe > div.au-pipe__you { background: var(--accent-soft); border-color: var(--accent); }
.au-pipe > span svg { width: 18px; height: 18px; color: var(--muted); }

/* Approvals */
.au-queue { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.au-q { display: flex; gap: 10px; align-items: center; width: 100%; padding: 10px; border: 1px solid transparent; border-radius: var(--r-control); background: transparent; text-align: left; color: var(--ink-2); }
.au-q:hover { background: var(--surface-2); }
.au-q.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.au-review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.au-review h4 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.au-review h4 svg { width: 14px; height: 14px; }
.au-in { padding: 12px; border-radius: var(--r-control); background: var(--surface-2); border: 1px solid var(--line); font-size: var(--fs-sm); white-space: pre-wrap; }
.au-out { min-height: 200px; resize: vertical; white-space: pre-wrap; font-size: var(--fs-sm); line-height: 1.55; border-color: var(--spark); }
.au-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* Ask your data */
.au-ask { display: flex; gap: 10px; align-items: center; }
.au-ask .search { flex: 1; }
.au-qs { display: flex; flex-wrap: wrap; gap: 6px; }
.au-answer { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--gap); }
.au-sql { margin: 0; padding: 12px; border-radius: var(--r-control); background: var(--ink); color: #dfe8ef; font: 12px/1.6 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-x: auto; }
.au-said { font-size: var(--fs-md); color: var(--ink); line-height: 1.5; }

/* Connections */
.au-hub { position: relative; width: 100%; height: calc(100vh - 260px); min-height: 420px; }
.au-hub svg.au-hub__lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.au-hub__lines line { stroke: color-mix(in srgb, var(--accent) 45%, var(--line)); stroke-width: 2; stroke-dasharray: 6 6; animation: au-dash 1.2s linear infinite; }
.au-hub__lines line.in { animation-direction: reverse; }
.au-hub__lines line.warn { stroke: var(--warn); }
.au-hub__lines line.err { stroke: var(--bad); animation: none; stroke-dasharray: 3 6; }
@keyframes au-dash { to { stroke-dashoffset: -24; } }
.au-hubcore { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 150px; height: 150px; border-radius: var(--r-dot); display: grid; place-items: center; text-align: center;
  background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 10px var(--accent-soft), var(--shadow-2); z-index: 2; }
.au-hubcore b { display: block; font: 800 var(--fs-lg) var(--font-head); color: var(--on-accent); }
.au-hubcore small { font-size: var(--fs-xs); opacity: .85; }
.au-sat { position: absolute; transform: translate(-50%, -50%); z-index: 2; display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 8px; border-radius: var(--r-pill);
  background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow-1); white-space: nowrap; transition: transform .15s var(--ease), box-shadow .15s; font-size: var(--fs-sm); color: var(--ink); }
.au-sat:hover { transform: translate(-50%, -50%) scale(1.05); box-shadow: var(--shadow-2); }
.au-sat small { display: block; font-size: 11px; color: var(--muted); }
.au-sat--warn { border-color: var(--warn); }
.au-sat--err { border-color: var(--bad); background: var(--bad-soft); }
.au-logo { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: var(--r-dot); background: var(--surface-2); overflow: hidden; }
.au-logo img { width: 18px; height: 18px; }
.au-logo--ini { background: var(--hex); color: #fff; font: 700 11px var(--font-head); }
.au-logo--lg { width: 52px; height: 52px; border-radius: var(--r-surface); }
.au-logo--lg img { width: 28px; height: 28px; }
.au-logo--lg.au-logo--ini { font-size: 16px; }
.au-stat { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 600; }
.au-stat::before { content: ""; width: 8px; height: 8px; border-radius: var(--r-dot); background: var(--good); }
.au-stat--warn::before { background: var(--warn); }
.au-stat--err::before { background: var(--bad); }
.au-stat--off::before { background: var(--line-strong); }
.au-flowrow { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-control); background: var(--surface-2); font-size: var(--fs-sm); }
.au-flowrow b { flex: 1; color: var(--ink); font-weight: 600; }
.au-flowrow svg { width: 16px; height: 16px; color: var(--accent-ink); }
.au-log { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.au-log:last-child { border-bottom: 0; }
.au-log span.t { flex: 1; min-width: 0; color: var(--ink); }
.au-log small { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.au-log--warn { background: var(--warn-soft); }
.au-log--err { background: var(--bad-soft); }

@media (max-width: 1180px) { .au-nightlist { grid-template-columns: repeat(2, minmax(0, 1fr)); } .au-tools { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .au-answer, .au-review { grid-template-columns: minmax(0, 1fr); }
  .au-pipe { grid-template-columns: minmax(0, 1fr); }
  .au-pipe > span { transform: rotate(90deg); justify-self: center; }
}
@media (max-width: 700px) {
  .au-nightlist { grid-template-columns: minmax(0, 1fr); }
  .au-rule { flex-wrap: wrap; }
  .au-rule__main { flex-basis: calc(100% - 100px); }
  .au-rule__stats { margin-left: 48px; }
  .au-arrow { transform: rotate(90deg); width: 100%; }
  .au-node { flex-basis: 100%; }
  .au-hub { height: auto; min-height: 0; display: grid; gap: 8px; }
  .au-hub svg.au-hub__lines { display: none; }
  .au-hubcore { position: static; transform: none; width: auto; height: auto; padding: 14px; border-radius: var(--r-surface); box-shadow: none; }
  .au-sat { position: static; transform: none; }
  .au-sat:hover { transform: none; }
  .au-io { grid-template-columns: minmax(0, 1fr); }
  .au-io__ai { justify-self: center; transform: rotate(90deg); }
}
@media (prefers-reduced-motion: reduce) { .au-hub__lines line, .au-flow--big .au-node--when { animation: none; } }
.au-tip { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-sm); }
.au-tip > svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--accent-ink); }
.au-hi { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; color: var(--accent-ink); }
.au-note { display: flex; gap: 8px; font-size: var(--fs-sm); padding: 8px 10px; margin-top: 10px; border-radius: var(--r-control); background: var(--warn-soft); }
.au-note svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.au-log { padding: 8px 6px; border-radius: var(--r-small); }
