/* ------------------------------------------------------------------
   Design tokens — defaults (the Graphite palette). Other palettes in
   themes.css override these via <html data-palette>. Primary
   = --accent-bg, Run = --ok, Retry = --warn, destructive = --danger.
------------------------------------------------------------------- */
:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --sub: #f5f5f4;
  --border: #e4e4e2;
  --border-strong: #a8a8a3;
  --fg: #171717;
  --fg-2: #3f3f3c;
  --muted: #66665f;
  --accent-bg: #171717;
  --accent-fg: #ffffff;
  --dot: #d9d9d5;
  --edge: #b0b0aa;
  --hover: #ececea;
  --code-bg: #f5f5f4;
  --glow: rgba(0,0,0,0.035);
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.05), 0 2px 8px -4px rgba(17, 24, 39, 0.08);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.22);
  --scrim: rgba(17, 24, 39, 0.35);

  --ok: #16a34a;
  --ok-fg: #ffffff;
  --warn: #d97706;
  --danger: #dc2626;
  --info: #0284c7;
  --brand: #171717;

  --ease: cubic-bezier(0.22, 0.8, 0.28, 1);
  color-scheme: light;
}

html.dark {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --sub: #202020;
  --border: #2a2a2a;
  --border-strong: #525252;
  --fg: #ededed;
  --fg-2: #d4d4d4;
  --muted: #a3a3a3;
  --accent-bg: #fafafa;
  --accent-fg: #111111;
  --dot: #222222;
  --edge: #525252;
  --hover: #242424;
  --code-bg: #0f0f0f;
  --glow: rgba(255,255,255,0.03);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px -4px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.75);
  --scrim: rgba(3, 6, 18, 0.65);

  --ok: #22c55e;
  --ok-fg: #052e16;
  --warn: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;
  --brand: #fafafa;
  color-scheme: dark;
}

/* ------------------------------------------------------------------
   Base typography
------------------------------------------------------------------- */
body {
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: -0.01em;
  background-color: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Labels and badges were mono + uppercase, which read as "terminal".
   Keep mono only where text is genuinely code-like. */
.font-mono {
  font-family: inherit !important;
  font-variant-numeric: tabular-nums;
}

input.font-mono,
textarea.font-mono,
code,
td .font-mono {
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace !important;
  --unused: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95em;
}

.uppercase {
  text-transform: none !important;
  letter-spacing: 0 !important;
}

label.uppercase {
  font-weight: 500;
  font-size: 11.5px;
}

th {
  font-weight: 500;
  letter-spacing: 0;
}

/* ------------------------------------------------------------------
   Surfaces / colours — remap the hard-coded utility hexes
------------------------------------------------------------------- */
.geist-dot-grid {
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
}

.bg-white { background-color: var(--surface) !important; }

.bg-\[\#fafafa\],
.bg-\[\#f5f5f5\],
.bg-\[\#f2f2f2\] { background-color: var(--sub) !important; }

.bg-\[\#eaeaea\] { background-color: var(--border) !important; }
.bg-\[\#666666\] { background-color: var(--muted) !important; }

.border-\[\#eaeaea\],
.border-\[\#e5e5e5\],
.border-\[\#f5f5f5\] { border-color: var(--border) !important; }

.divide-\[\#f2f2f2\] > :not([hidden]) ~ :not([hidden]) { border-color: var(--border) !important; }

.text-\[\#171717\] { color: var(--fg) !important; }
.text-\[\#666666\] { color: var(--muted) !important; }

.hover\:text-black:hover,
.hover\:text-\[\#171717\]:hover { color: var(--fg) !important; }

.border-black,
.hover\:border-black:hover,
.focus\:border-black:focus { border-color: var(--border-strong) !important; }

.hover\:border-\[\#eaeaea\]:hover { border-color: var(--border) !important; }

.hover\:bg-\[\#fafafa\]:hover,
.hover\:bg-\[\#f5f5f5\]:hover,
.hover\:bg-\[\#f2f2f2\]:hover,
.hover\:bg-\[\#f0f0f0\]:hover { background-color: var(--hover) !important; }

.dark\:text-\[\#ededed\] { color: var(--fg) !important; }

/* Inputs: calm focus ring instead of a hard black outline */
input, select, textarea {
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s var(--ease);
}
input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg) 8%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.6; }

/* Soft elevation (Tailwind v3 CDN has no shadow-2xs) */
.shadow-2xs { box-shadow: var(--shadow); }
.shadow-xl, .shadow-2xl { box-shadow: var(--shadow-lg) !important; }

/* Rounder, friendlier corners */
.rounded-xl { border-radius: 14px; }
.rounded-lg { border-radius: 10px; }
.rounded-md { border-radius: 8px; }
.rounded-2xl { border-radius: 18px; }

/* Primary button: soft ink, not pure black/white */
.geist-btn-primary {
  background-color: var(--accent-bg);
  color: var(--accent-fg);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.geist-btn-primary:hover { opacity: 0.88; }

.geist-btn-run {
  background-color: var(--ok);
  color: var(--ok-fg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 1px 2px color-mix(in srgb, var(--ok) 40%, transparent);
}
.geist-btn-run:hover { filter: brightness(1.07); }
.geist-btn-run:active { transform: scale(0.97); }

.geist-btn-retry {
  background-color: color-mix(in srgb, var(--warn) 16%, transparent);
  color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
}
.geist-btn-retry:hover { background-color: color-mix(in srgb, var(--warn) 26%, transparent); }
.geist-btn-primary:active { transform: scale(0.97); }

.geist-edge-port {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  background-color: var(--surface);
  border: 1.5px solid var(--edge);
  flex-shrink: 0;
}

/* Header and dock: blend into the page rather than hard-edged bars */
header.bg-white,
footer.bg-white { background-color: var(--surface) !important; }

/* ------------------------------------------------------------------
   Fluidity — transitions, modal entrances, theme cross-fade
------------------------------------------------------------------- */
button, a, [data-action], select {
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease),
    border-color 0.2s var(--ease), opacity 0.2s var(--ease), transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease),
    color 0.35s var(--ease), fill 0.35s var(--ease), stroke 0.35s var(--ease) !important;
}

/* Cards lift gently on hover */
.cursor-pointer.rounded-xl:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.cursor-pointer.rounded-xl { transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.2s var(--ease); }

/* Modals fade + rise in when un-hidden */
.fixed.inset-0:not(.hidden) { animation: fade-in 0.22s var(--ease); }
.fixed.inset-0:not(.hidden) > * { animation: rise-in 0.32s var(--ease); }
.fixed.inset-0.bg-black\/50 { background-color: var(--scrim) !important; backdrop-filter: blur(6px); }

#error-banner:not(.hidden) { animation: rise-in 0.3s var(--ease); }


@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

#poller-dock { transition: height 0.3s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------------
   Scrollbars
------------------------------------------------------------------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; border: 2px solid transparent; }

/* ------------------------------------------------------------------
   Logo: data travels from the source block into the target node.
   pathLength=100 on the flow path keeps the dash math simple.
------------------------------------------------------------------- */
.pipeline-logo { --cycle: 3.6s; color: var(--fg); overflow: visible; }

.pipeline-logo .logo-source,
.pipeline-logo .logo-target,
.pipeline-logo .logo-track {
  stroke: var(--fg);
  opacity: 0.55;
}
.pipeline-logo .logo-track { opacity: 0.22; }

.pipeline-logo .logo-pulse {
  stroke: var(--warn);
  stroke-width: 2;
  stroke-dasharray: 22 200;
  stroke-dashoffset: 22;
  animation: logo-travel var(--cycle) var(--ease) infinite;
}

.pipeline-logo .logo-source { animation: logo-source var(--cycle) ease-in-out infinite; }

.pipeline-logo .logo-target {
  transform-box: fill-box;
  transform-origin: center;
  animation: logo-target var(--cycle) ease-in-out infinite;
}

.pipeline-logo .logo-ring {
  stroke: var(--ok);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: logo-ring var(--cycle) ease-out infinite;
}

@keyframes logo-travel {
  0%, 12%  { stroke-dashoffset: 22; opacity: 0; }
  18%      { opacity: 1; }
  70%      { opacity: 1; }
  78%, 100% { stroke-dashoffset: -100; opacity: 0; }
}

@keyframes logo-source {
  0%, 100% { opacity: 0.55; }
  6%       { opacity: 1; stroke: var(--warn); }
  22%      { opacity: 0.55; stroke: var(--fg); }
}

@keyframes logo-target {
  0%, 72%, 100% { transform: scale(1); opacity: 0.55; stroke: var(--fg); }
  80%           { transform: scale(1.1); opacity: 1; stroke: var(--ok); }
  92%           { transform: scale(1); opacity: 0.8; stroke: var(--ok); }
}

@keyframes logo-ring {
  0%, 76% { opacity: 0; transform: scale(1); }
  80%     { opacity: 0.55; }
  100%    { opacity: 0; transform: scale(1.7); }
}

/* Wordmark: the O in tetherOps is the colour the logo's target circle blinks, and glows in step with it. */
.wm-o {
  color: var(--ok);
  animation: wm-o 3.6s ease-in-out infinite;
}
@keyframes wm-o {
  0%, 72%, 100% { text-shadow: none; }
  80%           { text-shadow: 0 0 10px color-mix(in srgb, var(--ok) 70%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .wm-o { animation: none; } }
/* Edition ("Cloud") sits in small caps-style type under the name. */
[data-app-name]:has(.wm-edition) { display: inline-flex; flex-direction: column; line-height: 1.05; }
.wm-edition {
  font-size: max(9px, 0.42em);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  opacity: 0.85;
}

header button, header span { white-space: nowrap; }

/* ------------------------------------------------------------------
   Legibility — tiny 9–11px utility sizes rendered thin and grey.
   Nudge them up a step so secondary text stays readable.
------------------------------------------------------------------- */
.text-\[9px\]  { font-size: 10.5px !important; }
.text-\[10px\] { font-size: 11.5px !important; }
.text-\[11px\] { font-size: 12px !important; }
.text-xs       { font-size: 12.5px !important; line-height: 1.15rem !important; }
.font-medium   { font-weight: 500; }
.text-\[\#171717\].font-medium,
.text-\[\#171717\].font-semibold { letter-spacing: -0.015em; }

/* Commands (dbt build, dbt run …) as a calm code chip */
.cmd-chip {
  display: block;
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  font-weight: 400;
  color: var(--fg-2);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  word-break: break-word;
  -webkit-font-smoothing: auto;
}
.cmd-chip-inline {
  display: inline-block;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.cmd-prompt {
  color: var(--muted);
  opacity: 0.7;
  margin-right: 0.55em;
  user-select: none;
}

/* ------------------------------------------------------------------
   Pipeline folder tree (sidebar)
------------------------------------------------------------------- */
/* Drag the bottom-right corner to widen it for deep trees */
.pipeline-sidebar {
  width: 300px;
  min-width: 240px;
  max-width: 560px;
  resize: horizontal;
  overflow: hidden;
}

.tree-total {
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

.tree-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: var(--muted);
}
.tree-tool:hover { background: var(--hover); color: var(--fg); }

.tree-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--sub);
  color: var(--muted);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.tree-search:focus-within {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg) 8%, transparent);
}
.tree-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  box-shadow: none !important;
  font-size: 12.5px;
  color: var(--fg);
}

.tree { padding: 6px 6px 16px; }

.tree-row {
  --indent: calc(var(--depth, 0) * 12px);
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 8px 0 calc(8px + var(--indent));
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--fg-2);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.tree-row:hover { background: var(--hover); color: var(--fg); }

.tree-branch { font-weight: 500; color: var(--fg); }

.tree-leaf.is-active {
  background: var(--sub);
  color: var(--fg);
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--border);
}

.tree-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s var(--ease);
}
.tree-branch.is-open .tree-chevron,
.tree-toggle.is-open .tree-chevron { transform: rotate(90deg); }

.tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 18px;
  margin: 0 -1px;
  border-radius: 4px;
  flex-shrink: 0;
}
.tree-toggle:hover { background: color-mix(in srgb, var(--fg) 8%, transparent); }
.tree-toggle:hover .tree-chevron { color: var(--fg); }

.tree-spacer { width: 14px; flex-shrink: 0; }

.tree-stage,
.tree-job { height: 27px; font-size: 12px; color: var(--muted); }
.tree-stage:hover,
.tree-job:hover { color: var(--fg); }

.tree-stage-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.tree-job .tree-dot { width: 6px; height: 6px; }

/* Card flashed after jumping to it from the tree */
.focus-flash { animation: focus-flash 1.4s var(--ease); }
@keyframes focus-flash {
  0%, 30% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 35%, transparent); }
  100%    { box-shadow: 0 0 0 3px transparent; }
}

.tree-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--muted);
}

.tree-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-count,
.tree-meta {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
/* Secondary info only takes room when you're looking at that row */
.tree-meta { display: none; }
.tree-row:hover .tree-meta,
.tree-leaf.is-active .tree-meta { display: inline; }
.tree-job:hover .tree-meta { max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tree-dot {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  flex-shrink: 0;
  background: var(--border-strong);
}
.tone-ok     { background: var(--ok); }
.tone-warn   { background: var(--warn); animation: tree-pulse 1.6s ease-in-out infinite; }
.tone-info   { background: var(--info); animation: tree-pulse 1.6s ease-in-out infinite; }
.tone-danger { background: var(--danger); }
.tone-idle   { background: var(--border-strong); opacity: 0.6; }

@keyframes tree-pulse { 50% { opacity: 0.35; } }


.tree-mark {
  background: color-mix(in srgb, var(--warn) 28%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

.tree-empty {
  padding: 32px 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

/* Drag & drop */
.tree-leaf.is-dragging { opacity: 0.4; }
.tree-row.is-drop-target {
  background: color-mix(in srgb, var(--info) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--info) 45%, transparent);
}
#pipelines-list.is-drop-target {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--info) 35%, transparent);
  border-radius: 8px;
}

/* Folder breadcrumb above the pipeline title */
.folder-crumb {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: -2px 0 6px -6px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
}
.folder-crumb .tree-icon { width: 13px; height: 13px; }
.folder-crumb:hover { background: var(--hover); color: var(--fg); }

/* ------------------------------------------------------------------
   Compact shell: top bar, buttons
------------------------------------------------------------------- */
.app-bar { height: 48px; }

.seg {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--sub);
}
.seg button { height: 26px; }
.seg { background: var(--hover); }
.seg button.bg-white {
  color: var(--brand) !important;
  box-shadow: var(--shadow), inset 0 0 0 1px color-mix(in srgb, var(--brand) 30%, transparent);
}
.seg-count {
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.bar-divider {
  width: 1px;
  height: 18px;
  margin: 0 6px;
  background: var(--border);
}

.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
}
.conn-pill:hover { background: var(--hover); color: var(--fg); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: var(--muted);
  flex-shrink: 0;
}
.icon-btn:hover,
.icon-btn.is-active { background: var(--hover); color: var(--fg); }
.icon-btn-danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn.h-8 svg { width: 16px; height: 16px; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
}
.ghost-btn:hover { background: var(--hover); }
.ghost-btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.ghost-btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }

/* ------------------------------------------------------------------
   Pipeline header — no box, just type and one row of settings
------------------------------------------------------------------- */
.pipeline-head { padding: 2px 4px 0; }
.pipeline-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.3;
}
.pipeline-desc {
  margin-top: 4px;
  max-width: 68ch;
  font-size: 13px;
  color: var(--muted);
}

.pipeline-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.setting {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12.5px;
}
.setting-label { color: var(--muted); }
.setting-value {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
  outline: none;
  cursor: pointer;
}
.setting-value:hover { background: var(--hover); }
.setting-value:focus { border-color: var(--border); box-shadow: none; }
.setting-add { color: var(--muted); font-weight: 400; max-width: 150px; }
select.setting-value { max-width: 200px; text-overflow: ellipsis; }
.setting-empty { color: var(--muted); opacity: 0.7; }
.setting-batch {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.chain-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 4px 0 9px;
  border-radius: 999px;
  background: var(--sub);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--fg);
}
.chain-chip button {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  color: var(--muted);
}
.chain-chip button:hover { background: var(--hover); color: var(--fg); }
.chain-chip svg { width: 12px; height: 12px; }

/* ------------------------------------------------------------------
   Stage columns & job cards
------------------------------------------------------------------- */
.column-label { padding: 0 4px; font-size: 12px; color: var(--muted); }

.link-node {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.link-node:hover { border-color: var(--border-strong); }

.stage-col {
  position: relative;
  z-index: 10;
  width: 272px;
  flex-shrink: 0;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(2px);
}
.stage-col.is-running { border-color: color-mix(in srgb, var(--warn) 60%, transparent); }

.stage-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 2px 10px;
}
.stage-title { font-size: 12.5px; font-weight: 600; color: var(--fg); }
.stage-sub {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stage-delete { opacity: 0; }
.stage-col:hover .stage-delete { opacity: 1; }

.stage-empty {
  padding: 18px 8px;
  border: 1px dashed var(--border);
  border-radius: 9px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.stage-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  height: 30px;
  margin-top: 6px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.stage-add:hover { background: var(--hover); color: var(--fg); }

.job-card {
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.job-card:hover { border-color: var(--border-strong); }
.job-card.is-running { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.job-card.is-error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }

.job-card-main {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 6px 7px 10px;
}
.job-card-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-card-sub {
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Actions only take room while hovered, so names get the full width otherwise */
.job-card-actions {
  display: none;
  align-items: center;
  gap: 1px;
}
.job-card:hover .job-card-actions,
.job-card.is-open .job-card-actions,
.job-card-actions:focus-within { display: flex; }

.job-card-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--border);
}
.job-card-details .cmd-chip { font-size: 11.5px; padding: 6px 9px; }

.job-card-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 6px 6px 10px;
  border-top: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
  font-size: 11.5px;
  color: var(--danger);
}

/* Runs table */
.run-row { transition: background-color 0.15s var(--ease); }
.run-row:hover { background: var(--hover); }
.run-row td { white-space: nowrap; }

.empty-state { padding: 96px 16px; text-align: center; }

/* ------------------------------------------------------------------
   How-to-use guide
------------------------------------------------------------------- */
.guide {
  max-width: 680px;
  margin: 8px auto 48px;
  padding: 36px 40px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-2);
  font-size: 14px;
  line-height: 1.65;
  user-select: text;
}
.guide-hero { padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.guide-eyebrow { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.guide h1 {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--fg);
}
.guide-lead { margin-top: 10px; font-size: 15px; color: var(--muted); }

.guide section { padding-top: 28px; }
.guide h2 {
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.guide b { font-weight: 600; color: var(--fg); }
.guide code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--sub);
  border: 1px solid var(--border);
  font-size: 12.5px;
}

.guide-terms { display: grid; gap: 2px; }
.guide-term {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 8px 0;
}
.guide-term + .guide-term { border-top: 1px solid var(--border); }
.guide-term dt { font-weight: 500; color: var(--fg); }

.guide-steps { display: grid; gap: 14px; }
.guide-step { display: flex; gap: 14px; }
.guide-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent-fg);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.guide-step h4 { font-weight: 600; color: var(--fg); }

.guide-note {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--sub);
  font-size: 13px;
}

.guide-list { display: grid; gap: 8px; padding-left: 18px; list-style: disc; }
.guide-list li::marker { color: var(--muted); }
.guide-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 2px 0 4px;
  border-radius: 999px;
  vertical-align: 1px;
}

/* ------------------------------------------------------------------
   Overview graph — compact pipeline nodes
------------------------------------------------------------------- */
.ov { display: flex; flex-direction: column; gap: 14px; }

.ov-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--border);
}
.ov-title { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; color: var(--fg); }
.ov-sub { margin-top: 1px; font-size: 12px; color: var(--muted); }
.ov-legend { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 11.5px; color: var(--muted); }
.ov-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ov-legend .tree-dot { animation: none; }
.ghost-btn-sm { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.ghost-btn-sm svg { width: 13px; height: 13px; }

.ov-canvas {
  position: relative;
  display: flex;
  align-items: center;
  gap: 40px;
  overflow-x: auto;
  padding: 4px 6px 24px;
}
/* Columns shrink to fit the pane before the canvas starts scrolling. */
.ov-tier {
  position: relative;
  z-index: 10;
  flex: 1 1 244px;
  min-width: 176px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ov-node {
  position: relative;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.ov-node:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.ov-node.is-selected { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent), var(--shadow); }
.ov-node.tone-border-warn { border-color: color-mix(in srgb, var(--warn) 60%, var(--border)); }
.ov-node.tone-border-info { border-color: color-mix(in srgb, var(--info) 50%, var(--border)); }
.ov-node.tone-border-danger { border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); }

.ov-node-main { display: flex; align-items: center; gap: 8px; padding: 8px 6px 2px 10px; }
.ov-node-name {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ov-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.ov-act svg { width: 11px; height: 11px; }
.ov-act-run { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.ov-act-run:hover { background: var(--ok); color: var(--ok-fg); }
.ov-act-stop { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.ov-act-stop:hover { background: var(--danger); color: #fff; }

.ov-node-meta { display: flex; align-items: center; gap: 8px; padding: 2px 6px 7px 24px; font-size: 11px; color: var(--muted); }
.ov-meta-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ov-stages { display: inline-flex; gap: 2px; margin-left: auto; flex-shrink: 0; }
.ov-stage { display: block; width: 10px; height: 4px; border-radius: 2px; }
.ov-stage.tone-idle { background: var(--border-strong); opacity: 0.45; }
.ov-jobs-toggle {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
  padding: 1px 3px 1px 5px;
  border-radius: 5px;
  font-size: 11px;
  color: var(--muted);
}
.ov-jobs-toggle:hover { background: var(--hover); color: var(--fg); }
.ov-jobs-toggle svg { width: 11px; height: 11px; }

.ov-node-jobs { padding: 6px 8px 8px; border-top: 1px solid var(--border); cursor: default; }
.ov-stage-label { padding: 4px 2px 2px; font-size: 10.5px; font-weight: 500; color: var(--muted); }
.ov-job { display: flex; align-items: center; gap: 7px; height: 22px; padding: 0 4px; border-radius: 5px; font-size: 11.5px; }
.ov-job:hover { background: var(--hover); }
.ov-job .tree-dot { width: 6px; height: 6px; }
.ov-job-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-2); }
.ov-job-proj { margin-left: auto; padding-left: 6px; flex-shrink: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10.5px; }
.ov-job-empty { color: var(--muted); }

/* "Run after" parent picker in the schedule and new-pipeline modals */
.upstream-options { max-height: 176px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.upstream-option { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 12px; color: var(--fg); cursor: pointer; }
.upstream-option + .upstream-option { border-top: 1px solid var(--border); }
.upstream-option:hover { background: var(--hover); }
.upstream-option input { accent-color: var(--fg); }
.upstream-option-folder { margin-left: auto; padding-left: 8px; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.upstream-empty { padding: 10px; font-size: 11.5px; color: var(--muted); }

/* Pipeline edit mode (app.js): the unsaved-changes bar and markers on cards the draft adds or changes. */
.draft-bar {
  margin-top: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px 8px 12px; border-radius: 10px; font-size: 12.5px;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border));
  background: color-mix(in srgb, var(--warn) 8%, var(--surface));
}
.draft-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--warn); flex: none; }
.draft-text { color: var(--fg-2); }
.draft-text b { color: var(--fg); font-weight: 600; }
.draft-list { position: relative; color: var(--muted); }
.draft-list summary { cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.draft-list ul {
  position: absolute; z-index: 30; top: 22px; left: 0; min-width: 260px; max-height: 260px; overflow: auto;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  box-shadow: var(--shadow-lg); list-style: disc outside; padding-left: 26px; min-width: 320px; color: var(--fg-2); line-height: 1.7;
}
.job-card.is-draft-new { border-style: dashed; border-color: color-mix(in srgb, var(--ok) 60%, var(--border)); }
.job-card.is-draft-moved { border-style: dashed; border-color: color-mix(in srgb, var(--warn) 60%, var(--border)); }
.ghost-btn:disabled, .geist-btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
