/* Builder UI tokens and primitives shared by the dashboard and the editor. */
:root {
  --bg: #0e0e12; --bg-1: #15151b; --bg-2: #1c1c24; --bg-3: #24242e;
  --line: #2a2a36; --line-2: #34344280;
  --fg: #ececf1; --fg-1: #b4b4c2; --fg-2: #7c7c8e; --fg-3: #55556a;
  --accent: #6366f1; --accent-2: #818cf8; --accent-soft: rgba(99,102,241,.16);
  --ok: #34d399; --warn: #fbbf24; --danger: #f87171;
  --r: 8px; --r-lg: 12px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow: 0 10px 40px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.04) inset;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent-soft); }
[hidden] { display: none !important; }

/* The builder's own backdrop (dashboard, interview, import, sign-in — not the
   editor): a dot grid fading from the top, three slow gradient orbs and a
   film of grain. Pure CSS on the body's pseudo-elements; still on reduced
   motion, lighter on phones. */
body.fx { position: relative; isolation: isolate; }
body.fx::before { content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image: radial-gradient(circle, rgba(255,255,255,.16) 1px, transparent 1.3px), url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  background-size: 26px 26px, 160px 160px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 15%, #000 15%, rgba(0,0,0,.35) 55%, transparent 90%); mask-image: radial-gradient(ellipse 80% 70% at 50% 15%, #000 15%, rgba(0,0,0,.35) 55%, transparent 90%); }
body.fx::after { content: ''; position: fixed; inset: -25%; z-index: -3; pointer-events: none;
  background: radial-gradient(38% 34% at 16% 14%, rgba(99,102,241,.5), transparent 70%), radial-gradient(30% 28% at 84% 10%, rgba(192,132,252,.38), transparent 70%), radial-gradient(42% 36% at 62% 96%, rgba(34,211,238,.28), transparent 70%);
  filter: blur(46px) saturate(1.15); animation: fx-orbs 32s ease-in-out infinite alternate; will-change: transform; }
@keyframes fx-orbs { to { transform: translate3d(3%, 2.5%, 0) scale(1.07) rotate(2deg); } }
@media (prefers-reduced-motion: reduce) { body.fx::after { animation: none; } }
@media (max-width: 600px) { body.fx::after { filter: blur(30px); inset: -35%; } body.fx::before { background-size: 22px 22px, 160px 160px; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--bg-2); color: var(--fg); font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s, transform .06s; user-select: none; }
.btn:hover { background: var(--bg-3); border-color: #3a3a4a; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: linear-gradient(180deg, #6b6ef5, var(--accent)); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 1px rgba(99,102,241,.35), 0 6px 18px rgba(99,102,241,.28); }
.btn.primary:hover { background: linear-gradient(180deg, #7477f7, #575af0); box-shadow: 0 0 0 1px rgba(129,140,248,.6), 0 8px 26px rgba(99,102,241,.4); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg-1); }
.btn.ghost:hover { background: var(--bg-2); color: var(--fg); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.3); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12.5px; border-radius: 6px; }
.btn.icon { width: 32px; padding: 0; }
.btn.icon.sm { width: 26px; }
.btn svg { width: 16px; height: 16px; flex: none; }

.input, .select, .textarea { width: 100%; height: 32px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--bg-1); color: var(--fg); outline: none; transition: border-color .12s, box-shadow .12s; }
.textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 72px; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--fg-3); }
.select { appearance: none; padding-right: 26px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237c7c8e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 8px center; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; font-weight: 500; color: var(--fg-1); }
.hint { font-size: 12px; color: var(--fg-2); }
.kbd { display: inline-block; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); background: var(--bg-2); font: 11px/1.4 var(--mono); color: var(--fg-1); }

.card { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-lg); }
/* glass over the backdrop: translucent fill, blurred, with a hairline that catches light at the top-left */
body.fx .card { background: linear-gradient(color-mix(in srgb, var(--bg-1) 84%, transparent), color-mix(in srgb, var(--bg-1) 84%, transparent)) padding-box, linear-gradient(135deg, rgba(255,255,255,.16), rgba(255,255,255,.04) 45%, rgba(255,255,255,.08)) border-box; border-color: transparent; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.muted { color: var(--fg-2); }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 100; padding: 16px; backdrop-filter: blur(4px); }
.modal { width: 100%; max-width: 520px; background: var(--bg-1); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.modal h2 { margin: 0; font-size: 16px; font-weight: 600; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; }

/* toast */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; pointer-events: none; }
.toast { background: var(--bg-2); border: 1px solid var(--line); color: var(--fg); padding: 9px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; animation: toast-in .18s ease-out; pointer-events: auto; display: flex; gap: 10px; align-items: center; }
.toast.ok { border-color: rgba(52,211,153,.4); } .toast.err { border-color: rgba(248,113,113,.5); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent-2); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
