/* ═══════════════════════════════════════════════════════════════════════
   Workspace — product-grade UI
   Modeled after Claude desktop / ChatGPT / Apple polish levels.
   Dark-first, warm neutral blacks, single cool accent, soft borders.
   ═══════════════════════════════════════════════════════════════════════ */

/* Global defensive: `hidden` attribute always hides, beats class overrides. */
[hidden] { display: none !important; }

:root {
  /* Surfaces — warm, deep, calm */
  --bg-0:       #0a0a0c;            /* page */
  --bg-1:       #111113;            /* rail, panels */
  --bg-2:       #17171b;            /* cards, elevated */
  --bg-3:       #1e1e23;            /* inputs, hover */
  --bg-4:       #27272d;            /* active, pressed */

  /* Borders — hair-thin, neutral */
  --line-1:     rgba(255,255,255,0.045);
  --line-2:     rgba(255,255,255,0.08);
  --line-3:     rgba(255,255,255,0.14);

  /* Text — warm off-white */
  --text:       #e9e6e1;
  --text-dim:   #a9a6a0;
  --text-faint: #6b6863;
  --text-on-primary: #0a0a0c;

  /* Accent — tasteful cool, used sparingly */
  --accent:     #87b8d3;
  --accent-2:   #9fc9df;
  --accent-soft: rgba(135,184,211,0.10);
  --accent-ring: rgba(135,184,211,0.28);

  /* Warm tint — for status dot / badges only */
  --warm:       #d9b071;
  --warm-soft:  rgba(217,176,113,0.14);

  --ok:         #7dbb8a;
  --warn:       #d9b071;
  --fail:       #d98a85;

  /* Radii */
  --r-xs:       6px;
  --r-sm:       8px;
  --r-md:       12px;
  --r-lg:       14px;
  --r-xl:       18px;
  --r-pill:     999px;

  /* Spacing scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;

  /* Shadows — refined, not dramatic */
  --sh-sm: 0 1px 2px rgba(0,0,0,0.45);
  --sh-md: 0 6px 18px rgba(0,0,0,0.35), 0 1px 3px rgba(0,0,0,0.3);
  --sh-lg: 0 18px 48px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.3);

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  /* Motion */
  --ease:    cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 140ms;
  --dur-med:  220ms;
  --dur-slow: 360ms;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  position: relative;
  margin: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

button, input, select, textarea {
  font: inherit; color: inherit; letter-spacing: inherit;
}
button { background: transparent; border: 0; padding: 0; cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }

/* Scrollbars — subtle */
* { scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--line-3); }

/* Keyboard chip */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; padding: 2px 6px;
  font: 500 10.5px/1 var(--mono);
  color: var(--text-faint);
  background: var(--bg-3); border: 1px solid var(--line-2);
  border-radius: 4px;
}
.kbd-sm { font-size: 10px; padding: 1px 5px; }

/* ────────────────────────────────────────────────────────────────────
   SHELL — 3-column grid (rail · main · context)
   ──────────────────────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 244px 1fr 0px;
  min-height: 100vh;
  background: var(--bg-0);
  transition: grid-template-columns var(--dur-med) var(--ease);
}
.app-shell[data-context-open="true"] {
  grid-template-columns: 244px 1fr 340px;
}
.app-shell[data-rail="collapsed"] {
  grid-template-columns: 64px 1fr 0px;
}
.app-shell[data-rail="collapsed"][data-context-open="true"] {
  grid-template-columns: 64px 1fr 340px;
}
@media (max-width: 900px) {
  .app-shell, .app-shell[data-context-open="true"], .app-shell[data-rail="collapsed"] {
    grid-template-columns: 1fr;
  }
}

/* ────────────────────────────────────────────────────────────────────
   LEFT RAIL
   ──────────────────────────────────────────────────────────────────── */
.rail {
  background: var(--bg-1);
  border-right: 1px solid var(--line-1);
  display: flex; flex-direction: column;
  padding: 10px 10px 14px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto; overflow-x: hidden;
}
@media (max-width: 900px) {
  .rail { position: fixed; left: 0; top: 0; z-index: 50;
    transform: translateX(-100%); transition: transform var(--dur-med) var(--ease);
    width: 268px; border-right: 1px solid var(--line-2);
    box-shadow: var(--sh-lg);
  }
  .app-shell[data-rail="mobile-open"] .rail { transform: translateX(0); }
}

.rail-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px 6px 8px;
  height: 40px;
}
.rail-brand {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 6px;
  color: var(--text); font-weight: 600; font-size: 14px;
  letter-spacing: -0.01em;
  border-radius: var(--r-sm);
}
.rail-brand:hover { background: var(--bg-2); }
.rail-mark { color: var(--accent); font-size: 14px; line-height: 1; }
.rail-brand-name { transition: opacity var(--dur-fast); }

.rail-collapse {
  width: 26px; height: 26px; border-radius: var(--r-sm);
  color: var(--text-dim);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.rail-collapse:hover { background: var(--bg-2); color: var(--text); }
.rail-collapse svg { width: 14px; height: 14px; }

.rail-new {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 4px 14px;
  padding: 9px 10px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 13px; font-weight: 500;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.rail-new:hover { background: var(--bg-4); border-color: var(--line-3); }
.rail-new svg { width: 15px; height: 15px; }
.rail-new .kbd { margin-left: auto; }

.rail-nav {
  display: flex; flex-direction: column; gap: 1px;
  padding: 0 2px;
}
.rail-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text-dim);
  font-size: 13px; font-weight: 450;
  transition: background var(--dur-fast), color var(--dur-fast);
  position: relative;
}
.rail-item:hover { background: var(--bg-2); color: var(--text); }
.rail-item.active {
  background: var(--bg-3);
  color: var(--text);
}
.rail-item.active::before {
  content: ''; position: absolute; left: 2px; top: 8px; bottom: 8px;
  width: 2px; background: var(--accent); border-radius: 2px;
}
.rail-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .85; }
.rail-item .kbd { margin-left: auto; }

.rail-section { margin-top: 18px; }
.rail-section-head {
  padding: 6px 12px 4px;
  font-size: 11px; font-weight: 500; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.rail-recent { display: flex; flex-direction: column; gap: 1px; padding: 0 2px; }
.rail-recent-item {
  display: block; padding: 6px 10px;
  font-size: 12.5px; color: var(--text-dim);
  border-radius: var(--r-sm);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.rail-recent-item:hover { background: var(--bg-2); color: var(--text); }
.rail-recent-empty { padding: 6px 12px; color: var(--text-faint); font-size: 12px; }

.rail-spacer { flex: 1; }

.rail-foot {
  border-top: 1px solid var(--line-1);
  margin-top: 10px; padding-top: 10px;
}
.rail-account {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 6px 8px;
  border-radius: var(--r-sm);
  transition: background var(--dur-fast);
}
.rail-account:hover { background: var(--bg-2); }
.rail-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #3a3c44, #1e1f25);
  border: 1px solid var(--line-2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.rail-account-info { flex: 1; min-width: 0; text-align: left; display: flex; flex-direction: column; gap: 2px; }
.rail-account-name { font-size: 12.5px; color: var(--text); font-weight: 500; }
.rail-account-plan {
  font-size: 11px; color: var(--text-dim);
  display: inline-flex; align-items: center; gap: 6px;
}
.plan-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--warm); box-shadow: 0 0 6px var(--warm-soft); }
.rail-account-chev { width: 12px; height: 12px; color: var(--text-faint); opacity: .6; }

/* Collapsed rail */
.app-shell[data-rail="collapsed"] .rail { padding: 10px 6px 14px; }
.app-shell[data-rail="collapsed"] .rail-brand-name,
.app-shell[data-rail="collapsed"] .rail-new span,
.app-shell[data-rail="collapsed"] .rail-new .kbd,
.app-shell[data-rail="collapsed"] .rail-item span,
.app-shell[data-rail="collapsed"] .rail-item .kbd,
.app-shell[data-rail="collapsed"] .rail-section,
.app-shell[data-rail="collapsed"] .rail-account-info,
.app-shell[data-rail="collapsed"] .rail-account-chev {
  display: none;
}
.app-shell[data-rail="collapsed"] .rail-new { padding: 9px; justify-content: center; }
.app-shell[data-rail="collapsed"] .rail-item { justify-content: center; padding: 9px; }
.app-shell[data-rail="collapsed"] .rail-account { justify-content: center; }

/* ────────────────────────────────────────────────────────────────────
   MAIN
   ──────────────────────────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; outline: none; }
.main-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line-1);
  background: rgba(10,10,12,0.72);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
  height: 54px;
}
.main-bar-title {
  font-size: 13px; font-weight: 500; color: var(--text);
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.main-bar-right { display: flex; align-items: center; gap: 8px; }
.rail-toggle-m {
  display: none; width: 32px; height: 32px; border-radius: var(--r-sm);
  color: var(--text-dim); align-items: center; justify-content: center;
}
.rail-toggle-m:hover { background: var(--bg-2); color: var(--text); }
.rail-toggle-m svg { width: 16px; height: 16px; }
@media (max-width: 900px) { .rail-toggle-m { display: inline-flex; } }

.status-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--bg-2); border: 1px solid var(--line-1);
  font-size: 12px; color: var(--text-dim);
}
.status-chip .status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 6px rgba(125,187,138,.4);
}
.status-chip[data-state="working"] .status-dot { background: var(--warm); animation: dot-pulse 1.4s ease infinite; }
.status-chip[data-state="fail"] .status-dot { background: var(--fail); }
@keyframes dot-pulse { 0%,100% { opacity: .6; } 50% { opacity: 1; } }

.ctx-toggle {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  color: var(--text-dim); display: inline-flex; align-items: center; justify-content: center;
}
.ctx-toggle:hover { background: var(--bg-2); color: var(--text); }
.ctx-toggle svg { width: 16px; height: 16px; }

.main-canvas { flex: 1; overflow-y: auto; }

/* ────────────────────────────────────────────────────────────────────
   VIEW — NEW (empty-state composer)
   ──────────────────────────────────────────────────────────────────── */
.view { animation: view-in var(--dur-med) var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.new-view {
  min-height: calc(100vh - 54px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
}
.new-stack {
  width: 100%; max-width: 720px;
  display: flex; flex-direction: column; gap: 28px; align-items: center;
}
.greeting {
  text-align: center; margin: 0;
  font-size: 30px; font-weight: 500; letter-spacing: -0.02em;
  color: var(--text);
}
.greeting em {
  font-style: normal;
  background: linear-gradient(135deg, #e9e6e1 0%, #a9a6a0 80%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.greeting-sub {
  margin: -18px 0 0; text-align: center;
  font-size: 14px; color: var(--text-dim);
}

/* Composer */
.composer {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  padding: 14px 14px 10px;
  transition: border-color var(--dur-med) var(--ease), box-shadow var(--dur-med) var(--ease);
}
.composer:focus-within {
  border-color: var(--accent-ring);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.composer-input {
  width: 100%; min-height: 64px; max-height: 280px;
  background: transparent; border: 0; outline: 0; resize: none;
  padding: 4px 2px; margin: 0;
  font-size: 15.5px; line-height: 1.55; color: var(--text);
  letter-spacing: -0.005em;
}
.composer-input::placeholder { color: var(--text-faint); }

.composer-foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
}
.composer-model {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: var(--r-pill);
  background: transparent; border: 1px solid var(--line-2);
  color: var(--text-dim); font-size: 12px;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.composer-model:hover { background: var(--bg-3); color: var(--text); border-color: var(--line-3); }
.composer-model svg { width: 12px; height: 12px; }
.composer-mode-select { display: inline-flex; align-items: center; gap: 6px; }

.composer-spacer { flex: 1; }

.composer-icon-btn {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  color: var(--text-dim);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.composer-icon-btn:hover { background: var(--bg-3); color: var(--text); }
.composer-icon-btn svg { width: 15px; height: 15px; }

.composer-send {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--text); color: var(--text-on-primary);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform var(--dur-fast), background var(--dur-fast), opacity var(--dur-fast);
}
.composer-send:hover { transform: scale(1.05); }
.composer-send:active { transform: scale(.96); }
.composer-send:disabled { background: var(--bg-4); color: var(--text-faint); cursor: not-allowed; transform: none; }
.composer-send svg { width: 16px; height: 16px; }

/* Action pills below composer */
.action-pills {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.action-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  color: var(--text-dim); font-size: 12.5px;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.action-pill:hover { background: var(--bg-3); color: var(--text); border-color: var(--line-3); }
.action-pill.active {
  background: var(--accent-soft); color: var(--accent-2);
  border-color: var(--accent-ring);
}
.action-pill svg { width: 13px; height: 13px; opacity: .85; }

/* ────────────────────────────────────────────────────────────────────
   VIEW — SESSION (task running / artifact)
   ──────────────────────────────────────────────────────────────────── */
.session-view {
  min-height: calc(100vh - 54px);
  display: flex; flex-direction: column;
  padding: 28px 32px 32px;
  gap: 24px;
}
.session-prompt {
  max-width: 780px; width: 100%; margin: 0 auto;
  padding: 16px 20px;
  background: var(--bg-2); border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  color: var(--text);
  font-size: 15px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}

.artifact-shell {
  max-width: 960px; width: 100%; margin: 0 auto;
  background: var(--bg-2); border: 1px solid var(--line-1);
  border-radius: var(--r-xl);
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 420px;
}
.artifact-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-1);
}
.artifact-bar-title { font-size: 13px; font-weight: 500; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-type {
  font: 500 10.5px/1 var(--mono);
  padding: 3px 8px; border-radius: var(--r-pill);
  color: var(--text-dim); background: var(--bg-3);
  border: 1px solid var(--line-2);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.artifact-type[data-type="text"]  { color: #b2c9df; }
.artifact-type[data-type="json"]  { color: #d9b071; }
.artifact-type[data-type="image"] { color: #9dcaa7; }
.artifact-type[data-type="audio"] { color: #d6a6c6; }
.artifact-type[data-type="video"] { color: #d9a383; }
.artifact-type[data-type="html"]  { color: #92c2c9; }

.artifact-menu-btn {
  width: 30px; height: 30px; border-radius: var(--r-sm); color: var(--text-dim);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.artifact-menu-btn:hover { background: var(--bg-3); color: var(--text); }
.artifact-menu-btn svg { width: 15px; height: 15px; }
.artifact-menu-wrap { position: relative; }

.artifact-body {
  flex: 1; overflow: auto; padding: 28px 32px;
}

/* Text output — large, readable, warm */
.text-out {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  font: 400 15.5px/1.7 var(--font);
  color: var(--text); max-width: 720px;
}
.text-cursor {
  display: inline-block; width: 2px; height: 1.05em; vertical-align: -2px;
  background: var(--accent); margin-left: 2px;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* JSON output */
.json-out {
  margin: 0;
  font: 400 13px/1.6 var(--mono);
  color: var(--text);
  background: var(--bg-3); border: 1px solid var(--line-1);
  border-radius: var(--r-md); padding: 16px 18px;
  overflow: auto; max-width: 780px;
}
.json-key  { color: #b2c9df; }
.json-str  { color: #a9c8a7; }
.json-num  { color: #d9b071; }
.json-bool { color: #d6a6c6; }
.json-null { color: var(--text-faint); }

/* Image */
.image-out {
  max-width: 100%; max-height: 640px;
  display: block; margin: 0 auto;
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg), 0 0 0 1px var(--line-1);
  transition: transform var(--dur-med) var(--ease);
  cursor: zoom-in;
}
.image-out:hover { transform: scale(1.03); box-shadow: 0 22px 60px rgba(0,0,0,.5), 0 0 0 1px var(--line-2); }
.image-out:active { transform: scale(1.02); }

/* Audio */
.audio-out {
  max-width: 520px; margin: 0 auto;
  padding: 18px 20px;
  background: var(--bg-3); border: 1px solid var(--line-2);
  border-radius: var(--r-md);
}
.ap-row { display: flex; align-items: center; gap: 14px; }
.ap-play {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--text); color: var(--text-on-primary);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform var(--dur-fast);
  flex-shrink: 0;
}
.ap-play:hover { transform: scale(1.06); }
.ap-play svg { width: 16px; height: 16px; }
.ap-progress { flex: 1; height: 3px; border-radius: 2px; background: var(--line-2); cursor: pointer; position: relative; overflow: hidden; }
.ap-fill { position: absolute; inset: 0; width: 0%; background: var(--accent); transition: width .1s linear; }
.ap-time { font: 400 12px/1 var(--mono); color: var(--text-dim); min-width: 52px; text-align: right; }
.ap-meta { margin-top: 10px; font-size: 11.5px; color: var(--text-faint); }

/* Video */
.video-out {
  width: 100%; max-width: 820px; max-height: 560px;
  background: #000; border-radius: var(--r-md); display: block; margin: 0 auto;
  box-shadow: var(--sh-lg);
}

/* HTML */
.html-out {
  width: 100%; height: 640px;
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: #fff; box-shadow: var(--sh-md);
}

.file-out {
  max-width: 460px; margin: 40px auto; padding: 40px 32px;
  text-align: center; color: var(--text-dim);
  border: 1px dashed var(--line-2); border-radius: var(--r-md);
}

/* Skeleton placeholders (shown while an artifact is being generated) */
.skeleton { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px; animation: view-in var(--dur-med) var(--ease); }
.sk-shimmer {
  position: relative; overflow: hidden;
  background: var(--bg-3); border-radius: var(--r-md);
}
.sk-shimmer::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.06) 45%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0.06) 55%, transparent 100%);
  transform: translateX(-100%);
  animation: sk-slide 1.4s ease infinite;
}
@keyframes sk-slide { 100% { transform: translateX(100%); } }
.sk-box  { width: 100%; max-width: 520px; height: 320px; }
.sk-wide { max-width: 780px; height: 420px; }
.sk-bar  { width: 100%; max-width: 520px; height: 60px; border-radius: var(--r-md); }
.sk-label { font-size: 13px; color: var(--text-dim); letter-spacing: -0.01em; }

.warn-banner {
  margin: 0 0 16px; padding: 10px 14px;
  background: var(--warm-soft); border: 1px solid var(--warm);
  color: var(--warm); border-radius: var(--r-sm);
  font-size: 12.5px;
  max-width: 780px;
}

.empty-out {
  min-height: 360px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 6px; color: var(--text-dim);
}
.empty-out h3 { margin: 0; font-size: 18px; font-weight: 500; color: var(--text); }
.empty-out p { margin: 0; font-size: 13.5px; max-width: 360px; }

/* Stage strip (in-session) */
.stage-strip {
  display: flex; align-items: center; gap: 12px;
  max-width: 960px; width: 100%; margin: 0 auto;
  padding: 10px 16px;
  background: var(--bg-2); border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  font-size: 12.5px; color: var(--text-dim);
}
.stage-dots { display: inline-flex; gap: 4px; }
.stage-dots span { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); animation: dot-bounce 1.2s ease infinite; }
.stage-dots span:nth-child(2) { animation-delay: .15s; }
.stage-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes dot-bounce { 0%,80%,100% { transform: scale(.55); opacity: .45; } 40% { transform: scale(1); opacity: 1; } }
.stage-text { flex: 1; min-width: 0; color: var(--text); font-weight: 500; }
.stage-progress { display: flex; gap: 3px; }
.stage-progress span { width: 28px; height: 3px; border-radius: 2px; background: var(--line-2); }
.stage-progress span.done   { background: var(--ok); }
.stage-progress span.active { background: var(--accent); animation: pulse 1.4s ease infinite; }
.stage-progress span.failed { background: var(--fail); }
@keyframes pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

/* ────────────────────────────────────────────────────────────────────
   LIST VIEWS (projects, search, deployments, …)
   ──────────────────────────────────────────────────────────────────── */
.list-view {
  padding: 28px 32px;
  max-width: 1040px; width: 100%; margin: 0 auto;
}
.list-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin-bottom: 20px;
}
.list-title {
  margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -0.015em;
  color: var(--text);
}
.list-sub { color: var(--text-dim); font-size: 13px; }

.search-box {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  margin-bottom: 18px;
}
.search-box input {
  flex: 1; background: transparent; border: 0; outline: 0;
  font-size: 14px; color: var(--text);
}
.search-box input::placeholder { color: var(--text-faint); }
.search-box svg { width: 15px; height: 15px; color: var(--text-dim); }

.list-empty {
  padding: 48px 20px; text-align: center; color: var(--text-dim);
  background: var(--bg-2); border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
}

/* Cards (projects / deployments / integrations) */
.grid-cards {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
  background: var(--bg-2); border: 1px solid var(--line-1);
  border-radius: var(--r-md); padding: 16px;
  transition: border-color var(--dur-fast), transform var(--dur-fast);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 10px;
}
.card:hover { border-color: var(--line-3); transform: translateY(-1px); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title { font-size: 14px; font-weight: 500; color: var(--text); }
.card-sub { font-size: 12.5px; color: var(--text-dim); }
.card-meta { display: flex; gap: 12px; font-size: 11.5px; color: var(--text-faint); }

/* Integration cards */
.int-card { display: flex; align-items: flex-start; gap: 14px; }
.int-icon {
  width: 38px; height: 38px; border-radius: var(--r-sm);
  background: var(--bg-3); border: 1px solid var(--line-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; color: var(--text);
  flex-shrink: 0;
}
.int-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.int-name { font-size: 14px; font-weight: 500; color: var(--text); }
.int-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.int-status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); }
.int-status[data-state="connected"] .int-status-dot { background: var(--ok); box-shadow: 0 0 6px rgba(125,187,138,.4); }
.int-status[data-state="connected"] { color: var(--ok); }
.int-status[data-state="error"] .int-status-dot { background: var(--fail); }
.int-desc { font-size: 12px; color: var(--text-faint); line-height: 1.5; }
.int-actions { display: flex; gap: 6px; margin-top: 8px; }

/* Buttons (general) */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: var(--r-sm);
  background: var(--bg-3); border: 1px solid var(--line-2);
  color: var(--text); font-size: 12.5px; font-weight: 500;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.btn:hover { background: var(--bg-4); border-color: var(--line-3); }
.btn-primary {
  background: var(--text); color: var(--text-on-primary); border: 1px solid transparent;
}
.btn-primary:hover { background: #fff; }
.btn-ghost {
  background: transparent; border-color: var(--line-2);
  color: var(--text-dim);
}
.btn-ghost:hover { color: var(--text); background: var(--bg-2); }
.btn-sm { padding: 5px 10px; font-size: 11.5px; }

/* ────────────────────────────────────────────────────────────────────
   RIGHT CONTEXT PANEL
   ──────────────────────────────────────────────────────────────────── */
.context {
  background: var(--bg-1); border-left: 1px solid var(--line-1);
  padding: 14px 16px; overflow-y: auto;
  position: sticky; top: 0; height: 100vh;
  animation: ctx-in var(--dur-med) var(--ease);
}
@keyframes ctx-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: translateX(0); } }
.context-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.context-title { font-size: 13px; font-weight: 500; color: var(--text); }
.ctx-close { width: 26px; height: 26px; border-radius: var(--r-sm); color: var(--text-dim); display: inline-flex; align-items: center; justify-content: center; }
.ctx-close:hover { background: var(--bg-2); color: var(--text); }
.ctx-close svg { width: 14px; height: 14px; }

.ctx-block {
  padding: 12px 14px;
  background: var(--bg-2); border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  margin-bottom: 10px;
}
.ctx-block-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin-bottom: 6px; }
.ctx-block-value { font-size: 13px; color: var(--text); }
.ctx-empty { padding: 24px 8px; text-align: center; color: var(--text-faint); font-size: 12.5px; }

/* ────────────────────────────────────────────────────────────────────
   OVERLAYS / POPOVERS (dropdowns, menus)
   ──────────────────────────────────────────────────────────────────── */
.overlays { position: static; pointer-events: none; z-index: 100; }
.overlays > * { pointer-events: auto; }

.popover {
  position: absolute;
  min-width: 180px; max-width: 320px;
  padding: 4px; background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: var(--r-md); box-shadow: var(--sh-lg);
  display: flex; flex-direction: column; gap: 1px;
  z-index: 200;
  animation: pop-in var(--dur-fast) var(--ease);
}
.popover[hidden] { display: none !important; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-2px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.pop-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--r-xs);
  background: transparent; border: 0;
  color: var(--text); font-size: 13px; text-align: left;
  transition: background var(--dur-fast);
  cursor: pointer;
}
.pop-item:hover { background: var(--bg-3); }
.pop-item.muted { color: var(--text-dim); }
.pop-item svg { width: 14px; height: 14px; opacity: .8; }
.pop-divider { height: 1px; background: var(--line-1); margin: 4px 2px; }
.pop-section-head {
  padding: 8px 12px 4px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint);
}

/* Inputs (generic — for forms, search, settings) */
.input, select.input, textarea.input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-3); border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  color: var(--text); font-size: 13px;
  outline: 0; transition: border-color var(--dur-fast), background var(--dur-fast);
  appearance: none;
}
select.input {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%238a8886' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 28px;
}
.input:focus { border-color: var(--accent-ring); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-faint); }

.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-label { font-size: 12px; color: var(--text-dim); font-weight: 500; }

/* Settings view sections */
.settings-group {
  background: var(--bg-2); border: 1px solid var(--line-1);
  border-radius: var(--r-md); padding: 16px;
  margin-bottom: 14px;
}
.settings-group h3 { margin: 0 0 12px; font-size: 14px; font-weight: 500; color: var(--text); }
.kv { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-1); }
.kv:last-child { border-bottom: 0; }
.kv-k { font-size: 13px; color: var(--text-dim); }
.kv-v { font-size: 13px; color: var(--text); font-family: var(--mono); }

/* ═══════════════════════════════════════════════════════════════════════
   PREMIUM POLISH
   Chunk smoothing, fade-scale swap, lightbox, HTML fullscreen, button glow,
   animated empty state, smoother stage bar.
   ═══════════════════════════════════════════════════════════════════════ */

/* Text streaming — each flushed bundle fades in softly */
.chunk-in {
  animation: chunk-in var(--dur-fast) var(--ease) both;
  will-change: opacity, transform;
}
@keyframes chunk-in {
  from { opacity: 0; transform: translateY(1px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Artifact body: fade + slight scale on every render swap (skeleton → real) */
.artifact-body {
  animation: art-swap 220ms var(--ease);
}
@keyframes art-swap {
  from { opacity: 0; transform: scale(0.985); }
  to   { opacity: 1; transform: scale(1); }
}

/* Image lightbox modal */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-med) var(--ease);
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.86);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.lightbox-img {
  position: relative; z-index: 1;
  max-width: 92vw; max-height: 92vh;
  border-radius: 12px;
  box-shadow: 0 32px 80px rgba(0,0,0,.6);
  transform: scale(0.96);
  transition: transform var(--dur-med) var(--ease);
}
.lightbox.open .lightbox-img { transform: scale(1); }
.lightbox-close {
  position: absolute; top: 20px; right: 24px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.08); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  transition: background var(--dur-fast), transform var(--dur-fast);
}
.lightbox-close:hover { background: rgba(255,255,255,0.16); transform: scale(1.05); }
.lightbox-close svg { width: 18px; height: 18px; }

/* HTML wrap — fade-in iframe + fullscreen button */
.html-wrap { position: relative; width: 100%; max-width: 980px; margin: 0 auto; }
.html-out {
  opacity: 0;
  transition: opacity 320ms var(--ease);
}
.html-out.loaded { opacity: 1; }
.html-fullscreen {
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(10,10,12,0.7); color: #fff;
  border: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(-4px);
  transition: opacity var(--dur-med) var(--ease), transform var(--dur-med) var(--ease), background var(--dur-fast);
}
.html-wrap:hover .html-fullscreen, .html-fullscreen:focus-visible { opacity: 1; transform: translateY(0); }
.html-fullscreen:hover { background: rgba(30,30,35,0.9); }
.html-fullscreen svg { width: 16px; height: 16px; }

/* Primary button glow (send, primary actions) */
.composer-send, .btn-primary {
  box-shadow: 0 0 0 0 transparent;
  transition: transform var(--dur-fast) var(--ease),
              box-shadow var(--dur-med) var(--ease),
              background var(--dur-fast);
}
.composer-send:not(:disabled):hover,
.btn-primary:hover {
  box-shadow: 0 0 24px var(--accent-ring), 0 4px 14px rgba(0,0,0,.35);
  transform: scale(1.04);
}
.composer-send:not(:disabled):active { transform: scale(0.97); }

/* Generic button subtle glow on hover */
.btn:not(.btn-primary):hover {
  box-shadow: 0 0 0 1px var(--line-3), 0 2px 12px rgba(0,0,0,.28);
}

/* Mode-btn hover polish */
.mode-btn { transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-med); }
.mode-btn:hover { box-shadow: 0 0 16px var(--accent-soft); }

/* Stage bar — smoother color fill transition */
.stage-progress span {
  transition: background 320ms var(--ease), box-shadow 320ms var(--ease);
}
.stage-progress span.done   { box-shadow: 0 0 10px rgba(125,187,138,.25); }
.stage-progress span.active { box-shadow: 0 0 10px var(--accent-ring); }

/* Empty state — animated gradient halo + pulsing text */
.new-view {
  position: relative; overflow: hidden;
}
.new-view::before {
  content: ''; position: absolute; top: -20%; left: 50%; transform: translateX(-50%);
  width: 900px; height: 900px; border-radius: 50%;
  background:
    radial-gradient(closest-side, var(--accent-soft), transparent 70%),
    radial-gradient(closest-side, rgba(217,176,113,0.06), transparent 70%);
  filter: blur(60px);
  animation: halo-drift 14s ease-in-out infinite;
  pointer-events: none; z-index: 0;
}
@keyframes halo-drift {
  0%, 100% { transform: translate(-50%, 0)   scale(1); }
  50%      { transform: translate(-48%, 14px) scale(1.06); }
}
.new-stack { position: relative; z-index: 1; }
.greeting {
  animation: greet-pulse 5s ease-in-out infinite;
}
@keyframes greet-pulse {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.08); }
}

/* Skeleton — add fade-scale in so swap feels continuous */
.skeleton { animation: art-swap 220ms var(--ease); }

/* Lightbox mobile */
@media (max-width: 640px) {
  .lightbox-close { top: 12px; right: 12px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Intelligence layer: suggestions, transforms, followup, auto-mode hint
   ═══════════════════════════════════════════════════════════════════════ */

/* Suggestion chips — below artifact shell */
.suggest-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line-1);
  background: transparent;
}
.suggest-chip {
  appearance: none; cursor: pointer;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font: 500 12.5px var(--sans);
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              box-shadow var(--dur-med) var(--ease);
  animation: chip-in 220ms var(--ease) both;
}
.suggest-chip:hover {
  background: var(--bg-3);
  border-color: var(--line-3);
  box-shadow: 0 0 14px var(--accent-soft);
  transform: translateY(-1px);
}
.suggest-chip:active { transform: translateY(0); }
@keyframes chip-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Transform buttons — sit in the artifact bar, right side */
.transform-row {
  display: inline-flex; gap: 6px;
  margin-left: auto;
}
.transform-btn {
  appearance: none; cursor: pointer;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 6px;
  font: 500 11.5px var(--sans);
  letter-spacing: 0.2px;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.transform-btn:hover {
  background: var(--bg-3);
  border-color: var(--accent);
  color: var(--text);
}

/* Follow-up composer — sits at the bottom of session view */
.composer.followup {
  margin-top: 16px;
  border: 1px solid var(--line-2);
  animation: chip-in 200ms var(--ease);
}
.composer.followup .composer-input {
  font-size: 14px;
  min-height: 44px;
  max-height: 200px;
}

/* Stack toggle */
.stack-toggle.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.stack-toggle[data-state='on'] svg { stroke: var(--accent); }

/* Auto-mode hint pill in composer foot */
.auto-mode-hint {
  display: inline-flex; align-items: center;
  font: 500 11.5px var(--sans);
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  padding: 3px 9px;
  border-radius: 999px;
  margin-left: 8px;
  letter-spacing: 0.2px;
  animation: chip-in 180ms var(--ease);
}
.auto-mode-hint[hidden] { display: none; }

/* Stacked artifacts — subtle separation */
.artifact-stack {
  display: flex; flex-direction: column; gap: 18px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px dashed var(--line-1);
  opacity: 0.94;
}
.artifact-stack .artifact-shell { animation: chip-in 220ms var(--ease); }
.session-prompt-stacked {
  opacity: 0.7;
  font-style: italic;
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════════════
   Workflow layer: toggle, chain picker pills, plan view, step states
   ═══════════════════════════════════════════════════════════════════════ */

/* Workflow toggle button */
.workflow-toggle.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.workflow-toggle[data-state='on'] svg { stroke: var(--accent); }

/* Chain-picker pills distinguish from single-mode action pills */
.action-pills[data-mode='workflow'] .action-pill { border-style: dashed; }
.chain-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  border-style: solid;
}

/* Workflow plan block */
.workflow-plan {
  margin: 12px 0 14px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  border-radius: 12px;
  overflow: hidden;
  animation: chip-in 220ms var(--ease);
}
.wp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-1);
  background: var(--bg-2);
}
.wp-chain-label {
  font: 600 13px var(--sans);
  color: var(--text);
  letter-spacing: 0.2px;
}
.wp-cancel {
  appearance: none; cursor: pointer;
  background: transparent;
  border: 1px solid var(--line-3);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 6px;
  font: 500 11.5px var(--sans);
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.wp-cancel:hover { background: var(--bg-3); color: var(--text); border-color: var(--line-3); }
.wp-tag {
  font: 600 11px var(--sans);
  letter-spacing: 0.4px;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
}
.wp-tag-done      { background: rgba(125,187,138,.14); color: #7dbb8a; }
.wp-tag-failed    { background: rgba(220,90,90,.14);   color: #dc6a6a; }
.wp-tag-cancelled { background: var(--bg-3);            color: var(--text-dim); }

.wp-list {
  display: flex; flex-direction: column;
}
.wp-step {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--line-1);
  transition: background var(--dur-fast);
}
.wp-step:first-child { border-top: none; }
.wp-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line-3);
  font: 600 13px var(--sans);
  color: var(--text-dim);
  background: var(--bg-2);
}
.wp-name { color: var(--text); font: 500 13.5px var(--sans); }
.wp-type {
  font: 500 11px var(--mono);
  color: var(--text-faint);
  letter-spacing: 0.3px;
}
.wp-pending   .wp-mark { color: var(--text-faint); }
.wp-running   .wp-mark {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  animation: wp-pulse 1.1s ease-in-out infinite;
}
.wp-done      .wp-mark { background: rgba(125,187,138,.14); border-color: #7dbb8a; color: #7dbb8a; }
.wp-failed    .wp-mark { background: rgba(220,90,90,.16);   border-color: #dc6a6a; color: #dc6a6a; }
.wp-cancelled .wp-mark { color: var(--text-faint); }
.wp-cancelled .wp-name { opacity: 0.55; text-decoration: line-through; }
.wp-clickable { cursor: pointer; }
.wp-clickable:hover { background: var(--bg-2); }

@keyframes wp-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-ring); }
  50%      { box-shadow: 0 0 0 6px transparent; }
}

/* Step preview panel */
.wp-preview {
  margin: 0 0 14px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  padding: 10px;
  background: var(--bg-1);
}
.wp-preview-close {
  appearance: none; cursor: pointer;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text-dim);
  padding: 3px 10px;
  border-radius: 6px;
  font: 500 11.5px var(--sans);
  margin-bottom: 10px;
}
.wp-preview-close:hover { background: var(--bg-3); color: var(--text); }

/* ═══════════════════════════════════════════════════════════════════════
   Knowledge: drag-drop, file cards, status
   ═══════════════════════════════════════════════════════════════════════ */
.kb-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  padding: 40px 24px;
  border: 1.5px dashed var(--line-2);
  border-radius: 14px;
  background: var(--bg-1);
  color: var(--text-dim);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
  margin-bottom: 12px;
}
.kb-drop:hover,
.kb-drop.kb-drop-over {
  border-color: var(--accent);
  background: var(--bg-2);
  color: var(--text);
}
.kb-drop.kb-drop-over { transform: scale(1.005); }
.kb-drop svg { width: 28px; height: 28px; }
.kb-drop-head { font: 600 14px var(--sans); color: var(--text); }
.kb-drop-sub  { font: 500 12px var(--sans); color: var(--text-faint); }

.kb-status {
  padding: 10px 14px; border-radius: 8px;
  font: 500 13px var(--sans); margin-bottom: 12px;
}
.kb-status.kb-working { background: var(--bg-2); color: var(--text-dim); border: 1px solid var(--line-2); }
.kb-status.kb-ok      { background: rgba(125,187,138,.12); color: #7dbb8a; border: 1px solid rgba(125,187,138,.35); }
.kb-status.kb-err     { background: rgba(220,106,106,.10); color: #dc6a6a; border: 1px solid rgba(220,106,106,.35); }

.kb-list { display: flex; flex-direction: column; gap: 10px; }
.kb-card {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px;
  padding: 12px 14px;
}
.kb-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-2); border: 1px solid var(--line-2);
  font-size: 20px;
}
.kb-body { min-width: 0; }
.kb-name { font: 600 14px var(--sans); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-meta { font: 500 11.5px var(--sans); color: var(--text-faint); margin-top: 2px; letter-spacing: .2px; }
.kb-preview {
  font: 500 12.5px var(--sans); color: var(--text-dim); margin-top: 6px;
  line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.kb-del { flex: 0 0 auto; }
.kb-del svg { width: 14px; height: 14px; }

/* ═══════════════════════════════════════════════════════════════════════
   Automations grid — real chain cards
   ═══════════════════════════════════════════════════════════════════════ */
.automations-grid { gap: 12px; }
.automation-card { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; }
.auto-head { display: flex; align-items: center; justify-content: space-between; }
.auto-name { font: 600 15px var(--sans); color: var(--text); }
.auto-badge {
  font: 600 11px var(--sans); letter-spacing: .3px;
  background: var(--bg-2); border: 1px solid var(--line-2);
  color: var(--text-dim); padding: 3px 8px; border-radius: 999px;
}
.auto-steps {
  font: 500 12.5px var(--mono); color: var(--text-dim);
  padding: 8px 10px; background: var(--bg-1); border-radius: 8px; border: 1px solid var(--line-1);
}
.auto-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.auto-input {
  background: var(--bg-2); border: 1px solid var(--line-2);
  color: var(--text); padding: 8px 12px; border-radius: 8px;
  font: 500 13.5px var(--sans);
}
.auto-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* ═══════════════════════════════════════════════════════════════════════
   Deployments — host status cards
   ═══════════════════════════════════════════════════════════════════════ */
.deploy-grid { margin-bottom: 8px; }
.deploy-sub  { font: 600 14px var(--sans); color: var(--text-dim); margin: 18px 0 10px; letter-spacing: .3px; text-transform: uppercase; }
.deploy-card { padding: 14px 16px; }
.deploy-card .card-head { align-items: center; }
.deploy-card .card-meta { margin-top: 6px; flex-wrap: wrap; gap: 10px; }
.deploy-card .card-meta a { color: var(--accent); text-decoration: none; font-family: var(--mono); font-size: 12px; }
.deploy-card .card-meta a:hover { text-decoration: underline; }
.deploy-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ═══════════════════════════════════════════════════════════════════════
   Integrations — new state colors
   ═══════════════════════════════════════════════════════════════════════ */
.int-status[data-state='degraded'] .int-status-dot { background: #d9b071; box-shadow: 0 0 6px rgba(217,176,113,.45); }
.int-status[data-state='degraded']                  { color: #d9b071; }
.int-status[data-state='offline']  .int-status-dot { background: var(--text-faint); }
.int-status[data-state='offline']                   { color: var(--text-faint); }
.int-status[data-state='idle']     .int-status-dot { background: var(--text-faint); opacity: .5; animation: pulse-dot 1.5s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: .35; } 50% { opacity: .85; } }

/* ═══════════════════════════════════════════════════════════════════════
   v1-lock: error card, system status dots, export buttons
   ═══════════════════════════════════════════════════════════════════════ */

/* Error card — unified failure surface */
.error-card {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 10px;
  padding: 28px 24px;
  background: rgba(220, 90, 90, 0.06);
  border: 1px solid rgba(220, 90, 90, 0.26);
  border-radius: 12px;
  animation: chip-in 220ms var(--ease);
}
.error-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(220, 90, 90, 0.16);
  color: #dc6a6a;
}
.error-icon svg { width: 20px; height: 20px; }
.error-title {
  margin: 0;
  font: 600 16px var(--sans);
  color: var(--text);
  letter-spacing: 0.1px;
}
.error-reason {
  margin: 0;
  max-width: 720px;
  font: 500 13px var(--sans);
  color: var(--text-dim);
  word-break: break-word;
}
.error-retry {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 6px;
}
.error-retry svg { width: 14px; height: 14px; }

/* System status dots — top-right in main-bar */
.sys-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  margin-right: 8px;
}
.sys-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-faint);
  transition: background var(--dur-med), box-shadow var(--dur-med);
}
.sys-dot[data-state='ok']    { background: #7dbb8a; box-shadow: 0 0 6px rgba(125,187,138,.55); }
.sys-dot[data-state='warn']  { background: #d9b071; box-shadow: 0 0 6px rgba(217,176,113,.45); }
.sys-dot[data-state='err']   { background: #dc6a6a; box-shadow: 0 0 6px rgba(220,106,106,.45); }
.sys-dot[data-state='idle']  { background: var(--text-faint); }

/* Export buttons on artifact bar */
.export-row {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: auto;
  padding-right: 4px;
}
.export-btn {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text-dim);
  border-radius: 6px;
  text-decoration: none;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast);
}
.export-btn:hover {
  background: var(--bg-3);
  border-color: var(--accent);
  color: var(--text);
}
.export-btn:active { transform: scale(0.96); }
.export-btn svg { width: 14px; height: 14px; }
.export-btn.copied {
  background: rgba(125,187,138,.14);
  border-color: #7dbb8a;
  color: #7dbb8a;
}

/* When both transform-row and export-row sit in the bar, align cleanly */
.artifact-bar .transform-row { margin-left: 8px; }
.artifact-bar .export-row + .artifact-menu-wrap { margin-left: 2px; }

/* ═════════════════════════════════════════════════════════════════════════
   AUTH — LANDING + LOGIN + BOOT SCREEN
   ═════════════════════════════════════════════════════════════════════════ */
body[data-auth-state="loading"] .app-shell,
body[data-auth-state="loading"] .landing-shell,
body[data-auth-state="loading"] .auth-shell { display: none !important; }
body[data-auth-state="landing"] .app-shell,
body[data-auth-state="landing"] .auth-shell,
body[data-auth-state="landing"] .boot-screen { display: none !important; }
body[data-auth-state="auth"] .app-shell,
body[data-auth-state="auth"] .landing-shell,
body[data-auth-state="auth"] .boot-screen { display: none !important; }
body[data-auth-state="app"] .landing-shell,
body[data-auth-state="app"] .auth-shell,
body[data-auth-state="app"] .boot-screen { display: none !important; }

/* Boot loader */
.boot-screen {
  position: fixed; inset: 0; background: var(--bg-0);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; z-index: 1000;
}
.boot-ring {
  width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.08); border-top-color: var(--text);
  animation: boot-spin 0.9s linear infinite;
}
.boot-label { color: var(--text-dim); font-size: 13px; letter-spacing: .02em; }
@keyframes boot-spin { to { transform: rotate(360deg); } }

/* Landing */
.landing-shell {
  position: fixed; inset: 0; background: #07080b; color: #e9edf2;
  overflow: auto; display: flex; flex-direction: column; z-index: 500;
}
.landing-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.landing-bg-grid {
  position: absolute; inset: -2px;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 40%, black 30%, transparent 75%);
}
.landing-bg-glow {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  width: 900px; height: 900px;
  background: radial-gradient(circle, rgba(120,130,255,.22) 0%, rgba(120,130,255,0) 60%);
  filter: blur(20px);
  animation: landing-pulse 9s ease-in-out infinite;
}
@keyframes landing-pulse { 0%,100%{opacity:.75;transform:translate(-50%,-50%) scale(1);} 50%{opacity:1;transform:translate(-50%,-50%) scale(1.08);} }

.landing-top {
  position: relative; z-index: 1;
  padding: 22px 32px; display: flex; align-items: center; justify-content: space-between;
}
.landing-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .02em; color: #f2f4f8; }
.landing-mark { color: #8892ff; font-size: 18px; }
.landing-login-link {
  background: transparent; border: 0; color: #b0b7c3; font-size: 13px; cursor: pointer;
  padding: 8px 14px; border-radius: 999px; transition: color .2s, background .2s;
}
.landing-login-link:hover { color: #fff; background: rgba(255,255,255,.04); }

.landing-main {
  position: relative; z-index: 1; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 24px 80px; text-align: center;
}
.landing-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 999px;
  background: rgba(255,255,255,.02); color: #c6cbd5; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 24px;
}
.landing-pill-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #8892ff;
  box-shadow: 0 0 12px #8892ff; animation: pulse-dot 1.8s infinite ease-in-out;
}
@keyframes pulse-dot { 0%,100%{opacity:.6;} 50%{opacity:1;} }

.landing-hero {
  font-size: clamp(44px, 7vw, 84px); line-height: 1.02; font-weight: 600;
  letter-spacing: -.02em; margin: 0 0 18px; color: #f2f4f8;
}
.landing-hero em {
  font-style: normal;
  background: linear-gradient(110deg, #8892ff 0%, #b6b0ff 50%, #66d9d7 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.landing-sub {
  max-width: 620px; color: #a8afbb; font-size: 15.5px; line-height: 1.55; margin: 0 0 36px;
}
.countdown {
  display: grid; grid-template-columns: repeat(4, minmax(88px, 1fr));
  gap: 14px; width: min(520px, 100%); margin: 0 auto 36px;
}
.cd-cell {
  padding: 18px 12px; border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px; background: rgba(255,255,255,.02); backdrop-filter: blur(6px);
}
.cd-num {
  font-variant-numeric: tabular-nums; font-size: clamp(28px, 4vw, 42px);
  font-weight: 600; color: #f2f4f8; line-height: 1;
}
.cd-unit { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #888f9b; margin-top: 8px; }

.wait-form {
  display: flex; flex-wrap: wrap; gap: 10px; width: min(540px, 100%); margin: 0 auto;
}
.wait-name, .wait-email {
  flex: 1 1 200px; min-width: 0;
  padding: 14px 16px; border-radius: 12px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08);
  color: #f2f4f8; font-size: 14px; outline: none;
  transition: border-color .2s, background .2s;
}
.wait-name:focus, .wait-email:focus {
  border-color: rgba(136,146,255,.6); background: rgba(136,146,255,.05);
}
.wait-btn {
  padding: 14px 22px; border-radius: 12px; font-weight: 600; font-size: 14px; cursor: pointer;
  background: linear-gradient(180deg, #e9ebf2 0%, #cfd3df 100%); color: #0a0b0f; border: 0;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 12px 24px rgba(120,130,255,.15);
  transition: transform .12s ease, box-shadow .2s;
  flex: 0 0 auto;
}
.wait-btn:hover  { transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(255,255,255,.14), 0 16px 30px rgba(136,146,255,.25); }
.wait-btn:active { transform: scale(0.98); }
.wait-msg { min-height: 20px; margin-top: 16px; font-size: 13px; color: #a8afbb; }
.wait-msg.ok  { color: #7dbb8a; }
.wait-msg.err { color: #f08a8a; }

.landing-foot { display: flex; gap: 10px; align-items: center; margin-top: 42px; font-size: 12px; color: #777d89; }
.scarcity-counter { font-variant-numeric: tabular-nums; color: #c6cbd5; }

/* Auth screen */
.auth-shell {
  position: fixed; inset: 0; background: #07080b; color: #e9edf2;
  display: flex; align-items: center; justify-content: center; padding: 32px; z-index: 500; overflow: auto;
}
.auth-card {
  width: 100%; max-width: 420px;
  padding: 32px; border-radius: 18px;
  background: rgba(20,22,28,.85); border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 30px 80px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.02) inset;
  backdrop-filter: blur(10px); position: relative;
}
.auth-back {
  position: absolute; top: 14px; left: 14px;
  background: transparent; border: 0; color: #888f9b; font-size: 12px; cursor: pointer;
  padding: 6px 10px; border-radius: 8px;
}
.auth-back:hover { color: #fff; background: rgba(255,255,255,.04); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 22px; justify-content: center; }
.auth-tabs { display: flex; gap: 4px; padding: 4px; background: rgba(255,255,255,.03); border-radius: 12px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; background: transparent; border: 0; color: #a8afbb;
  padding: 8px 12px; border-radius: 8px; font-size: 13px; cursor: pointer; transition: all .15s;
}
.auth-tab.active { background: rgba(255,255,255,.06); color: #f2f4f8; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: #9aa0ad; }
.auth-label input {
  padding: 12px 14px; border-radius: 10px; background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08); color: #f2f4f8; font-size: 14px; outline: none;
  transition: border-color .2s, background .2s;
}
.auth-label input:focus { border-color: rgba(136,146,255,.6); background: rgba(136,146,255,.05); }
.auth-submit {
  padding: 12px 18px; border-radius: 10px; font-weight: 600; font-size: 14px; cursor: pointer;
  background: linear-gradient(180deg, #e9ebf2 0%, #cfd3df 100%); color: #0a0b0f; border: 0;
  margin-top: 6px; transition: transform .12s;
}
.auth-submit:hover  { transform: translateY(-1px); }
.auth-submit:active { transform: scale(0.98); }
.auth-msg { min-height: 20px; margin-top: 14px; font-size: 13px; color: #a8afbb; }
.auth-msg.ok  { color: #7dbb8a; }
.auth-msg.err { color: #f08a8a; }
.auth-hint { margin-top: 16px; font-size: 12px; color: #777d89; text-align: center; }

/* Admin panel */
.admin-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
.admin-section-head { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); margin: 10px 0 8px; }
.admin-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 10px 12px; border: 1px solid var(--line-1); border-radius: 8px;
  background: var(--bg-2); font-size: 13px;
}
.admin-row .mono { font-family: var(--mono); font-size: 12px; }
.admin-actions { display: flex; gap: 6px; }
.admin-code-out {
  padding: 14px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line-1);
  font-family: var(--mono); font-size: 15px; color: var(--text); text-align: center; letter-spacing: .06em;
  margin-bottom: 8px;
}

@media (max-width: 640px) {
  .landing-hero { font-size: clamp(36px, 9vw, 56px); }
  .countdown    { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .cd-cell      { padding: 14px 6px; }
}

/* Pricing cards */
.pricing-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.pricing-card {
  display: flex; flex-direction: column; padding: 24px 20px;
  border-radius: var(--r-lg); border: 1px solid var(--line-2);
  background: var(--bg-2); min-height: 360px;
}
.pricing-featured {
  border-color: rgba(136,146,255,.5);
  box-shadow: 0 0 0 1px rgba(136,146,255,.2) inset, 0 18px 40px rgba(136,146,255,.14);
}
.pricing-tier { font-size: 11px; letter-spacing: .2em; color: var(--text-dim); font-weight: 600; }
.pricing-price { font-size: 36px; font-weight: 600; margin: 8px 0 4px; letter-spacing: -.02em; }
.pricing-per { font-size: 13px; color: var(--text-dim); font-weight: 400; margin-left: 4px; }
.pricing-tagline { color: var(--text-dim); font-size: 13px; margin-bottom: 18px; }
.pricing-features {
  list-style: none; padding: 0; margin: 0 0 22px; flex: 1;
  display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--text);
}
.pricing-features li { padding-left: 18px; position: relative; }
.pricing-features li::before {
  content: '✓'; position: absolute; left: 0; top: 0;
  color: #7dbb8a; font-weight: 600;
}
.pricing-btn { width: 100%; }
.pricing-current {
  text-align: center; font-size: 12.5px;
  color: var(--text-dim); padding: 10px; border: 1px dashed var(--line-2); border-radius: 8px;
}

/* Usage bar (on pricing banner + account) */
.usage-bar {
  margin-top: 10px; height: 6px; background: rgba(255,255,255,.06);
  border-radius: 999px; overflow: hidden;
}
.usage-bar-fill {
  height: 100%; background: linear-gradient(90deg, #8892ff 0%, #66d9d7 100%);
  border-radius: 999px; transition: width .4s ease;
}
