/* ═══ fal-admin — styled after fal's own design system ═══ */
:root {
  /* Neutrals (exact HSL from fal tokens) */
  --n-50: 0 0% 98%;
  --n-100: 240 4% 96%;
  --n-200: 240 7% 90%;
  --n-300: 240 5% 84%;
  --n-400: 240 6% 67%;
  --n-500: 240 4% 49%;
  --n-600: 240 5% 37%;
  --n-700: 240 5% 30%;
  --n-800: 240 3% 20%;
  --n-900: 240 3% 15%;
  --n-950: 240 2% 11%;
  --n-1000: 240 10% 8%;

  --p-200: 248 100% 92%;
  --p-300: 252 100% 85%;
  --p-400: 255 100% 76%;
  --p-500: 257 100% 66%;
  --p-600: 261 94% 58%;
  --p-700: 260 81% 43%;
  --p-800: 263 78% 42%;

  --s-500: 79 100% 45%;
  --error-500: 344 96% 48%;
  --error-400: 349 100% 69%;
  --success-500: 142 71% 45%;
  --warning-500: 36 100% 50%;
  --info-500: 217 91% 60%;

  /* Dark mode surfaces — true-black aesthetic */
  --surface-50: hsl(240 3% 12%);
  --surface-100: hsl(240 4% 6%);
  --surface-200: hsl(240 4% 4%);
  --surface-300: hsl(240 6% 3%);
  --surface: hsl(240 6% 2%);
  --surface-light: var(--surface-200);
  --surface-alpha: hsla(0, 0%, 100%, 0.04);
  --surface-alpha-light: hsla(0, 0%, 100%, 0.02);
  --surface-alpha-strong: hsla(0, 0%, 100%, 0.08);

  /* Strokes (exact fal tokens) */
  --stroke-light: hsla(0, 0%, 100%, 0.03);
  --stroke-base: hsla(0, 0%, 100%, 0.05);
  --stroke-strong: hsla(0, 0%, 100%, 0.1);
  --stroke-stronger: hsla(0, 0%, 100%, 0.15);
  --stroke-strongest: hsla(0, 0%, 100%, 0.3);

  /* Content (text) — exact fal tokens */
  --content-base: hsl(var(--n-100));
  --content-strong: hsl(var(--n-50));
  --content-light: hsl(var(--n-400));
  --content-lighter: hsl(var(--n-500));
  --content-subtle: hsl(240 5% 42%);
  --content-muted: hsl(var(--n-600));

  /* Semantic — neutral (fal dark-mode CTA: white on black) */
  --primary: hsl(var(--n-50));
  --primary-hover: hsl(0 0% 100%);
  --primary-foreground: hsl(var(--n-1000));
  --primary-alpha: hsla(0, 0%, 100%, 0.08);
  --primary-alpha-hover: hsla(0, 0%, 100%, 0.14);
  --primary-text: hsl(var(--n-50));

  --danger: hsl(var(--error-500));
  --danger-alpha: hsl(var(--error-500) / 0.12);
  --danger-text: hsl(var(--error-400));
  --success: hsl(var(--success-500));
  --warning: hsl(var(--warning-500));

  /* Radii (fal uses 4px = rounded, 8px = rounded-md) */
  --radius: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Shadows (exact fal tokens — dark mode includes 1px internal ring) */
  --shadow-xs: 0 0 0 1px var(--stroke-light), 0 1px 2px 0 rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 0 0 1px var(--stroke-light), 0 1px 2px 0 rgba(0, 0, 0, 0.5), 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow: 0 0 0 1px var(--stroke-light), 0 2px 4px -1px rgba(0, 0, 0, 0.45), 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 0 0 1px var(--stroke-base), 0 10px 15px -3px rgba(0, 0, 0, 0.35), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 0 0 1px var(--stroke-base), 0 10px 10px -5px rgba(0, 0, 0, 0.35), 0 20px 25px -5px rgba(0, 0, 0, 0.45);
  --shadow-xl: 0 0 0 1px var(--stroke-base), 0 25px 50px -12px rgba(0, 0, 0, 0.6);

  /* Focus ring — neutral white, no purple */
  --focus-ring: 0 0 0 2px hsla(0, 0%, 100%, 0.18);
}

/* ═══ Light mode overrides ═══ */
[data-theme="light"] {
  --surface-50: hsl(0 0% 100%);
  --surface-100: hsl(240 5% 98%);
  --surface-200: hsl(240 5% 96%);
  --surface-300: hsl(240 6% 94%);
  --surface: hsl(0 0% 100%);
  --surface-light: var(--surface-200);
  --surface-alpha: hsla(240, 10%, 8%, 0.04);
  --surface-alpha-light: hsla(240, 10%, 8%, 0.02);
  --surface-alpha-strong: hsla(240, 10%, 8%, 0.08);

  --stroke-light: hsla(240, 10%, 8%, 0.05);
  --stroke-base: hsla(240, 10%, 8%, 0.08);
  --stroke-strong: hsla(240, 10%, 8%, 0.12);
  --stroke-stronger: hsla(240, 10%, 8%, 0.18);
  --stroke-strongest: hsla(240, 10%, 8%, 0.3);

  --content-base: hsl(240 6% 15%);
  --content-strong: hsl(240 10% 8%);
  --content-light: hsl(240 5% 37%);
  --content-lighter: hsl(240 4% 49%);
  --content-subtle: hsl(240 5% 55%);
  --content-muted: hsl(240 5% 62%);

  --primary: hsl(240 10% 8%);
  --primary-foreground: hsl(0 0% 100%);
  --primary-alpha: hsla(240, 10%, 8%, 0.08);
  --primary-alpha-hover: hsla(240, 10%, 8%, 0.14);
  --primary-text: hsl(240 10% 8%);

  --shadow-xs: 0 0 0 1px var(--stroke-base), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 0 0 1px var(--stroke-base), 0 1px 3px 0 rgba(0, 0, 0, 0.07);
  --shadow: 0 0 0 1px var(--stroke-base), 0 4px 6px -1px rgba(0, 0, 0, 0.07);
  --shadow-md: 0 0 0 1px var(--stroke-base), 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 0 0 1px var(--stroke-base), 0 20px 25px -5px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] body {
  background: radial-gradient(900px 600px at 50% -10%, hsl(260 60% 96%) 0%, hsl(0 0% 100%) 60%);
}

[data-theme="light"] .topbar,
[data-theme="light"] .actionbar {
  background: var(--surface);
}

[data-theme="light"] .runners-dot { box-shadow: 0 0 0 3px hsl(0 0% 100%); }
[data-theme="light"] .runners-dot.live { box-shadow: 0 0 0 3px hsl(0 0% 100%), 0 0 8px hsl(var(--success-500) / 0.45); }
[data-theme="light"] .tab-trigger.needs-attention::before,
[data-theme="light"] .icon-chip.needs-attention::after { box-shadow: 0 0 0 2px hsl(0 0% 100%); }

[data-theme="light"] th {
  background: var(--surface-200);
}
[data-theme="light"] tbody tr:hover td { background: hsla(240, 10%, 8%, 0.02); }

[data-theme="light"] .actionbar {
  background: var(--surface-100);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--content-base);
  font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-ligatures: none;
  font-size: 14px;
  line-height: 1.5;
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.015em; font-weight: 500; }
h1 { font-size: 22px; color: var(--content-strong); }
h2 { font-size: 16px; }
h3 { font-size: 14px; font-weight: 500; }

/* ═══ Layout ═══ */
.app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
}

/* ═══ Topbar — two levels (account/runtime on top, config tabs below) ═══ */
.topbar {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-bottom: 1px solid var(--stroke-base);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  flex-wrap: nowrap;
  min-width: 0;
}

.topbar-row-1 {
  height: 52px;
  border-bottom: 1px solid var(--stroke-base);
}

.topbar-row-2 {
  height: 58px;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.topbar-actions .btn-stack {
  height: 40px;
  padding: 4px 14px;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 130px;
}
.topbar-actions .btn-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.1;
}
.topbar-actions .btn-sub {
  font-family: "Chivo Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.1;
  opacity: 0.65;
}
.topbar-actions .btn-primary .btn-sub { color: hsl(var(--n-1000)); opacity: 0.55; }
.topbar-actions .deploy-meta { padding-right: 12px; }

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-right: 4px;
  border-right: 1px solid var(--stroke-base);
  margin-right: 6px;
}

.brand-logo {
  color: var(--content-strong);
  flex-shrink: 0;
}

.brand-word {
  font-family: "Public Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--content-strong);
  line-height: 1;
  margin-right: 2px;
}

.brand-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--content-light);
  padding-left: 10px;
  margin-left: 2px;
  border-left: 1px solid var(--stroke-strong);
}

.beta-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  margin-left: 2px;
  background: var(--primary-alpha);
  color: var(--primary-text);
  border-radius: var(--radius);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Fal-style underline tabs */
.tabs {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  height: 100%;
  position: relative;
}

.tab-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 4px 10px;
  background: transparent;
  border: none;
  color: var(--content-light);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: color 0.15s ease-out;
}

.tab-trigger:hover { color: var(--content-strong); }

.tab-trigger::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--content-strong);
  opacity: 0;
  transition: opacity 0.15s ease-out;
  pointer-events: none;
}

.tab-trigger.active {
  color: var(--content-strong);
}

.tab-trigger.active::after { opacity: 1; }

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.env-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  background: var(--surface-alpha-light);
  border: 1px solid var(--stroke-base);
  border-radius: var(--radius);
  font-size: 11px;
}

.env-chip-btn {
  cursor: pointer;
  font-family: inherit;
  color: var(--content-base);
  transition: all 0.12s;
}
.env-chip-btn:hover {
  background: var(--surface-alpha);
  border-color: var(--stroke-strong);
}
.env-chip-btn:hover .env-edit { opacity: 1; }
.env-edit {
  opacity: 0.4;
  font-size: 10px;
  margin-left: 2px;
  color: var(--content-lighter);
  transition: opacity 0.12s;
}

.env-label {
  color: var(--content-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.env-value {
  color: var(--content-light);
  font-family: "Chivo Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 11px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runners-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 10px 0 8px;
  background: var(--surface-alpha-light);
  border: 1px solid var(--stroke-base);
  border-radius: 999px;
  color: var(--content-base);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 0.12s ease-out;
}
.runners-chip:hover {
  background: var(--surface-alpha);
  border-color: var(--stroke-strong);
  color: var(--content-strong);
}
.runners-chip.active {
  background: var(--surface-alpha-strong);
  border-color: var(--stroke-stronger);
  color: var(--content-strong);
}
.runners-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--content-muted);
  vertical-align: middle;
  margin-right: 4px;
}
.runners-dot.idle {
  background: hsl(0 0% 98%);
}
.runners-dot.live {
  background: hsl(var(--success-500));
  box-shadow: 0 0 8px hsl(var(--success-500) / 0.6);
  animation: pulse 1.8s ease-in-out infinite;
}
.runners-dot.warn {
  background: hsl(var(--warning-500));
}
.runners-count {
  display: inline-block;
  margin-left: 6px;
  font-family: "Chivo Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--content-muted);
  padding: 1px 5px;
  background: var(--surface-alpha);
  border-radius: var(--radius);
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.runners-count {
  font-family: "Chivo Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--content-light);
  padding: 1px 5px;
  background: var(--surface-alpha);
  border-radius: var(--radius);
}

.icon-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: var(--surface-alpha-light);
  border: 1px solid var(--stroke-base);
  border-radius: 999px;
  color: var(--content-light);
  cursor: pointer;
  transition: all 0.12s;
}
.icon-chip:hover {
  color: var(--content-strong);
  background: var(--surface-alpha);
  border-color: var(--stroke-strong);
}
.icon-chip.active {
  color: var(--content-strong);
  background: var(--surface-alpha-strong);
  border-color: var(--stroke-stronger);
}
.icon-chip.needs-attention {
  border-color: hsl(var(--warning-500) / 0.4);
  color: hsl(var(--warning-500));
  background: hsl(var(--warning-500) / 0.08);
}
.icon-chip.needs-attention::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: hsl(var(--warning-500));
  box-shadow: 0 0 0 2px hsl(240 6% 2%);
}
.icon-chip { position: relative; }

.topbar-divider {
  width: 1px;
  height: 18px;
  background: var(--stroke-strong);
  margin: 0 2px;
}

/* ═══ Settings tab ═══ */
.tab-trigger.needs-attention {
  color: hsl(var(--warning-500));
}
.tab-trigger.needs-attention::before {
  content: "";
  position: absolute;
  top: 10px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: hsl(var(--warning-500));
  box-shadow: 0 0 0 2px hsl(240 6% 2%);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
  max-width: 880px;
}

.settings-card {
  background: var(--surface-100);
  border: 1px solid var(--stroke-base);
  border-radius: var(--radius-md);
  padding: 20px 22px;
}
.settings-card h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--content-strong);
  letter-spacing: -0.01em;
}
.settings-hint {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.5;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--content-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.form-group small {
  font-size: 11px;
  color: var(--content-muted);
  line-height: 1.5;
}
.settings-card .form-group { gap: 8px; }

.settings-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  max-width: 880px;
}

/* ═══ Outputs grid ═══ */
.outputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.output-card {
  background: var(--surface-100);
  border: 1px solid var(--stroke-base);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.12s;
}
.output-card:hover { border-color: var(--stroke-strong); }
.output-media {
  aspect-ratio: 1;
  background: var(--surface-200);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.output-media img, .output-media video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.output-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  gap: 8px;
  font-size: 11px;
  color: var(--content-muted);
  border-top: 1px solid var(--stroke-light);
}
.output-time {
  font-family: "Chivo Mono", ui-monospace, monospace;
  letter-spacing: 0;
}
.output-actions { display: inline-flex; gap: 4px; }
.output-empty {
  grid-column: 1 / -1;
  padding: 48px 20px;
  text-align: center;
  color: var(--content-muted);
  font-size: 13px;
  background: var(--surface-100);
  border: 1px dashed var(--stroke-strong);
  border-radius: var(--radius-md);
}

.danger-zone {
  margin-top: 48px;
  padding: 20px 22px;
  background: hsl(var(--error-500) / 0.04);
  border: 1px solid hsl(var(--error-500) / 0.2);
  border-radius: var(--radius-md);
  max-width: 880px;
}
.danger-zone h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: hsl(var(--error-400));
  letter-spacing: -0.01em;
}

.settings-warn {
  padding: 10px 12px;
  margin: 0 0 16px;
  background: hsl(var(--warning-500) / 0.1);
  border: 1px solid hsl(var(--warning-500) / 0.25);
  border-radius: var(--radius);
  font-size: 12px;
  color: hsl(var(--warning-500));
}

.main {
  overflow-y: auto;
  padding: 28px 40px 32px;
}

/* ═══ Bottom log drawer ═══ */
.actionbar {
  display: block;
  padding: 10px 24px;
  background: hsl(240 6% 3%);
  border-top: 1px solid var(--stroke-strong);
  box-shadow: 0 -8px 24px -12px rgba(0, 0, 0, 0.8);
  position: sticky;
  bottom: 0;
  z-index: 15;
}

.actionbar-left {
  min-width: 0;
}

.actionbar-left .logs {
  min-height: 0;
  max-height: 44px;
  padding: 6px 10px;
  margin: 0;
  background: var(--surface-alpha-light);
  border: 1px solid var(--stroke-base);
  border-radius: var(--radius);
  font-size: 11px;
  line-height: 1.4;
  color: var(--content-light);
  overflow: auto;
  white-space: pre-wrap;
}

.actionbar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.actionbar .btn-stack {
  height: 48px;
  padding: 4px 18px;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 140px;
}

.btn-showcase {
  min-width: 200px;
  height: 52px;
  padding: 4px 22px;
  position: relative;
  overflow: hidden;
}
.btn-showcase .btn-label {
  font-size: 14px;
  letter-spacing: -0.02em;
}
.btn-showcase::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.35) 0%,
    transparent 50%
  );
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.btn-showcase:hover::after { opacity: 1; }

.btn-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.1;
}

.btn-sub {
  font-family: "Chivo Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.1;
  opacity: 0.65;
}

.btn-primary .btn-sub { color: hsl(var(--n-1000)); opacity: 0.55; }

.action-pair { display: inline-flex; align-items: center; gap: 10px; }

.deploy-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 10px;
  text-align: right;
  border-right: 1px solid var(--stroke-base);
  padding-right: 14px;
}
.deploy-meta-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--content-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.deploy-meta-value {
  font-family: "Chivo Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--content-strong);
}
.deploy-meta-value.unknown { color: var(--content-muted); }
.deploy-meta-value.warn { color: hsl(var(--warning-500)); }

#deployStatus.deployed::before {
  content: "●";
  color: hsl(var(--success-500));
  margin-right: 4px;
}
#deployStatus.failed::before {
  content: "●";
  color: hsl(var(--error-400));
  margin-right: 4px;
}
#deployStatus.deploying::before {
  content: "●";
  color: hsl(var(--warning-500));
  margin-right: 4px;
}

/* Expanded logs drawer */
.actionbar.expanded { grid-template-columns: 1fr auto; }
.actionbar.expanded .actionbar-left .logs-pane {
  max-height: 340px;
  min-height: 200px;
  font-size: 12px;
  line-height: 1.55;
}

/* Tabbed logs */
.logs-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px 6px;
  border-bottom: 1px solid var(--stroke-base);
  margin-bottom: 6px;
}
.logs-tab {
  background: transparent;
  border: none;
  color: var(--content-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.12s;
}
.logs-tab:hover { color: var(--content-light); background: var(--surface-alpha); }
.logs-tab.active { color: var(--content-strong); background: var(--surface-alpha-strong); }
.logs-tab.live::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 5px;
  border-radius: 50%;
  background: hsl(var(--success-500));
  box-shadow: 0 0 6px hsl(var(--success-500) / 0.6);
  vertical-align: 2px;
  animation: pulse 1.8s ease-in-out infinite;
}
.logs-hint {
  flex: 1;
  margin-left: 10px;
  font-family: "Chivo Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--content-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logs-clear {
  background: transparent;
  border: 1px solid var(--stroke-base);
  border-radius: var(--radius);
  color: var(--content-muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
}
.logs-clear:hover { color: var(--content-light); border-color: var(--stroke-strong); }

.logs-pane.hidden { display: none; }

/* ═══ Icon button (e.g. runner terminate/logs) ═══ */
.btn-icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--content-lighter);
  cursor: pointer;
  transition: all 0.12s;
  margin-right: 4px;
}
.btn-icon-only:hover {
  color: var(--content-strong);
  background: var(--surface-alpha);
  border-color: var(--stroke-strong);
}
.btn-icon-only.danger-hover:hover {
  color: hsl(var(--error-400));
  border-color: hsl(var(--error-400) / 0.3);
  background: hsl(var(--error-500) / 0.1);
}

/* ═══ Tabs ═══ */
.tab.hidden { display: none; }

.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
}

.tab-header p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--content-lighter);
}

.muted { color: var(--content-lighter); font-size: 13px; }

/* ═══ Buttons (fal variants) ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  height: 32px;
  background: var(--surface-300);
  color: var(--content-strong);
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 0.12s ease-out;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: var(--surface-alpha-strong);
  border-color: var(--stroke-stronger);
}

.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.btn-primary {
  background: var(--primary);
  border-color: transparent;
  color: var(--primary-foreground);
}
.btn-primary:hover:not(:disabled) {
  background: hsl(var(--p-700));
  border-color: transparent;
}

.btn-primary-alpha {
  background: var(--primary-alpha);
  border-color: transparent;
  color: var(--primary-text);
}
.btn-primary-alpha:hover:not(:disabled) {
  background: var(--primary-alpha-hover);
  color: hsl(var(--p-200));
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--content-base);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-alpha);
  border-color: transparent;
}

.btn-danger {
  background: var(--danger-alpha);
  border-color: transparent;
  color: var(--danger-text);
}
.btn-danger:hover:not(:disabled) {
  background: hsl(var(--error-500) / 0.2);
  color: hsl(var(--error-400));
}

.btn-lg { height: 40px; padding: 0 16px; font-size: 14px; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; gap: 4px; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--content-lighter);
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 14px;
  transition: all 0.12s;
}
.btn-icon:hover { background: var(--surface-alpha); color: var(--content-base); }

/* ═══ Inputs ═══ */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

input[type="text"], input[type="password"], input[type="url"], input[type="search"], input[type="email"], select, textarea {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  background: var(--surface-alpha-light);
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius);
  color: var(--content-strong);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s;
}

textarea { padding: 10px 12px; height: auto; line-height: 1.5; }

input::placeholder, textarea::placeholder { color: var(--content-muted); font-weight: 400; }

input:hover, select:hover, textarea:hover {
  border-color: var(--stroke-stronger);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: hsla(0, 0%, 100%, 0.25);
  box-shadow: 0 0 0 3px hsla(0, 0%, 100%, 0.08);
  background: var(--surface-alpha);
}

.filter-bar input { flex: 1; }
.filter-bar select { width: 220px; }

.code-editor {
  font-family: "Chivo Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  min-height: 500px;
  resize: vertical;
  line-height: 1.7;
  tab-size: 2;
}

.logs {
  background: var(--surface-100);
  border: 1px solid var(--stroke-base);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-family: "Chivo Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  min-height: 420px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--content-light);
  margin: 0;
  line-height: 1.6;
}

/* ═══ Tables ═══ */
.table-wrap {
  background: var(--surface-100);
  border: 1px solid var(--stroke-base);
  border-radius: var(--radius-md);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--content-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: hsl(var(--n-950));
  border-bottom: 1px solid var(--stroke-base);
  user-select: none;
}

td {
  padding: 11px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--stroke-light);
  vertical-align: middle;
  color: var(--content-base);
}

tr:last-child td { border-bottom: none; }

tbody tr { transition: background 0.1s; }
tbody tr:hover td { background: hsl(var(--n-50) / 0.02); }

td.mono, .mono {
  font-family: "Chivo Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--content-light);
}

tbody tr.mine td {
  background: hsl(var(--success-500) / 0.05);
  border-left: 2px solid hsl(var(--success-500) / 0.6);
}
.runner-mine-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: hsl(var(--success-500));
  background: hsl(var(--success-500) / 0.12);
  border-radius: 3px;
}

td.url, .url {
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--content-lighter);
}

/* ═══ Badges ═══ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  height: 20px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
}

.folder-badge { /* alias for primary-alpha badge */
  background: var(--primary-alpha);
  color: var(--primary-text);
}

.state-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  height: 20px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.state-badge.state-IDLE, .state-badge.state-ACTIVE {
  background: hsl(var(--success-500) / 0.15);
  color: hsl(var(--success-500));
}
.state-badge.state-SETUP, .state-badge.state-PENDING {
  background: hsl(var(--warning-500) / 0.15);
  color: hsl(var(--warning-500));
}
.state-badge.state-FAILURE_DELAY, .state-badge.state-TERMINATED, .state-badge.state-FAILED {
  background: hsl(var(--error-500) / 0.15);
  color: var(--danger-text);
}

/* ═══ Modal (fal dialog style) ═══ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.12s ease-out;
}

.modal.hidden { display: none; }

.modal-content {
  background: var(--surface-100);
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius-md);
  width: min(520px, 90vw);
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.15s ease-out;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--stroke-base);
}

.modal-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--content-strong);
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: transparent;
  border: none;
  color: var(--content-lighter);
  cursor: pointer;
  font-size: 15px;
  border-radius: var(--radius);
  transition: all 0.12s;
}

.modal-close:hover { color: var(--content-strong); background: var(--surface-alpha); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-body label {
  display: block;
  font-size: 12px;
  color: var(--content-lighter);
  margin-bottom: 6px;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--stroke-base);
  margin: 20px -20px -20px;
  background: hsl(var(--n-950));
}

.field-help {
  font-size: 12px;
  color: var(--content-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.deps-list {
  max-height: 200px;
  overflow-y: auto;
  background: var(--surface-alpha-light);
  border: 1px solid var(--stroke-base);
  border-radius: var(--radius);
  padding: 8px;
  margin-top: 2px;
}

.dep-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  font-family: "Chivo Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  border-radius: 4px;
  transition: background 0.1s;
  color: var(--content-base);
}
.dep-item:hover { background: var(--surface-alpha); }

.dep-item input[type="checkbox"] {
  margin: 0;
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
}

.dep-item .muted { font-size: 11px; margin-left: auto; }

/* ═══ Toast ═══ */
.toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface-100);
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--content-strong);
  box-shadow: var(--shadow-md);
  min-width: 240px;
  animation: toastIn 0.2s ease-out;
  border-left-width: 3px;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

@keyframes toastIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ═══ Validation feedback ═══ */
.validating {
  font-size: 12px;
  color: var(--content-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.validating.ok { color: var(--success); }
.validating.err { color: var(--danger-text); }

/* ═══ Empty state ═══ */
.empty-state {
  padding: 48px 16px;
  text-align: center;
  color: var(--content-muted);
}

.empty-state-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--content-light);
  margin-bottom: 4px;
}

/* ═══ Scrollbar (dark) ═══ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--stroke-strong); border-radius: 5px; border: 2px solid var(--surface); }
::-webkit-scrollbar-thumb:hover { background: var(--stroke-stronger); }

/* ═══ Selection ═══ */
::selection { background: hsl(var(--p-500) / 0.35); color: var(--content-strong); }
