/* Thebes IDE — S1 shell. Near-black character grid, JetBrains Mono,
 * one accent. Bloomberg density: conceal, don't remove. */

@font-face {
  font-family: 'JetBrains Mono';
  src: url('./jetbrains-mono-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('./jetbrains-mono-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

:root {
  /* shadcn/ui design tokens — CLEAN LIGHT (Jun-14 redesign). HSL triples,
     hsl(var(--x)) at use sites. Thebes cyan stays --primary (brand survives);
     deepened to cyan-600 so it reads on white. */
  --background: 210 33% 99%;     /* near-white #fbfcfd */
  --foreground: 222 47% 11%;     /* slate-900 ink      */
  --card: 0 0% 100%;             /* white panels       */
  --popover: 0 0% 100%;
  --muted: 210 24% 96%;          /* light grey raise/hover */
  --muted-foreground: 215 16% 42%;
  --border: 214 22% 89%;         /* hairline           */
  --input: 214 22% 86%;
  --primary: 189 94% 38%;        /* cyan-600 #0891b2-ish, readable on white */
  --primary-foreground: 0 0% 100%;
  --secondary: 210 24% 96%;
  --secondary-foreground: 222 47% 11%;
  --ring: 189 94% 42%;
  --destructive: 0 72% 48%;
  --success: 152 58% 34%;
  --warning: 32 90% 42%;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;

  /* legacy IDE token names — DERIVED from the shadcn tokens above. */
  --bg: hsl(var(--background));
  --bg-soft: hsl(var(--card));
  --bg-raise: hsl(var(--muted));
  --line: hsl(var(--border));
  --ink: hsl(var(--foreground));
  --ink-dim: hsl(var(--muted-foreground));
  --accent: hsl(var(--primary));
  --accent-dim: hsl(189 60% 80%);   /* light cyan tint for borders */
  --ok: hsl(var(--success));
  --err: hsl(var(--destructive));
  --warn: hsl(var(--warning));
  --shadow: 220 43% 25%;            /* soft slate shadow base for light UI */
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--mono); font-size: 13px; line-height: 1.5;
  background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column; overflow: hidden;
}
a { color: var(--accent); text-decoration: none; }
button {
  font-family: var(--mono); font-size: 12px; color: var(--ink);
  background: hsl(var(--secondary)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px 12px; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
button:hover { background: hsl(var(--muted)); border-color: hsl(var(--primary) / 0.45); color: var(--ink); }
button:focus-visible { outline: 2px solid hsl(var(--ring) / 0.55); outline-offset: 1px; }
button.primary {
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary)); font-weight: 600;
}
button.primary:hover { background: hsl(var(--primary) / 0.88); color: hsl(var(--primary-foreground)); }
/* ── guided journey step rail (Jun-15): Sign in → Credits → Template → Edit → Check → Deploy ── */
.steprail {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 7px 16px; background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.steprail .steps { list-style: none; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.step {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 10px 3px 6px; border-radius: 999px; cursor: pointer;
  color: var(--ink-dim); border: 1px solid transparent;
  font-size: 12px; user-select: none; transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.step + .step { margin-left: 2px; }
.step:not(:last-child)::after {
  content: ''; width: 14px; height: 1px; background: var(--line);
  margin-left: 9px; margin-right: -4px;
}
.step:hover { background: hsl(var(--muted)); color: var(--ink); }
.step:focus-visible { outline: 2px solid hsl(var(--ring) / 0.55); outline-offset: 1px; }
.step-badge {
  display: inline-grid; place-items: center; width: 19px; height: 19px;
  border-radius: 50%; font-size: 11px; font-weight: 600;
  background: hsl(var(--muted)); color: var(--ink-dim);
  border: 1px solid var(--line); flex: none;
}
.step-label { white-space: nowrap; }
.step-meta { font-size: 11px; color: var(--accent); font-weight: 600; }
/* done — cyan filled badge with a check */
.step.done { color: var(--ink); }
.step.done .step-badge {
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary)); font-size: 0;
}
.step.done .step-badge::after { content: '✓'; font-size: 11px; }
/* active — the next thing to do: cyan ring, bold */
.step.active { color: var(--ink); border-color: hsl(var(--primary) / 0.5); background: hsl(var(--primary) / 0.06); }
.step.active .step-label { font-weight: 600; }
.step.active .step-badge { background: hsl(var(--primary) / 0.12); color: var(--accent); border-color: hsl(var(--primary) / 0.6); }
.coach {
  margin-left: auto; display: inline-flex; align-items: center; gap: 7px;
  color: var(--ink-dim); font-size: 12px; max-width: 52ch;
}
.coach-dot { color: var(--accent); font-weight: 700; }
#coach-text { color: var(--ink); }
.coach-prog { color: var(--ok); font-weight: 600; margin-right: 2px; }

/* first-run tour banner — one-time, dismissible */
.tour {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; background: hsl(var(--primary) / 0.07);
  border-bottom: 1px solid hsl(var(--primary) / 0.25); font-size: 12px; color: var(--ink);
}
.tour-wave { font-size: 15px; flex: none; }
.tour-msg { flex: 1; }
.tour-msg b { color: var(--accent); }
.tour-x { flex: none; background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-color: hsl(var(--primary)); font-weight: 600; }
.tour-x:hover { background: hsl(var(--primary) / 0.88); color: hsl(var(--primary-foreground)); }

/* ── responsive: collapse the rail labels, stack the 3-pane frame on phones ── */
@media (max-width: 720px) {
  .coach { margin-left: 0; width: 100%; order: 2; max-width: none; }
  .step-label { display: none; }
  .step.active .step-label { display: inline; }
  .step:not(:last-child)::after { width: 8px; margin-left: 5px; }
  .tour { font-size: 11px; }
  /* drop the file tree on phones; the 900px block already stacks to one column
     and hiding .tree collapses its (empty) grid row → editor over engineer feed. */
  .tree { display: none; }
  .topbar { flex-wrap: wrap; row-gap: 6px; }
  .topbar-right { flex-wrap: wrap; }
  .status { flex-wrap: wrap; row-gap: 4px; font-size: 11px; }
}

/* ── branded sign-in modal (Jun-15): borrows the homepage Thebes branding ── */
.signin-card {
  width: min(440px, 94vw); position: relative; text-align: center;
  background: #14171F; border: 1px solid rgba(46,230,226,0.28);
  border-radius: 16px; color: #E5E7EE; padding: 34px 30px 26px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.45);
}
.signin-brand {
  font-size: 36px; font-weight: 600; letter-spacing: -0.5px; line-height: 1;
  background: linear-gradient(135deg, #2EE6E2 0%, #A78BFA 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.signin-dot { -webkit-text-fill-color: #2EE6E2; color: #2EE6E2; }
.signin-tag { color: #C7CBD6; font-size: 13px; line-height: 1.5; margin: 10px auto 22px; max-width: 34ch; }
.signin-label { display: block; text-align: left; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #8E92A0; margin-bottom: 6px; }
.signin-input {
  width: 100%; background: #0C0E13; border: 1px solid rgba(255,255,255,0.12);
  border-radius: 9px; padding: 12px 13px; color: #E5E7EE; font-family: var(--mono); font-size: 14px;
}
.signin-input:focus { outline: none; border-color: rgba(46,230,226,0.6); box-shadow: 0 0 0 3px rgba(46,230,226,0.13); }
.signin-go {
  width: 100%; margin-top: 14px; padding: 12px; border: none; border-radius: 9px; cursor: pointer;
  background: linear-gradient(135deg, #2EE6E2 0%, #A78BFA 100%); color: #07090d;
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  transition: filter .15s ease, opacity .15s ease;
}
.signin-go:hover { filter: brightness(1.08); }
.signin-go:disabled { opacity: .6; cursor: default; }
.signin-status { min-height: 16px; margin-top: 12px; font-size: 12px; color: #C7CBD6; }
.signin-status.pending { color: #FBBF24; } .signin-status.error { color: #F87171; } .signin-status.success { color: #34D399; }
.signin-hint { color: #8E92A0; font-size: 11px; line-height: 1.5; margin-top: 16px; }
.signin-card .modal-x { position: absolute; top: 12px; right: 14px; color: #8E92A0; background: transparent; border: none; font-size: 15px; }
.signin-card .modal-x:hover { color: #E5E7EE; background: transparent; }

/* ── topbar grouping (Jun-14 redesign): Create | Build·Ship | Guide ── */
.brand-ide { color: var(--ink-dim); font-weight: 600; }
.tb-group {
  display: inline-flex; align-items: center; gap: 6px;
  padding-right: 12px; margin-right: 2px; border-right: 1px solid var(--line);
}
.tb-group:last-of-type { border-right: none; padding-right: 4px; }
/* Deploy ▸ dropdown */
.deploy-wrap { position: relative; display: inline-block; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 272px;
  background: hsl(var(--popover)); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: 0 18px 50px -16px hsl(var(--shadow) / 0.30);
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.menu[hidden] { display: none; }
.menu button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  text-align: left; width: 100%; background: transparent; border: none;
  border-radius: 8px; padding: 8px 10px; cursor: pointer;
}
.menu button:hover { background: var(--bg-raise); }
.menu button b { font-size: 12px; color: var(--ink); font-weight: 600; }
.menu button span { font-size: 11px; color: var(--ink-dim); }
code { color: var(--accent); }

/* ── topbar ── */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--bg-soft);
}
.brand { font-weight: 600; letter-spacing: 0.02em; }
.topbar-title { color: var(--ink-dim); }
.chip-s1 {
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  border: 1px dashed var(--line); border-radius: 99px; padding: 2px 8px; color: var(--warn);
}
.chip-boosta {
  font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase;
  border: 1px solid hsl(var(--primary) / 0.35); border-radius: 99px; padding: 2px 8px;
  color: hsl(var(--primary)); background: hsl(var(--primary) / 0.08); white-space: nowrap;
}
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.guide-link { font-size: 12px; color: var(--ink-dim); padding: 5px 8px; }
.guide-link:hover { color: var(--accent); }

/* ── frame ── */
.frame {
  flex: 1; display: grid; min-height: 0;
  grid-template-columns: 200px minmax(0, 1fr) 380px;
}
@media (max-width: 900px) {
  .frame { grid-template-columns: 1fr; grid-template-rows: auto minmax(0,1fr) minmax(0,1fr); }
  .tree { max-height: 130px; }
}

/* ── tree ── */
.tree { border-right: 1px solid var(--line); overflow: auto; padding: 10px 0; background: var(--bg-soft); }
.tree-head {
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-dim); padding: 0 14px 8px;
}
.tree ul { list-style: none; }
.tree li {
  padding: 4px 14px; cursor: pointer; color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tree li:hover { color: var(--ink); background: var(--bg-raise); }
.tree li[aria-selected="true"] { color: var(--accent); background: var(--bg-raise); }
.tree li .dirty { color: var(--warn); }

/* ── editor ── */
.editor-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tabs { display: flex; gap: 1px; background: var(--bg-soft); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  border: none; border-radius: 0; background: transparent; color: var(--ink-dim);
  padding: 7px 14px; border-bottom: 2px solid transparent;
}
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.editor { flex: 1; min-height: 0; }
.editor .cm-editor { height: 100%; font-size: 13px; }
.editor .cm-editor.cm-focused { outline: none; }

/* ── agent feed ── */
.feed-col { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg-soft); }
.feed { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.block { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
.block p + p { margin-top: 8px; }
.block-user { border-color: var(--accent-dim); }
.block-user .who { color: var(--accent); }
.block-info { color: var(--ink-dim); }
.block-agent .who { color: var(--ink-dim); }
.block .who {
  display: block; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 6px;
}
.block pre {
  margin-top: 6px; padding: 8px 10px; background: var(--bg-raise); border-radius: 6px;
  overflow-x: auto; font-size: 12px; line-height: 1.45; white-space: pre-wrap;
}
.block-err { border-color: var(--err); color: var(--err); }

/* tool rows — collapsed by default, expandable */
.toolrow { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 12px; }
.toolrow summary {
  list-style: none; cursor: pointer; padding: 7px 12px; color: var(--ink-dim);
  display: flex; gap: 8px; align-items: center;
}
.toolrow summary::-webkit-details-marker { display: none; }
.toolrow summary::before { content: '▸'; color: var(--ink-dim); }
.toolrow[open] summary::before { content: '▾'; }
.toolrow .t-ok { color: var(--ok); }
.toolrow .t-err { color: var(--err); }
.toolrow pre { margin: 0 12px 10px; padding: 8px 10px; background: var(--bg-raise); border-radius: 6px; overflow-x: auto; white-space: pre-wrap; }

.ask { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.ask textarea {
  flex: 1; resize: none; background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font-family: var(--mono); font-size: 13px;
}
.ask textarea:focus { outline: none; border-color: var(--accent-dim); }
.ask button[disabled] { opacity: 0.4; cursor: wait; }

/* ── output pane ── */
.output {
  height: 140px; border-top: 1px solid var(--line); overflow: auto;
  background: hsl(210 24% 97%); padding: 8px 14px;
}
.output pre { font-size: 12px; line-height: 1.5; color: hsl(215 20% 35%); white-space: pre-wrap; }
.output .ok { color: var(--ok); } .output .err { color: var(--err); }

/* ── status bar ── */
.status {
  display: flex; gap: 22px; align-items: center;
  padding: 6px 14px; border-top: 1px solid var(--line); background: var(--bg-soft);
  font-size: 11px; color: var(--ink-dim); flex-wrap: wrap;
}
.status .st-gw { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.status input {
  width: 200px; background: var(--bg); border: 1px solid var(--line); border-radius: 5px;
  color: var(--ink); font-family: var(--mono); font-size: 11px; padding: 2px 7px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--err); }
.dot.up { background: var(--ok); }

/* ── palette ── */
.palette {
  position: fixed; top: 12vh; left: 50%; transform: translateX(-50%);
  width: min(560px, 92vw); z-index: 50;
  background: hsl(var(--card)); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 24px 70px -20px hsl(var(--shadow) / 0.30); overflow: hidden;
}
.palette input {
  width: 100%; padding: 12px 14px; background: transparent; border: none;
  border-bottom: 1px solid var(--line); color: var(--ink);
  font-family: var(--mono); font-size: 14px;
}
.palette input:focus { outline: none; }
.palette ul { list-style: none; max-height: 300px; overflow: auto; }
.palette li { padding: 8px 14px; cursor: pointer; color: var(--ink-dim); }
.palette li.on, .palette li:hover { background: var(--bg); color: var(--accent); }

/* onboarding hint line in the feed */
.block .hint { color: #6b7280; font-size: 12px; margin-top: 8px; line-height: 1.5; }
.block .hint code { color: #9aa4b2; }

/* project-space tree groups + primary deploy-dapp button */
.tree-group { list-style:none; margin:14px 0 4px; padding:0 8px; font-size:11px;
  text-transform:uppercase; letter-spacing:0.08em; color:#6b7280; font-weight:600; }
.tree-group:first-child { margin-top:0; }
#btn-deploy-dapp.primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-color: hsl(var(--primary)); font-weight:600; }
#btn-deploy-dapp.primary:hover { background: hsl(var(--primary) / 0.90); }

/* ── Templates gallery modal ───────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: hsl(220 43% 20% / 0.32); backdrop-filter: blur(3px);
  padding: 24px;
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(880px, 96vw); max-height: 86vh; overflow: auto;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65); padding: 22px 24px 26px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-size: 18px; font-weight: 600; color: var(--ink); }
.modal-x {
  background: transparent; border: 1px solid var(--line); border-radius: 8px;
  width: 30px; height: 30px; color: var(--ink-dim); cursor: pointer; padding: 0;
}
.modal-x:hover { color: var(--err); border-color: var(--err); }
.modal-sub { color: var(--ink-dim); font-size: 12px; margin: 8px 0 18px; line-height: 1.6; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tpl-loading { color: var(--ink-dim); font-size: 13px; grid-column: 1 / -1; padding: 18px 0; }
.tpl-card {
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
  padding: 16px; display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.15s, transform 0.15s;
}
.tpl-card:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.tpl-tag {
  align-self: flex-start; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); background: rgba(46, 230, 226, 0.08);
  border: 1px solid var(--accent-dim); border-radius: 999px; padding: 2px 9px;
}
.tpl-card h3 { font-size: 15px; font-weight: 600; color: var(--ink); }
.tpl-card p { font-size: 12px; color: var(--ink-dim); line-height: 1.55; flex: 1; }
.tpl-use {
  margin-top: 6px; align-self: flex-start; background: var(--bg-raise);
  border: 1px solid var(--accent-dim); color: var(--accent);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600;
}
.tpl-use:hover { background: var(--accent); color: #06201f; border-color: var(--accent); }

/* ── Developer login (status bar) ──────────────────────────────────────────── */
.st-dev { margin-left: 16px; display: inline-flex; align-items: center; gap: 6px; }
.st-dev button { font-size: 11px; padding: 3px 9px; }
.st-dev .dev-id { color: var(--accent); }
.st-dev strong { color: var(--ink); }

/* ── BYO-AI status + settings ──────────────────────────────────────────────── */
.st-ai { margin-left: 16px; display: inline-flex; align-items: center; gap: 5px; color: var(--ink-dim); }
.st-ai #st-ai-name { color: var(--ink); }
.st-ai #st-ai-name.ai-custom { color: var(--accent); }
.st-ai button { font-size: 11px; padding: 2px 7px; }
.ai-field { display: block; margin: 12px 0; font-size: 12px; color: var(--ink-dim); }
.ai-field input { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 7px; font-family: var(--mono); font-size: 13px; }
.ai-field input:focus { outline: none; border-color: var(--accent-dim); }
.ai-actions { display: flex; gap: 10px; margin-top: 18px; }
.ai-actions button { padding: 8px 16px; border-radius: 8px; }
.ai-actions .primary { background: var(--accent); color: #06201f; border-color: var(--accent); font-weight: 600; }

/* ── Demo toggle ───────────────────────────────────────────────────────────── */
.demo-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
  color: var(--ink-dim); cursor: pointer; padding: 0 4px; white-space: nowrap; }
.demo-toggle input { accent-color: var(--accent); cursor: pointer; }

/* ── Mobile (≤640px): no overflow, tappable controls, usable stacked panels ── */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 6px 8px; padding: 8px 10px; }
  .topbar-title { display: none; }
  .topbar-right { margin-left: 0; width: 100%; flex-wrap: nowrap; overflow-x: auto;
    -webkit-overflow-scrolling: touch; gap: 6px; padding-bottom: 3px; }
  .topbar-right button, .guide-link, .demo-toggle { flex: 0 0 auto; padding: 9px 13px;
    font-size: 12px; min-height: 40px; border-radius: 8px; }
  .frame { grid-template-rows: auto minmax(150px, 40vh) minmax(150px, 1fr); }
  .tree { max-height: 104px; }
  .feed-col { border-left: none; border-top: 1px solid var(--line); }
  .output { height: 92px; }
  .status { flex-wrap: wrap; gap: 6px 12px; font-size: 11px; padding: 7px 10px; }
  .status .st-gw, .st-ai, .st-dev { margin-left: 0; }
  .status #st-tokens, .status #st-file { display: none; }
  .status input { width: 116px; }
  .ask textarea { font-size: 16px; }   /* ≥16px stops iOS zoom-on-focus */
  .ask button, .tpl-use, .ai-actions button { min-height: 40px; }
  .modal { padding: 12px; align-items: flex-start; }
  .modal-card { max-height: 92vh; width: 100%; }
  .palette { width: 96vw; top: 8vh; }
}

/* ── Boosta block library gallery ───────────────────────────────────────── */
.blocks-card { width: min(1100px, 97vw); }
.blk-by {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); border: 1px solid rgba(46,230,226,0.4);
  background: rgba(46,230,226,0.07); border-radius: 99px; padding: 2px 8px; margin-left: 8px; vertical-align: middle;
}
.blocks-body { display: grid; grid-template-columns: 1fr 300px; gap: 18px; margin-top: 14px; }
.blocks-gallery { max-height: 66vh; overflow: auto; padding-right: 6px; }
.blk-cat { margin-bottom: 18px; }
.blk-cat-h {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim);
  margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.blk-cat-h span { color: var(--accent-dim); margin-left: 4px; }
.blk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 10px; }
.blk-card {
  position: relative; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); padding: 12px 13px 13px; display: flex; flex-direction: column; gap: 6px;
  opacity: 0; transform: translateY(6px); animation: blkIn 0.32s ease forwards;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
@keyframes blkIn { to { opacity: 1; transform: none; } }
.blk-card:hover { border-color: var(--accent-dim); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.blk-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.blk-chip {
  align-self: flex-start; font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); background: rgba(46,230,226,0.08); border-radius: 99px; padding: 2px 7px;
}
.blk-card h5 { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.blk-card p { margin: 0; font-size: 11.5px; line-height: 1.45; color: var(--ink-dim); }
.blk-slots { font-size: 10px; color: var(--accent-dim); background: var(--bg-raise); border-radius: 5px; padding: 4px 6px; word-break: break-word; }
.blk-add {
  margin-top: 4px; align-self: flex-start; font-size: 11px; padding: 4px 10px;
  border-radius: 6px; border: 1px solid var(--line); background: var(--bg-raise); cursor: pointer;
}
.blk-card.on .blk-add { color: var(--accent); border-color: var(--accent-dim); }
.blocks-plan {
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg); padding: 14px;
  display: flex; flex-direction: column; align-self: start; position: sticky; top: 0; max-height: 66vh;
}
.blocks-plan h3 { margin: 0 0 10px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.blk-count { color: var(--accent); border: 1px solid var(--accent-dim); border-radius: 99px; padding: 0 7px; font-size: 11px; margin-left: 4px; }
.blk-plan-list { list-style: none; margin: 0; padding: 0; overflow: auto; counter-reset: blk; flex: 1; }
.blk-plan-item {
  display: flex; align-items: center; gap: 6px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 12px;
}
.blk-plan-item::before { counter-increment: blk; content: counter(blk); color: var(--accent-dim); font-family: var(--mono); font-size: 10px; min-width: 14px; }
.blk-plan-t { flex: 1; color: var(--ink); }
.blk-plan-ctl { display: flex; gap: 2px; }
.blk-plan-ctl button { padding: 2px 6px; font-size: 11px; border-radius: 5px; }
.blk-plan-empty { font-size: 11.5px; color: var(--ink-dim); line-height: 1.5; margin: 8px 2px; }
.blk-plan-foot { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-dim); }

/* ── shadcn/ui polish (Jun-14) — radius, soft borders, focus rings, cards ── */
.modal-card {
  border-radius: var(--radius-lg, 0.75rem);
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px -12px rgba(0,0,0,0.6), 0 0 0 1px hsl(var(--border) / 0.4);
}
.block { border-radius: var(--radius); }
.tpl-card {
  background: hsl(var(--card)); border: 1px solid var(--line);
  border-radius: var(--radius-lg, 0.75rem); padding: 16px;
  transition: border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.tpl-card:hover {
  border-color: hsl(var(--primary) / 0.5); transform: translateY(-2px);
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.5);
}
.tpl-card h3 { color: var(--ink); font-size: 14px; margin: 6px 0; }
.tpl-card .tpl-tag {
  display: inline-block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: hsl(var(--primary)); background: hsl(var(--primary) / 0.10);
  border: 1px solid hsl(var(--primary) / 0.30); border-radius: 99px; padding: 2px 8px;
}
input, textarea, select {
  background: hsl(var(--card)); border: 1px solid hsl(var(--input));
  border-radius: var(--radius); color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.18);
}

/* ── Frontend preview (Jun-14) — see your design + the backend wiring ──── */
.preview-card { width: min(1040px, 97vw); }
.prev-sub { font-size: 11px; color: var(--ink-dim); font-weight: 400; letter-spacing: 0.02em; margin-left: 8px; }
.prev-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0 10px; }
.prev-cid-l { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-dim); white-space: nowrap; }
.prev-cid-l input { width: 230px; padding: 6px 9px; font-size: 12px; }
.prev-conn { font-size: 11px; color: var(--ink-dim); }
.prev-conn code { font-size: 11px; background: var(--bg-raise); padding: 1px 5px; border-radius: 4px; }
.prev-bar .primary { margin-left: auto; }
.prev-frame { width: 100%; height: 56vh; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; display: block; }
.prev-note { font-size: 11.5px; color: var(--ink-dim); line-height: 1.6; margin-top: 10px; }

/* ── Compose with Boosta (Jun-14) — brief → V13 fills → editable + static see ── */
.blk-brief-l { display: block; font-size: 11px; color: var(--ink-dim); margin: 4px 0 10px; }
.blk-brief-l textarea { display: block; width: 100%; margin-top: 5px; resize: vertical;
  background: hsl(var(--card)); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); font-family: var(--mono); font-size: 12px; padding: 8px 10px; }
.blk-compose { width: 100%; margin-top: 10px; }
.blocks-result { max-height: 70vh; overflow: auto; margin-top: 12px; }
.cmp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; background: hsl(var(--card)); padding: 4px 0 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cmp-hint { font-size: 11px; color: var(--ink-dim); margin-left: 8px; }
.cmp-actions { display: flex; gap: 6px; }
.cmp-page { margin: 14px 0; }
.cmp-route { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); margin: 8px 0; }
.cmp-block { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: hsl(var(--card)); }
.cmp-bk { font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent);
  background: hsl(var(--primary) / 0.08); border-radius: 99px; padding: 2px 8px; display: inline-block; margin-bottom: 8px; }
.cmp-f { display: block; margin: 7px 0; }
.cmp-k { display: block; font-size: 10px; color: var(--ink-dim); margin-bottom: 3px; }
.cmp-in { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink); font-family: var(--mono); font-size: 12px; padding: 6px 8px; }
.cmp-item { border-left: 2px solid var(--accent-dim); padding-left: 10px; margin: 8px 0; }
.cmp-ro { font-size: 12px; color: var(--ink-dim); }
